Skip to content
GitLab
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
b9540f0b
Commit
b9540f0b
authored
Apr 19, 2017
by
okhin
Browse files
Raise eception in the event_handler too
parent
b7da2f21
Changes
1
Hide whitespace changes
Inline
Side-by-side
piphone.py
View file @
b9540f0b
...
...
@@ -266,7 +266,10 @@ class Call(object):
'''
state
=
event
[
'type'
]
if
state
in
self
.
actions
:
getattr
(
self
,
self
.
actions
[
state
])(
event
=
event
)
try
:
getattr
(
self
,
self
.
actions
[
state
])(
event
=
event
)
except
Exception
as
e
:
raise
e
def
hangup
(
self
,
event
):
'''
...
...
@@ -319,6 +322,10 @@ class Call(object):
channel
.
originate
(
endpoint
)
except
AssertionError
as
e
:
phone_logger
.
error
(
"Received a DTMF sequence out le being in a '{}' state, ignoring: {}"
.
format
(
self
.
state
,
event
[
'digit'
]))
raise
e
except
ValueError
as
e
:
phone_logger
.
error
(
"Incorrect number: {}"
.
format
(
e
.
message
,))
raise
e
def
change
(
self
,
event
):
'''
...
...
@@ -389,7 +396,6 @@ class Call(object):
self
.
db
.
commit
()
except
Exception
as
e
:
bottle_logger
.
exception
(
e
)
phone_logger
.
exception
(
e
)
raise
e
def
start
(
db
):
...
...
@@ -466,6 +472,9 @@ def originate(db, callid=None):
,
'user'
:
request
.
params
[
'api'
]
,
'hits'
:
1
}
return
{
'header'
:
head
,
'data'
:
call
}
except
ValueError
as
e
:
bottle_logger
.
exception
(
e
)
abort
(
403
,
"Your phone number isnt' authorized to use the piphone"
)
except
Exception
as
e
:
bottle_logger
.
debug
(
"Missing params : {}"
.
format
([
p
for
p
in
request
.
params
],))
bottle_logger
.
exception
(
e
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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