Built motion from commit 497d3d92.|2.5.43
[motion2.git] / server / api / webbar / webbar.controller.js
index 7313e99..b27cb7e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6d2e=['calls\x20fired:','UserId','conference\x20fired:','webbar:conference','transfer','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','http','ioredis','redis','defaults','localhost','validate','userId\x20is\x20required','string','number','sessionId\x20is\x20required','info','stringify','log','handleError:','error','stack','name','send','status','request','then','code','message','result','catch','findOne','agent','VoiceChannels','all','filter','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','json','userId','callNumber','callbackUrl','entityFound:','format','webbar:originate','originate\x20executed!','hangup\x20fired:','user:%s','webbar:hangup','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','webbar:unhold','unhold\x20executed!','calls'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6d2e,0x97));var _0xe6d2=function(_0x53594d,_0xb372ae){_0x53594d=_0x53594d-0x0;var _0x3b2544=_0x6d2e[_0x53594d];return _0x3b2544;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xe6d2('0x0'));var db=require(_0xe6d2('0x1'))['db'];var config=require(_0xe6d2('0x2'));var util=require(_0xe6d2('0x3'));var BPromise=require(_0xe6d2('0x4'));var jayson=require(_0xe6d2('0x5'));var amiClient=jayson['client'][_0xe6d2('0x6')]({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require(_0xe6d2('0x7'));config[_0xe6d2('0x8')]=_[_0xe6d2('0x9')](config['redis'],{'host':_0xe6d2('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe6d2('0x8')]));var Schema=require(_0xe6d2('0xb'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe6d2('0xc')]},'callNumber':{'type':_0xe6d2('0xd'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xe6d2('0xd')},'callbackUrl':{'type':_0xe6d2('0xd')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe6d2('0xc')]},'sessionId':{'type':_0xe6d2('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xe6d2('0xe'),'required':[!![],_0xe6d2('0xc')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xe6d2('0xe'),'required':[!![],_0xe6d2('0xc')]},'sessionId':{'type':'string','required':[!![],_0xe6d2('0xf')]},'transferNumber':{'type':_0xe6d2('0xd'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xe6d2('0xe'),'required':[!![],_0xe6d2('0xc')]},'sessionId':{'type':_0xe6d2('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xe6d2('0xe'),'required':[!![],_0xe6d2('0xc')]},'sessionId':{'type':_0xe6d2('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xe6d2('0xe'),'required':[!![],_0xe6d2('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0xe6d2('0xe'),'required':[!![],_0xe6d2('0xc')]}});function emit(_0xf6a43e,_0x34ff3e,_0x1e85a0){logger[_0xe6d2('0x10')](_0xf6a43e,_0x34ff3e,JSON[_0xe6d2('0x11')](_0x1e85a0));io['to'](_0xf6a43e)['emit'](_0x34ff3e,_0x1e85a0);}function handleError(_0x2ec9cc){return function(_0x35cc9c){console[_0xe6d2('0x12')](_0xe6d2('0x13'),_0x35cc9c,_0x35cc9c instanceof RangeError);logger[_0xe6d2('0x14')](_0x35cc9c[_0xe6d2('0x15')]);if(_0x35cc9c instanceof RangeError){if(_0x35cc9c[_0xe6d2('0x16')]){delete _0x35cc9c[_0xe6d2('0x16')];}_0x2ec9cc['status'](0x194)[_0xe6d2('0x17')](_0x35cc9c);}else{if(_0x35cc9c[_0xe6d2('0x16')]){delete _0x35cc9c['name'];}_0x2ec9cc[_0xe6d2('0x18')](0x1f4)[_0xe6d2('0x17')](_0x35cc9c);}};}function checkError(){return function(_0x19bce0){if(!_0x19bce0){throw new RangeError('NotFound');}return _0x19bce0;};}function respondWithRpcPromise(_0x3d4387,_0x5ade7b){return new BPromise(function(_0x2d5acf,_0xa4fac9){var _0x2f374f=amiClient;return _0x2f374f[_0xe6d2('0x19')](_0x3d4387,_0x5ade7b)[_0xe6d2('0x1a')](function(_0xb05d8c){if(_0xb05d8c[_0xe6d2('0x14')]){if(_0xb05d8c[_0xe6d2('0x14')][_0xe6d2('0x1b')]===0x1f4){return _0xa4fac9(_0xb05d8c['error'][_0xe6d2('0x1c')]);}return _0x2d5acf(_0xb05d8c[_0xe6d2('0x14')][_0xe6d2('0x1c')]);}else{_0x2d5acf(_0xb05d8c[_0xe6d2('0x1d')]);}})[_0xe6d2('0x1e')](function(_0x5d327a){_0xa4fac9(_0x5d327a);});});}function getAgent(_0x4a6ba8){return db['User'][_0xe6d2('0x1f')]({'where':{'id':_0x4a6ba8,'role':_0xe6d2('0x20')}})[_0xe6d2('0x1a')](checkError());}function getAgentCheckSession(_0x3a8734,_0x125286){return new BPromise(function(_0x223992,_0x83af1){var _0x4c4a4e=respondWithRpcPromise(_0xe6d2('0x21'));var _0x5d8299=getAgent(_0x3a8734);Promise[_0xe6d2('0x22')]([_0x4c4a4e,_0x5d8299])[_0xe6d2('0x1a')](function(_0x15b607){var _0x31d894=_0x15b607[0x0];var _0x2dceba=_0x15b607[0x1];var _0x2a9149=_[_0xe6d2('0x23')](_0x31d894[_0xe6d2('0x24')],function(_0x32056f){return _0x32056f['UserId']==_0x2dceba['id']&&_0x32056f[_0xe6d2('0x25')]==_0x125286;});if(_0x2a9149[_0xe6d2('0x26')]==0x1){_0x223992(_0x2dceba);}else{_0x83af1(new RangeError(_0xe6d2('0x27')+_0x125286+_0xe6d2('0x28')));}});});}exports['originate']=function(_0x22a192,_0x7c1e7e){logger[_0xe6d2('0x10')](_0xe6d2('0x29'),_0x22a192[_0xe6d2('0x2a')]);var _0x54bd35=originateValidation[_0xe6d2('0xb')](_0x22a192[_0xe6d2('0x2a')]);if(_0x54bd35[_0xe6d2('0x26')]>0x0){return _0x7c1e7e[_0xe6d2('0x18')](0x190)[_0xe6d2('0x2b')](_0x54bd35);}var _0x21b470=_0x22a192['body'][_0xe6d2('0x2c')];var _0x1ecefe=_0x22a192['body'][_0xe6d2('0x2d')];var _0x44e9c7=_0x22a192[_0xe6d2('0x2a')]['callerId'];var _0x4e11a9=_0x22a192[_0xe6d2('0x2a')][_0xe6d2('0x2e')];return getAgent(_0x21b470)[_0xe6d2('0x1a')](function(_0x486ff0){logger[_0xe6d2('0x10')](_0xe6d2('0x2f'),_0x486ff0[_0xe6d2('0x16')]);emit(util[_0xe6d2('0x30')]('user:%s',_0x486ff0[_0xe6d2('0x16')]),_0xe6d2('0x31'),{'callNumber':_0x1ecefe,'callerId':_0x44e9c7,'callbackUrl':_0x4e11a9});return _0x7c1e7e[_0xe6d2('0x18')](0xc8)[_0xe6d2('0x2b')]({'error':![],'message':_0xe6d2('0x32')});})['catch'](handleError(_0x7c1e7e));};exports['hangup']=function(_0x18329a,_0x33879f){logger[_0xe6d2('0x10')](_0xe6d2('0x33'),_0x18329a[_0xe6d2('0x2a')]);var _0x10280b=hangupValidation['validate'](_0x18329a[_0xe6d2('0x2a')]);if(_0x10280b[_0xe6d2('0x26')]>0x0){return _0x33879f['status'](0x190)[_0xe6d2('0x2b')](_0x10280b);}var _0x12396f=_0x18329a[_0xe6d2('0x2a')][_0xe6d2('0x2c')];var _0x558742=_0x18329a[_0xe6d2('0x2a')][_0xe6d2('0x25')];return getAgent(_0x12396f)[_0xe6d2('0x1a')](function(_0x1a192b){logger[_0xe6d2('0x10')](_0xe6d2('0x2f'),_0x1a192b[_0xe6d2('0x16')]);emit(util[_0xe6d2('0x30')](_0xe6d2('0x34'),_0x1a192b[_0xe6d2('0x16')]),_0xe6d2('0x35'),{'sessionId':_0x558742});return _0x33879f[_0xe6d2('0x18')](0xc8)[_0xe6d2('0x2b')]({'error':![],'message':'hangup\x20executed!'});})[_0xe6d2('0x1e')](handleError(_0x33879f));};exports[_0xe6d2('0x36')]=function(_0x358b2d,_0x233741){logger[_0xe6d2('0x10')](_0xe6d2('0x37'),_0x358b2d['body']);var _0x1ca811=answerValidation[_0xe6d2('0xb')](_0x358b2d[_0xe6d2('0x2a')]);if(_0x1ca811[_0xe6d2('0x26')]>0x0){return _0x233741[_0xe6d2('0x18')](0x190)['json'](_0x1ca811);}var _0x56b482=_0x358b2d[_0xe6d2('0x2a')][_0xe6d2('0x2c')];var _0x44f148=_0x358b2d[_0xe6d2('0x2a')]['sessionId'];return getAgent(_0x56b482)[_0xe6d2('0x1a')](function(_0x3d6cb4){logger[_0xe6d2('0x10')](_0xe6d2('0x2f'),_0x3d6cb4[_0xe6d2('0x16')]);emit(util['format']('user:%s',_0x3d6cb4[_0xe6d2('0x16')]),_0xe6d2('0x38'),{'sessionId':_0x44f148});return _0x233741[_0xe6d2('0x18')](0xc8)['json']({'error':![],'message':_0xe6d2('0x39')});})[_0xe6d2('0x1e')](handleError(_0x233741));};exports[_0xe6d2('0x3a')]=function(_0x2a82ee,_0x4650dd){logger['info'](_0xe6d2('0x3b'),_0x2a82ee[_0xe6d2('0x2a')]);var _0x3c90d9=holdValidation['validate'](_0x2a82ee[_0xe6d2('0x2a')]);if(_0x3c90d9[_0xe6d2('0x26')]>0x0){return _0x4650dd[_0xe6d2('0x18')](0x190)[_0xe6d2('0x2b')](_0x3c90d9);}var _0x3c93b0=_0x2a82ee[_0xe6d2('0x2a')][_0xe6d2('0x2c')];var _0x532279=_0x2a82ee[_0xe6d2('0x2a')][_0xe6d2('0x25')];return getAgent(_0x3c93b0)[_0xe6d2('0x1a')](function(_0x3493f6){logger[_0xe6d2('0x10')](_0xe6d2('0x2f'),_0x3493f6[_0xe6d2('0x16')]);emit(util[_0xe6d2('0x30')](_0xe6d2('0x34'),_0x3493f6[_0xe6d2('0x16')]),_0xe6d2('0x3c'),{'sessionId':_0x532279});return _0x4650dd[_0xe6d2('0x18')](0xc8)[_0xe6d2('0x2b')]({'error':![],'message':_0xe6d2('0x3d')});})[_0xe6d2('0x1e')](handleError(_0x4650dd));};exports['unhold']=function(_0x26ff5f,_0x41552a){logger[_0xe6d2('0x10')]('unhold\x20fired:',_0x26ff5f[_0xe6d2('0x2a')]);var _0x4b9a47=unholdValidation['validate'](_0x26ff5f[_0xe6d2('0x2a')]);if(_0x4b9a47[_0xe6d2('0x26')]>0x0){return _0x41552a[_0xe6d2('0x18')](0x190)[_0xe6d2('0x2b')](_0x4b9a47);}var _0x3d0338=_0x26ff5f['body']['userId'];var _0x2ae7a6=_0x26ff5f[_0xe6d2('0x2a')][_0xe6d2('0x25')];return getAgent(_0x3d0338)[_0xe6d2('0x1a')](function(_0x4d879c){logger[_0xe6d2('0x10')]('entityFound:',_0x4d879c[_0xe6d2('0x16')]);emit(util[_0xe6d2('0x30')](_0xe6d2('0x34'),_0x4d879c[_0xe6d2('0x16')]),_0xe6d2('0x3e'),{'sessionId':_0x2ae7a6});return _0x41552a[_0xe6d2('0x18')](0xc8)[_0xe6d2('0x2b')]({'error':![],'message':_0xe6d2('0x3f')});})[_0xe6d2('0x1e')](handleError(_0x41552a));};exports[_0xe6d2('0x40')]=function(_0x5558b3,_0x3d6499){logger['info'](_0xe6d2('0x41'),_0x3d6499['body']);var _0x271c1e=callsValidation[_0xe6d2('0xb')](_0x5558b3[_0xe6d2('0x2a')]);if(_0x271c1e[_0xe6d2('0x26')]>0x0){return _0x3d6499['status'](0x190)['json'](_0x271c1e);}var _0xa98cc2=_0x5558b3[_0xe6d2('0x2a')][_0xe6d2('0x2c')];var _0x1c2191=respondWithRpcPromise(_0xe6d2('0x21'));var _0x389beb=getAgent(_0xa98cc2);return Promise[_0xe6d2('0x22')]([_0x1c2191,_0x389beb])[_0xe6d2('0x1a')](function(_0x47748a){var _0x2e4518=_0x47748a[0x0];var _0x4f1a9b=_0x47748a[0x1];var _0x3d0d50=_[_0xe6d2('0x23')](_0x2e4518['rows'],function(_0xb9d96a){return _0xb9d96a[_0xe6d2('0x42')]==_0x4f1a9b['id'];});return _0x3d6499[_0xe6d2('0x18')](0xc8)['json']({'count':_0x3d0d50[_0xe6d2('0x26')],'rows':_0x3d0d50});})[_0xe6d2('0x1e')](handleError(_0x3d6499));};exports['conference']=function(_0x51c939,_0x32dd6b){logger[_0xe6d2('0x10')](_0xe6d2('0x43'),_0x51c939[_0xe6d2('0x2a')]);var _0x40f0f4=conferenceValidation[_0xe6d2('0xb')](_0x51c939[_0xe6d2('0x2a')]);if(_0x40f0f4[_0xe6d2('0x26')]>0x0){return _0x32dd6b[_0xe6d2('0x18')](0x190)[_0xe6d2('0x2b')](_0x40f0f4);}var _0x500bf2=_0x51c939['body'][_0xe6d2('0x2c')];return getAgent(_0x500bf2)[_0xe6d2('0x1a')](function(_0x4c3f99){logger['info']('entityFound:',_0x4c3f99[_0xe6d2('0x16')]);emit(util[_0xe6d2('0x30')]('user:%s',_0x4c3f99[_0xe6d2('0x16')]),_0xe6d2('0x44'));return _0x32dd6b[_0xe6d2('0x18')](0xc8)[_0xe6d2('0x2b')]({'error':![],'message':'conference\x20executed!'});})[_0xe6d2('0x1e')](handleError(_0x32dd6b));};exports[_0xe6d2('0x45')]=function(_0x2cf7cd,_0x54adc7){logger[_0xe6d2('0x10')]('transfer\x20fired:',_0x2cf7cd['body']);var _0x1a4c82=transferValidation[_0xe6d2('0xb')](_0x2cf7cd['body']);if(_0x1a4c82[_0xe6d2('0x26')]>0x0){return _0x54adc7[_0xe6d2('0x18')](0x190)[_0xe6d2('0x2b')](_0x1a4c82);}var _0xc4800e=_0x2cf7cd[_0xe6d2('0x2a')][_0xe6d2('0x2c')];var _0x4de025=_0x2cf7cd[_0xe6d2('0x2a')][_0xe6d2('0x25')];var _0x152bca=_0x2cf7cd['body']['transferNumber'];return getAgent(_0xc4800e)[_0xe6d2('0x1a')](function(_0x2af1fc){logger[_0xe6d2('0x10')](_0xe6d2('0x2f'),_0x2af1fc[_0xe6d2('0x16')]);emit(util[_0xe6d2('0x30')](_0xe6d2('0x34'),_0x2af1fc[_0xe6d2('0x16')]),_0xe6d2('0x46'),{'sessionId':_0x4de025,'transferNumber':_0x152bca});return _0x54adc7[_0xe6d2('0x18')](0xc8)['json']({'error':![],'message':_0xe6d2('0x47')});})['catch'](handleError(_0x54adc7));};
\ No newline at end of file
+var _0x6f7a=['findOne','agent','then','VoiceChannels','all','filter','rows','UserId','length','sessionId\x20','originate','originate\x20fired:','body','json','userId','callNumber','callerId','entityFound:','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','sessionId','format','webbar:hangup','hangup\x20executed!','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls\x20fired:','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','info','stringify','emit','log','error','stack','name','status','send','NotFound','code','catch','User'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x12f2eb,_0x3f8838){_0x12f2eb=_0x12f2eb-0x0;var _0x241e8c=_0x6f7a[_0x12f2eb];return _0x241e8c;};'use strict';var path=require(_0xa6f7('0x0'));var fs=require('fs');var _=require(_0xa6f7('0x1'));var db=require(_0xa6f7('0x2'))['db'];var config=require(_0xa6f7('0x3'));var util=require('util');var BPromise=require(_0xa6f7('0x4'));var jayson=require(_0xa6f7('0x5'));var amiClient=jayson[_0xa6f7('0x6')][_0xa6f7('0x7')]({'port':0x232a});var logger=require(_0xa6f7('0x8'))(_0xa6f7('0x9'));var Redis=require(_0xa6f7('0xa'));config[_0xa6f7('0xb')]=_[_0xa6f7('0xc')](config[_0xa6f7('0xb')],{'host':_0xa6f7('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0xa6f7('0xe'));var originateValidation=new Schema({'userId':{'type':_0xa6f7('0xf'),'required':[!![],_0xa6f7('0x10')]},'callNumber':{'type':_0xa6f7('0x11'),'required':[!![],_0xa6f7('0x12')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xa6f7('0xf'),'required':[!![],_0xa6f7('0x10')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xa6f7('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xa6f7('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xa6f7('0xf'),'required':[!![],_0xa6f7('0x10')]},'sessionId':{'type':_0xa6f7('0x11'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xa6f7('0x11'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xa6f7('0xf'),'required':[!![],_0xa6f7('0x10')]},'sessionId':{'type':_0xa6f7('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa6f7('0x10')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xa6f7('0xf'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xa6f7('0xf'),'required':[!![],_0xa6f7('0x10')]}});function emit(_0x6efd38,_0x47e664,_0xdb37e2){logger[_0xa6f7('0x13')](_0x6efd38,_0x47e664,JSON[_0xa6f7('0x14')](_0xdb37e2));io['to'](_0x6efd38)[_0xa6f7('0x15')](_0x47e664,_0xdb37e2);}function handleError(_0x5681d5){return function(_0x4a8827){console[_0xa6f7('0x16')]('handleError:',_0x4a8827,_0x4a8827 instanceof RangeError);logger[_0xa6f7('0x17')](_0x4a8827[_0xa6f7('0x18')]);if(_0x4a8827 instanceof RangeError){if(_0x4a8827['name']){delete _0x4a8827[_0xa6f7('0x19')];}_0x5681d5[_0xa6f7('0x1a')](0x194)[_0xa6f7('0x1b')](_0x4a8827);}else{if(_0x4a8827[_0xa6f7('0x19')]){delete _0x4a8827[_0xa6f7('0x19')];}_0x5681d5[_0xa6f7('0x1a')](0x1f4)['send'](_0x4a8827);}};}function checkError(){return function(_0x3c0c55){if(!_0x3c0c55){throw new RangeError(_0xa6f7('0x1c'));}return _0x3c0c55;};}function respondWithRpcPromise(_0x58b6a1,_0x5d1159){return new BPromise(function(_0x5ddc8d,_0x1de6c9){var _0x119950=amiClient;return _0x119950['request'](_0x58b6a1,_0x5d1159)['then'](function(_0x50e2be){if(_0x50e2be[_0xa6f7('0x17')]){if(_0x50e2be[_0xa6f7('0x17')][_0xa6f7('0x1d')]===0x1f4){return _0x1de6c9(_0x50e2be['error']['message']);}return _0x5ddc8d(_0x50e2be[_0xa6f7('0x17')]['message']);}else{_0x5ddc8d(_0x50e2be['result']);}})[_0xa6f7('0x1e')](function(_0x5efdce){_0x1de6c9(_0x5efdce);});});}function getAgent(_0x35847e){return db[_0xa6f7('0x1f')][_0xa6f7('0x20')]({'where':{'id':_0x35847e,'role':_0xa6f7('0x21')}})[_0xa6f7('0x22')](checkError());}function getAgentCheckSession(_0x4b8d2b,_0x51db47){return new BPromise(function(_0x1c419b,_0x2ad0d9){var _0x55d45a=respondWithRpcPromise(_0xa6f7('0x23'));var _0x27babb=getAgent(_0x4b8d2b);Promise[_0xa6f7('0x24')]([_0x55d45a,_0x27babb])[_0xa6f7('0x22')](function(_0x224f5a){var _0x10bf77=_0x224f5a[0x0];var _0x353de8=_0x224f5a[0x1];var _0x54f72c=_[_0xa6f7('0x25')](_0x10bf77[_0xa6f7('0x26')],function(_0x40b0f8){return _0x40b0f8[_0xa6f7('0x27')]==_0x353de8['id']&&_0x40b0f8['sessionId']==_0x51db47;});if(_0x54f72c[_0xa6f7('0x28')]==0x1){_0x1c419b(_0x353de8);}else{_0x2ad0d9(new RangeError(_0xa6f7('0x29')+_0x51db47+'\x20not\x20found!'));}});});}exports[_0xa6f7('0x2a')]=function(_0x34d571,_0x4d79d8){logger['info'](_0xa6f7('0x2b'),_0x34d571[_0xa6f7('0x2c')]);var _0x2b33d=originateValidation[_0xa6f7('0xe')](_0x34d571[_0xa6f7('0x2c')]);if(_0x2b33d['length']>0x0){return _0x4d79d8['status'](0x190)[_0xa6f7('0x2d')](_0x2b33d);}var _0x4c2acd=_0x34d571[_0xa6f7('0x2c')][_0xa6f7('0x2e')];var _0xfa0fb6=_0x34d571[_0xa6f7('0x2c')][_0xa6f7('0x2f')];var _0xbdfc5a=_0x34d571['body'][_0xa6f7('0x30')];var _0xb1a7f8=_0x34d571[_0xa6f7('0x2c')]['callbackUrl'];return getAgent(_0x4c2acd)[_0xa6f7('0x22')](function(_0x5ab03d){logger[_0xa6f7('0x13')](_0xa6f7('0x31'),_0x5ab03d[_0xa6f7('0x19')]);emit(util['format'](_0xa6f7('0x32'),_0x5ab03d[_0xa6f7('0x19')]),_0xa6f7('0x33'),{'callNumber':_0xfa0fb6,'callerId':_0xbdfc5a,'callbackUrl':_0xb1a7f8});return _0x4d79d8[_0xa6f7('0x1a')](0xc8)[_0xa6f7('0x2d')]({'error':![],'message':_0xa6f7('0x34')});})['catch'](handleError(_0x4d79d8));};exports[_0xa6f7('0x35')]=function(_0xd930e8,_0xc25a1b){logger[_0xa6f7('0x13')](_0xa6f7('0x36'),_0xd930e8[_0xa6f7('0x2c')]);var _0x45acdd=hangupValidation[_0xa6f7('0xe')](_0xd930e8['body']);if(_0x45acdd[_0xa6f7('0x28')]>0x0){return _0xc25a1b[_0xa6f7('0x1a')](0x190)[_0xa6f7('0x2d')](_0x45acdd);}var _0x518088=_0xd930e8[_0xa6f7('0x2c')][_0xa6f7('0x2e')];var _0x589d94=_0xd930e8[_0xa6f7('0x2c')][_0xa6f7('0x37')];return getAgent(_0x518088)[_0xa6f7('0x22')](function(_0x14d532){logger[_0xa6f7('0x13')]('entityFound:',_0x14d532[_0xa6f7('0x19')]);emit(util[_0xa6f7('0x38')](_0xa6f7('0x32'),_0x14d532[_0xa6f7('0x19')]),_0xa6f7('0x39'),{'sessionId':_0x589d94});return _0xc25a1b[_0xa6f7('0x1a')](0xc8)[_0xa6f7('0x2d')]({'error':![],'message':_0xa6f7('0x3a')});})['catch'](handleError(_0xc25a1b));};exports['answer']=function(_0x12f7b5,_0x3e1535){logger[_0xa6f7('0x13')](_0xa6f7('0x3b'),_0x12f7b5[_0xa6f7('0x2c')]);var _0x387714=answerValidation[_0xa6f7('0xe')](_0x12f7b5[_0xa6f7('0x2c')]);if(_0x387714[_0xa6f7('0x28')]>0x0){return _0x3e1535[_0xa6f7('0x1a')](0x190)['json'](_0x387714);}var _0x41917c=_0x12f7b5[_0xa6f7('0x2c')]['userId'];var _0x22d500=_0x12f7b5[_0xa6f7('0x2c')][_0xa6f7('0x37')];return getAgent(_0x41917c)[_0xa6f7('0x22')](function(_0x51de13){logger[_0xa6f7('0x13')]('entityFound:',_0x51de13['name']);emit(util[_0xa6f7('0x38')](_0xa6f7('0x32'),_0x51de13[_0xa6f7('0x19')]),_0xa6f7('0x3c'),{'sessionId':_0x22d500});return _0x3e1535[_0xa6f7('0x1a')](0xc8)[_0xa6f7('0x2d')]({'error':![],'message':_0xa6f7('0x3d')});})['catch'](handleError(_0x3e1535));};exports[_0xa6f7('0x3e')]=function(_0x40dbe6,_0x55cb70){logger[_0xa6f7('0x13')](_0xa6f7('0x3f'),_0x40dbe6[_0xa6f7('0x2c')]);var _0x5cc89c=holdValidation[_0xa6f7('0xe')](_0x40dbe6['body']);if(_0x5cc89c[_0xa6f7('0x28')]>0x0){return _0x55cb70[_0xa6f7('0x1a')](0x190)[_0xa6f7('0x2d')](_0x5cc89c);}var _0x5f3c84=_0x40dbe6['body'][_0xa6f7('0x2e')];var _0x5928e4=_0x40dbe6[_0xa6f7('0x2c')]['sessionId'];return getAgent(_0x5f3c84)['then'](function(_0x1e7089){logger[_0xa6f7('0x13')](_0xa6f7('0x31'),_0x1e7089[_0xa6f7('0x19')]);emit(util[_0xa6f7('0x38')](_0xa6f7('0x32'),_0x1e7089['name']),_0xa6f7('0x40'),{'sessionId':_0x5928e4});return _0x55cb70[_0xa6f7('0x1a')](0xc8)['json']({'error':![],'message':_0xa6f7('0x41')});})['catch'](handleError(_0x55cb70));};exports[_0xa6f7('0x42')]=function(_0x59091a,_0x488efc){logger[_0xa6f7('0x13')](_0xa6f7('0x43'),_0x59091a[_0xa6f7('0x2c')]);var _0x2b3de2=unholdValidation[_0xa6f7('0xe')](_0x59091a['body']);if(_0x2b3de2[_0xa6f7('0x28')]>0x0){return _0x488efc[_0xa6f7('0x1a')](0x190)['json'](_0x2b3de2);}var _0x4b83f6=_0x59091a['body'][_0xa6f7('0x2e')];var _0x1c2099=_0x59091a[_0xa6f7('0x2c')]['sessionId'];return getAgent(_0x4b83f6)[_0xa6f7('0x22')](function(_0x5dab05){logger[_0xa6f7('0x13')](_0xa6f7('0x31'),_0x5dab05[_0xa6f7('0x19')]);emit(util[_0xa6f7('0x38')](_0xa6f7('0x32'),_0x5dab05['name']),'webbar:unhold',{'sessionId':_0x1c2099});return _0x488efc[_0xa6f7('0x1a')](0xc8)[_0xa6f7('0x2d')]({'error':![],'message':_0xa6f7('0x44')});})[_0xa6f7('0x1e')](handleError(_0x488efc));};exports['calls']=function(_0x9d901e,_0x2105dd){logger[_0xa6f7('0x13')](_0xa6f7('0x45'),_0x2105dd[_0xa6f7('0x2c')]);var _0x39538e=callsValidation['validate'](_0x9d901e[_0xa6f7('0x2c')]);if(_0x39538e[_0xa6f7('0x28')]>0x0){return _0x2105dd[_0xa6f7('0x1a')](0x190)['json'](_0x39538e);}var _0xb049d7=_0x9d901e[_0xa6f7('0x2c')][_0xa6f7('0x2e')];var _0x4496f1=respondWithRpcPromise('VoiceChannels');var _0x4ec005=getAgent(_0xb049d7);return Promise[_0xa6f7('0x24')]([_0x4496f1,_0x4ec005])[_0xa6f7('0x22')](function(_0x1103c6){var _0x52e647=_0x1103c6[0x0];var _0x301327=_0x1103c6[0x1];var _0x269249=_[_0xa6f7('0x25')](_0x52e647['rows'],function(_0x169bbe){return _0x169bbe[_0xa6f7('0x27')]==_0x301327['id'];});return _0x2105dd[_0xa6f7('0x1a')](0xc8)[_0xa6f7('0x2d')]({'count':_0x269249[_0xa6f7('0x28')],'rows':_0x269249});})[_0xa6f7('0x1e')](handleError(_0x2105dd));};exports[_0xa6f7('0x46')]=function(_0x3bc870,_0x444177){logger[_0xa6f7('0x13')](_0xa6f7('0x47'),_0x3bc870['body']);var _0x224e33=conferenceValidation['validate'](_0x3bc870[_0xa6f7('0x2c')]);if(_0x224e33['length']>0x0){return _0x444177[_0xa6f7('0x1a')](0x190)[_0xa6f7('0x2d')](_0x224e33);}var _0x5a158f=_0x3bc870[_0xa6f7('0x2c')][_0xa6f7('0x2e')];return getAgent(_0x5a158f)[_0xa6f7('0x22')](function(_0x501503){logger[_0xa6f7('0x13')]('entityFound:',_0x501503[_0xa6f7('0x19')]);emit(util[_0xa6f7('0x38')]('user:%s',_0x501503[_0xa6f7('0x19')]),'webbar:conference');return _0x444177[_0xa6f7('0x1a')](0xc8)['json']({'error':![],'message':_0xa6f7('0x48')});})[_0xa6f7('0x1e')](handleError(_0x444177));};exports[_0xa6f7('0x49')]=function(_0xca47c2,_0x315939){logger[_0xa6f7('0x13')](_0xa6f7('0x4a'),_0xca47c2[_0xa6f7('0x2c')]);var _0x153635=transferValidation[_0xa6f7('0xe')](_0xca47c2[_0xa6f7('0x2c')]);if(_0x153635[_0xa6f7('0x28')]>0x0){return _0x315939['status'](0x190)[_0xa6f7('0x2d')](_0x153635);}var _0x3c0c6e=_0xca47c2[_0xa6f7('0x2c')][_0xa6f7('0x2e')];var _0x154c78=_0xca47c2[_0xa6f7('0x2c')][_0xa6f7('0x37')];var _0x3a5700=_0xca47c2['body'][_0xa6f7('0x4b')];return getAgent(_0x3c0c6e)[_0xa6f7('0x22')](function(_0x9c102f){logger['info'](_0xa6f7('0x31'),_0x9c102f[_0xa6f7('0x19')]);emit(util[_0xa6f7('0x38')](_0xa6f7('0x32'),_0x9c102f[_0xa6f7('0x19')]),_0xa6f7('0x4c'),{'sessionId':_0x154c78,'transferNumber':_0x3a5700});return _0x315939[_0xa6f7('0x1a')](0xc8)[_0xa6f7('0x2d')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x315939));};
\ No newline at end of file