Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Benjamin Graillot
scripts
Commits
9b0f83fd
Commit
9b0f83fd
authored
Nov 20, 2013
by
Valentin Samir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[sip/asterisk/sms_daemon] Erreur via levée d'exceptions
parent
efa97540
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
sip/asterisk.py
sip/asterisk.py
+4
-4
No files found.
sip/asterisk.py
View file @
9b0f83fd
...
...
@@ -111,14 +111,14 @@ class Sms(object):
num
=
params
[
'Peer'
].
split
(
'/'
)[
1
]
conn
=
psycopg2
.
connect
(
self
.
sql_params
)
cur
=
conn
.
cursor
(
cursor_factory
=
psycopg2
.
extras
.
DictCursor
)
cur
.
execute
(
'SELECT * FROM %s WHERE "user"=%%s'
%
self
.
database
,
(
num
,))
cur
.
execute
(
'SELECT * FROM %s WHERE "user"=%%s
ORDER BY "date" ASC
'
%
self
.
database
,
(
num
,))
for
sms
in
cur
.
fetchall
():
status
,
params
=
manager
.
messageSend
(
sms
[
'from'
],
sms
[
'to'
],
sms
[
'body'
],
body_type
=
'base64'
)
if
status
==
'Success'
:
try
:
manager
.
messageSend
(
sms
[
'from'
],
sms
[
'to'
],
sms
[
'body'
],
body_type
=
'base64'
)
syslog
.
syslog
(
"Message from %s successfully delivered to %s"
%
(
sms
[
'from'
],
sms
[
'to'
]))
cur
.
execute
(
'DELETE FROM %s WHERE id=%%s'
%
self
.
database
,
(
sms
[
'id'
],))
conn
.
commit
()
e
lif
status
==
'E
rror
'
:
e
xcept
AsteriskError
as
e
rror
:
syslog
.
syslog
(
"Message from %s to %s : %s"
%
(
sms
[
'from'
],
sms
[
'to'
],
params
[
'Message'
]))
cur
.
close
()
conn
.
close
()
...
...
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