Built motion from commit (unavailable).|2.5.10
[motion2.git] / server / api / webbar / webbar.controller.js
index 0bd419b..dc4e3aa 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 _0x1798=['agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','originate','originate\x20fired:','body','json','userId','callerId','callbackUrl','then','info','entityFound:','webbar:originate','originate\x20executed!','hangup','user:%s','hangup\x20executed!','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','format','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','webbar:conference','conference\x20executed!','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','webbarapi','ioredis','redis','localhost','validate','number','userId\x20is\x20required','string','handleError:','stack','status','send','name','NotFound','request','error','code','message','catch','User'];(function(_0x50822a,_0x56c5c0){var _0x34a923=function(_0x44a70e){while(--_0x44a70e){_0x50822a['push'](_0x50822a['shift']());}};_0x34a923(++_0x56c5c0);}(_0x1798,0x1d6));var _0x8179=function(_0x40a831,_0x1204f4){_0x40a831=_0x40a831-0x0;var _0x67b86e=_0x1798[_0x40a831];return _0x67b86e;};'use strict';var path=require(_0x8179('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x8179('0x1'))['db'];var config=require(_0x8179('0x2'));var util=require('util');var BPromise=require(_0x8179('0x3'));var jayson=require(_0x8179('0x4'));var amiClient=jayson[_0x8179('0x5')][_0x8179('0x6')]({'port':0x232a});var logger=require('../../config/logger')(_0x8179('0x7'));var Redis=require(_0x8179('0x8'));config['redis']=_['defaults'](config[_0x8179('0x9')],{'host':_0x8179('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8179('0x9')]));var Schema=require(_0x8179('0xb'));var originateValidation=new Schema({'userId':{'type':_0x8179('0xc'),'required':[!![],_0x8179('0xd')]},'callNumber':{'type':_0x8179('0xe'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x8179('0xe')},'callbackUrl':{'type':_0x8179('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x8179('0xc'),'required':[!![],_0x8179('0xd')]},'sessionId':{'type':_0x8179('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8179('0xd')]},'sessionId':{'type':_0x8179('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x8179('0xc'),'required':[!![],_0x8179('0xd')]},'sessionId':{'type':_0x8179('0xe'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':'string','required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x8179('0xc'),'required':[!![],_0x8179('0xd')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8179('0xc'),'required':[!![],_0x8179('0xd')]},'sessionId':{'type':_0x8179('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x8179('0xc'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0x2ecd53,_0x46da7c,_0xc1c396){logger['info'](_0x2ecd53,_0x46da7c,JSON['stringify'](_0xc1c396));io['to'](_0x2ecd53)['emit'](_0x46da7c,_0xc1c396);}function handleError(_0x498f57){return function(_0x430dcf){console['log'](_0x8179('0xf'),_0x430dcf,_0x430dcf instanceof RangeError);logger['error'](_0x430dcf[_0x8179('0x10')]);if(_0x430dcf instanceof RangeError){if(_0x430dcf['name']){delete _0x430dcf['name'];}_0x498f57[_0x8179('0x11')](0x194)[_0x8179('0x12')](_0x430dcf);}else{if(_0x430dcf[_0x8179('0x13')]){delete _0x430dcf['name'];}_0x498f57[_0x8179('0x11')](0x1f4)[_0x8179('0x12')](_0x430dcf);}};}function checkError(){return function(_0x1cbc23){if(!_0x1cbc23){throw new RangeError(_0x8179('0x14'));}return _0x1cbc23;};}function respondWithRpcPromise(_0x35cc21,_0x26a8f7){return new BPromise(function(_0x3cff62,_0x5cc7d5){var _0x331559=amiClient;return _0x331559[_0x8179('0x15')](_0x35cc21,_0x26a8f7)['then'](function(_0x156861){if(_0x156861[_0x8179('0x16')]){if(_0x156861['error'][_0x8179('0x17')]===0x1f4){return _0x5cc7d5(_0x156861['error'][_0x8179('0x18')]);}return _0x3cff62(_0x156861['error'][_0x8179('0x18')]);}else{_0x3cff62(_0x156861['result']);}})[_0x8179('0x19')](function(_0x1ea4db){_0x5cc7d5(_0x1ea4db);});});}function getAgent(_0x4cbe64){return db[_0x8179('0x1a')]['findOne']({'where':{'id':_0x4cbe64,'role':_0x8179('0x1b')}})['then'](checkError());}function getAgentCheckSession(_0x3e078a,_0x250146){return new BPromise(function(_0x7e91a2,_0x2bcf0a){var _0x41db88=respondWithRpcPromise(_0x8179('0x1c'));var _0x23145d=getAgent(_0x3e078a);Promise[_0x8179('0x1d')]([_0x41db88,_0x23145d])['then'](function(_0x2693e4){var _0x35a265=_0x2693e4[0x0];var _0xdb61d1=_0x2693e4[0x1];var _0x4722b1=_[_0x8179('0x1e')](_0x35a265[_0x8179('0x1f')],function(_0x35952c){return _0x35952c[_0x8179('0x20')]==_0xdb61d1['id']&&_0x35952c[_0x8179('0x21')]==_0x250146;});if(_0x4722b1[_0x8179('0x22')]==0x1){_0x7e91a2(_0xdb61d1);}else{_0x2bcf0a(new RangeError(_0x8179('0x23')+_0x250146+'\x20not\x20found!'));}});});}exports[_0x8179('0x24')]=function(_0x10d6a1,_0x54ef15){logger['info'](_0x8179('0x25'),_0x10d6a1[_0x8179('0x26')]);var _0x38220e=originateValidation[_0x8179('0xb')](_0x10d6a1['body']);if(_0x38220e[_0x8179('0x22')]>0x0){return _0x54ef15[_0x8179('0x11')](0x190)[_0x8179('0x27')](_0x38220e);}var _0xaebaeb=_0x10d6a1[_0x8179('0x26')][_0x8179('0x28')];var _0x1757f8=_0x10d6a1[_0x8179('0x26')]['callNumber'];var _0x3e405c=_0x10d6a1[_0x8179('0x26')][_0x8179('0x29')];var _0x125a5c=_0x10d6a1[_0x8179('0x26')][_0x8179('0x2a')];return getAgent(_0xaebaeb)[_0x8179('0x2b')](function(_0x2f0245){logger[_0x8179('0x2c')](_0x8179('0x2d'),_0x2f0245[_0x8179('0x13')]);emit(util['format']('user:%s',_0x2f0245[_0x8179('0x13')]),_0x8179('0x2e'),{'callNumber':_0x1757f8,'callerId':_0x3e405c,'callbackUrl':_0x125a5c});return _0x54ef15['status'](0xc8)[_0x8179('0x27')]({'error':![],'message':_0x8179('0x2f')});})[_0x8179('0x19')](handleError(_0x54ef15));};exports[_0x8179('0x30')]=function(_0x5a4e2d,_0x11adfc){logger[_0x8179('0x2c')]('hangup\x20fired:',_0x5a4e2d[_0x8179('0x26')]);var _0x196b01=hangupValidation[_0x8179('0xb')](_0x5a4e2d['body']);if(_0x196b01['length']>0x0){return _0x11adfc[_0x8179('0x11')](0x190)[_0x8179('0x27')](_0x196b01);}var _0x281e95=_0x5a4e2d[_0x8179('0x26')]['userId'];var _0x599eee=_0x5a4e2d['body'][_0x8179('0x21')];return getAgent(_0x281e95)[_0x8179('0x2b')](function(_0x552630){logger[_0x8179('0x2c')](_0x8179('0x2d'),_0x552630[_0x8179('0x13')]);emit(util['format'](_0x8179('0x31'),_0x552630[_0x8179('0x13')]),'webbar:hangup',{'sessionId':_0x599eee});return _0x11adfc[_0x8179('0x11')](0xc8)[_0x8179('0x27')]({'error':![],'message':_0x8179('0x32')});})['catch'](handleError(_0x11adfc));};exports['answer']=function(_0x24ed63,_0x30c418){logger[_0x8179('0x2c')](_0x8179('0x33'),_0x24ed63['body']);var _0x8fd2ab=answerValidation['validate'](_0x24ed63[_0x8179('0x26')]);if(_0x8fd2ab[_0x8179('0x22')]>0x0){return _0x30c418[_0x8179('0x11')](0x190)[_0x8179('0x27')](_0x8fd2ab);}var _0x3ed396=_0x24ed63[_0x8179('0x26')]['userId'];var _0x4371c1=_0x24ed63[_0x8179('0x26')][_0x8179('0x21')];return getAgent(_0x3ed396)[_0x8179('0x2b')](function(_0x260f2f){logger[_0x8179('0x2c')](_0x8179('0x2d'),_0x260f2f['name']);emit(util['format']('user:%s',_0x260f2f[_0x8179('0x13')]),_0x8179('0x34'),{'sessionId':_0x4371c1});return _0x30c418['status'](0xc8)[_0x8179('0x27')]({'error':![],'message':_0x8179('0x35')});})['catch'](handleError(_0x30c418));};exports[_0x8179('0x36')]=function(_0x2d7931,_0x29ad47){logger[_0x8179('0x2c')](_0x8179('0x37'),_0x2d7931[_0x8179('0x26')]);var _0x15294f=holdValidation[_0x8179('0xb')](_0x2d7931[_0x8179('0x26')]);if(_0x15294f[_0x8179('0x22')]>0x0){return _0x29ad47['status'](0x190)[_0x8179('0x27')](_0x15294f);}var _0x45a9f5=_0x2d7931['body']['userId'];var _0x5e4b8f=_0x2d7931['body'][_0x8179('0x21')];return getAgent(_0x45a9f5)['then'](function(_0x35a463){logger[_0x8179('0x2c')](_0x8179('0x2d'),_0x35a463[_0x8179('0x13')]);emit(util[_0x8179('0x38')]('user:%s',_0x35a463[_0x8179('0x13')]),_0x8179('0x39'),{'sessionId':_0x5e4b8f});return _0x29ad47[_0x8179('0x11')](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})[_0x8179('0x19')](handleError(_0x29ad47));};exports[_0x8179('0x3a')]=function(_0x407e41,_0x5aa513){logger['info'](_0x8179('0x3b'),_0x407e41[_0x8179('0x26')]);var _0x2db950=unholdValidation[_0x8179('0xb')](_0x407e41['body']);if(_0x2db950[_0x8179('0x22')]>0x0){return _0x5aa513[_0x8179('0x11')](0x190)[_0x8179('0x27')](_0x2db950);}var _0x473098=_0x407e41['body'][_0x8179('0x28')];var _0x28bebe=_0x407e41[_0x8179('0x26')][_0x8179('0x21')];return getAgent(_0x473098)[_0x8179('0x2b')](function(_0x1a326a){logger[_0x8179('0x2c')](_0x8179('0x2d'),_0x1a326a[_0x8179('0x13')]);emit(util[_0x8179('0x38')](_0x8179('0x31'),_0x1a326a[_0x8179('0x13')]),_0x8179('0x3c'),{'sessionId':_0x28bebe});return _0x5aa513[_0x8179('0x11')](0xc8)[_0x8179('0x27')]({'error':![],'message':_0x8179('0x3d')});})['catch'](handleError(_0x5aa513));};exports[_0x8179('0x3e')]=function(_0x11a8a2,_0x545b1f){logger[_0x8179('0x2c')](_0x8179('0x3f'),_0x545b1f[_0x8179('0x26')]);var _0x25e1c4=callsValidation['validate'](_0x11a8a2[_0x8179('0x26')]);if(_0x25e1c4['length']>0x0){return _0x545b1f[_0x8179('0x11')](0x190)[_0x8179('0x27')](_0x25e1c4);}var _0x44b180=_0x11a8a2['body'][_0x8179('0x28')];var _0x24916e=respondWithRpcPromise('VoiceChannels');var _0x13198b=getAgent(_0x44b180);return Promise['all']([_0x24916e,_0x13198b])[_0x8179('0x2b')](function(_0x105b5f){var _0x32171a=_0x105b5f[0x0];var _0xdafabd=_0x105b5f[0x1];var _0x298890=_[_0x8179('0x1e')](_0x32171a[_0x8179('0x1f')],function(_0x157f95){return _0x157f95['UserId']==_0xdafabd['id'];});return _0x545b1f[_0x8179('0x11')](0xc8)['json']({'count':_0x298890['length'],'rows':_0x298890});})['catch'](handleError(_0x545b1f));};exports[_0x8179('0x40')]=function(_0x367929,_0x3878e7){logger[_0x8179('0x2c')]('conference\x20fired:',_0x367929[_0x8179('0x26')]);var _0x1b2cf0=conferenceValidation[_0x8179('0xb')](_0x367929[_0x8179('0x26')]);if(_0x1b2cf0[_0x8179('0x22')]>0x0){return _0x3878e7[_0x8179('0x11')](0x190)[_0x8179('0x27')](_0x1b2cf0);}var _0x7614f4=_0x367929[_0x8179('0x26')][_0x8179('0x28')];return getAgent(_0x7614f4)['then'](function(_0x28a583){logger[_0x8179('0x2c')](_0x8179('0x2d'),_0x28a583[_0x8179('0x13')]);emit(util['format'](_0x8179('0x31'),_0x28a583[_0x8179('0x13')]),_0x8179('0x41'));return _0x3878e7[_0x8179('0x11')](0xc8)[_0x8179('0x27')]({'error':![],'message':_0x8179('0x42')});})['catch'](handleError(_0x3878e7));};exports[_0x8179('0x43')]=function(_0x381f73,_0x42ffda){logger[_0x8179('0x2c')]('transfer\x20fired:',_0x381f73[_0x8179('0x26')]);var _0x3f48fc=transferValidation[_0x8179('0xb')](_0x381f73[_0x8179('0x26')]);if(_0x3f48fc['length']>0x0){return _0x42ffda[_0x8179('0x11')](0x190)[_0x8179('0x27')](_0x3f48fc);}var _0x5d52e3=_0x381f73[_0x8179('0x26')][_0x8179('0x28')];var _0x33614e=_0x381f73['body'][_0x8179('0x21')];var _0x561364=_0x381f73['body'][_0x8179('0x44')];return getAgent(_0x5d52e3)[_0x8179('0x2b')](function(_0x306d43){logger[_0x8179('0x2c')]('entityFound:',_0x306d43[_0x8179('0x13')]);emit(util['format'](_0x8179('0x31'),_0x306d43[_0x8179('0x13')]),_0x8179('0x45'),{'sessionId':_0x33614e,'transferNumber':_0x561364});return _0x42ffda['status'](0xc8)['json']({'error':![],'message':_0x8179('0x46')});})['catch'](handleError(_0x42ffda));};
\ No newline at end of file