Commit 5d4f5c57 authored by okhin's avatar okhin 🚴
Browse files

Merge branch '5-fix-unauthorized-calls' into 'master'

Raise eception in the event_handler too

Closes #5

See merge request !21
parents ee558e44 b9540f0b
Pipeline #945 passed with stage
in 5 seconds
......@@ -266,7 +266,10 @@ class Call(object):
state = event['type']
if state in self.actions:
getattr(self, self.actions[state])(event=event)
except Exception as e:
raise e
def hangup(self, event):
......@@ -319,6 +322,10 @@ class Call(object):
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):
except Exception as 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:
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],))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment