Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
La Quadrature du Net
piphone
piphone-sip
Commits
37fde94f
Commit
37fde94f
authored
Apr 14, 2016
by
okhin
Browse files
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
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
Supports
Markdown
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