Built motion from commit 0900f080.|2.5.45
[motion2.git] / server / api / webbar / webbar.controller.js
index 8a6994e..76d6d6b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd33b=['userId','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','length','sessionId','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','UserId','conference','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','client','http','webbarapi','ioredis','redis','defaults','localhost','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','handleError:','stack','name','status','send','NotFound','then','error','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','sessionId\x20','originate','body','json'];(function(_0x43635e,_0x12619b){var _0x1b972f=function(_0x1f0618){while(--_0x1f0618){_0x43635e['push'](_0x43635e['shift']());}};_0x1b972f(++_0x12619b);}(_0xd33b,0x1af));var _0xbd33=function(_0xf16ba7,_0x166d3f){_0xf16ba7=_0xf16ba7-0x0;var _0xb132f0=_0xd33b[_0xf16ba7];return _0xb132f0;};'use strict';var path=require(_0xbd33('0x0'));var fs=require('fs');var _=require(_0xbd33('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xbd33('0x2'));var util=require('util');var BPromise=require('bluebird');var jayson=require('jayson/promise');var amiClient=jayson[_0xbd33('0x3')][_0xbd33('0x4')]({'port':0x232a});var logger=require('../../config/logger')(_0xbd33('0x5'));var Redis=require(_0xbd33('0x6'));config[_0xbd33('0x7')]=_[_0xbd33('0x8')](config['redis'],{'host':_0xbd33('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbd33('0x7')]));var Schema=require(_0xbd33('0xa'));var originateValidation=new Schema({'userId':{'type':_0xbd33('0xb'),'required':[!![],_0xbd33('0xc')]},'callNumber':{'type':_0xbd33('0xd'),'required':[!![],_0xbd33('0xe')]},'callerId':{'type':_0xbd33('0xd')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xbd33('0xb'),'required':[!![],_0xbd33('0xc')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xbd33('0xb'),'required':[!![],_0xbd33('0xc')]},'sessionId':{'type':_0xbd33('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xbd33('0xc')]},'sessionId':{'type':_0xbd33('0xd'),'required':[!![],_0xbd33('0xf')]},'transferNumber':{'type':_0xbd33('0xd'),'required':[!![],_0xbd33('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0xbd33('0xb'),'required':[!![],_0xbd33('0xc')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xbd33('0xb'),'required':[!![],_0xbd33('0xc')]},'sessionId':{'type':_0xbd33('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0x3f5964,_0x322341,_0x4ba160){logger[_0xbd33('0x11')](_0x3f5964,_0x322341,JSON[_0xbd33('0x12')](_0x4ba160));io['to'](_0x3f5964)['emit'](_0x322341,_0x4ba160);}function handleError(_0x13bcda){return function(_0x381a36){console[_0xbd33('0x13')](_0xbd33('0x14'),_0x381a36,_0x381a36 instanceof RangeError);logger['error'](_0x381a36[_0xbd33('0x15')]);if(_0x381a36 instanceof RangeError){if(_0x381a36[_0xbd33('0x16')]){delete _0x381a36[_0xbd33('0x16')];}_0x13bcda[_0xbd33('0x17')](0x194)[_0xbd33('0x18')](_0x381a36);}else{if(_0x381a36[_0xbd33('0x16')]){delete _0x381a36['name'];}_0x13bcda['status'](0x1f4)['send'](_0x381a36);}};}function checkError(){return function(_0x311c5b){if(!_0x311c5b){throw new RangeError(_0xbd33('0x19'));}return _0x311c5b;};}function respondWithRpcPromise(_0x500c80,_0x4a3be2){return new BPromise(function(_0x4d021a,_0x48f4af){var _0x9c2f99=amiClient;return _0x9c2f99['request'](_0x500c80,_0x4a3be2)[_0xbd33('0x1a')](function(_0x1a0dcd){if(_0x1a0dcd[_0xbd33('0x1b')]){if(_0x1a0dcd[_0xbd33('0x1b')][_0xbd33('0x1c')]===0x1f4){return _0x48f4af(_0x1a0dcd['error']['message']);}return _0x4d021a(_0x1a0dcd[_0xbd33('0x1b')][_0xbd33('0x1d')]);}else{_0x4d021a(_0x1a0dcd[_0xbd33('0x1e')]);}})[_0xbd33('0x1f')](function(_0x1be515){_0x48f4af(_0x1be515);});});}function getAgent(_0x463f36){return db[_0xbd33('0x20')][_0xbd33('0x21')]({'where':{'id':_0x463f36,'role':_0xbd33('0x22')}})[_0xbd33('0x1a')](checkError());}function getAgentCheckSession(_0x5a3e37,_0x5d51ab){return new BPromise(function(_0x4f4b63,_0x3f2c91){var _0x1d43bd=respondWithRpcPromise(_0xbd33('0x23'));var _0x22a9c9=getAgent(_0x5a3e37);Promise[_0xbd33('0x24')]([_0x1d43bd,_0x22a9c9])[_0xbd33('0x1a')](function(_0x47ce9f){var _0x30848c=_0x47ce9f[0x0];var _0x3806c3=_0x47ce9f[0x1];var _0x2cb9df=_[_0xbd33('0x25')](_0x30848c[_0xbd33('0x26')],function(_0x29204f){return _0x29204f['UserId']==_0x3806c3['id']&&_0x29204f['sessionId']==_0x5d51ab;});if(_0x2cb9df['length']==0x1){_0x4f4b63(_0x3806c3);}else{_0x3f2c91(new RangeError(_0xbd33('0x27')+_0x5d51ab+'\x20not\x20found!'));}});});}exports[_0xbd33('0x28')]=function(_0x1f82b4,_0x22c33f){logger[_0xbd33('0x11')]('originate\x20fired:',_0x1f82b4[_0xbd33('0x29')]);var _0x1d007e=originateValidation['validate'](_0x1f82b4[_0xbd33('0x29')]);if(_0x1d007e['length']>0x0){return _0x22c33f[_0xbd33('0x17')](0x190)[_0xbd33('0x2a')](_0x1d007e);}var _0x1b501b=_0x1f82b4[_0xbd33('0x29')][_0xbd33('0x2b')];var _0x4bc639=_0x1f82b4[_0xbd33('0x29')]['callNumber'];var _0x2ffd45=_0x1f82b4[_0xbd33('0x29')][_0xbd33('0x2c')];var _0x483fa1=_0x1f82b4[_0xbd33('0x29')][_0xbd33('0x2d')];return getAgent(_0x1b501b)[_0xbd33('0x1a')](function(_0x1a2677){logger[_0xbd33('0x11')](_0xbd33('0x2e'),_0x1a2677[_0xbd33('0x16')]);emit(util[_0xbd33('0x2f')](_0xbd33('0x30'),_0x1a2677['name']),_0xbd33('0x31'),{'callNumber':_0x4bc639,'callerId':_0x2ffd45,'callbackUrl':_0x483fa1});return _0x22c33f[_0xbd33('0x17')](0xc8)[_0xbd33('0x2a')]({'error':![],'message':_0xbd33('0x32')});})['catch'](handleError(_0x22c33f));};exports[_0xbd33('0x33')]=function(_0x2eca01,_0x8f5a3){logger['info'](_0xbd33('0x34'),_0x2eca01['body']);var _0x5dffe1=hangupValidation[_0xbd33('0xa')](_0x2eca01[_0xbd33('0x29')]);if(_0x5dffe1[_0xbd33('0x35')]>0x0){return _0x8f5a3[_0xbd33('0x17')](0x190)['json'](_0x5dffe1);}var _0x1e978e=_0x2eca01[_0xbd33('0x29')][_0xbd33('0x2b')];var _0x15056e=_0x2eca01[_0xbd33('0x29')][_0xbd33('0x36')];return getAgent(_0x1e978e)[_0xbd33('0x1a')](function(_0x411277){logger['info'](_0xbd33('0x2e'),_0x411277['name']);emit(util[_0xbd33('0x2f')](_0xbd33('0x30'),_0x411277[_0xbd33('0x16')]),_0xbd33('0x37'),{'sessionId':_0x15056e});return _0x8f5a3[_0xbd33('0x17')](0xc8)['json']({'error':![],'message':_0xbd33('0x38')});})[_0xbd33('0x1f')](handleError(_0x8f5a3));};exports[_0xbd33('0x39')]=function(_0x2bca10,_0x1e70d2){logger[_0xbd33('0x11')](_0xbd33('0x3a'),_0x2bca10[_0xbd33('0x29')]);var _0x27250c=answerValidation['validate'](_0x2bca10[_0xbd33('0x29')]);if(_0x27250c['length']>0x0){return _0x1e70d2['status'](0x190)[_0xbd33('0x2a')](_0x27250c);}var _0xfb6776=_0x2bca10['body'][_0xbd33('0x2b')];var _0x2022cc=_0x2bca10['body'][_0xbd33('0x36')];return getAgent(_0xfb6776)[_0xbd33('0x1a')](function(_0x2c2aea){logger[_0xbd33('0x11')](_0xbd33('0x2e'),_0x2c2aea[_0xbd33('0x16')]);emit(util[_0xbd33('0x2f')]('user:%s',_0x2c2aea['name']),_0xbd33('0x3b'),{'sessionId':_0x2022cc});return _0x1e70d2['status'](0xc8)[_0xbd33('0x2a')]({'error':![],'message':_0xbd33('0x3c')});})['catch'](handleError(_0x1e70d2));};exports[_0xbd33('0x3d')]=function(_0x4ce968,_0x496835){logger[_0xbd33('0x11')](_0xbd33('0x3e'),_0x4ce968[_0xbd33('0x29')]);var _0x4ce9c7=holdValidation[_0xbd33('0xa')](_0x4ce968[_0xbd33('0x29')]);if(_0x4ce9c7[_0xbd33('0x35')]>0x0){return _0x496835[_0xbd33('0x17')](0x190)['json'](_0x4ce9c7);}var _0x29d55c=_0x4ce968[_0xbd33('0x29')]['userId'];var _0x3d5feb=_0x4ce968[_0xbd33('0x29')][_0xbd33('0x36')];return getAgent(_0x29d55c)[_0xbd33('0x1a')](function(_0x276ffb){logger[_0xbd33('0x11')](_0xbd33('0x2e'),_0x276ffb[_0xbd33('0x16')]);emit(util[_0xbd33('0x2f')](_0xbd33('0x30'),_0x276ffb['name']),_0xbd33('0x3f'),{'sessionId':_0x3d5feb});return _0x496835[_0xbd33('0x17')](0xc8)[_0xbd33('0x2a')]({'error':![],'message':_0xbd33('0x40')});})[_0xbd33('0x1f')](handleError(_0x496835));};exports[_0xbd33('0x41')]=function(_0x1dfcb7,_0x5850e8){logger[_0xbd33('0x11')](_0xbd33('0x42'),_0x1dfcb7[_0xbd33('0x29')]);var _0x2ddce4=unholdValidation['validate'](_0x1dfcb7[_0xbd33('0x29')]);if(_0x2ddce4[_0xbd33('0x35')]>0x0){return _0x5850e8[_0xbd33('0x17')](0x190)['json'](_0x2ddce4);}var _0x51d21a=_0x1dfcb7[_0xbd33('0x29')]['userId'];var _0x59819b=_0x1dfcb7[_0xbd33('0x29')][_0xbd33('0x36')];return getAgent(_0x51d21a)['then'](function(_0x26af0d){logger['info']('entityFound:',_0x26af0d[_0xbd33('0x16')]);emit(util[_0xbd33('0x2f')]('user:%s',_0x26af0d[_0xbd33('0x16')]),_0xbd33('0x43'),{'sessionId':_0x59819b});return _0x5850e8['status'](0xc8)[_0xbd33('0x2a')]({'error':![],'message':_0xbd33('0x44')});})[_0xbd33('0x1f')](handleError(_0x5850e8));};exports['calls']=function(_0x1a64a8,_0x3e70b4){logger['info'](_0xbd33('0x45'),_0x3e70b4[_0xbd33('0x29')]);var _0x4bf784=callsValidation[_0xbd33('0xa')](_0x1a64a8[_0xbd33('0x29')]);if(_0x4bf784[_0xbd33('0x35')]>0x0){return _0x3e70b4[_0xbd33('0x17')](0x190)['json'](_0x4bf784);}var _0x40d030=_0x1a64a8[_0xbd33('0x29')][_0xbd33('0x2b')];var _0x4ce0fd=respondWithRpcPromise('VoiceChannels');var _0x875a45=getAgent(_0x40d030);return Promise[_0xbd33('0x24')]([_0x4ce0fd,_0x875a45])[_0xbd33('0x1a')](function(_0x2ff73f){var _0x3fbd20=_0x2ff73f[0x0];var _0x3e4142=_0x2ff73f[0x1];var _0x527ea4=_[_0xbd33('0x25')](_0x3fbd20['rows'],function(_0xa92727){return _0xa92727[_0xbd33('0x46')]==_0x3e4142['id'];});return _0x3e70b4[_0xbd33('0x17')](0xc8)[_0xbd33('0x2a')]({'count':_0x527ea4[_0xbd33('0x35')],'rows':_0x527ea4});})['catch'](handleError(_0x3e70b4));};exports[_0xbd33('0x47')]=function(_0x5b554e,_0x30c199){logger[_0xbd33('0x11')](_0xbd33('0x48'),_0x5b554e[_0xbd33('0x29')]);var _0x468a56=conferenceValidation[_0xbd33('0xa')](_0x5b554e[_0xbd33('0x29')]);if(_0x468a56[_0xbd33('0x35')]>0x0){return _0x30c199[_0xbd33('0x17')](0x190)[_0xbd33('0x2a')](_0x468a56);}var _0x42a3ee=_0x5b554e['body'][_0xbd33('0x2b')];return getAgent(_0x42a3ee)[_0xbd33('0x1a')](function(_0x11a675){logger[_0xbd33('0x11')](_0xbd33('0x2e'),_0x11a675[_0xbd33('0x16')]);emit(util[_0xbd33('0x2f')]('user:%s',_0x11a675[_0xbd33('0x16')]),_0xbd33('0x49'));return _0x30c199[_0xbd33('0x17')](0xc8)[_0xbd33('0x2a')]({'error':![],'message':'conference\x20executed!'});})[_0xbd33('0x1f')](handleError(_0x30c199));};exports[_0xbd33('0x4a')]=function(_0x18456a,_0x9b53bf){logger[_0xbd33('0x11')](_0xbd33('0x4b'),_0x18456a[_0xbd33('0x29')]);var _0x102af8=transferValidation['validate'](_0x18456a[_0xbd33('0x29')]);if(_0x102af8[_0xbd33('0x35')]>0x0){return _0x9b53bf[_0xbd33('0x17')](0x190)[_0xbd33('0x2a')](_0x102af8);}var _0x10790a=_0x18456a[_0xbd33('0x29')][_0xbd33('0x2b')];var _0x20b3f2=_0x18456a[_0xbd33('0x29')][_0xbd33('0x36')];var _0x1fa444=_0x18456a[_0xbd33('0x29')][_0xbd33('0x4c')];return getAgent(_0x10790a)[_0xbd33('0x1a')](function(_0x2f7dd6){logger[_0xbd33('0x11')](_0xbd33('0x2e'),_0x2f7dd6[_0xbd33('0x16')]);emit(util[_0xbd33('0x2f')](_0xbd33('0x30'),_0x2f7dd6[_0xbd33('0x16')]),_0xbd33('0x4d'),{'sessionId':_0x20b3f2,'transferNumber':_0x1fa444});return _0x9b53bf[_0xbd33('0x17')](0xc8)['json']({'error':![],'message':_0xbd33('0x4e')});})[_0xbd33('0x1f')](handleError(_0x9b53bf));};
\ 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