Commit 4841ab42 authored by okhin's avatar okhin 🚴

COrrectling cathing the Hangup event

parent 0675c446
Pipeline #766 passed with stage
in 4 seconds
...@@ -216,7 +216,7 @@ class Call(object): ...@@ -216,7 +216,7 @@ class Call(object):
actions = {'Created': 'call_caller' actions = {'Created': 'call_caller'
, 'ChannelStateChange': 'change' , 'ChannelStateChange': 'change'
, 'ChannelDtmfReceived': 'dtmf' , 'ChannelDtmfReceived': 'dtmf'
, 'Hangup': 'hangup'} , 'ChannelHangupRequest': 'hangup'}
def __init__(self, caller, callee, owner, callid=None, db=None): def __init__(self, caller, callee, owner, callid=None, db=None):
try: try:
...@@ -472,7 +472,6 @@ def originate(db, callid=None): ...@@ -472,7 +472,6 @@ def originate(db, callid=None):
bottle_logger.exception(e) bottle_logger.exception(e)
abort(400, "Missing or incorrect fields, the call cannot be processed") abort(400, "Missing or incorrect fields, the call cannot be processed")
@app.get('/static/<filepath:path>') @app.get('/static/<filepath:path>')
def static_files(filepath): def static_files(filepath):
""" """
...@@ -481,14 +480,19 @@ def static_files(filepath): ...@@ -481,14 +480,19 @@ def static_files(filepath):
""" """
return static_file(filepath, root='./views') return static_file(filepath, root='./views')
@app.get('/admin') @app.get('/admin')
@authenticated
def little_admin(db): def little_admin(db):
# We need to check if we're admin
requests = db.execute('SELECT admin FROM users WHERE api = ?', (request.params['api']));
admin = admin.fetchall()
if admin[0] is not True:
abort(403, "You need to have an admin access")
users = db.execute('SELECT api, token, admin FROM users').fetchall() users = db.execute('SELECT api, token, admin FROM users').fetchall()
return template('index', users=users) return template('index', users=users)
@app.post('/admin') @app.post('/admin')
@authenticated
def medium_admin(db): def medium_admin(db):
api = request.forms.get('api') api = request.forms.get('api')
token = request.forms.get('token') token = request.forms.get('token')
......
Markdown is supported
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