Built motion from commit 497d3d92.|2.5.43
[motion2.git] / server / api / webbar / webbar.controller.js
index 9cf0c2b..b27cb7e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x55ea=['NotFound','request','code','message','result','catch','User','findOne','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','originate','info','originate\x20fired:','body','userId','callNumber','callerId','callbackUrl','entityFound:','webbar:originate','json','originate\x20executed!','hangup','hangup\x20fired:','format','user:%s','webbar:hangup','answer','answer\x20fired:','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference\x20fired:','transfer\x20fired:','path','lodash','../../mysqldb','util','bluebird','jayson/promise','client','http','webbarapi','localhost','socket.io-emitter','redis','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','log','handleError:','error','stack','name','status','send'];(function(_0xbc4659,_0x578fba){var _0x5831f9=function(_0x5eb0eb){while(--_0x5eb0eb){_0xbc4659['push'](_0xbc4659['shift']());}};_0x5831f9(++_0x578fba);}(_0x55ea,0xc9));var _0xa55e=function(_0x3d64cb,_0x47ad3d){_0x3d64cb=_0x3d64cb-0x0;var _0x38c85a=_0x55ea[_0x3d64cb];return _0x38c85a;};'use strict';var path=require(_0xa55e('0x0'));var fs=require('fs');var _=require(_0xa55e('0x1'));var db=require(_0xa55e('0x2'))['db'];var config=require('../../config/environment');var util=require(_0xa55e('0x3'));var BPromise=require(_0xa55e('0x4'));var jayson=require(_0xa55e('0x5'));var amiClient=jayson[_0xa55e('0x6')][_0xa55e('0x7')]({'port':0x232a});var logger=require('../../config/logger')(_0xa55e('0x8'));var Redis=require('ioredis');config['redis']=_['defaults'](config['redis'],{'host':_0xa55e('0x9'),'port':0x18eb});var io=require(_0xa55e('0xa'))(new Redis(config[_0xa55e('0xb')]));var Schema=require(_0xa55e('0xc'));var originateValidation=new Schema({'userId':{'type':_0xa55e('0xd'),'required':[!![],_0xa55e('0xe')]},'callNumber':{'type':_0xa55e('0xf'),'required':[!![],_0xa55e('0x10')]},'callerId':{'type':_0xa55e('0xf')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa55e('0xe')]},'sessionId':{'type':_0xa55e('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xa55e('0xd'),'required':[!![],_0xa55e('0xe')]},'sessionId':{'type':_0xa55e('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa55e('0xe')]},'sessionId':{'type':'string','required':[!![],_0xa55e('0x11')]},'transferNumber':{'type':_0xa55e('0xf'),'required':[!![],_0xa55e('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0xa55e('0xd'),'required':[!![],_0xa55e('0xe')]},'sessionId':{'type':_0xa55e('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xa55e('0xd'),'required':[!![],_0xa55e('0xe')]},'sessionId':{'type':_0xa55e('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa55e('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xa55e('0xd'),'required':[!![],_0xa55e('0xe')]}});function emit(_0x12895e,_0x303698,_0x339f1e){logger['info'](_0x12895e,_0x303698,JSON[_0xa55e('0x13')](_0x339f1e));io['to'](_0x12895e)['emit'](_0x303698,_0x339f1e);}function handleError(_0x517142){return function(_0x4599b9){console[_0xa55e('0x14')](_0xa55e('0x15'),_0x4599b9,_0x4599b9 instanceof RangeError);logger[_0xa55e('0x16')](_0x4599b9[_0xa55e('0x17')]);if(_0x4599b9 instanceof RangeError){if(_0x4599b9['name']){delete _0x4599b9[_0xa55e('0x18')];}_0x517142['status'](0x194)['send'](_0x4599b9);}else{if(_0x4599b9[_0xa55e('0x18')]){delete _0x4599b9[_0xa55e('0x18')];}_0x517142[_0xa55e('0x19')](0x1f4)[_0xa55e('0x1a')](_0x4599b9);}};}function checkError(){return function(_0x51304d){if(!_0x51304d){throw new RangeError(_0xa55e('0x1b'));}return _0x51304d;};}function respondWithRpcPromise(_0x475dde,_0x267adb){return new BPromise(function(_0x9594a3,_0x5b0e74){var _0x53a2f9=amiClient;return _0x53a2f9[_0xa55e('0x1c')](_0x475dde,_0x267adb)['then'](function(_0xaaf2f1){if(_0xaaf2f1[_0xa55e('0x16')]){if(_0xaaf2f1[_0xa55e('0x16')][_0xa55e('0x1d')]===0x1f4){return _0x5b0e74(_0xaaf2f1[_0xa55e('0x16')][_0xa55e('0x1e')]);}return _0x9594a3(_0xaaf2f1[_0xa55e('0x16')][_0xa55e('0x1e')]);}else{_0x9594a3(_0xaaf2f1[_0xa55e('0x1f')]);}})[_0xa55e('0x20')](function(_0x3c519d){_0x5b0e74(_0x3c519d);});});}function getAgent(_0x137aca){return db[_0xa55e('0x21')][_0xa55e('0x22')]({'where':{'id':_0x137aca,'role':_0xa55e('0x23')}})[_0xa55e('0x24')](checkError());}function getAgentCheckSession(_0x2f2579,_0xa1917c){return new BPromise(function(_0x875010,_0x4eebcc){var _0x5c218d=respondWithRpcPromise(_0xa55e('0x25'));var _0x4ebcbd=getAgent(_0x2f2579);Promise[_0xa55e('0x26')]([_0x5c218d,_0x4ebcbd])['then'](function(_0x2fe4e9){var _0x4d9634=_0x2fe4e9[0x0];var _0x2758ca=_0x2fe4e9[0x1];var _0x532b13=_[_0xa55e('0x27')](_0x4d9634[_0xa55e('0x28')],function(_0x4a03ef){return _0x4a03ef[_0xa55e('0x29')]==_0x2758ca['id']&&_0x4a03ef[_0xa55e('0x2a')]==_0xa1917c;});if(_0x532b13[_0xa55e('0x2b')]==0x1){_0x875010(_0x2758ca);}else{_0x4eebcc(new RangeError(_0xa55e('0x2c')+_0xa1917c+'\x20not\x20found!'));}});});}exports[_0xa55e('0x2d')]=function(_0x25ecb3,_0x5b79d6){logger[_0xa55e('0x2e')](_0xa55e('0x2f'),_0x25ecb3[_0xa55e('0x30')]);var _0xcaeba6=originateValidation['validate'](_0x25ecb3[_0xa55e('0x30')]);if(_0xcaeba6['length']>0x0){return _0x5b79d6[_0xa55e('0x19')](0x190)['json'](_0xcaeba6);}var _0x339406=_0x25ecb3[_0xa55e('0x30')][_0xa55e('0x31')];var _0x1e53f0=_0x25ecb3['body'][_0xa55e('0x32')];var _0x5aec2c=_0x25ecb3[_0xa55e('0x30')][_0xa55e('0x33')];var _0x7999ac=_0x25ecb3['body'][_0xa55e('0x34')];return getAgent(_0x339406)[_0xa55e('0x24')](function(_0x602aa0){logger[_0xa55e('0x2e')](_0xa55e('0x35'),_0x602aa0[_0xa55e('0x18')]);emit(util['format']('user:%s',_0x602aa0[_0xa55e('0x18')]),_0xa55e('0x36'),{'callNumber':_0x1e53f0,'callerId':_0x5aec2c,'callbackUrl':_0x7999ac});return _0x5b79d6[_0xa55e('0x19')](0xc8)[_0xa55e('0x37')]({'error':![],'message':_0xa55e('0x38')});})[_0xa55e('0x20')](handleError(_0x5b79d6));};exports[_0xa55e('0x39')]=function(_0x596a5d,_0x5cd5b3){logger[_0xa55e('0x2e')](_0xa55e('0x3a'),_0x596a5d[_0xa55e('0x30')]);var _0x351dbf=hangupValidation[_0xa55e('0xc')](_0x596a5d[_0xa55e('0x30')]);if(_0x351dbf[_0xa55e('0x2b')]>0x0){return _0x5cd5b3[_0xa55e('0x19')](0x190)[_0xa55e('0x37')](_0x351dbf);}var _0x113ab5=_0x596a5d[_0xa55e('0x30')]['userId'];var _0x1da8a9=_0x596a5d[_0xa55e('0x30')][_0xa55e('0x2a')];return getAgent(_0x113ab5)['then'](function(_0x1e806a){logger['info'](_0xa55e('0x35'),_0x1e806a[_0xa55e('0x18')]);emit(util[_0xa55e('0x3b')](_0xa55e('0x3c'),_0x1e806a[_0xa55e('0x18')]),_0xa55e('0x3d'),{'sessionId':_0x1da8a9});return _0x5cd5b3[_0xa55e('0x19')](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})[_0xa55e('0x20')](handleError(_0x5cd5b3));};exports[_0xa55e('0x3e')]=function(_0x27e756,_0x518e06){logger[_0xa55e('0x2e')](_0xa55e('0x3f'),_0x27e756[_0xa55e('0x30')]);var _0xb43d62=answerValidation[_0xa55e('0xc')](_0x27e756[_0xa55e('0x30')]);if(_0xb43d62[_0xa55e('0x2b')]>0x0){return _0x518e06[_0xa55e('0x19')](0x190)['json'](_0xb43d62);}var _0x4bd20d=_0x27e756[_0xa55e('0x30')][_0xa55e('0x31')];var _0x186dc2=_0x27e756[_0xa55e('0x30')][_0xa55e('0x2a')];return getAgent(_0x4bd20d)[_0xa55e('0x24')](function(_0x52c3b5){logger[_0xa55e('0x2e')]('entityFound:',_0x52c3b5['name']);emit(util[_0xa55e('0x3b')]('user:%s',_0x52c3b5[_0xa55e('0x18')]),'webbar:answer',{'sessionId':_0x186dc2});return _0x518e06['status'](0xc8)[_0xa55e('0x37')]({'error':![],'message':_0xa55e('0x40')});})['catch'](handleError(_0x518e06));};exports['hold']=function(_0x3ae40d,_0x1dda95){logger[_0xa55e('0x2e')](_0xa55e('0x41'),_0x3ae40d[_0xa55e('0x30')]);var _0x1031c9=holdValidation['validate'](_0x3ae40d['body']);if(_0x1031c9[_0xa55e('0x2b')]>0x0){return _0x1dda95[_0xa55e('0x19')](0x190)[_0xa55e('0x37')](_0x1031c9);}var _0x259cb3=_0x3ae40d[_0xa55e('0x30')][_0xa55e('0x31')];var _0x5b8776=_0x3ae40d[_0xa55e('0x30')][_0xa55e('0x2a')];return getAgent(_0x259cb3)[_0xa55e('0x24')](function(_0x1de3a8){logger[_0xa55e('0x2e')](_0xa55e('0x35'),_0x1de3a8['name']);emit(util['format'](_0xa55e('0x3c'),_0x1de3a8['name']),_0xa55e('0x42'),{'sessionId':_0x5b8776});return _0x1dda95['status'](0xc8)[_0xa55e('0x37')]({'error':![],'message':_0xa55e('0x43')});})[_0xa55e('0x20')](handleError(_0x1dda95));};exports[_0xa55e('0x44')]=function(_0x2c35a8,_0x63aa32){logger[_0xa55e('0x2e')](_0xa55e('0x45'),_0x2c35a8['body']);var _0x12c9e1=unholdValidation[_0xa55e('0xc')](_0x2c35a8[_0xa55e('0x30')]);if(_0x12c9e1[_0xa55e('0x2b')]>0x0){return _0x63aa32[_0xa55e('0x19')](0x190)[_0xa55e('0x37')](_0x12c9e1);}var _0x50bc5b=_0x2c35a8[_0xa55e('0x30')][_0xa55e('0x31')];var _0x42c00c=_0x2c35a8[_0xa55e('0x30')][_0xa55e('0x2a')];return getAgent(_0x50bc5b)[_0xa55e('0x24')](function(_0x5e0e05){logger[_0xa55e('0x2e')]('entityFound:',_0x5e0e05[_0xa55e('0x18')]);emit(util[_0xa55e('0x3b')](_0xa55e('0x3c'),_0x5e0e05[_0xa55e('0x18')]),_0xa55e('0x46'),{'sessionId':_0x42c00c});return _0x63aa32[_0xa55e('0x19')](0xc8)['json']({'error':![],'message':_0xa55e('0x47')});})['catch'](handleError(_0x63aa32));};exports[_0xa55e('0x48')]=function(_0x5be88c,_0x4f7b59){logger[_0xa55e('0x2e')](_0xa55e('0x49'),_0x4f7b59[_0xa55e('0x30')]);var _0x1f03a8=callsValidation[_0xa55e('0xc')](_0x5be88c[_0xa55e('0x30')]);if(_0x1f03a8[_0xa55e('0x2b')]>0x0){return _0x4f7b59['status'](0x190)[_0xa55e('0x37')](_0x1f03a8);}var _0x33d1e4=_0x5be88c[_0xa55e('0x30')]['userId'];var _0x467ea7=respondWithRpcPromise(_0xa55e('0x25'));var _0x2aeae3=getAgent(_0x33d1e4);return Promise['all']([_0x467ea7,_0x2aeae3])[_0xa55e('0x24')](function(_0x12c5a0){var _0x28fd5a=_0x12c5a0[0x0];var _0x2a6a1f=_0x12c5a0[0x1];var _0x6f0032=_[_0xa55e('0x27')](_0x28fd5a[_0xa55e('0x28')],function(_0x2f8b5f){return _0x2f8b5f[_0xa55e('0x29')]==_0x2a6a1f['id'];});return _0x4f7b59[_0xa55e('0x19')](0xc8)[_0xa55e('0x37')]({'count':_0x6f0032['length'],'rows':_0x6f0032});})[_0xa55e('0x20')](handleError(_0x4f7b59));};exports['conference']=function(_0x373874,_0x1ea145){logger[_0xa55e('0x2e')](_0xa55e('0x4a'),_0x373874[_0xa55e('0x30')]);var _0x1bef1b=conferenceValidation[_0xa55e('0xc')](_0x373874[_0xa55e('0x30')]);if(_0x1bef1b[_0xa55e('0x2b')]>0x0){return _0x1ea145[_0xa55e('0x19')](0x190)[_0xa55e('0x37')](_0x1bef1b);}var _0x424b87=_0x373874[_0xa55e('0x30')][_0xa55e('0x31')];return getAgent(_0x424b87)[_0xa55e('0x24')](function(_0x448641){logger['info']('entityFound:',_0x448641[_0xa55e('0x18')]);emit(util[_0xa55e('0x3b')](_0xa55e('0x3c'),_0x448641[_0xa55e('0x18')]),'webbar:conference');return _0x1ea145['status'](0xc8)[_0xa55e('0x37')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x1ea145));};exports['transfer']=function(_0x16f585,_0x37cd3a){logger[_0xa55e('0x2e')](_0xa55e('0x4b'),_0x16f585[_0xa55e('0x30')]);var _0x909ec4=transferValidation[_0xa55e('0xc')](_0x16f585[_0xa55e('0x30')]);if(_0x909ec4[_0xa55e('0x2b')]>0x0){return _0x37cd3a[_0xa55e('0x19')](0x190)['json'](_0x909ec4);}var _0x100633=_0x16f585[_0xa55e('0x30')][_0xa55e('0x31')];var _0x5d9388=_0x16f585[_0xa55e('0x30')][_0xa55e('0x2a')];var _0x3dab7b=_0x16f585[_0xa55e('0x30')]['transferNumber'];return getAgent(_0x100633)[_0xa55e('0x24')](function(_0x14fcad){logger[_0xa55e('0x2e')]('entityFound:',_0x14fcad['name']);emit(util[_0xa55e('0x3b')]('user:%s',_0x14fcad[_0xa55e('0x18')]),'webbar:transfer',{'sessionId':_0x5d9388,'transferNumber':_0x3dab7b});return _0x37cd3a[_0xa55e('0x19')](0xc8)[_0xa55e('0x37')]({'error':![],'message':'transfer\x20executed!'});})[_0xa55e('0x20')](handleError(_0x37cd3a));};
\ 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