Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
piphone-sip
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
4
Issues
4
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
La Quadrature du Net
piphone
piphone-sip
Commits
37fde94f
Commit
37fde94f
authored
Apr 14, 2016
by
okhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a save function to save a call in database
parent
808a09a0
Pipeline
#10
skipped
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
app.py
app.py
+9
-1
No files found.
app.py
View file @
37fde94f
...
...
@@ -55,7 +55,7 @@ class Call(json.JSONEncoder):
@
classmethod
def
load
(
cls
,
callid
,
db
):
results
=
db
.
execute
(
'SELECT caller, callee, owner, callid, history
, state
FROM calls WHERE callid = ?;'
,
(
callid
,))
results
=
db
.
execute
(
'SELECT caller, callee, owner, callid, history FROM calls WHERE callid = ?;'
,
(
callid
,))
try
:
result
=
results
.
fetchone
()
object
=
cls
(
result
[
0
],
result
[
1
],
result
[
2
])
...
...
@@ -65,6 +65,14 @@ class Call(json.JSONEncoder):
except
:
return
None
def
save
(
self
,
db
):
'''
Save the Call to database.
'''
db
.
execute
(
'''INSERT OR REPLACE INTO calls (caller, callee, owner, callid, history)
VALUES (?, ?, ?, ?, ?)
'''
,
(
self
.
caller
,
self
.
callee
,
self
.
owner
,
self
.
callid
,
json
.
dumps
(
self
.
history
)))
# We need a decorator to check if our query is authenticated.
# We will store an API key and SECRET in ur database, the client
# needs to have both of them.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment