Built motion from commit e1760111.|2.6.18
[motion2.git] / server / api / webbar / webbar.controller.js
index 0bd419b..89a817b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x170f=['callerId','callbackUrl','entityFound:','webbar:originate','hangup\x20fired:','json','format','user:%s','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','catch','hold','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','UserId','webbar:conference','conference\x20executed!','transfer','transferNumber','webbar:transfer','path','lodash','../../mysqldb','../../config/environment','util','client','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','error','stack','name','status','send','NotFound','request','then','code','message','findOne','agent','filter','rows','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','userId'];(function(_0x152449,_0x49f41d){var _0x5b58b2=function(_0x226c30){while(--_0x226c30){_0x152449['push'](_0x152449['shift']());}};_0x5b58b2(++_0x49f41d);}(_0x170f,0x65));var _0xf170=function(_0x358806,_0x322b66){_0x358806=_0x358806-0x0;var _0x19fdcb=_0x170f[_0x358806];return _0x19fdcb;};'use strict';var path=require(_0xf170('0x0'));var fs=require('fs');var _=require(_0xf170('0x1'));var db=require(_0xf170('0x2'))['db'];var config=require(_0xf170('0x3'));var util=require(_0xf170('0x4'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var amiClient=jayson[_0xf170('0x5')]['http']({'port':0x232a});var logger=require('../../config/logger')(_0xf170('0x6'));var Redis=require(_0xf170('0x7'));config[_0xf170('0x8')]=_[_0xf170('0x9')](config[_0xf170('0x8')],{'host':_0xf170('0xa'),'port':0x18eb});var io=require(_0xf170('0xb'))(new Redis(config[_0xf170('0x8')]));var Schema=require(_0xf170('0xc'));var originateValidation=new Schema({'userId':{'type':_0xf170('0xd'),'required':[!![],_0xf170('0xe')]},'callNumber':{'type':_0xf170('0xf'),'required':[!![],_0xf170('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xf170('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf170('0xd'),'required':[!![],_0xf170('0xe')]},'sessionId':{'type':_0xf170('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xf170('0xd'),'required':[!![],_0xf170('0xe')]},'sessionId':{'type':'string','required':[!![],_0xf170('0x11')]},'transferNumber':{'type':_0xf170('0xf'),'required':[!![],_0xf170('0x12')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf170('0xe')]},'sessionId':{'type':_0xf170('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xf170('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xf170('0xd'),'required':[!![],_0xf170('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xf170('0xd'),'required':[!![],_0xf170('0xe')]}});function emit(_0x2fc80a,_0x15a2d7,_0x323d69){logger[_0xf170('0x13')](_0x2fc80a,_0x15a2d7,JSON[_0xf170('0x14')](_0x323d69));io['to'](_0x2fc80a)[_0xf170('0x15')](_0x15a2d7,_0x323d69);}function handleError(_0x93af04){return function(_0x2bac8e){console['log']('handleError:',_0x2bac8e,_0x2bac8e instanceof RangeError);logger[_0xf170('0x16')](_0x2bac8e[_0xf170('0x17')]);if(_0x2bac8e instanceof RangeError){if(_0x2bac8e[_0xf170('0x18')]){delete _0x2bac8e[_0xf170('0x18')];}_0x93af04[_0xf170('0x19')](0x194)[_0xf170('0x1a')](_0x2bac8e);}else{if(_0x2bac8e[_0xf170('0x18')]){delete _0x2bac8e[_0xf170('0x18')];}_0x93af04[_0xf170('0x19')](0x1f4)[_0xf170('0x1a')](_0x2bac8e);}};}function checkError(){return function(_0x1f555a){if(!_0x1f555a){throw new RangeError(_0xf170('0x1b'));}return _0x1f555a;};}function respondWithRpcPromise(_0xa6abfd,_0x429ffa){return new BPromise(function(_0x27a34a,_0x1d1fa1){var _0x1c0032=amiClient;return _0x1c0032[_0xf170('0x1c')](_0xa6abfd,_0x429ffa)[_0xf170('0x1d')](function(_0x407e95){if(_0x407e95[_0xf170('0x16')]){if(_0x407e95[_0xf170('0x16')][_0xf170('0x1e')]===0x1f4){return _0x1d1fa1(_0x407e95[_0xf170('0x16')][_0xf170('0x1f')]);}return _0x27a34a(_0x407e95[_0xf170('0x16')][_0xf170('0x1f')]);}else{_0x27a34a(_0x407e95['result']);}})['catch'](function(_0xbb7745){_0x1d1fa1(_0xbb7745);});});}function getAgent(_0x1f9739){return db['User'][_0xf170('0x20')]({'where':{'id':_0x1f9739,'role':_0xf170('0x21')}})['then'](checkError());}function getAgentCheckSession(_0x2cd2c7,_0x491e3f){return new BPromise(function(_0x1cc2af,_0x398b70){var _0x4d420c=respondWithRpcPromise('VoiceChannels');var _0x5a63bb=getAgent(_0x2cd2c7);Promise['all']([_0x4d420c,_0x5a63bb])[_0xf170('0x1d')](function(_0x1ae240){var _0x28ffb8=_0x1ae240[0x0];var _0x5326e5=_0x1ae240[0x1];var _0x5dfe57=_[_0xf170('0x22')](_0x28ffb8[_0xf170('0x23')],function(_0x4164fd){return _0x4164fd['UserId']==_0x5326e5['id']&&_0x4164fd[_0xf170('0x24')]==_0x491e3f;});if(_0x5dfe57[_0xf170('0x25')]==0x1){_0x1cc2af(_0x5326e5);}else{_0x398b70(new RangeError('sessionId\x20'+_0x491e3f+_0xf170('0x26')));}});});}exports[_0xf170('0x27')]=function(_0x21e699,_0x3a8478){logger[_0xf170('0x13')](_0xf170('0x28'),_0x21e699[_0xf170('0x29')]);var _0x1af1d9=originateValidation[_0xf170('0xc')](_0x21e699[_0xf170('0x29')]);if(_0x1af1d9['length']>0x0){return _0x3a8478[_0xf170('0x19')](0x190)['json'](_0x1af1d9);}var _0x2ec04f=_0x21e699['body'][_0xf170('0x2a')];var _0x4cd13c=_0x21e699[_0xf170('0x29')]['callNumber'];var _0x2205bd=_0x21e699[_0xf170('0x29')][_0xf170('0x2b')];var _0x36151d=_0x21e699[_0xf170('0x29')][_0xf170('0x2c')];return getAgent(_0x2ec04f)['then'](function(_0x45f63b){logger['info'](_0xf170('0x2d'),_0x45f63b[_0xf170('0x18')]);emit(util['format']('user:%s',_0x45f63b[_0xf170('0x18')]),_0xf170('0x2e'),{'callNumber':_0x4cd13c,'callerId':_0x2205bd,'callbackUrl':_0x36151d});return _0x3a8478[_0xf170('0x19')](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x3a8478));};exports['hangup']=function(_0x4a7bff,_0x56866d){logger[_0xf170('0x13')](_0xf170('0x2f'),_0x4a7bff[_0xf170('0x29')]);var _0x32cad0=hangupValidation[_0xf170('0xc')](_0x4a7bff[_0xf170('0x29')]);if(_0x32cad0[_0xf170('0x25')]>0x0){return _0x56866d[_0xf170('0x19')](0x190)[_0xf170('0x30')](_0x32cad0);}var _0x30e48c=_0x4a7bff[_0xf170('0x29')][_0xf170('0x2a')];var _0x159aa5=_0x4a7bff[_0xf170('0x29')]['sessionId'];return getAgent(_0x30e48c)[_0xf170('0x1d')](function(_0x3e08e9){logger[_0xf170('0x13')](_0xf170('0x2d'),_0x3e08e9[_0xf170('0x18')]);emit(util[_0xf170('0x31')](_0xf170('0x32'),_0x3e08e9['name']),'webbar:hangup',{'sessionId':_0x159aa5});return _0x56866d[_0xf170('0x19')](0xc8)[_0xf170('0x30')]({'error':![],'message':_0xf170('0x33')});})['catch'](handleError(_0x56866d));};exports[_0xf170('0x34')]=function(_0x25706e,_0x8837d5){logger[_0xf170('0x13')](_0xf170('0x35'),_0x25706e[_0xf170('0x29')]);var _0x4f2f71=answerValidation[_0xf170('0xc')](_0x25706e['body']);if(_0x4f2f71[_0xf170('0x25')]>0x0){return _0x8837d5[_0xf170('0x19')](0x190)[_0xf170('0x30')](_0x4f2f71);}var _0x3bad8c=_0x25706e[_0xf170('0x29')][_0xf170('0x2a')];var _0x2b3f41=_0x25706e[_0xf170('0x29')]['sessionId'];return getAgent(_0x3bad8c)[_0xf170('0x1d')](function(_0x47663e){logger['info'](_0xf170('0x2d'),_0x47663e[_0xf170('0x18')]);emit(util['format'](_0xf170('0x32'),_0x47663e['name']),_0xf170('0x36'),{'sessionId':_0x2b3f41});return _0x8837d5[_0xf170('0x19')](0xc8)[_0xf170('0x30')]({'error':![],'message':'answer\x20executed!'});})[_0xf170('0x37')](handleError(_0x8837d5));};exports[_0xf170('0x38')]=function(_0x3525a1,_0x1c6ec7){logger[_0xf170('0x13')]('hold\x20fired:',_0x3525a1[_0xf170('0x29')]);var _0x1b57f4=holdValidation[_0xf170('0xc')](_0x3525a1['body']);if(_0x1b57f4[_0xf170('0x25')]>0x0){return _0x1c6ec7['status'](0x190)[_0xf170('0x30')](_0x1b57f4);}var _0x49d4bc=_0x3525a1['body'][_0xf170('0x2a')];var _0xceb3b3=_0x3525a1[_0xf170('0x29')][_0xf170('0x24')];return getAgent(_0x49d4bc)[_0xf170('0x1d')](function(_0x4abf55){logger['info'](_0xf170('0x2d'),_0x4abf55[_0xf170('0x18')]);emit(util[_0xf170('0x31')]('user:%s',_0x4abf55[_0xf170('0x18')]),_0xf170('0x39'),{'sessionId':_0xceb3b3});return _0x1c6ec7['status'](0xc8)[_0xf170('0x30')]({'error':![],'message':_0xf170('0x3a')});})[_0xf170('0x37')](handleError(_0x1c6ec7));};exports[_0xf170('0x3b')]=function(_0x575f1b,_0x5768b2){logger[_0xf170('0x13')](_0xf170('0x3c'),_0x575f1b['body']);var _0x1178a5=unholdValidation[_0xf170('0xc')](_0x575f1b[_0xf170('0x29')]);if(_0x1178a5[_0xf170('0x25')]>0x0){return _0x5768b2[_0xf170('0x19')](0x190)[_0xf170('0x30')](_0x1178a5);}var _0x591708=_0x575f1b[_0xf170('0x29')]['userId'];var _0x46b837=_0x575f1b[_0xf170('0x29')][_0xf170('0x24')];return getAgent(_0x591708)[_0xf170('0x1d')](function(_0x90a8c6){logger['info'](_0xf170('0x2d'),_0x90a8c6[_0xf170('0x18')]);emit(util[_0xf170('0x31')]('user:%s',_0x90a8c6[_0xf170('0x18')]),_0xf170('0x3d'),{'sessionId':_0x46b837});return _0x5768b2[_0xf170('0x19')](0xc8)[_0xf170('0x30')]({'error':![],'message':_0xf170('0x3e')});})[_0xf170('0x37')](handleError(_0x5768b2));};exports[_0xf170('0x3f')]=function(_0x3a73b7,_0x3bd3cf){logger[_0xf170('0x13')](_0xf170('0x40'),_0x3bd3cf['body']);var _0x19d056=callsValidation[_0xf170('0xc')](_0x3a73b7[_0xf170('0x29')]);if(_0x19d056[_0xf170('0x25')]>0x0){return _0x3bd3cf[_0xf170('0x19')](0x190)[_0xf170('0x30')](_0x19d056);}var _0x28c7b1=_0x3a73b7[_0xf170('0x29')]['userId'];var _0x2aba2f=respondWithRpcPromise(_0xf170('0x41'));var _0x1eacee=getAgent(_0x28c7b1);return Promise['all']([_0x2aba2f,_0x1eacee])[_0xf170('0x1d')](function(_0x2880d8){var _0x78686b=_0x2880d8[0x0];var _0x17b46c=_0x2880d8[0x1];var _0x5ea868=_[_0xf170('0x22')](_0x78686b['rows'],function(_0x1a17fa){return _0x1a17fa[_0xf170('0x42')]==_0x17b46c['id'];});return _0x3bd3cf[_0xf170('0x19')](0xc8)[_0xf170('0x30')]({'count':_0x5ea868[_0xf170('0x25')],'rows':_0x5ea868});})[_0xf170('0x37')](handleError(_0x3bd3cf));};exports['conference']=function(_0x4bfa46,_0x45095e){logger[_0xf170('0x13')]('conference\x20fired:',_0x4bfa46[_0xf170('0x29')]);var _0x1e7136=conferenceValidation[_0xf170('0xc')](_0x4bfa46[_0xf170('0x29')]);if(_0x1e7136[_0xf170('0x25')]>0x0){return _0x45095e[_0xf170('0x19')](0x190)[_0xf170('0x30')](_0x1e7136);}var _0x17c7d8=_0x4bfa46[_0xf170('0x29')][_0xf170('0x2a')];return getAgent(_0x17c7d8)[_0xf170('0x1d')](function(_0x447b8e){logger['info'](_0xf170('0x2d'),_0x447b8e['name']);emit(util['format'](_0xf170('0x32'),_0x447b8e[_0xf170('0x18')]),_0xf170('0x43'));return _0x45095e[_0xf170('0x19')](0xc8)['json']({'error':![],'message':_0xf170('0x44')});})['catch'](handleError(_0x45095e));};exports[_0xf170('0x45')]=function(_0x302b69,_0x71ca98){logger[_0xf170('0x13')]('transfer\x20fired:',_0x302b69[_0xf170('0x29')]);var _0x4a2a06=transferValidation[_0xf170('0xc')](_0x302b69[_0xf170('0x29')]);if(_0x4a2a06[_0xf170('0x25')]>0x0){return _0x71ca98[_0xf170('0x19')](0x190)[_0xf170('0x30')](_0x4a2a06);}var _0x2573ca=_0x302b69[_0xf170('0x29')]['userId'];var _0x3469e3=_0x302b69[_0xf170('0x29')][_0xf170('0x24')];var _0x303c7b=_0x302b69[_0xf170('0x29')][_0xf170('0x46')];return getAgent(_0x2573ca)[_0xf170('0x1d')](function(_0x1a1d16){logger[_0xf170('0x13')]('entityFound:',_0x1a1d16[_0xf170('0x18')]);emit(util['format'](_0xf170('0x32'),_0x1a1d16[_0xf170('0x18')]),_0xf170('0x47'),{'sessionId':_0x3469e3,'transferNumber':_0x303c7b});return _0x71ca98['status'](0xc8)[_0xf170('0x30')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x71ca98));};
\ No newline at end of file
+var _0x0a12=['send','code','result','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','body','validate','json','callerId','callbackUrl','info','entityFound:','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','userId','user:%s','hangup\x20executed!','answer','answer\x20fired:','format','webbar:answer','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','conference\x20executed!','transferNumber','webbar:transfer','lodash','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','error','stack','name','status'];(function(_0x1f31aa,_0x50b37d){var _0x333f10=function(_0x39f43a){while(--_0x39f43a){_0x1f31aa['push'](_0x1f31aa['shift']());}};_0x333f10(++_0x50b37d);}(_0x0a12,0xb8));var _0x20a1=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x0a12[_0xe66cf2];return _0x2d84e7;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x20a1('0x0'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0x20a1('0x1'));var jayson=require('jayson/promise');var amiClient=jayson[_0x20a1('0x2')][_0x20a1('0x3')]({'port':0x232a});var logger=require(_0x20a1('0x4'))(_0x20a1('0x5'));var Redis=require(_0x20a1('0x6'));config[_0x20a1('0x7')]=_[_0x20a1('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x20a1('0x9'))(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x20a1('0xa'),'required':[!![],_0x20a1('0xb')]},'callNumber':{'type':_0x20a1('0xc'),'required':[!![],_0x20a1('0xd')]},'callerId':{'type':_0x20a1('0xc')},'callbackUrl':{'type':_0x20a1('0xc')}});var hangupValidation=new Schema({'userId':{'type':_0x20a1('0xa'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x20a1('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x20a1('0xa'),'required':[!![],_0x20a1('0xb')]},'sessionId':{'type':_0x20a1('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x20a1('0xa'),'required':[!![],_0x20a1('0xb')]},'sessionId':{'type':'string','required':[!![],_0x20a1('0xe')]},'transferNumber':{'type':_0x20a1('0xc'),'required':[!![],_0x20a1('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0x20a1('0xa'),'required':[!![],_0x20a1('0xb')]},'sessionId':{'type':_0x20a1('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x20a1('0xa'),'required':[!![],_0x20a1('0xb')]},'sessionId':{'type':_0x20a1('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x20a1('0xa'),'required':[!![],_0x20a1('0xb')]}});var conferenceValidation=new Schema({'userId':{'type':_0x20a1('0xa'),'required':[!![],_0x20a1('0xb')]}});function emit(_0xec799b,_0x559a97,_0x50d618){logger['info'](_0xec799b,_0x559a97,JSON['stringify'](_0x50d618));io['to'](_0xec799b)['emit'](_0x559a97,_0x50d618);}function handleError(_0x478974){return function(_0x5c00a6){console['log']('handleError:',_0x5c00a6,_0x5c00a6 instanceof RangeError);logger[_0x20a1('0x10')](_0x5c00a6[_0x20a1('0x11')]);if(_0x5c00a6 instanceof RangeError){if(_0x5c00a6[_0x20a1('0x12')]){delete _0x5c00a6[_0x20a1('0x12')];}_0x478974[_0x20a1('0x13')](0x194)[_0x20a1('0x14')](_0x5c00a6);}else{if(_0x5c00a6['name']){delete _0x5c00a6['name'];}_0x478974[_0x20a1('0x13')](0x1f4)[_0x20a1('0x14')](_0x5c00a6);}};}function checkError(){return function(_0x3720c2){if(!_0x3720c2){throw new RangeError('NotFound');}return _0x3720c2;};}function respondWithRpcPromise(_0x5dfb97,_0x1f6669){return new BPromise(function(_0x2969cd,_0x9089cc){var _0x16605d=amiClient;return _0x16605d['request'](_0x5dfb97,_0x1f6669)['then'](function(_0x4e0100){if(_0x4e0100['error']){if(_0x4e0100[_0x20a1('0x10')][_0x20a1('0x15')]===0x1f4){return _0x9089cc(_0x4e0100[_0x20a1('0x10')]['message']);}return _0x2969cd(_0x4e0100[_0x20a1('0x10')]['message']);}else{_0x2969cd(_0x4e0100[_0x20a1('0x16')]);}})['catch'](function(_0x4bed2d){_0x9089cc(_0x4bed2d);});});}function getAgent(_0x47dcab){return db['User']['findOne']({'where':{'id':_0x47dcab,'role':_0x20a1('0x17')}})[_0x20a1('0x18')](checkError());}function getAgentCheckSession(_0x24d1e2,_0xee9dd8){return new BPromise(function(_0x3927b2,_0x26bd09){var _0x5a1352=respondWithRpcPromise(_0x20a1('0x19'));var _0x47877f=getAgent(_0x24d1e2);Promise[_0x20a1('0x1a')]([_0x5a1352,_0x47877f])[_0x20a1('0x18')](function(_0x522a7b){var _0x1c48cf=_0x522a7b[0x0];var _0x5a7c8b=_0x522a7b[0x1];var _0x4148a0=_[_0x20a1('0x1b')](_0x1c48cf[_0x20a1('0x1c')],function(_0x1cdc2c){return _0x1cdc2c[_0x20a1('0x1d')]==_0x5a7c8b['id']&&_0x1cdc2c[_0x20a1('0x1e')]==_0xee9dd8;});if(_0x4148a0[_0x20a1('0x1f')]==0x1){_0x3927b2(_0x5a7c8b);}else{_0x26bd09(new RangeError(_0x20a1('0x20')+_0xee9dd8+_0x20a1('0x21')));}});});}exports[_0x20a1('0x22')]=function(_0x49e141,_0x1e6b14){logger['info']('originate\x20fired:',_0x49e141[_0x20a1('0x23')]);var _0x38503f=originateValidation[_0x20a1('0x24')](_0x49e141[_0x20a1('0x23')]);if(_0x38503f['length']>0x0){return _0x1e6b14[_0x20a1('0x13')](0x190)[_0x20a1('0x25')](_0x38503f);}var _0x308e15=_0x49e141[_0x20a1('0x23')]['userId'];var _0x4296be=_0x49e141['body']['callNumber'];var _0x2a65c4=_0x49e141[_0x20a1('0x23')][_0x20a1('0x26')];var _0x1a425f=_0x49e141['body'][_0x20a1('0x27')];return getAgent(_0x308e15)[_0x20a1('0x18')](function(_0x4989c1){logger[_0x20a1('0x28')](_0x20a1('0x29'),_0x4989c1[_0x20a1('0x12')]);emit(util['format']('user:%s',_0x4989c1[_0x20a1('0x12')]),_0x20a1('0x2a'),{'callNumber':_0x4296be,'callerId':_0x2a65c4,'callbackUrl':_0x1a425f});return _0x1e6b14[_0x20a1('0x13')](0xc8)[_0x20a1('0x25')]({'error':![],'message':_0x20a1('0x2b')});})[_0x20a1('0x2c')](handleError(_0x1e6b14));};exports[_0x20a1('0x2d')]=function(_0x27927a,_0x4a811d){logger[_0x20a1('0x28')](_0x20a1('0x2e'),_0x27927a[_0x20a1('0x23')]);var _0x2cbdc6=hangupValidation[_0x20a1('0x24')](_0x27927a['body']);if(_0x2cbdc6[_0x20a1('0x1f')]>0x0){return _0x4a811d['status'](0x190)[_0x20a1('0x25')](_0x2cbdc6);}var _0x21f8b7=_0x27927a['body'][_0x20a1('0x2f')];var _0x55120d=_0x27927a[_0x20a1('0x23')]['sessionId'];return getAgent(_0x21f8b7)['then'](function(_0xe1b39b){logger[_0x20a1('0x28')](_0x20a1('0x29'),_0xe1b39b[_0x20a1('0x12')]);emit(util['format'](_0x20a1('0x30'),_0xe1b39b[_0x20a1('0x12')]),'webbar:hangup',{'sessionId':_0x55120d});return _0x4a811d[_0x20a1('0x13')](0xc8)[_0x20a1('0x25')]({'error':![],'message':_0x20a1('0x31')});})[_0x20a1('0x2c')](handleError(_0x4a811d));};exports[_0x20a1('0x32')]=function(_0x51f8f2,_0x475c5d){logger[_0x20a1('0x28')](_0x20a1('0x33'),_0x51f8f2['body']);var _0x8fac61=answerValidation[_0x20a1('0x24')](_0x51f8f2['body']);if(_0x8fac61[_0x20a1('0x1f')]>0x0){return _0x475c5d['status'](0x190)['json'](_0x8fac61);}var _0x55133c=_0x51f8f2['body'][_0x20a1('0x2f')];var _0x29968a=_0x51f8f2['body']['sessionId'];return getAgent(_0x55133c)['then'](function(_0x37118d){logger[_0x20a1('0x28')](_0x20a1('0x29'),_0x37118d['name']);emit(util[_0x20a1('0x34')](_0x20a1('0x30'),_0x37118d[_0x20a1('0x12')]),_0x20a1('0x35'),{'sessionId':_0x29968a});return _0x475c5d[_0x20a1('0x13')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0x475c5d));};exports[_0x20a1('0x36')]=function(_0x183507,_0x5c1fe3){logger[_0x20a1('0x28')](_0x20a1('0x37'),_0x183507[_0x20a1('0x23')]);var _0x49a6fe=holdValidation[_0x20a1('0x24')](_0x183507['body']);if(_0x49a6fe[_0x20a1('0x1f')]>0x0){return _0x5c1fe3[_0x20a1('0x13')](0x190)['json'](_0x49a6fe);}var _0x40fcf7=_0x183507[_0x20a1('0x23')]['userId'];var _0xb11b6f=_0x183507[_0x20a1('0x23')]['sessionId'];return getAgent(_0x40fcf7)[_0x20a1('0x18')](function(_0x85cbfd){logger[_0x20a1('0x28')]('entityFound:',_0x85cbfd[_0x20a1('0x12')]);emit(util[_0x20a1('0x34')](_0x20a1('0x30'),_0x85cbfd['name']),_0x20a1('0x38'),{'sessionId':_0xb11b6f});return _0x5c1fe3['status'](0xc8)[_0x20a1('0x25')]({'error':![],'message':_0x20a1('0x39')});})[_0x20a1('0x2c')](handleError(_0x5c1fe3));};exports[_0x20a1('0x3a')]=function(_0x19bb8d,_0x2c2363){logger[_0x20a1('0x28')]('unhold\x20fired:',_0x19bb8d[_0x20a1('0x23')]);var _0x2a4eb3=unholdValidation['validate'](_0x19bb8d[_0x20a1('0x23')]);if(_0x2a4eb3['length']>0x0){return _0x2c2363[_0x20a1('0x13')](0x190)[_0x20a1('0x25')](_0x2a4eb3);}var _0x57f1f9=_0x19bb8d[_0x20a1('0x23')][_0x20a1('0x2f')];var _0x1f988c=_0x19bb8d[_0x20a1('0x23')][_0x20a1('0x1e')];return getAgent(_0x57f1f9)[_0x20a1('0x18')](function(_0x1686d7){logger[_0x20a1('0x28')](_0x20a1('0x29'),_0x1686d7['name']);emit(util[_0x20a1('0x34')](_0x20a1('0x30'),_0x1686d7[_0x20a1('0x12')]),_0x20a1('0x3b'),{'sessionId':_0x1f988c});return _0x2c2363['status'](0xc8)[_0x20a1('0x25')]({'error':![],'message':_0x20a1('0x3c')});})['catch'](handleError(_0x2c2363));};exports[_0x20a1('0x3d')]=function(_0x57126d,_0xfbcadd){logger[_0x20a1('0x28')](_0x20a1('0x3e'),_0xfbcadd[_0x20a1('0x23')]);var _0x12c17c=callsValidation[_0x20a1('0x24')](_0x57126d[_0x20a1('0x23')]);if(_0x12c17c[_0x20a1('0x1f')]>0x0){return _0xfbcadd[_0x20a1('0x13')](0x190)[_0x20a1('0x25')](_0x12c17c);}var _0x283728=_0x57126d['body'][_0x20a1('0x2f')];var _0x4a12ac=respondWithRpcPromise(_0x20a1('0x19'));var _0x5cf3b4=getAgent(_0x283728);return Promise[_0x20a1('0x1a')]([_0x4a12ac,_0x5cf3b4])[_0x20a1('0x18')](function(_0x2a73cc){var _0x45f6da=_0x2a73cc[0x0];var _0x2fb198=_0x2a73cc[0x1];var _0x442410=_[_0x20a1('0x1b')](_0x45f6da['rows'],function(_0x436500){return _0x436500[_0x20a1('0x1d')]==_0x2fb198['id'];});return _0xfbcadd['status'](0xc8)[_0x20a1('0x25')]({'count':_0x442410[_0x20a1('0x1f')],'rows':_0x442410});})[_0x20a1('0x2c')](handleError(_0xfbcadd));};exports[_0x20a1('0x3f')]=function(_0x38efae,_0x6e85d){logger[_0x20a1('0x28')](_0x20a1('0x40'),_0x38efae[_0x20a1('0x23')]);var _0x4eae72=conferenceValidation[_0x20a1('0x24')](_0x38efae['body']);if(_0x4eae72[_0x20a1('0x1f')]>0x0){return _0x6e85d[_0x20a1('0x13')](0x190)[_0x20a1('0x25')](_0x4eae72);}var _0x1c3d8a=_0x38efae['body'][_0x20a1('0x2f')];return getAgent(_0x1c3d8a)[_0x20a1('0x18')](function(_0x3363a8){logger[_0x20a1('0x28')](_0x20a1('0x29'),_0x3363a8[_0x20a1('0x12')]);emit(util[_0x20a1('0x34')](_0x20a1('0x30'),_0x3363a8[_0x20a1('0x12')]),'webbar:conference');return _0x6e85d[_0x20a1('0x13')](0xc8)[_0x20a1('0x25')]({'error':![],'message':_0x20a1('0x41')});})[_0x20a1('0x2c')](handleError(_0x6e85d));};exports['transfer']=function(_0x4d3f32,_0x240044){logger[_0x20a1('0x28')]('transfer\x20fired:',_0x4d3f32[_0x20a1('0x23')]);var _0x1689f9=transferValidation[_0x20a1('0x24')](_0x4d3f32[_0x20a1('0x23')]);if(_0x1689f9[_0x20a1('0x1f')]>0x0){return _0x240044['status'](0x190)['json'](_0x1689f9);}var _0x221b0a=_0x4d3f32[_0x20a1('0x23')][_0x20a1('0x2f')];var _0x4cc007=_0x4d3f32[_0x20a1('0x23')][_0x20a1('0x1e')];var _0x1e8abe=_0x4d3f32[_0x20a1('0x23')][_0x20a1('0x42')];return getAgent(_0x221b0a)['then'](function(_0x1fb621){logger['info']('entityFound:',_0x1fb621[_0x20a1('0x12')]);emit(util[_0x20a1('0x34')]('user:%s',_0x1fb621[_0x20a1('0x12')]),_0x20a1('0x43'),{'sessionId':_0x4cc007,'transferNumber':_0x1e8abe});return _0x240044[_0x20a1('0x13')](0xc8)['json']({'error':![],'message':'transfer\x20executed!'});})[_0x20a1('0x2c')](handleError(_0x240044));};
\ No newline at end of file