|
|
@@ -637,6 +637,31 @@ class AtXfer(Resource):
|
|
|
else:
|
|
|
return errorReply(reply.message)
|
|
|
|
|
|
+@app.route('/bxfer/<userA>/<userB>')
|
|
|
+class BXfer(Resource):
|
|
|
+ @app.param('userA', 'User initiating the blind transfer', 'path')
|
|
|
+ @app.param('userB', 'Transfer destination user', 'path')
|
|
|
+ @app.response(HTTPStatus.OK, 'Json reply')
|
|
|
+ @app.response(HTTPStatus.UNAUTHORIZED, 'Authorization required')
|
|
|
+ async def get(self, userA, userB):
|
|
|
+ '''Blind call transfer
|
|
|
+ '''
|
|
|
+ device = await getUserDevice(userA)
|
|
|
+ if device in NONEs:
|
|
|
+ return noUserDevice(userA)
|
|
|
+ channel = await amiDeviceChannel(device)
|
|
|
+ if channel in NONEs:
|
|
|
+ return noUserChannel(userA)
|
|
|
+ reply = await manager.send_action({'Action':'BlindTransfer',
|
|
|
+ 'Channel':channel,
|
|
|
+ 'async':'false',
|
|
|
+ 'Exten':userB})
|
|
|
+ if isinstance(reply, Message):
|
|
|
+ if reply.success:
|
|
|
+ return successfullyTransfered(userA, userB)
|
|
|
+ else:
|
|
|
+ return errorReply(reply.message)
|
|
|
+
|
|
|
@app.route('/users/states')
|
|
|
class UsersStates(Resource):
|
|
|
@app.response(HTTPStatus.OK, 'JSON reply with user:state map or error message')
|