Built motion from commit (unavailable).|2.5.30
[motion2.git] / server / api / webbar / webbar.controller.js
index 8e4ecad..4951e7e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0f9f=['hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','error','name','status','send','NotFound','then','code','message','result','catch','User','agent','all','filter','rows','UserId','sessionId','\x20not\x20found!','originate\x20fired:','body','length','json','userId','callNumber','callerId','entityFound:','format','user:%s','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','validate','webbar:answer','answer\x20executed!'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x291ec3,_0x2f19a7){_0x291ec3=_0x291ec3-0x0;var _0x423b99=_0x0f9f[_0x291ec3];return _0x423b99;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xf0f9('0x0'));var db=require(_0xf0f9('0x1'))['db'];var config=require(_0xf0f9('0x2'));var util=require('util');var BPromise=require(_0xf0f9('0x3'));var jayson=require(_0xf0f9('0x4'));var amiClient=jayson[_0xf0f9('0x5')][_0xf0f9('0x6')]({'port':0x232a});var logger=require(_0xf0f9('0x7'))(_0xf0f9('0x8'));var Redis=require(_0xf0f9('0x9'));config[_0xf0f9('0xa')]=_[_0xf0f9('0xb')](config[_0xf0f9('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xf0f9('0xc'))(new Redis(config[_0xf0f9('0xa')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],_0xf0f9('0xe')]},'callNumber':{'type':_0xf0f9('0xf'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xf0f9('0xf')},'callbackUrl':{'type':_0xf0f9('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],_0xf0f9('0xe')]},'sessionId':{'type':_0xf0f9('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],_0xf0f9('0xe')]},'sessionId':{'type':_0xf0f9('0xf'),'required':[!![],_0xf0f9('0x10')]},'transferNumber':{'type':'string','required':[!![],_0xf0f9('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],_0xf0f9('0xe')]},'sessionId':{'type':_0xf0f9('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xf0f9('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],_0xf0f9('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],_0xf0f9('0xe')]}});function emit(_0x2f5bec,_0x2f75da,_0x16a928){logger[_0xf0f9('0x12')](_0x2f5bec,_0x2f75da,JSON[_0xf0f9('0x13')](_0x16a928));io['to'](_0x2f5bec)['emit'](_0x2f75da,_0x16a928);}function handleError(_0x526fff){return function(_0x350a48){console[_0xf0f9('0x14')]('handleError:',_0x350a48,_0x350a48 instanceof RangeError);logger[_0xf0f9('0x15')](_0x350a48['stack']);if(_0x350a48 instanceof RangeError){if(_0x350a48['name']){delete _0x350a48[_0xf0f9('0x16')];}_0x526fff[_0xf0f9('0x17')](0x194)[_0xf0f9('0x18')](_0x350a48);}else{if(_0x350a48[_0xf0f9('0x16')]){delete _0x350a48[_0xf0f9('0x16')];}_0x526fff['status'](0x1f4)['send'](_0x350a48);}};}function checkError(){return function(_0x5294ac){if(!_0x5294ac){throw new RangeError(_0xf0f9('0x19'));}return _0x5294ac;};}function respondWithRpcPromise(_0x1c8c39,_0x126ba7){return new BPromise(function(_0x5d87a9,_0x4a8726){var _0x209cd4=amiClient;return _0x209cd4['request'](_0x1c8c39,_0x126ba7)[_0xf0f9('0x1a')](function(_0x414f87){if(_0x414f87[_0xf0f9('0x15')]){if(_0x414f87['error'][_0xf0f9('0x1b')]===0x1f4){return _0x4a8726(_0x414f87[_0xf0f9('0x15')][_0xf0f9('0x1c')]);}return _0x5d87a9(_0x414f87['error'][_0xf0f9('0x1c')]);}else{_0x5d87a9(_0x414f87[_0xf0f9('0x1d')]);}})[_0xf0f9('0x1e')](function(_0x185e1e){_0x4a8726(_0x185e1e);});});}function getAgent(_0x16f639){return db[_0xf0f9('0x1f')]['findOne']({'where':{'id':_0x16f639,'role':_0xf0f9('0x20')}})['then'](checkError());}function getAgentCheckSession(_0x1288e0,_0x30e85c){return new BPromise(function(_0x519a46,_0x4b75b2){var _0x119793=respondWithRpcPromise('VoiceChannels');var _0x2121b8=getAgent(_0x1288e0);Promise[_0xf0f9('0x21')]([_0x119793,_0x2121b8])[_0xf0f9('0x1a')](function(_0x353502){var _0x3ec658=_0x353502[0x0];var _0x39cd34=_0x353502[0x1];var _0x1377ed=_[_0xf0f9('0x22')](_0x3ec658[_0xf0f9('0x23')],function(_0x4e4e08){return _0x4e4e08[_0xf0f9('0x24')]==_0x39cd34['id']&&_0x4e4e08[_0xf0f9('0x25')]==_0x30e85c;});if(_0x1377ed['length']==0x1){_0x519a46(_0x39cd34);}else{_0x4b75b2(new RangeError('sessionId\x20'+_0x30e85c+_0xf0f9('0x26')));}});});}exports['originate']=function(_0x483a8c,_0x14f3cb){logger['info'](_0xf0f9('0x27'),_0x483a8c[_0xf0f9('0x28')]);var _0x5305e0=originateValidation['validate'](_0x483a8c[_0xf0f9('0x28')]);if(_0x5305e0[_0xf0f9('0x29')]>0x0){return _0x14f3cb[_0xf0f9('0x17')](0x190)[_0xf0f9('0x2a')](_0x5305e0);}var _0x278192=_0x483a8c[_0xf0f9('0x28')][_0xf0f9('0x2b')];var _0x30bc8e=_0x483a8c[_0xf0f9('0x28')][_0xf0f9('0x2c')];var _0x2a7648=_0x483a8c[_0xf0f9('0x28')][_0xf0f9('0x2d')];var _0x5a8b35=_0x483a8c[_0xf0f9('0x28')]['callbackUrl'];return getAgent(_0x278192)[_0xf0f9('0x1a')](function(_0x44c9ed){logger[_0xf0f9('0x12')](_0xf0f9('0x2e'),_0x44c9ed[_0xf0f9('0x16')]);emit(util[_0xf0f9('0x2f')](_0xf0f9('0x30'),_0x44c9ed['name']),'webbar:originate',{'callNumber':_0x30bc8e,'callerId':_0x2a7648,'callbackUrl':_0x5a8b35});return _0x14f3cb[_0xf0f9('0x17')](0xc8)[_0xf0f9('0x2a')]({'error':![],'message':_0xf0f9('0x31')});})[_0xf0f9('0x1e')](handleError(_0x14f3cb));};exports[_0xf0f9('0x32')]=function(_0x4ac1d2,_0x2b9d56){logger[_0xf0f9('0x12')](_0xf0f9('0x33'),_0x4ac1d2[_0xf0f9('0x28')]);var _0x32a248=hangupValidation['validate'](_0x4ac1d2[_0xf0f9('0x28')]);if(_0x32a248[_0xf0f9('0x29')]>0x0){return _0x2b9d56[_0xf0f9('0x17')](0x190)[_0xf0f9('0x2a')](_0x32a248);}var _0x7cf75a=_0x4ac1d2[_0xf0f9('0x28')]['userId'];var _0x3a0f27=_0x4ac1d2[_0xf0f9('0x28')][_0xf0f9('0x25')];return getAgent(_0x7cf75a)['then'](function(_0x3b52e3){logger[_0xf0f9('0x12')](_0xf0f9('0x2e'),_0x3b52e3[_0xf0f9('0x16')]);emit(util[_0xf0f9('0x2f')](_0xf0f9('0x30'),_0x3b52e3[_0xf0f9('0x16')]),_0xf0f9('0x34'),{'sessionId':_0x3a0f27});return _0x2b9d56[_0xf0f9('0x17')](0xc8)[_0xf0f9('0x2a')]({'error':![],'message':_0xf0f9('0x35')});})[_0xf0f9('0x1e')](handleError(_0x2b9d56));};exports[_0xf0f9('0x36')]=function(_0x5153b5,_0x4ff1f0){logger[_0xf0f9('0x12')]('answer\x20fired:',_0x5153b5['body']);var _0x4e8234=answerValidation[_0xf0f9('0x37')](_0x5153b5[_0xf0f9('0x28')]);if(_0x4e8234[_0xf0f9('0x29')]>0x0){return _0x4ff1f0[_0xf0f9('0x17')](0x190)[_0xf0f9('0x2a')](_0x4e8234);}var _0xfef8ad=_0x5153b5[_0xf0f9('0x28')][_0xf0f9('0x2b')];var _0x1a3a6b=_0x5153b5['body'][_0xf0f9('0x25')];return getAgent(_0xfef8ad)[_0xf0f9('0x1a')](function(_0x434fc1){logger['info'](_0xf0f9('0x2e'),_0x434fc1[_0xf0f9('0x16')]);emit(util[_0xf0f9('0x2f')]('user:%s',_0x434fc1[_0xf0f9('0x16')]),_0xf0f9('0x38'),{'sessionId':_0x1a3a6b});return _0x4ff1f0['status'](0xc8)[_0xf0f9('0x2a')]({'error':![],'message':_0xf0f9('0x39')});})[_0xf0f9('0x1e')](handleError(_0x4ff1f0));};exports[_0xf0f9('0x3a')]=function(_0x4be16e,_0x35bcf8){logger[_0xf0f9('0x12')](_0xf0f9('0x3b'),_0x4be16e[_0xf0f9('0x28')]);var _0x226bda=holdValidation[_0xf0f9('0x37')](_0x4be16e['body']);if(_0x226bda[_0xf0f9('0x29')]>0x0){return _0x35bcf8['status'](0x190)[_0xf0f9('0x2a')](_0x226bda);}var _0x38956b=_0x4be16e[_0xf0f9('0x28')][_0xf0f9('0x2b')];var _0x44b00d=_0x4be16e[_0xf0f9('0x28')][_0xf0f9('0x25')];return getAgent(_0x38956b)[_0xf0f9('0x1a')](function(_0x1f47fa){logger[_0xf0f9('0x12')](_0xf0f9('0x2e'),_0x1f47fa[_0xf0f9('0x16')]);emit(util[_0xf0f9('0x2f')](_0xf0f9('0x30'),_0x1f47fa[_0xf0f9('0x16')]),_0xf0f9('0x3c'),{'sessionId':_0x44b00d});return _0x35bcf8[_0xf0f9('0x17')](0xc8)[_0xf0f9('0x2a')]({'error':![],'message':_0xf0f9('0x3d')});})[_0xf0f9('0x1e')](handleError(_0x35bcf8));};exports[_0xf0f9('0x3e')]=function(_0x40711c,_0x3db0b2){logger[_0xf0f9('0x12')]('unhold\x20fired:',_0x40711c['body']);var _0x2eb8b4=unholdValidation['validate'](_0x40711c[_0xf0f9('0x28')]);if(_0x2eb8b4[_0xf0f9('0x29')]>0x0){return _0x3db0b2[_0xf0f9('0x17')](0x190)['json'](_0x2eb8b4);}var _0x2b2604=_0x40711c['body'][_0xf0f9('0x2b')];var _0x603804=_0x40711c[_0xf0f9('0x28')][_0xf0f9('0x25')];return getAgent(_0x2b2604)[_0xf0f9('0x1a')](function(_0x593b54){logger[_0xf0f9('0x12')]('entityFound:',_0x593b54[_0xf0f9('0x16')]);emit(util[_0xf0f9('0x2f')](_0xf0f9('0x30'),_0x593b54[_0xf0f9('0x16')]),_0xf0f9('0x3f'),{'sessionId':_0x603804});return _0x3db0b2['status'](0xc8)[_0xf0f9('0x2a')]({'error':![],'message':_0xf0f9('0x40')});})[_0xf0f9('0x1e')](handleError(_0x3db0b2));};exports[_0xf0f9('0x41')]=function(_0x1dbc9d,_0x2a8aae){logger[_0xf0f9('0x12')](_0xf0f9('0x42'),_0x2a8aae[_0xf0f9('0x28')]);var _0x406b45=callsValidation[_0xf0f9('0x37')](_0x1dbc9d[_0xf0f9('0x28')]);if(_0x406b45[_0xf0f9('0x29')]>0x0){return _0x2a8aae[_0xf0f9('0x17')](0x190)['json'](_0x406b45);}var _0x329b59=_0x1dbc9d[_0xf0f9('0x28')][_0xf0f9('0x2b')];var _0x59d7bd=respondWithRpcPromise(_0xf0f9('0x43'));var _0x32f641=getAgent(_0x329b59);return Promise[_0xf0f9('0x21')]([_0x59d7bd,_0x32f641])[_0xf0f9('0x1a')](function(_0x6979f){var _0x586022=_0x6979f[0x0];var _0x3b1d45=_0x6979f[0x1];var _0x838550=_[_0xf0f9('0x22')](_0x586022[_0xf0f9('0x23')],function(_0x2807f9){return _0x2807f9[_0xf0f9('0x24')]==_0x3b1d45['id'];});return _0x2a8aae[_0xf0f9('0x17')](0xc8)[_0xf0f9('0x2a')]({'count':_0x838550[_0xf0f9('0x29')],'rows':_0x838550});})[_0xf0f9('0x1e')](handleError(_0x2a8aae));};exports['conference']=function(_0x3777ae,_0x3fa078){logger['info'](_0xf0f9('0x44'),_0x3777ae['body']);var _0x3ac206=conferenceValidation[_0xf0f9('0x37')](_0x3777ae[_0xf0f9('0x28')]);if(_0x3ac206['length']>0x0){return _0x3fa078[_0xf0f9('0x17')](0x190)[_0xf0f9('0x2a')](_0x3ac206);}var _0x28879c=_0x3777ae[_0xf0f9('0x28')][_0xf0f9('0x2b')];return getAgent(_0x28879c)[_0xf0f9('0x1a')](function(_0xdb0e6c){logger[_0xf0f9('0x12')](_0xf0f9('0x2e'),_0xdb0e6c[_0xf0f9('0x16')]);emit(util[_0xf0f9('0x2f')](_0xf0f9('0x30'),_0xdb0e6c['name']),_0xf0f9('0x45'));return _0x3fa078[_0xf0f9('0x17')](0xc8)[_0xf0f9('0x2a')]({'error':![],'message':_0xf0f9('0x46')});})['catch'](handleError(_0x3fa078));};exports[_0xf0f9('0x47')]=function(_0xb29b92,_0xb47567){logger['info'](_0xf0f9('0x48'),_0xb29b92[_0xf0f9('0x28')]);var _0x56e467=transferValidation[_0xf0f9('0x37')](_0xb29b92[_0xf0f9('0x28')]);if(_0x56e467['length']>0x0){return _0xb47567[_0xf0f9('0x17')](0x190)[_0xf0f9('0x2a')](_0x56e467);}var _0x3d1542=_0xb29b92[_0xf0f9('0x28')][_0xf0f9('0x2b')];var _0x16564d=_0xb29b92[_0xf0f9('0x28')]['sessionId'];var _0x392ffa=_0xb29b92[_0xf0f9('0x28')]['transferNumber'];return getAgent(_0x3d1542)[_0xf0f9('0x1a')](function(_0x539ac6){logger['info'](_0xf0f9('0x2e'),_0x539ac6[_0xf0f9('0x16')]);emit(util['format'](_0xf0f9('0x30'),_0x539ac6['name']),_0xf0f9('0x49'),{'sessionId':_0x16564d,'transferNumber':_0x392ffa});return _0xb47567[_0xf0f9('0x17')](0xc8)[_0xf0f9('0x2a')]({'error':![],'message':'transfer\x20executed!'});})[_0xf0f9('0x1e')](handleError(_0xb47567));};
\ No newline at end of file
+var _0xb734=['answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','calls','all','rows','conference','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','validate','userId\x20is\x20required','callNumber\x20is\x20required','string','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','emit','log','handleError:','error','stack','name','send','status','message','result','catch','User','findOne','agent','VoiceChannels','then','filter','UserId','sessionId','length','sessionId\x20','originate','originate\x20fired:','body','userId','callNumber','callbackUrl','info','entityFound:','format','user:%s','webbar:originate','hangup','hangup\x20fired:','json','webbar:hangup','answer','answer\x20fired:'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb734,0xe3));var _0x4b73=function(_0xb875ee,_0x583042){_0xb875ee=_0xb875ee-0x0;var _0x4c7f3a=_0xb734[_0xb875ee];return _0x4c7f3a;};'use strict';var path=require(_0x4b73('0x0'));var fs=require('fs');var _=require(_0x4b73('0x1'));var db=require(_0x4b73('0x2'))['db'];var config=require(_0x4b73('0x3'));var util=require(_0x4b73('0x4'));var BPromise=require(_0x4b73('0x5'));var jayson=require('jayson/promise');var amiClient=jayson['client']['http']({'port':0x232a});var logger=require(_0x4b73('0x6'))(_0x4b73('0x7'));var Redis=require(_0x4b73('0x8'));config[_0x4b73('0x9')]=_[_0x4b73('0xa')](config[_0x4b73('0x9')],{'host':_0x4b73('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4b73('0x9')]));var Schema=require(_0x4b73('0xc'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4b73('0xd')]},'callNumber':{'type':'string','required':[!![],_0x4b73('0xe')]},'callerId':{'type':_0x4b73('0xf')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x4b73('0x10'),'required':[!![],_0x4b73('0xd')]},'sessionId':{'type':_0x4b73('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x4b73('0x10'),'required':[!![],_0x4b73('0xd')]},'sessionId':{'type':_0x4b73('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x4b73('0x10'),'required':[!![],_0x4b73('0xd')]},'sessionId':{'type':_0x4b73('0xf'),'required':[!![],_0x4b73('0x11')]},'transferNumber':{'type':_0x4b73('0xf'),'required':[!![],_0x4b73('0x12')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4b73('0xd')]},'sessionId':{'type':_0x4b73('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4b73('0xd')]},'sessionId':{'type':_0x4b73('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4b73('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0x4b73('0x10'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x5286e5,_0x44ccde,_0x210219){logger['info'](_0x5286e5,_0x44ccde,JSON['stringify'](_0x210219));io['to'](_0x5286e5)[_0x4b73('0x13')](_0x44ccde,_0x210219);}function handleError(_0x221b81){return function(_0x5e6a98){console[_0x4b73('0x14')](_0x4b73('0x15'),_0x5e6a98,_0x5e6a98 instanceof RangeError);logger[_0x4b73('0x16')](_0x5e6a98[_0x4b73('0x17')]);if(_0x5e6a98 instanceof RangeError){if(_0x5e6a98[_0x4b73('0x18')]){delete _0x5e6a98['name'];}_0x221b81['status'](0x194)[_0x4b73('0x19')](_0x5e6a98);}else{if(_0x5e6a98[_0x4b73('0x18')]){delete _0x5e6a98[_0x4b73('0x18')];}_0x221b81[_0x4b73('0x1a')](0x1f4)['send'](_0x5e6a98);}};}function checkError(){return function(_0x5749d8){if(!_0x5749d8){throw new RangeError('NotFound');}return _0x5749d8;};}function respondWithRpcPromise(_0x4b2ca3,_0x1f6b8f){return new BPromise(function(_0x597a27,_0x3d5cdf){var _0x2d24f4=amiClient;return _0x2d24f4['request'](_0x4b2ca3,_0x1f6b8f)['then'](function(_0x1ea5fd){if(_0x1ea5fd['error']){if(_0x1ea5fd['error']['code']===0x1f4){return _0x3d5cdf(_0x1ea5fd[_0x4b73('0x16')]['message']);}return _0x597a27(_0x1ea5fd[_0x4b73('0x16')][_0x4b73('0x1b')]);}else{_0x597a27(_0x1ea5fd[_0x4b73('0x1c')]);}})[_0x4b73('0x1d')](function(_0x120a0b){_0x3d5cdf(_0x120a0b);});});}function getAgent(_0x4e81d2){return db[_0x4b73('0x1e')][_0x4b73('0x1f')]({'where':{'id':_0x4e81d2,'role':_0x4b73('0x20')}})['then'](checkError());}function getAgentCheckSession(_0x424b98,_0x5bf25f){return new BPromise(function(_0x523e03,_0x367307){var _0x45ec66=respondWithRpcPromise(_0x4b73('0x21'));var _0x5bd53d=getAgent(_0x424b98);Promise['all']([_0x45ec66,_0x5bd53d])[_0x4b73('0x22')](function(_0x4d54c3){var _0x5874f7=_0x4d54c3[0x0];var _0x21337d=_0x4d54c3[0x1];var _0xa34789=_[_0x4b73('0x23')](_0x5874f7['rows'],function(_0x5748ba){return _0x5748ba[_0x4b73('0x24')]==_0x21337d['id']&&_0x5748ba[_0x4b73('0x25')]==_0x5bf25f;});if(_0xa34789[_0x4b73('0x26')]==0x1){_0x523e03(_0x21337d);}else{_0x367307(new RangeError(_0x4b73('0x27')+_0x5bf25f+'\x20not\x20found!'));}});});}exports[_0x4b73('0x28')]=function(_0x5d8b73,_0x2bdfc5){logger['info'](_0x4b73('0x29'),_0x5d8b73[_0x4b73('0x2a')]);var _0x272fe8=originateValidation['validate'](_0x5d8b73[_0x4b73('0x2a')]);if(_0x272fe8['length']>0x0){return _0x2bdfc5['status'](0x190)['json'](_0x272fe8);}var _0x462e06=_0x5d8b73[_0x4b73('0x2a')][_0x4b73('0x2b')];var _0x3bf7dd=_0x5d8b73[_0x4b73('0x2a')][_0x4b73('0x2c')];var _0x1687d1=_0x5d8b73[_0x4b73('0x2a')]['callerId'];var _0x33fada=_0x5d8b73[_0x4b73('0x2a')][_0x4b73('0x2d')];return getAgent(_0x462e06)['then'](function(_0x20ea6e){logger[_0x4b73('0x2e')](_0x4b73('0x2f'),_0x20ea6e[_0x4b73('0x18')]);emit(util[_0x4b73('0x30')](_0x4b73('0x31'),_0x20ea6e[_0x4b73('0x18')]),_0x4b73('0x32'),{'callNumber':_0x3bf7dd,'callerId':_0x1687d1,'callbackUrl':_0x33fada});return _0x2bdfc5['status'](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x2bdfc5));};exports[_0x4b73('0x33')]=function(_0x5e543f,_0x570461){logger[_0x4b73('0x2e')](_0x4b73('0x34'),_0x5e543f[_0x4b73('0x2a')]);var _0xedc83a=hangupValidation['validate'](_0x5e543f['body']);if(_0xedc83a[_0x4b73('0x26')]>0x0){return _0x570461[_0x4b73('0x1a')](0x190)[_0x4b73('0x35')](_0xedc83a);}var _0x36cf65=_0x5e543f[_0x4b73('0x2a')][_0x4b73('0x2b')];var _0x432878=_0x5e543f[_0x4b73('0x2a')][_0x4b73('0x25')];return getAgent(_0x36cf65)['then'](function(_0x4616f8){logger['info'](_0x4b73('0x2f'),_0x4616f8[_0x4b73('0x18')]);emit(util[_0x4b73('0x30')]('user:%s',_0x4616f8[_0x4b73('0x18')]),_0x4b73('0x36'),{'sessionId':_0x432878});return _0x570461[_0x4b73('0x1a')](0xc8)[_0x4b73('0x35')]({'error':![],'message':'hangup\x20executed!'});})[_0x4b73('0x1d')](handleError(_0x570461));};exports[_0x4b73('0x37')]=function(_0x20bf2e,_0x4a8096){logger[_0x4b73('0x2e')](_0x4b73('0x38'),_0x20bf2e['body']);var _0x11c320=answerValidation['validate'](_0x20bf2e[_0x4b73('0x2a')]);if(_0x11c320[_0x4b73('0x26')]>0x0){return _0x4a8096[_0x4b73('0x1a')](0x190)[_0x4b73('0x35')](_0x11c320);}var _0x58ac1a=_0x20bf2e[_0x4b73('0x2a')][_0x4b73('0x2b')];var _0x28252c=_0x20bf2e['body']['sessionId'];return getAgent(_0x58ac1a)[_0x4b73('0x22')](function(_0x463aa5){logger[_0x4b73('0x2e')](_0x4b73('0x2f'),_0x463aa5[_0x4b73('0x18')]);emit(util[_0x4b73('0x30')](_0x4b73('0x31'),_0x463aa5['name']),'webbar:answer',{'sessionId':_0x28252c});return _0x4a8096[_0x4b73('0x1a')](0xc8)[_0x4b73('0x35')]({'error':![],'message':_0x4b73('0x39')});})[_0x4b73('0x1d')](handleError(_0x4a8096));};exports['hold']=function(_0x1c6b1d,_0x492c6d){logger[_0x4b73('0x2e')](_0x4b73('0x3a'),_0x1c6b1d[_0x4b73('0x2a')]);var _0x1fcc52=holdValidation[_0x4b73('0xc')](_0x1c6b1d[_0x4b73('0x2a')]);if(_0x1fcc52[_0x4b73('0x26')]>0x0){return _0x492c6d['status'](0x190)[_0x4b73('0x35')](_0x1fcc52);}var _0x37b24c=_0x1c6b1d[_0x4b73('0x2a')][_0x4b73('0x2b')];var _0x5813b8=_0x1c6b1d[_0x4b73('0x2a')][_0x4b73('0x25')];return getAgent(_0x37b24c)[_0x4b73('0x22')](function(_0x1088f8){logger[_0x4b73('0x2e')](_0x4b73('0x2f'),_0x1088f8[_0x4b73('0x18')]);emit(util[_0x4b73('0x30')]('user:%s',_0x1088f8[_0x4b73('0x18')]),_0x4b73('0x3b'),{'sessionId':_0x5813b8});return _0x492c6d[_0x4b73('0x1a')](0xc8)['json']({'error':![],'message':_0x4b73('0x3c')});})[_0x4b73('0x1d')](handleError(_0x492c6d));};exports['unhold']=function(_0x24509d,_0x49d027){logger['info']('unhold\x20fired:',_0x24509d[_0x4b73('0x2a')]);var _0x59dbfa=unholdValidation['validate'](_0x24509d['body']);if(_0x59dbfa[_0x4b73('0x26')]>0x0){return _0x49d027[_0x4b73('0x1a')](0x190)['json'](_0x59dbfa);}var _0x5526e8=_0x24509d[_0x4b73('0x2a')][_0x4b73('0x2b')];var _0x53d5eb=_0x24509d[_0x4b73('0x2a')][_0x4b73('0x25')];return getAgent(_0x5526e8)[_0x4b73('0x22')](function(_0x4b5336){logger[_0x4b73('0x2e')](_0x4b73('0x2f'),_0x4b5336[_0x4b73('0x18')]);emit(util[_0x4b73('0x30')](_0x4b73('0x31'),_0x4b5336[_0x4b73('0x18')]),'webbar:unhold',{'sessionId':_0x53d5eb});return _0x49d027['status'](0xc8)[_0x4b73('0x35')]({'error':![],'message':'unhold\x20executed!'});})[_0x4b73('0x1d')](handleError(_0x49d027));};exports[_0x4b73('0x3d')]=function(_0xbe111d,_0x540e54){logger['info']('calls\x20fired:',_0x540e54[_0x4b73('0x2a')]);var _0x2866a7=callsValidation['validate'](_0xbe111d[_0x4b73('0x2a')]);if(_0x2866a7[_0x4b73('0x26')]>0x0){return _0x540e54[_0x4b73('0x1a')](0x190)['json'](_0x2866a7);}var _0x2e4729=_0xbe111d[_0x4b73('0x2a')][_0x4b73('0x2b')];var _0x57b47d=respondWithRpcPromise('VoiceChannels');var _0x3e7ae9=getAgent(_0x2e4729);return Promise[_0x4b73('0x3e')]([_0x57b47d,_0x3e7ae9])[_0x4b73('0x22')](function(_0x353615){var _0x1e3b02=_0x353615[0x0];var _0x181aa0=_0x353615[0x1];var _0x229b1a=_['filter'](_0x1e3b02[_0x4b73('0x3f')],function(_0x348217){return _0x348217[_0x4b73('0x24')]==_0x181aa0['id'];});return _0x540e54[_0x4b73('0x1a')](0xc8)[_0x4b73('0x35')]({'count':_0x229b1a[_0x4b73('0x26')],'rows':_0x229b1a});})[_0x4b73('0x1d')](handleError(_0x540e54));};exports[_0x4b73('0x40')]=function(_0x4e756a,_0x126f16){logger[_0x4b73('0x2e')]('conference\x20fired:',_0x4e756a[_0x4b73('0x2a')]);var _0x5803d1=conferenceValidation[_0x4b73('0xc')](_0x4e756a['body']);if(_0x5803d1['length']>0x0){return _0x126f16['status'](0x190)[_0x4b73('0x35')](_0x5803d1);}var _0x3d6dc9=_0x4e756a[_0x4b73('0x2a')][_0x4b73('0x2b')];return getAgent(_0x3d6dc9)['then'](function(_0x244cef){logger[_0x4b73('0x2e')](_0x4b73('0x2f'),_0x244cef[_0x4b73('0x18')]);emit(util[_0x4b73('0x30')](_0x4b73('0x31'),_0x244cef[_0x4b73('0x18')]),_0x4b73('0x41'));return _0x126f16[_0x4b73('0x1a')](0xc8)['json']({'error':![],'message':_0x4b73('0x42')});})[_0x4b73('0x1d')](handleError(_0x126f16));};exports[_0x4b73('0x43')]=function(_0x19d632,_0x5a3f4a){logger[_0x4b73('0x2e')](_0x4b73('0x44'),_0x19d632[_0x4b73('0x2a')]);var _0x2212df=transferValidation[_0x4b73('0xc')](_0x19d632['body']);if(_0x2212df[_0x4b73('0x26')]>0x0){return _0x5a3f4a['status'](0x190)['json'](_0x2212df);}var _0x52c641=_0x19d632[_0x4b73('0x2a')][_0x4b73('0x2b')];var _0x4cc89c=_0x19d632[_0x4b73('0x2a')][_0x4b73('0x25')];var _0x4d272c=_0x19d632['body']['transferNumber'];return getAgent(_0x52c641)[_0x4b73('0x22')](function(_0x2169bb){logger[_0x4b73('0x2e')](_0x4b73('0x2f'),_0x2169bb[_0x4b73('0x18')]);emit(util['format'](_0x4b73('0x31'),_0x2169bb['name']),_0x4b73('0x45'),{'sessionId':_0x4cc89c,'transferNumber':_0x4d272c});return _0x5a3f4a[_0x4b73('0x1a')](0xc8)[_0x4b73('0x35')]({'error':![],'message':_0x4b73('0x46')});})[_0x4b73('0x1d')](handleError(_0x5a3f4a));};
\ No newline at end of file