|
|
@@ -1024,5 +1024,21 @@ class UserCalls(Resource):
|
|
|
request.args.get('order', 'ASC'))
|
|
|
return successReply(cdr)
|
|
|
|
|
|
+@app.route('/device/<device>/callback')
|
|
|
+class DeviceCallback(Resource):
|
|
|
+ @authRequired
|
|
|
+ @app.param('device', 'Device to get/set the callback url for', 'path')
|
|
|
+ @app.param('url', 'Callback url', 'query')
|
|
|
+ @app.response(HTTPStatus.OK, 'JSON data {"user":user,"state":state}')
|
|
|
+ @app.response(HTTPStatus.UNAUTHORIZED, 'Authorization required')
|
|
|
+ async def get(self, device):
|
|
|
+ '''Returns device's callback url.
|
|
|
+ '''
|
|
|
+ if (device != request.device) and (not request.admin):
|
|
|
+ abort(401)
|
|
|
+ if url is None:
|
|
|
+ url = 'http://127.0.0.1:65535/status'
|
|
|
+ return successCallbackURL(device, url)
|
|
|
+
|
|
|
manager.connect()
|
|
|
app.run(loop=main_loop, host='0.0.0.0', port=app.config['PORT'])
|