Built motion from commit 0900f080.|2.5.45
[motion2.git] / server / api / webbar / webbar.controller.js
index 0bd419b..76d6d6b 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 _0x7341=['answer\x20fired:','answer\x20executed!','webbar:hold','hold\x20executed!','unhold\x20fired:','calls','calls\x20fired:','all','rows','conference','conference\x20fired:','webbar:conference','transfer\x20fired:','transferNumber','webbar:transfer','../../mysqldb','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','number','callNumber\x20is\x20required','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','error','status','name','NotFound','request','then','code','catch','User','findOne','agent','VoiceChannels','filter','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','validate','json','userId','callNumber','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer'];(function(_0x2f4d1b,_0x1f65be){var _0x5da6c2=function(_0x5cd4a2){while(--_0x5cd4a2){_0x2f4d1b['push'](_0x2f4d1b['shift']());}};_0x5da6c2(++_0x1f65be);}(_0x7341,0xe4));var _0x1734=function(_0x4cd294,_0x5f02b6){_0x4cd294=_0x4cd294-0x0;var _0x22278e=_0x7341[_0x4cd294];return _0x22278e;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require(_0x1734('0x0'))['db'];var config=require('../../config/environment');var util=require(_0x1734('0x1'));var BPromise=require(_0x1734('0x2'));var jayson=require('jayson/promise');var amiClient=jayson[_0x1734('0x3')][_0x1734('0x4')]({'port':0x232a});var logger=require(_0x1734('0x5'))(_0x1734('0x6'));var Redis=require(_0x1734('0x7'));config[_0x1734('0x8')]=_[_0x1734('0x9')](config['redis'],{'host':_0x1734('0xa'),'port':0x18eb});var io=require(_0x1734('0xb'))(new Redis(config[_0x1734('0x8')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x1734('0xd')]},'callerId':{'type':_0x1734('0xe')},'callbackUrl':{'type':_0x1734('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]},'sessionId':{'type':_0x1734('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]},'sessionId':{'type':_0x1734('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x1734('0xe'),'required':[!![],_0x1734('0x10')]},'transferNumber':{'type':_0x1734('0xe'),'required':[!![],_0x1734('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]},'sessionId':{'type':_0x1734('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]},'sessionId':{'type':_0x1734('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]}});function emit(_0x3989a6,_0x24bbf3,_0x2b375d){logger[_0x1734('0x12')](_0x3989a6,_0x24bbf3,JSON[_0x1734('0x13')](_0x2b375d));io['to'](_0x3989a6)['emit'](_0x24bbf3,_0x2b375d);}function handleError(_0x5ab895){return function(_0x1fa9c0){console[_0x1734('0x14')]('handleError:',_0x1fa9c0,_0x1fa9c0 instanceof RangeError);logger[_0x1734('0x15')](_0x1fa9c0['stack']);if(_0x1fa9c0 instanceof RangeError){if(_0x1fa9c0['name']){delete _0x1fa9c0['name'];}_0x5ab895[_0x1734('0x16')](0x194)['send'](_0x1fa9c0);}else{if(_0x1fa9c0[_0x1734('0x17')]){delete _0x1fa9c0[_0x1734('0x17')];}_0x5ab895['status'](0x1f4)['send'](_0x1fa9c0);}};}function checkError(){return function(_0x4bd526){if(!_0x4bd526){throw new RangeError(_0x1734('0x18'));}return _0x4bd526;};}function respondWithRpcPromise(_0x53f13d,_0x183f7a){return new BPromise(function(_0x5ad801,_0x215ae4){var _0x42485f=amiClient;return _0x42485f[_0x1734('0x19')](_0x53f13d,_0x183f7a)[_0x1734('0x1a')](function(_0x29bb2c){if(_0x29bb2c[_0x1734('0x15')]){if(_0x29bb2c[_0x1734('0x15')][_0x1734('0x1b')]===0x1f4){return _0x215ae4(_0x29bb2c[_0x1734('0x15')]['message']);}return _0x5ad801(_0x29bb2c[_0x1734('0x15')]['message']);}else{_0x5ad801(_0x29bb2c['result']);}})[_0x1734('0x1c')](function(_0x46b2fa){_0x215ae4(_0x46b2fa);});});}function getAgent(_0x309d3f){return db[_0x1734('0x1d')][_0x1734('0x1e')]({'where':{'id':_0x309d3f,'role':_0x1734('0x1f')}})[_0x1734('0x1a')](checkError());}function getAgentCheckSession(_0x27d6e5,_0x4a670a){return new BPromise(function(_0x381960,_0x52eaf5){var _0x17e068=respondWithRpcPromise(_0x1734('0x20'));var _0xfca2ad=getAgent(_0x27d6e5);Promise['all']([_0x17e068,_0xfca2ad])[_0x1734('0x1a')](function(_0x3f9abe){var _0xf2d136=_0x3f9abe[0x0];var _0x50efce=_0x3f9abe[0x1];var _0x2b1352=_[_0x1734('0x21')](_0xf2d136['rows'],function(_0x1bd659){return _0x1bd659[_0x1734('0x22')]==_0x50efce['id']&&_0x1bd659[_0x1734('0x23')]==_0x4a670a;});if(_0x2b1352[_0x1734('0x24')]==0x1){_0x381960(_0x50efce);}else{_0x52eaf5(new RangeError('sessionId\x20'+_0x4a670a+_0x1734('0x25')));}});});}exports[_0x1734('0x26')]=function(_0x546a94,_0x4dd04a){logger[_0x1734('0x12')](_0x1734('0x27'),_0x546a94[_0x1734('0x28')]);var _0x3903a7=originateValidation[_0x1734('0x29')](_0x546a94[_0x1734('0x28')]);if(_0x3903a7[_0x1734('0x24')]>0x0){return _0x4dd04a[_0x1734('0x16')](0x190)[_0x1734('0x2a')](_0x3903a7);}var _0x2921c8=_0x546a94[_0x1734('0x28')][_0x1734('0x2b')];var _0x18a0c7=_0x546a94[_0x1734('0x28')][_0x1734('0x2c')];var _0x29ccc3=_0x546a94[_0x1734('0x28')]['callerId'];var _0x1e7134=_0x546a94['body'][_0x1734('0x2d')];return getAgent(_0x2921c8)[_0x1734('0x1a')](function(_0x1f8446){logger[_0x1734('0x12')](_0x1734('0x2e'),_0x1f8446[_0x1734('0x17')]);emit(util[_0x1734('0x2f')](_0x1734('0x30'),_0x1f8446['name']),_0x1734('0x31'),{'callNumber':_0x18a0c7,'callerId':_0x29ccc3,'callbackUrl':_0x1e7134});return _0x4dd04a[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':_0x1734('0x32')});})[_0x1734('0x1c')](handleError(_0x4dd04a));};exports[_0x1734('0x33')]=function(_0x26072f,_0x4db10d){logger[_0x1734('0x12')](_0x1734('0x34'),_0x26072f[_0x1734('0x28')]);var _0x3a9bcd=hangupValidation[_0x1734('0x29')](_0x26072f[_0x1734('0x28')]);if(_0x3a9bcd[_0x1734('0x24')]>0x0){return _0x4db10d[_0x1734('0x16')](0x190)['json'](_0x3a9bcd);}var _0x1f5cc6=_0x26072f['body'][_0x1734('0x2b')];var _0x2d9873=_0x26072f[_0x1734('0x28')][_0x1734('0x23')];return getAgent(_0x1f5cc6)[_0x1734('0x1a')](function(_0x169db8){logger[_0x1734('0x12')](_0x1734('0x2e'),_0x169db8[_0x1734('0x17')]);emit(util[_0x1734('0x2f')](_0x1734('0x30'),_0x169db8['name']),_0x1734('0x35'),{'sessionId':_0x2d9873});return _0x4db10d[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':_0x1734('0x36')});})['catch'](handleError(_0x4db10d));};exports[_0x1734('0x37')]=function(_0x562be1,_0x539270){logger[_0x1734('0x12')](_0x1734('0x38'),_0x562be1[_0x1734('0x28')]);var _0x71f9c1=answerValidation['validate'](_0x562be1[_0x1734('0x28')]);if(_0x71f9c1[_0x1734('0x24')]>0x0){return _0x539270['status'](0x190)[_0x1734('0x2a')](_0x71f9c1);}var _0x1b104a=_0x562be1['body'][_0x1734('0x2b')];var _0x4bfc67=_0x562be1[_0x1734('0x28')][_0x1734('0x23')];return getAgent(_0x1b104a)[_0x1734('0x1a')](function(_0x400a1f){logger[_0x1734('0x12')](_0x1734('0x2e'),_0x400a1f[_0x1734('0x17')]);emit(util['format'](_0x1734('0x30'),_0x400a1f[_0x1734('0x17')]),'webbar:answer',{'sessionId':_0x4bfc67});return _0x539270[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':_0x1734('0x39')});})[_0x1734('0x1c')](handleError(_0x539270));};exports['hold']=function(_0x6f821f,_0x70fd09){logger[_0x1734('0x12')]('hold\x20fired:',_0x6f821f[_0x1734('0x28')]);var _0x245420=holdValidation[_0x1734('0x29')](_0x6f821f[_0x1734('0x28')]);if(_0x245420[_0x1734('0x24')]>0x0){return _0x70fd09[_0x1734('0x16')](0x190)[_0x1734('0x2a')](_0x245420);}var _0x8bfed7=_0x6f821f[_0x1734('0x28')][_0x1734('0x2b')];var _0x1ef5d6=_0x6f821f[_0x1734('0x28')][_0x1734('0x23')];return getAgent(_0x8bfed7)[_0x1734('0x1a')](function(_0x470110){logger[_0x1734('0x12')](_0x1734('0x2e'),_0x470110[_0x1734('0x17')]);emit(util['format'](_0x1734('0x30'),_0x470110['name']),_0x1734('0x3a'),{'sessionId':_0x1ef5d6});return _0x70fd09[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':_0x1734('0x3b')});})['catch'](handleError(_0x70fd09));};exports['unhold']=function(_0x294097,_0xe86f1f){logger['info'](_0x1734('0x3c'),_0x294097[_0x1734('0x28')]);var _0x2a71cf=unholdValidation[_0x1734('0x29')](_0x294097[_0x1734('0x28')]);if(_0x2a71cf[_0x1734('0x24')]>0x0){return _0xe86f1f[_0x1734('0x16')](0x190)['json'](_0x2a71cf);}var _0x141f68=_0x294097[_0x1734('0x28')][_0x1734('0x2b')];var _0x47cd87=_0x294097[_0x1734('0x28')][_0x1734('0x23')];return getAgent(_0x141f68)[_0x1734('0x1a')](function(_0x441c62){logger['info'](_0x1734('0x2e'),_0x441c62[_0x1734('0x17')]);emit(util[_0x1734('0x2f')](_0x1734('0x30'),_0x441c62[_0x1734('0x17')]),'webbar:unhold',{'sessionId':_0x47cd87});return _0xe86f1f[_0x1734('0x16')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0x1734('0x1c')](handleError(_0xe86f1f));};exports[_0x1734('0x3d')]=function(_0x4ae49c,_0x4ff6a9){logger[_0x1734('0x12')](_0x1734('0x3e'),_0x4ff6a9['body']);var _0x515e39=callsValidation['validate'](_0x4ae49c[_0x1734('0x28')]);if(_0x515e39[_0x1734('0x24')]>0x0){return _0x4ff6a9[_0x1734('0x16')](0x190)[_0x1734('0x2a')](_0x515e39);}var _0x54ef53=_0x4ae49c['body'][_0x1734('0x2b')];var _0x7872f5=respondWithRpcPromise('VoiceChannels');var _0x349b6a=getAgent(_0x54ef53);return Promise[_0x1734('0x3f')]([_0x7872f5,_0x349b6a])[_0x1734('0x1a')](function(_0x553daf){var _0xfcc609=_0x553daf[0x0];var _0x371a48=_0x553daf[0x1];var _0x28c467=_[_0x1734('0x21')](_0xfcc609[_0x1734('0x40')],function(_0x41469e){return _0x41469e[_0x1734('0x22')]==_0x371a48['id'];});return _0x4ff6a9[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'count':_0x28c467['length'],'rows':_0x28c467});})[_0x1734('0x1c')](handleError(_0x4ff6a9));};exports[_0x1734('0x41')]=function(_0x16bea9,_0x3a4d5b){logger[_0x1734('0x12')](_0x1734('0x42'),_0x16bea9[_0x1734('0x28')]);var _0x30848e=conferenceValidation[_0x1734('0x29')](_0x16bea9[_0x1734('0x28')]);if(_0x30848e[_0x1734('0x24')]>0x0){return _0x3a4d5b['status'](0x190)[_0x1734('0x2a')](_0x30848e);}var _0x25f2fd=_0x16bea9[_0x1734('0x28')][_0x1734('0x2b')];return getAgent(_0x25f2fd)[_0x1734('0x1a')](function(_0xa43585){logger[_0x1734('0x12')]('entityFound:',_0xa43585[_0x1734('0x17')]);emit(util['format'](_0x1734('0x30'),_0xa43585[_0x1734('0x17')]),_0x1734('0x43'));return _0x3a4d5b[_0x1734('0x16')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0x1734('0x1c')](handleError(_0x3a4d5b));};exports['transfer']=function(_0x41fdf2,_0xc91e7a){logger[_0x1734('0x12')](_0x1734('0x44'),_0x41fdf2['body']);var _0x586418=transferValidation['validate'](_0x41fdf2[_0x1734('0x28')]);if(_0x586418[_0x1734('0x24')]>0x0){return _0xc91e7a[_0x1734('0x16')](0x190)[_0x1734('0x2a')](_0x586418);}var _0x387aac=_0x41fdf2[_0x1734('0x28')][_0x1734('0x2b')];var _0x2d3a75=_0x41fdf2['body'][_0x1734('0x23')];var _0x4fd501=_0x41fdf2['body'][_0x1734('0x45')];return getAgent(_0x387aac)[_0x1734('0x1a')](function(_0x31ec5b){logger['info'](_0x1734('0x2e'),_0x31ec5b[_0x1734('0x17')]);emit(util['format'](_0x1734('0x30'),_0x31ec5b[_0x1734('0x17')]),_0x1734('0x46'),{'sessionId':_0x2d3a75,'transferNumber':_0x4fd501});return _0xc91e7a[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0xc91e7a));};
\ No newline at end of file