Built motion from commit 00bf23f6.|2.6.16
[motion2.git] / server / api / webbar / webbar.controller.js
index f1a65d1..5b8e9aa 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 _0x9649=['error','name','status','send','NotFound','then','code','message','catch','User','findOne','VoiceChannels','all','filter','length','sessionId\x20','\x20not\x20found!','originate','info','originate\x20fired:','body','json','callerId','callbackUrl','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','sessionId','entityFound:','format','webbar:hangup','hangup\x20executed!','answer\x20fired:','userId','webbar:answer','answer\x20executed!','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','rows','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','http','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','handleError:'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9649,0x19f));var _0x9964=function(_0x34092c,_0x450b06){_0x34092c=_0x34092c-0x0;var _0x5017e6=_0x9649[_0x34092c];return _0x5017e6;};'use strict';var path=require(_0x9964('0x0'));var fs=require('fs');var _=require(_0x9964('0x1'));var db=require(_0x9964('0x2'))['db'];var config=require(_0x9964('0x3'));var util=require('util');var BPromise=require(_0x9964('0x4'));var jayson=require(_0x9964('0x5'));var amiClient=jayson['client'][_0x9964('0x6')]({'port':0x232a});var logger=require('../../config/logger')(_0x9964('0x7'));var Redis=require(_0x9964('0x8'));config[_0x9964('0x9')]=_[_0x9964('0xa')](config[_0x9964('0x9')],{'host':_0x9964('0xb'),'port':0x18eb});var io=require(_0x9964('0xc'))(new Redis(config['redis']));var Schema=require(_0x9964('0xd'));var originateValidation=new Schema({'userId':{'type':_0x9964('0xe'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x9964('0xf'),'required':[!![],_0x9964('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x9964('0xe'),'required':[!![],_0x9964('0x11')]},'sessionId':{'type':_0x9964('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x9964('0xe'),'required':[!![],_0x9964('0x11')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x9964('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x9964('0xf'),'required':[!![],_0x9964('0x12')]},'transferNumber':{'type':'string','required':[!![],_0x9964('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0x9964('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x9964('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x9964('0xe'),'required':[!![],_0x9964('0x11')]},'sessionId':{'type':_0x9964('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x9964('0xe'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x9964('0xe'),'required':[!![],_0x9964('0x11')]}});function emit(_0x57b330,_0x2fd50d,_0x3fe796){logger['info'](_0x57b330,_0x2fd50d,JSON[_0x9964('0x14')](_0x3fe796));io['to'](_0x57b330)[_0x9964('0x15')](_0x2fd50d,_0x3fe796);}function handleError(_0x69994d){return function(_0x4c18a4){console['log'](_0x9964('0x16'),_0x4c18a4,_0x4c18a4 instanceof RangeError);logger[_0x9964('0x17')](_0x4c18a4['stack']);if(_0x4c18a4 instanceof RangeError){if(_0x4c18a4[_0x9964('0x18')]){delete _0x4c18a4[_0x9964('0x18')];}_0x69994d[_0x9964('0x19')](0x194)[_0x9964('0x1a')](_0x4c18a4);}else{if(_0x4c18a4[_0x9964('0x18')]){delete _0x4c18a4[_0x9964('0x18')];}_0x69994d[_0x9964('0x19')](0x1f4)[_0x9964('0x1a')](_0x4c18a4);}};}function checkError(){return function(_0x1072b5){if(!_0x1072b5){throw new RangeError(_0x9964('0x1b'));}return _0x1072b5;};}function respondWithRpcPromise(_0x4f625e,_0x455b62){return new BPromise(function(_0x447026,_0x4c479f){var _0x2b03a8=amiClient;return _0x2b03a8['request'](_0x4f625e,_0x455b62)[_0x9964('0x1c')](function(_0xdc3ba){if(_0xdc3ba[_0x9964('0x17')]){if(_0xdc3ba[_0x9964('0x17')][_0x9964('0x1d')]===0x1f4){return _0x4c479f(_0xdc3ba[_0x9964('0x17')]['message']);}return _0x447026(_0xdc3ba[_0x9964('0x17')][_0x9964('0x1e')]);}else{_0x447026(_0xdc3ba['result']);}})[_0x9964('0x1f')](function(_0x15a14c){_0x4c479f(_0x15a14c);});});}function getAgent(_0x196812){return db[_0x9964('0x20')][_0x9964('0x21')]({'where':{'id':_0x196812,'role':'agent'}})[_0x9964('0x1c')](checkError());}function getAgentCheckSession(_0x4c2b44,_0x44cb60){return new BPromise(function(_0x512f6b,_0x17b29f){var _0x5dc789=respondWithRpcPromise(_0x9964('0x22'));var _0x162b83=getAgent(_0x4c2b44);Promise[_0x9964('0x23')]([_0x5dc789,_0x162b83])[_0x9964('0x1c')](function(_0x11cdce){var _0x23df5e=_0x11cdce[0x0];var _0x146cf2=_0x11cdce[0x1];var _0x2f6068=_[_0x9964('0x24')](_0x23df5e['rows'],function(_0x498014){return _0x498014['UserId']==_0x146cf2['id']&&_0x498014['sessionId']==_0x44cb60;});if(_0x2f6068[_0x9964('0x25')]==0x1){_0x512f6b(_0x146cf2);}else{_0x17b29f(new RangeError(_0x9964('0x26')+_0x44cb60+_0x9964('0x27')));}});});}exports[_0x9964('0x28')]=function(_0x1a3698,_0x3092b2){logger[_0x9964('0x29')](_0x9964('0x2a'),_0x1a3698[_0x9964('0x2b')]);var _0x5e92a9=originateValidation[_0x9964('0xd')](_0x1a3698[_0x9964('0x2b')]);if(_0x5e92a9['length']>0x0){return _0x3092b2[_0x9964('0x19')](0x190)[_0x9964('0x2c')](_0x5e92a9);}var _0x3e5154=_0x1a3698[_0x9964('0x2b')]['userId'];var _0x55b7a0=_0x1a3698[_0x9964('0x2b')]['callNumber'];var _0x49b3c6=_0x1a3698[_0x9964('0x2b')][_0x9964('0x2d')];var _0x5d28d8=_0x1a3698['body'][_0x9964('0x2e')];return getAgent(_0x3e5154)[_0x9964('0x1c')](function(_0x4df44b){logger[_0x9964('0x29')]('entityFound:',_0x4df44b['name']);emit(util['format'](_0x9964('0x2f'),_0x4df44b[_0x9964('0x18')]),_0x9964('0x30'),{'callNumber':_0x55b7a0,'callerId':_0x49b3c6,'callbackUrl':_0x5d28d8});return _0x3092b2[_0x9964('0x19')](0xc8)[_0x9964('0x2c')]({'error':![],'message':_0x9964('0x31')});})[_0x9964('0x1f')](handleError(_0x3092b2));};exports[_0x9964('0x32')]=function(_0x131073,_0x526c96){logger[_0x9964('0x29')](_0x9964('0x33'),_0x131073[_0x9964('0x2b')]);var _0x132c7c=hangupValidation['validate'](_0x131073['body']);if(_0x132c7c[_0x9964('0x25')]>0x0){return _0x526c96[_0x9964('0x19')](0x190)[_0x9964('0x2c')](_0x132c7c);}var _0x1bad9d=_0x131073[_0x9964('0x2b')]['userId'];var _0x3aac69=_0x131073[_0x9964('0x2b')][_0x9964('0x34')];return getAgent(_0x1bad9d)[_0x9964('0x1c')](function(_0x24d5d9){logger[_0x9964('0x29')](_0x9964('0x35'),_0x24d5d9[_0x9964('0x18')]);emit(util[_0x9964('0x36')](_0x9964('0x2f'),_0x24d5d9[_0x9964('0x18')]),_0x9964('0x37'),{'sessionId':_0x3aac69});return _0x526c96[_0x9964('0x19')](0xc8)[_0x9964('0x2c')]({'error':![],'message':_0x9964('0x38')});})[_0x9964('0x1f')](handleError(_0x526c96));};exports['answer']=function(_0x344c6c,_0x4c5362){logger[_0x9964('0x29')](_0x9964('0x39'),_0x344c6c[_0x9964('0x2b')]);var _0x4c3d38=answerValidation[_0x9964('0xd')](_0x344c6c['body']);if(_0x4c3d38[_0x9964('0x25')]>0x0){return _0x4c5362['status'](0x190)[_0x9964('0x2c')](_0x4c3d38);}var _0x4ad7a6=_0x344c6c[_0x9964('0x2b')][_0x9964('0x3a')];var _0x121059=_0x344c6c[_0x9964('0x2b')][_0x9964('0x34')];return getAgent(_0x4ad7a6)[_0x9964('0x1c')](function(_0x516529){logger[_0x9964('0x29')](_0x9964('0x35'),_0x516529[_0x9964('0x18')]);emit(util[_0x9964('0x36')](_0x9964('0x2f'),_0x516529[_0x9964('0x18')]),_0x9964('0x3b'),{'sessionId':_0x121059});return _0x4c5362[_0x9964('0x19')](0xc8)[_0x9964('0x2c')]({'error':![],'message':_0x9964('0x3c')});})['catch'](handleError(_0x4c5362));};exports['hold']=function(_0x36e684,_0x5d52d8){logger[_0x9964('0x29')]('hold\x20fired:',_0x36e684['body']);var _0x5d8720=holdValidation[_0x9964('0xd')](_0x36e684[_0x9964('0x2b')]);if(_0x5d8720[_0x9964('0x25')]>0x0){return _0x5d52d8['status'](0x190)['json'](_0x5d8720);}var _0x652882=_0x36e684['body'][_0x9964('0x3a')];var _0x159eb7=_0x36e684[_0x9964('0x2b')][_0x9964('0x34')];return getAgent(_0x652882)[_0x9964('0x1c')](function(_0x5b0fa7){logger['info'](_0x9964('0x35'),_0x5b0fa7[_0x9964('0x18')]);emit(util[_0x9964('0x36')](_0x9964('0x2f'),_0x5b0fa7[_0x9964('0x18')]),'webbar:hold',{'sessionId':_0x159eb7});return _0x5d52d8[_0x9964('0x19')](0xc8)[_0x9964('0x2c')]({'error':![],'message':_0x9964('0x3d')});})['catch'](handleError(_0x5d52d8));};exports[_0x9964('0x3e')]=function(_0x2649cc,_0x474631){logger[_0x9964('0x29')](_0x9964('0x3f'),_0x2649cc[_0x9964('0x2b')]);var _0x1a5344=unholdValidation[_0x9964('0xd')](_0x2649cc['body']);if(_0x1a5344[_0x9964('0x25')]>0x0){return _0x474631['status'](0x190)['json'](_0x1a5344);}var _0x160316=_0x2649cc['body'][_0x9964('0x3a')];var _0x45ca09=_0x2649cc[_0x9964('0x2b')]['sessionId'];return getAgent(_0x160316)[_0x9964('0x1c')](function(_0x187004){logger[_0x9964('0x29')](_0x9964('0x35'),_0x187004[_0x9964('0x18')]);emit(util[_0x9964('0x36')](_0x9964('0x2f'),_0x187004[_0x9964('0x18')]),_0x9964('0x40'),{'sessionId':_0x45ca09});return _0x474631['status'](0xc8)[_0x9964('0x2c')]({'error':![],'message':'unhold\x20executed!'});})[_0x9964('0x1f')](handleError(_0x474631));};exports[_0x9964('0x41')]=function(_0x216a88,_0x4f10fd){logger[_0x9964('0x29')](_0x9964('0x42'),_0x4f10fd[_0x9964('0x2b')]);var _0x375ad6=callsValidation[_0x9964('0xd')](_0x216a88['body']);if(_0x375ad6[_0x9964('0x25')]>0x0){return _0x4f10fd[_0x9964('0x19')](0x190)[_0x9964('0x2c')](_0x375ad6);}var _0xde3842=_0x216a88[_0x9964('0x2b')]['userId'];var _0x5a0ece=respondWithRpcPromise('VoiceChannels');var _0x5a57d2=getAgent(_0xde3842);return Promise[_0x9964('0x23')]([_0x5a0ece,_0x5a57d2])['then'](function(_0x5133fc){var _0x5b8892=_0x5133fc[0x0];var _0x275535=_0x5133fc[0x1];var _0x498c8f=_[_0x9964('0x24')](_0x5b8892[_0x9964('0x43')],function(_0x464ab1){return _0x464ab1['UserId']==_0x275535['id'];});return _0x4f10fd[_0x9964('0x19')](0xc8)['json']({'count':_0x498c8f['length'],'rows':_0x498c8f});})[_0x9964('0x1f')](handleError(_0x4f10fd));};exports[_0x9964('0x44')]=function(_0x2ffa8e,_0x4f039e){logger[_0x9964('0x29')](_0x9964('0x45'),_0x2ffa8e[_0x9964('0x2b')]);var _0x5af75e=conferenceValidation[_0x9964('0xd')](_0x2ffa8e[_0x9964('0x2b')]);if(_0x5af75e[_0x9964('0x25')]>0x0){return _0x4f039e['status'](0x190)['json'](_0x5af75e);}var _0x234607=_0x2ffa8e[_0x9964('0x2b')][_0x9964('0x3a')];return getAgent(_0x234607)[_0x9964('0x1c')](function(_0x3001d7){logger[_0x9964('0x29')](_0x9964('0x35'),_0x3001d7[_0x9964('0x18')]);emit(util[_0x9964('0x36')](_0x9964('0x2f'),_0x3001d7[_0x9964('0x18')]),_0x9964('0x46'));return _0x4f039e[_0x9964('0x19')](0xc8)[_0x9964('0x2c')]({'error':![],'message':_0x9964('0x47')});})['catch'](handleError(_0x4f039e));};exports[_0x9964('0x48')]=function(_0x37aa3c,_0x2e2b33){logger[_0x9964('0x29')]('transfer\x20fired:',_0x37aa3c['body']);var _0x58fb4f=transferValidation['validate'](_0x37aa3c['body']);if(_0x58fb4f[_0x9964('0x25')]>0x0){return _0x2e2b33[_0x9964('0x19')](0x190)['json'](_0x58fb4f);}var _0x249fa7=_0x37aa3c[_0x9964('0x2b')][_0x9964('0x3a')];var _0x19608a=_0x37aa3c[_0x9964('0x2b')]['sessionId'];var _0x3446c8=_0x37aa3c[_0x9964('0x2b')]['transferNumber'];return getAgent(_0x249fa7)[_0x9964('0x1c')](function(_0x57b0de){logger[_0x9964('0x29')]('entityFound:',_0x57b0de[_0x9964('0x18')]);emit(util[_0x9964('0x36')]('user:%s',_0x57b0de[_0x9964('0x18')]),'webbar:transfer',{'sessionId':_0x19608a,'transferNumber':_0x3446c8});return _0x2e2b33['status'](0xc8)[_0x9964('0x2c')]({'error':![],'message':'transfer\x20executed!'});})[_0x9964('0x1f')](handleError(_0x2e2b33));};
\ No newline at end of file