Built motion from commit 0900f080.|2.5.45
[motion2.git] / server / api / webbar / webbar.controller.js
index f1a65d1..76d6d6b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x777f=['webbar:unhold','unhold\x20executed!','calls','rows','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','../../config/logger','webbarapi','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','name','status','send','request','then','catch','findOne','agent','VoiceChannels','filter','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!','hangup\x20fired:','format','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20executed!','unhold','unhold\x20fired:'];(function(_0x375480,_0x376eac){var _0x57ae6a=function(_0x2d581d){while(--_0x2d581d){_0x375480['push'](_0x375480['shift']());}};_0x57ae6a(++_0x376eac);}(_0x777f,0x9f));var _0xf777=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x777f[_0x6cf19c];return _0xce14f3;};'use strict';var path=require(_0xf777('0x0'));var fs=require('fs');var _=require(_0xf777('0x1'));var db=require(_0xf777('0x2'))['db'];var config=require(_0xf777('0x3'));var util=require(_0xf777('0x4'));var BPromise=require(_0xf777('0x5'));var jayson=require(_0xf777('0x6'));var amiClient=jayson[_0xf777('0x7')]['http']({'port':0x232a});var logger=require(_0xf777('0x8'))(_0xf777('0x9'));var Redis=require('ioredis');config['redis']=_['defaults'](config[_0xf777('0xa')],{'host':_0xf777('0xb'),'port':0x18eb});var io=require(_0xf777('0xc'))(new Redis(config[_0xf777('0xa')]));var Schema=require(_0xf777('0xd'));var originateValidation=new Schema({'userId':{'type':_0xf777('0xe'),'required':[!![],_0xf777('0xf')]},'callNumber':{'type':_0xf777('0x10'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xf777('0xe'),'required':[!![],_0xf777('0xf')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf777('0xe'),'required':[!![],_0xf777('0xf')]},'sessionId':{'type':_0xf777('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf777('0xf')]},'sessionId':{'type':_0xf777('0x10'),'required':[!![],_0xf777('0x11')]},'transferNumber':{'type':_0xf777('0x10'),'required':[!![],_0xf777('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0xf777('0xe'),'required':[!![],_0xf777('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf777('0xf')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xf777('0xe'),'required':[!![],_0xf777('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0xf777('0xe'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x3ecaa5,_0xa9c4f8,_0x1c4681){logger[_0xf777('0x13')](_0x3ecaa5,_0xa9c4f8,JSON[_0xf777('0x14')](_0x1c4681));io['to'](_0x3ecaa5)[_0xf777('0x15')](_0xa9c4f8,_0x1c4681);}function handleError(_0x263c7f){return function(_0x3e0ba3){console[_0xf777('0x16')](_0xf777('0x17'),_0x3e0ba3,_0x3e0ba3 instanceof RangeError);logger[_0xf777('0x18')](_0x3e0ba3['stack']);if(_0x3e0ba3 instanceof RangeError){if(_0x3e0ba3[_0xf777('0x19')]){delete _0x3e0ba3['name'];}_0x263c7f[_0xf777('0x1a')](0x194)['send'](_0x3e0ba3);}else{if(_0x3e0ba3[_0xf777('0x19')]){delete _0x3e0ba3['name'];}_0x263c7f['status'](0x1f4)[_0xf777('0x1b')](_0x3e0ba3);}};}function checkError(){return function(_0x3ffa51){if(!_0x3ffa51){throw new RangeError('NotFound');}return _0x3ffa51;};}function respondWithRpcPromise(_0xfe9fa9,_0x1d0b38){return new BPromise(function(_0x50bddb,_0x55c56a){var _0x54bdf8=amiClient;return _0x54bdf8[_0xf777('0x1c')](_0xfe9fa9,_0x1d0b38)[_0xf777('0x1d')](function(_0x527305){if(_0x527305['error']){if(_0x527305[_0xf777('0x18')]['code']===0x1f4){return _0x55c56a(_0x527305[_0xf777('0x18')]['message']);}return _0x50bddb(_0x527305[_0xf777('0x18')]['message']);}else{_0x50bddb(_0x527305['result']);}})[_0xf777('0x1e')](function(_0x4d4296){_0x55c56a(_0x4d4296);});});}function getAgent(_0x9b8b20){return db['User'][_0xf777('0x1f')]({'where':{'id':_0x9b8b20,'role':_0xf777('0x20')}})[_0xf777('0x1d')](checkError());}function getAgentCheckSession(_0x27e728,_0x2f3d82){return new BPromise(function(_0x232b3c,_0x5b6d3a){var _0x36a83b=respondWithRpcPromise(_0xf777('0x21'));var _0x13b2a8=getAgent(_0x27e728);Promise['all']([_0x36a83b,_0x13b2a8])['then'](function(_0x451e21){var _0x56376d=_0x451e21[0x0];var _0x2719c3=_0x451e21[0x1];var _0x5f3fd2=_[_0xf777('0x22')](_0x56376d['rows'],function(_0x30f09b){return _0x30f09b[_0xf777('0x23')]==_0x2719c3['id']&&_0x30f09b[_0xf777('0x24')]==_0x2f3d82;});if(_0x5f3fd2[_0xf777('0x25')]==0x1){_0x232b3c(_0x2719c3);}else{_0x5b6d3a(new RangeError(_0xf777('0x26')+_0x2f3d82+_0xf777('0x27')));}});});}exports['originate']=function(_0x456f82,_0x1d2405){logger[_0xf777('0x13')](_0xf777('0x28'),_0x456f82[_0xf777('0x29')]);var _0x15fecb=originateValidation[_0xf777('0xd')](_0x456f82['body']);if(_0x15fecb[_0xf777('0x25')]>0x0){return _0x1d2405[_0xf777('0x1a')](0x190)[_0xf777('0x2a')](_0x15fecb);}var _0x12dc46=_0x456f82[_0xf777('0x29')][_0xf777('0x2b')];var _0x4d56f4=_0x456f82[_0xf777('0x29')][_0xf777('0x2c')];var _0x35fc90=_0x456f82[_0xf777('0x29')][_0xf777('0x2d')];var _0x1a7875=_0x456f82[_0xf777('0x29')][_0xf777('0x2e')];return getAgent(_0x12dc46)['then'](function(_0x1e4a12){logger[_0xf777('0x13')](_0xf777('0x2f'),_0x1e4a12[_0xf777('0x19')]);emit(util['format'](_0xf777('0x30'),_0x1e4a12['name']),_0xf777('0x31'),{'callNumber':_0x4d56f4,'callerId':_0x35fc90,'callbackUrl':_0x1a7875});return _0x1d2405[_0xf777('0x1a')](0xc8)[_0xf777('0x2a')]({'error':![],'message':_0xf777('0x32')});})['catch'](handleError(_0x1d2405));};exports['hangup']=function(_0x1c2661,_0x3b60d4){logger[_0xf777('0x13')](_0xf777('0x33'),_0x1c2661['body']);var _0x467152=hangupValidation['validate'](_0x1c2661['body']);if(_0x467152[_0xf777('0x25')]>0x0){return _0x3b60d4[_0xf777('0x1a')](0x190)['json'](_0x467152);}var _0x289327=_0x1c2661[_0xf777('0x29')]['userId'];var _0x31feff=_0x1c2661['body'][_0xf777('0x24')];return getAgent(_0x289327)[_0xf777('0x1d')](function(_0x2b6414){logger[_0xf777('0x13')](_0xf777('0x2f'),_0x2b6414[_0xf777('0x19')]);emit(util[_0xf777('0x34')](_0xf777('0x30'),_0x2b6414[_0xf777('0x19')]),_0xf777('0x35'),{'sessionId':_0x31feff});return _0x3b60d4['status'](0xc8)[_0xf777('0x2a')]({'error':![],'message':_0xf777('0x36')});})[_0xf777('0x1e')](handleError(_0x3b60d4));};exports[_0xf777('0x37')]=function(_0x7df0a4,_0x589929){logger[_0xf777('0x13')](_0xf777('0x38'),_0x7df0a4[_0xf777('0x29')]);var _0x54d0ae=answerValidation[_0xf777('0xd')](_0x7df0a4[_0xf777('0x29')]);if(_0x54d0ae[_0xf777('0x25')]>0x0){return _0x589929[_0xf777('0x1a')](0x190)['json'](_0x54d0ae);}var _0x1c9b21=_0x7df0a4['body']['userId'];var _0x283050=_0x7df0a4[_0xf777('0x29')]['sessionId'];return getAgent(_0x1c9b21)[_0xf777('0x1d')](function(_0x2ab31f){logger[_0xf777('0x13')](_0xf777('0x2f'),_0x2ab31f[_0xf777('0x19')]);emit(util[_0xf777('0x34')](_0xf777('0x30'),_0x2ab31f[_0xf777('0x19')]),_0xf777('0x39'),{'sessionId':_0x283050});return _0x589929[_0xf777('0x1a')](0xc8)['json']({'error':![],'message':_0xf777('0x3a')});})[_0xf777('0x1e')](handleError(_0x589929));};exports[_0xf777('0x3b')]=function(_0x205b32,_0x19809f){logger['info']('hold\x20fired:',_0x205b32[_0xf777('0x29')]);var _0x258c73=holdValidation[_0xf777('0xd')](_0x205b32['body']);if(_0x258c73['length']>0x0){return _0x19809f['status'](0x190)[_0xf777('0x2a')](_0x258c73);}var _0x40dd4a=_0x205b32[_0xf777('0x29')][_0xf777('0x2b')];var _0x5409e3=_0x205b32[_0xf777('0x29')][_0xf777('0x24')];return getAgent(_0x40dd4a)['then'](function(_0x2b0232){logger['info'](_0xf777('0x2f'),_0x2b0232[_0xf777('0x19')]);emit(util['format']('user:%s',_0x2b0232[_0xf777('0x19')]),'webbar:hold',{'sessionId':_0x5409e3});return _0x19809f[_0xf777('0x1a')](0xc8)[_0xf777('0x2a')]({'error':![],'message':_0xf777('0x3c')});})[_0xf777('0x1e')](handleError(_0x19809f));};exports[_0xf777('0x3d')]=function(_0x478f50,_0xf9259a){logger[_0xf777('0x13')](_0xf777('0x3e'),_0x478f50[_0xf777('0x29')]);var _0x4341e0=unholdValidation[_0xf777('0xd')](_0x478f50[_0xf777('0x29')]);if(_0x4341e0[_0xf777('0x25')]>0x0){return _0xf9259a['status'](0x190)[_0xf777('0x2a')](_0x4341e0);}var _0x402dd6=_0x478f50[_0xf777('0x29')][_0xf777('0x2b')];var _0x295e5d=_0x478f50[_0xf777('0x29')][_0xf777('0x24')];return getAgent(_0x402dd6)[_0xf777('0x1d')](function(_0x17c903){logger[_0xf777('0x13')]('entityFound:',_0x17c903[_0xf777('0x19')]);emit(util['format'](_0xf777('0x30'),_0x17c903[_0xf777('0x19')]),_0xf777('0x3f'),{'sessionId':_0x295e5d});return _0xf9259a['status'](0xc8)[_0xf777('0x2a')]({'error':![],'message':_0xf777('0x40')});})[_0xf777('0x1e')](handleError(_0xf9259a));};exports[_0xf777('0x41')]=function(_0x5888db,_0x1e668a){logger[_0xf777('0x13')]('calls\x20fired:',_0x1e668a[_0xf777('0x29')]);var _0x2ee3e5=callsValidation[_0xf777('0xd')](_0x5888db[_0xf777('0x29')]);if(_0x2ee3e5[_0xf777('0x25')]>0x0){return _0x1e668a[_0xf777('0x1a')](0x190)[_0xf777('0x2a')](_0x2ee3e5);}var _0xec011b=_0x5888db[_0xf777('0x29')][_0xf777('0x2b')];var _0x207ed7=respondWithRpcPromise(_0xf777('0x21'));var _0xa1c8bc=getAgent(_0xec011b);return Promise['all']([_0x207ed7,_0xa1c8bc])[_0xf777('0x1d')](function(_0x590172){var _0x1ac4e6=_0x590172[0x0];var _0x434e10=_0x590172[0x1];var _0x2cf595=_[_0xf777('0x22')](_0x1ac4e6[_0xf777('0x42')],function(_0x336e89){return _0x336e89[_0xf777('0x23')]==_0x434e10['id'];});return _0x1e668a[_0xf777('0x1a')](0xc8)[_0xf777('0x2a')]({'count':_0x2cf595['length'],'rows':_0x2cf595});})['catch'](handleError(_0x1e668a));};exports['conference']=function(_0x4ef3d0,_0x547416){logger[_0xf777('0x13')](_0xf777('0x43'),_0x4ef3d0[_0xf777('0x29')]);var _0x27090a=conferenceValidation[_0xf777('0xd')](_0x4ef3d0[_0xf777('0x29')]);if(_0x27090a['length']>0x0){return _0x547416[_0xf777('0x1a')](0x190)[_0xf777('0x2a')](_0x27090a);}var _0x59e40e=_0x4ef3d0[_0xf777('0x29')]['userId'];return getAgent(_0x59e40e)[_0xf777('0x1d')](function(_0x3f58fa){logger[_0xf777('0x13')]('entityFound:',_0x3f58fa[_0xf777('0x19')]);emit(util[_0xf777('0x34')](_0xf777('0x30'),_0x3f58fa[_0xf777('0x19')]),_0xf777('0x44'));return _0x547416[_0xf777('0x1a')](0xc8)[_0xf777('0x2a')]({'error':![],'message':_0xf777('0x45')});})[_0xf777('0x1e')](handleError(_0x547416));};exports[_0xf777('0x46')]=function(_0x1690df,_0x1bb447){logger[_0xf777('0x13')](_0xf777('0x47'),_0x1690df['body']);var _0x32515d=transferValidation['validate'](_0x1690df['body']);if(_0x32515d[_0xf777('0x25')]>0x0){return _0x1bb447[_0xf777('0x1a')](0x190)[_0xf777('0x2a')](_0x32515d);}var _0x5ac10a=_0x1690df[_0xf777('0x29')]['userId'];var _0xed9d1c=_0x1690df[_0xf777('0x29')][_0xf777('0x24')];var _0x1bfaa5=_0x1690df[_0xf777('0x29')]['transferNumber'];return getAgent(_0x5ac10a)['then'](function(_0x177098){logger[_0xf777('0x13')]('entityFound:',_0x177098[_0xf777('0x19')]);emit(util[_0xf777('0x34')](_0xf777('0x30'),_0x177098[_0xf777('0x19')]),_0xf777('0x48'),{'sessionId':_0xed9d1c,'transferNumber':_0x1bfaa5});return _0x1bb447['status'](0xc8)['json']({'error':![],'message':_0xf777('0x49')});})[_0xf777('0x1e')](handleError(_0x1bb447));};
\ 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