Built motion from commit 06a208af.|2.6.26
[motion2.git] / server / api / webbar / webbar.controller.js
index 72b9181..acf546f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2f68=['conference\x20fired:','conference\x20executed!','transferNumber','webbar:transfer','lodash','../../mysqldb','../../config/environment','util','jayson/promise','http','../../config/logger','ioredis','redis','localhost','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','message','result','catch','User','agent','then','all','filter','rows','UserId','sessionId','length','sessionId\x20','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls\x20fired:','VoiceChannels','conference'];(function(_0x4e0f70,_0x375e11){var _0x21e651=function(_0x2a7f92){while(--_0x2a7f92){_0x4e0f70['push'](_0x4e0f70['shift']());}};_0x21e651(++_0x375e11);}(_0x2f68,0x9a));var _0x82f6=function(_0x17205e,_0x171e68){_0x17205e=_0x17205e-0x0;var _0x30e4f6=_0x2f68[_0x17205e];return _0x30e4f6;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x82f6('0x0'));var db=require(_0x82f6('0x1'))['db'];var config=require(_0x82f6('0x2'));var util=require(_0x82f6('0x3'));var BPromise=require('bluebird');var jayson=require(_0x82f6('0x4'));var amiClient=jayson['client'][_0x82f6('0x5')]({'port':0x232a});var logger=require(_0x82f6('0x6'))('webbarapi');var Redis=require(_0x82f6('0x7'));config[_0x82f6('0x8')]=_['defaults'](config['redis'],{'host':_0x82f6('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0x82f6('0xa'));var originateValidation=new Schema({'userId':{'type':_0x82f6('0xb'),'required':[!![],_0x82f6('0xc')]},'callNumber':{'type':'string','required':[!![],_0x82f6('0xd')]},'callerId':{'type':_0x82f6('0xe')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x82f6('0xb'),'required':[!![],_0x82f6('0xc')]},'sessionId':{'type':_0x82f6('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x82f6('0xb'),'required':[!![],_0x82f6('0xc')]},'sessionId':{'type':_0x82f6('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x82f6('0xc')]},'sessionId':{'type':_0x82f6('0xe'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x82f6('0xe'),'required':[!![],_0x82f6('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0x82f6('0xb'),'required':[!![],_0x82f6('0xc')]},'sessionId':{'type':_0x82f6('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x82f6('0xb'),'required':[!![],_0x82f6('0xc')]},'sessionId':{'type':_0x82f6('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x82f6('0xb'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x82f6('0xb'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x249222,_0x1d0263,_0x31b4fb){logger[_0x82f6('0x10')](_0x249222,_0x1d0263,JSON[_0x82f6('0x11')](_0x31b4fb));io['to'](_0x249222)[_0x82f6('0x12')](_0x1d0263,_0x31b4fb);}function handleError(_0x326378){return function(_0xcbc95f){console[_0x82f6('0x13')](_0x82f6('0x14'),_0xcbc95f,_0xcbc95f instanceof RangeError);logger[_0x82f6('0x15')](_0xcbc95f[_0x82f6('0x16')]);if(_0xcbc95f instanceof RangeError){if(_0xcbc95f[_0x82f6('0x17')]){delete _0xcbc95f[_0x82f6('0x17')];}_0x326378[_0x82f6('0x18')](0x194)['send'](_0xcbc95f);}else{if(_0xcbc95f[_0x82f6('0x17')]){delete _0xcbc95f[_0x82f6('0x17')];}_0x326378['status'](0x1f4)[_0x82f6('0x19')](_0xcbc95f);}};}function checkError(){return function(_0x4b9f0){if(!_0x4b9f0){throw new RangeError(_0x82f6('0x1a'));}return _0x4b9f0;};}function respondWithRpcPromise(_0x25cae6,_0x4bfeb8){return new BPromise(function(_0xdc4dea,_0x4beccf){var _0x8668bb=amiClient;return _0x8668bb[_0x82f6('0x1b')](_0x25cae6,_0x4bfeb8)['then'](function(_0x516deb){if(_0x516deb[_0x82f6('0x15')]){if(_0x516deb[_0x82f6('0x15')]['code']===0x1f4){return _0x4beccf(_0x516deb['error'][_0x82f6('0x1c')]);}return _0xdc4dea(_0x516deb[_0x82f6('0x15')]['message']);}else{_0xdc4dea(_0x516deb[_0x82f6('0x1d')]);}})[_0x82f6('0x1e')](function(_0x5037f8){_0x4beccf(_0x5037f8);});});}function getAgent(_0x57ac0d){return db[_0x82f6('0x1f')]['findOne']({'where':{'id':_0x57ac0d,'role':_0x82f6('0x20')}})[_0x82f6('0x21')](checkError());}function getAgentCheckSession(_0x54ce11,_0x3795ef){return new BPromise(function(_0x15c9b7,_0x33ef08){var _0x1125a0=respondWithRpcPromise('VoiceChannels');var _0x40a071=getAgent(_0x54ce11);Promise[_0x82f6('0x22')]([_0x1125a0,_0x40a071])[_0x82f6('0x21')](function(_0x400137){var _0x271c28=_0x400137[0x0];var _0x328707=_0x400137[0x1];var _0x27e473=_[_0x82f6('0x23')](_0x271c28[_0x82f6('0x24')],function(_0x402449){return _0x402449[_0x82f6('0x25')]==_0x328707['id']&&_0x402449[_0x82f6('0x26')]==_0x3795ef;});if(_0x27e473[_0x82f6('0x27')]==0x1){_0x15c9b7(_0x328707);}else{_0x33ef08(new RangeError(_0x82f6('0x28')+_0x3795ef+'\x20not\x20found!'));}});});}exports[_0x82f6('0x29')]=function(_0x2c764f,_0x418f34){logger['info'](_0x82f6('0x2a'),_0x2c764f[_0x82f6('0x2b')]);var _0x831131=originateValidation[_0x82f6('0xa')](_0x2c764f[_0x82f6('0x2b')]);if(_0x831131[_0x82f6('0x27')]>0x0){return _0x418f34[_0x82f6('0x18')](0x190)[_0x82f6('0x2c')](_0x831131);}var _0x4756ee=_0x2c764f[_0x82f6('0x2b')][_0x82f6('0x2d')];var _0x31df71=_0x2c764f[_0x82f6('0x2b')][_0x82f6('0x2e')];var _0x4c45a4=_0x2c764f[_0x82f6('0x2b')][_0x82f6('0x2f')];var _0x1c6ce4=_0x2c764f[_0x82f6('0x2b')][_0x82f6('0x30')];return getAgent(_0x4756ee)[_0x82f6('0x21')](function(_0x34c2f1){logger[_0x82f6('0x10')](_0x82f6('0x31'),_0x34c2f1[_0x82f6('0x17')]);emit(util[_0x82f6('0x32')](_0x82f6('0x33'),_0x34c2f1[_0x82f6('0x17')]),_0x82f6('0x34'),{'callNumber':_0x31df71,'callerId':_0x4c45a4,'callbackUrl':_0x1c6ce4});return _0x418f34['status'](0xc8)[_0x82f6('0x2c')]({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x418f34));};exports[_0x82f6('0x35')]=function(_0x18c81e,_0x5e8828){logger[_0x82f6('0x10')](_0x82f6('0x36'),_0x18c81e[_0x82f6('0x2b')]);var _0x56e5f1=hangupValidation[_0x82f6('0xa')](_0x18c81e['body']);if(_0x56e5f1[_0x82f6('0x27')]>0x0){return _0x5e8828['status'](0x190)[_0x82f6('0x2c')](_0x56e5f1);}var _0x47ef9e=_0x18c81e[_0x82f6('0x2b')][_0x82f6('0x2d')];var _0x5ad42c=_0x18c81e[_0x82f6('0x2b')][_0x82f6('0x26')];return getAgent(_0x47ef9e)[_0x82f6('0x21')](function(_0x43dcd1){logger['info'](_0x82f6('0x31'),_0x43dcd1[_0x82f6('0x17')]);emit(util[_0x82f6('0x32')](_0x82f6('0x33'),_0x43dcd1['name']),_0x82f6('0x37'),{'sessionId':_0x5ad42c});return _0x5e8828[_0x82f6('0x18')](0xc8)['json']({'error':![],'message':_0x82f6('0x38')});})[_0x82f6('0x1e')](handleError(_0x5e8828));};exports[_0x82f6('0x39')]=function(_0x23662f,_0xc3e250){logger['info'](_0x82f6('0x3a'),_0x23662f['body']);var _0x139614=answerValidation[_0x82f6('0xa')](_0x23662f[_0x82f6('0x2b')]);if(_0x139614[_0x82f6('0x27')]>0x0){return _0xc3e250[_0x82f6('0x18')](0x190)[_0x82f6('0x2c')](_0x139614);}var _0x43fefc=_0x23662f['body'][_0x82f6('0x2d')];var _0x297cda=_0x23662f[_0x82f6('0x2b')][_0x82f6('0x26')];return getAgent(_0x43fefc)['then'](function(_0x408dce){logger['info'](_0x82f6('0x31'),_0x408dce[_0x82f6('0x17')]);emit(util[_0x82f6('0x32')](_0x82f6('0x33'),_0x408dce[_0x82f6('0x17')]),_0x82f6('0x3b'),{'sessionId':_0x297cda});return _0xc3e250['status'](0xc8)[_0x82f6('0x2c')]({'error':![],'message':_0x82f6('0x3c')});})[_0x82f6('0x1e')](handleError(_0xc3e250));};exports[_0x82f6('0x3d')]=function(_0x10ae6e,_0x95c1fa){logger[_0x82f6('0x10')](_0x82f6('0x3e'),_0x10ae6e['body']);var _0x43b92e=holdValidation[_0x82f6('0xa')](_0x10ae6e['body']);if(_0x43b92e[_0x82f6('0x27')]>0x0){return _0x95c1fa['status'](0x190)[_0x82f6('0x2c')](_0x43b92e);}var _0x5e3321=_0x10ae6e[_0x82f6('0x2b')][_0x82f6('0x2d')];var _0xbcc26b=_0x10ae6e[_0x82f6('0x2b')][_0x82f6('0x26')];return getAgent(_0x5e3321)[_0x82f6('0x21')](function(_0x53f7d4){logger[_0x82f6('0x10')](_0x82f6('0x31'),_0x53f7d4['name']);emit(util['format'](_0x82f6('0x33'),_0x53f7d4[_0x82f6('0x17')]),_0x82f6('0x3f'),{'sessionId':_0xbcc26b});return _0x95c1fa['status'](0xc8)[_0x82f6('0x2c')]({'error':![],'message':_0x82f6('0x40')});})[_0x82f6('0x1e')](handleError(_0x95c1fa));};exports[_0x82f6('0x41')]=function(_0x4e9e13,_0x495400){logger[_0x82f6('0x10')](_0x82f6('0x42'),_0x4e9e13[_0x82f6('0x2b')]);var _0x5231bb=unholdValidation[_0x82f6('0xa')](_0x4e9e13[_0x82f6('0x2b')]);if(_0x5231bb['length']>0x0){return _0x495400['status'](0x190)['json'](_0x5231bb);}var _0x2e6b03=_0x4e9e13['body'][_0x82f6('0x2d')];var _0x57c023=_0x4e9e13[_0x82f6('0x2b')]['sessionId'];return getAgent(_0x2e6b03)[_0x82f6('0x21')](function(_0x58f89b){logger[_0x82f6('0x10')](_0x82f6('0x31'),_0x58f89b[_0x82f6('0x17')]);emit(util[_0x82f6('0x32')](_0x82f6('0x33'),_0x58f89b[_0x82f6('0x17')]),'webbar:unhold',{'sessionId':_0x57c023});return _0x495400[_0x82f6('0x18')](0xc8)[_0x82f6('0x2c')]({'error':![],'message':_0x82f6('0x43')});})['catch'](handleError(_0x495400));};exports['calls']=function(_0x13406f,_0x81e595){logger[_0x82f6('0x10')](_0x82f6('0x44'),_0x81e595['body']);var _0x2c1c0e=callsValidation[_0x82f6('0xa')](_0x13406f[_0x82f6('0x2b')]);if(_0x2c1c0e['length']>0x0){return _0x81e595['status'](0x190)['json'](_0x2c1c0e);}var _0x44218c=_0x13406f[_0x82f6('0x2b')][_0x82f6('0x2d')];var _0x59176d=respondWithRpcPromise(_0x82f6('0x45'));var _0x26c1d8=getAgent(_0x44218c);return Promise[_0x82f6('0x22')]([_0x59176d,_0x26c1d8])[_0x82f6('0x21')](function(_0x51791c){var _0x255da2=_0x51791c[0x0];var _0x94aed4=_0x51791c[0x1];var _0x12a5b9=_[_0x82f6('0x23')](_0x255da2['rows'],function(_0x53c715){return _0x53c715[_0x82f6('0x25')]==_0x94aed4['id'];});return _0x81e595[_0x82f6('0x18')](0xc8)['json']({'count':_0x12a5b9[_0x82f6('0x27')],'rows':_0x12a5b9});})[_0x82f6('0x1e')](handleError(_0x81e595));};exports[_0x82f6('0x46')]=function(_0x5b3aaa,_0x32fa83){logger[_0x82f6('0x10')](_0x82f6('0x47'),_0x5b3aaa[_0x82f6('0x2b')]);var _0x169aa3=conferenceValidation[_0x82f6('0xa')](_0x5b3aaa['body']);if(_0x169aa3[_0x82f6('0x27')]>0x0){return _0x32fa83[_0x82f6('0x18')](0x190)[_0x82f6('0x2c')](_0x169aa3);}var _0x2d57e3=_0x5b3aaa[_0x82f6('0x2b')]['userId'];return getAgent(_0x2d57e3)[_0x82f6('0x21')](function(_0x3cc579){logger[_0x82f6('0x10')](_0x82f6('0x31'),_0x3cc579[_0x82f6('0x17')]);emit(util[_0x82f6('0x32')](_0x82f6('0x33'),_0x3cc579[_0x82f6('0x17')]),'webbar:conference');return _0x32fa83[_0x82f6('0x18')](0xc8)['json']({'error':![],'message':_0x82f6('0x48')});})[_0x82f6('0x1e')](handleError(_0x32fa83));};exports['transfer']=function(_0x843458,_0x32e43d){logger[_0x82f6('0x10')]('transfer\x20fired:',_0x843458['body']);var _0x140dcd=transferValidation[_0x82f6('0xa')](_0x843458['body']);if(_0x140dcd['length']>0x0){return _0x32e43d[_0x82f6('0x18')](0x190)[_0x82f6('0x2c')](_0x140dcd);}var _0x1c37d2=_0x843458[_0x82f6('0x2b')][_0x82f6('0x2d')];var _0x11581c=_0x843458[_0x82f6('0x2b')][_0x82f6('0x26')];var _0x2d0d7c=_0x843458[_0x82f6('0x2b')][_0x82f6('0x49')];return getAgent(_0x1c37d2)[_0x82f6('0x21')](function(_0x53d931){logger[_0x82f6('0x10')](_0x82f6('0x31'),_0x53d931[_0x82f6('0x17')]);emit(util[_0x82f6('0x32')](_0x82f6('0x33'),_0x53d931['name']),_0x82f6('0x4a'),{'sessionId':_0x11581c,'transferNumber':_0x2d0d7c});return _0x32e43d[_0x82f6('0x18')](0xc8)[_0x82f6('0x2c')]({'error':![],'message':'transfer\x20executed!'});})[_0x82f6('0x1e')](handleError(_0x32e43d));};
\ No newline at end of file
+var _0xb903=['answer\x20fired:','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','conference','conference\x20fired:','webbar:conference','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','defaults','socket.io-emitter','redis','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','stringify','emit','log','handleError:','error','name','status','send','NotFound','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callerId','info','format','user:%s','webbar:originate','hangup','hangup\x20fired:','length','sessionId','entityFound:','webbar:hangup','hangup\x20executed!','answer'];(function(_0x26c03b,_0x208848){var _0x17f6fc=function(_0x958c38){while(--_0x958c38){_0x26c03b['push'](_0x26c03b['shift']());}};_0x17f6fc(++_0x208848);}(_0xb903,0x185));var _0x3b90=function(_0xd38e9c,_0x96c284){_0xd38e9c=_0xd38e9c-0x0;var _0x3d27c6=_0xb903[_0xd38e9c];return _0x3d27c6;};'use strict';var path=require(_0x3b90('0x0'));var fs=require('fs');var _=require(_0x3b90('0x1'));var db=require(_0x3b90('0x2'))['db'];var config=require(_0x3b90('0x3'));var util=require('util');var BPromise=require(_0x3b90('0x4'));var jayson=require(_0x3b90('0x5'));var amiClient=jayson[_0x3b90('0x6')][_0x3b90('0x7')]({'port':0x232a});var logger=require(_0x3b90('0x8'))(_0x3b90('0x9'));var Redis=require(_0x3b90('0xa'));config['redis']=_[_0x3b90('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3b90('0xc'))(new Redis(config[_0x3b90('0xd')]));var Schema=require(_0x3b90('0xe'));var originateValidation=new Schema({'userId':{'type':_0x3b90('0xf'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3b90('0x10')]},'sessionId':{'type':_0x3b90('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3b90('0x10')]},'sessionId':{'type':_0x3b90('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3b90('0x10')]},'sessionId':{'type':_0x3b90('0x11'),'required':[!![],_0x3b90('0x12')]},'transferNumber':{'type':'string','required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x3b90('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x3b90('0xf'),'required':[!![],_0x3b90('0x10')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3b90('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0x3b90('0xf'),'required':[!![],_0x3b90('0x10')]}});function emit(_0x1af265,_0x1efe01,_0x529421){logger['info'](_0x1af265,_0x1efe01,JSON[_0x3b90('0x13')](_0x529421));io['to'](_0x1af265)[_0x3b90('0x14')](_0x1efe01,_0x529421);}function handleError(_0x4e9120){return function(_0x269488){console[_0x3b90('0x15')](_0x3b90('0x16'),_0x269488,_0x269488 instanceof RangeError);logger[_0x3b90('0x17')](_0x269488['stack']);if(_0x269488 instanceof RangeError){if(_0x269488[_0x3b90('0x18')]){delete _0x269488['name'];}_0x4e9120[_0x3b90('0x19')](0x194)[_0x3b90('0x1a')](_0x269488);}else{if(_0x269488['name']){delete _0x269488[_0x3b90('0x18')];}_0x4e9120[_0x3b90('0x19')](0x1f4)[_0x3b90('0x1a')](_0x269488);}};}function checkError(){return function(_0x3ce411){if(!_0x3ce411){throw new RangeError(_0x3b90('0x1b'));}return _0x3ce411;};}function respondWithRpcPromise(_0x43deca,_0x3bc7d5){return new BPromise(function(_0x2f4270,_0xa98414){var _0x3e5bb8=amiClient;return _0x3e5bb8['request'](_0x43deca,_0x3bc7d5)[_0x3b90('0x1c')](function(_0x36b93e){if(_0x36b93e[_0x3b90('0x17')]){if(_0x36b93e[_0x3b90('0x17')][_0x3b90('0x1d')]===0x1f4){return _0xa98414(_0x36b93e[_0x3b90('0x17')]['message']);}return _0x2f4270(_0x36b93e['error'][_0x3b90('0x1e')]);}else{_0x2f4270(_0x36b93e[_0x3b90('0x1f')]);}})[_0x3b90('0x20')](function(_0x2ffa1a){_0xa98414(_0x2ffa1a);});});}function getAgent(_0x583523){return db[_0x3b90('0x21')][_0x3b90('0x22')]({'where':{'id':_0x583523,'role':_0x3b90('0x23')}})['then'](checkError());}function getAgentCheckSession(_0x14752c,_0x138d79){return new BPromise(function(_0x17ec7f,_0x33c07a){var _0x153d7c=respondWithRpcPromise(_0x3b90('0x24'));var _0x4b4d33=getAgent(_0x14752c);Promise[_0x3b90('0x25')]([_0x153d7c,_0x4b4d33])['then'](function(_0xaf453c){var _0x9891e4=_0xaf453c[0x0];var _0x1a193e=_0xaf453c[0x1];var _0x38eed0=_[_0x3b90('0x26')](_0x9891e4[_0x3b90('0x27')],function(_0x290283){return _0x290283[_0x3b90('0x28')]==_0x1a193e['id']&&_0x290283['sessionId']==_0x138d79;});if(_0x38eed0['length']==0x1){_0x17ec7f(_0x1a193e);}else{_0x33c07a(new RangeError(_0x3b90('0x29')+_0x138d79+_0x3b90('0x2a')));}});});}exports[_0x3b90('0x2b')]=function(_0x1c2e84,_0x522ede){logger['info'](_0x3b90('0x2c'),_0x1c2e84[_0x3b90('0x2d')]);var _0x24d5c9=originateValidation['validate'](_0x1c2e84[_0x3b90('0x2d')]);if(_0x24d5c9['length']>0x0){return _0x522ede['status'](0x190)[_0x3b90('0x2e')](_0x24d5c9);}var _0x3fbc03=_0x1c2e84['body'][_0x3b90('0x2f')];var _0x3d9605=_0x1c2e84[_0x3b90('0x2d')]['callNumber'];var _0x47cd8f=_0x1c2e84[_0x3b90('0x2d')][_0x3b90('0x30')];var _0x64a5e=_0x1c2e84[_0x3b90('0x2d')]['callbackUrl'];return getAgent(_0x3fbc03)['then'](function(_0x25ff34){logger[_0x3b90('0x31')]('entityFound:',_0x25ff34['name']);emit(util[_0x3b90('0x32')](_0x3b90('0x33'),_0x25ff34[_0x3b90('0x18')]),_0x3b90('0x34'),{'callNumber':_0x3d9605,'callerId':_0x47cd8f,'callbackUrl':_0x64a5e});return _0x522ede['status'](0xc8)[_0x3b90('0x2e')]({'error':![],'message':'originate\x20executed!'});})[_0x3b90('0x20')](handleError(_0x522ede));};exports[_0x3b90('0x35')]=function(_0x2355bf,_0x20abf8){logger[_0x3b90('0x31')](_0x3b90('0x36'),_0x2355bf[_0x3b90('0x2d')]);var _0x534bea=hangupValidation[_0x3b90('0xe')](_0x2355bf[_0x3b90('0x2d')]);if(_0x534bea[_0x3b90('0x37')]>0x0){return _0x20abf8[_0x3b90('0x19')](0x190)[_0x3b90('0x2e')](_0x534bea);}var _0x390952=_0x2355bf[_0x3b90('0x2d')][_0x3b90('0x2f')];var _0x356e14=_0x2355bf['body'][_0x3b90('0x38')];return getAgent(_0x390952)[_0x3b90('0x1c')](function(_0x40ce3a){logger[_0x3b90('0x31')](_0x3b90('0x39'),_0x40ce3a[_0x3b90('0x18')]);emit(util[_0x3b90('0x32')](_0x3b90('0x33'),_0x40ce3a[_0x3b90('0x18')]),_0x3b90('0x3a'),{'sessionId':_0x356e14});return _0x20abf8[_0x3b90('0x19')](0xc8)[_0x3b90('0x2e')]({'error':![],'message':_0x3b90('0x3b')});})[_0x3b90('0x20')](handleError(_0x20abf8));};exports[_0x3b90('0x3c')]=function(_0x3d2680,_0x3a27cf){logger[_0x3b90('0x31')](_0x3b90('0x3d'),_0x3d2680[_0x3b90('0x2d')]);var _0x11698a=answerValidation['validate'](_0x3d2680[_0x3b90('0x2d')]);if(_0x11698a[_0x3b90('0x37')]>0x0){return _0x3a27cf[_0x3b90('0x19')](0x190)[_0x3b90('0x2e')](_0x11698a);}var _0x5a48a9=_0x3d2680[_0x3b90('0x2d')]['userId'];var _0x564907=_0x3d2680[_0x3b90('0x2d')][_0x3b90('0x38')];return getAgent(_0x5a48a9)['then'](function(_0x1412b3){logger[_0x3b90('0x31')](_0x3b90('0x39'),_0x1412b3[_0x3b90('0x18')]);emit(util[_0x3b90('0x32')](_0x3b90('0x33'),_0x1412b3[_0x3b90('0x18')]),_0x3b90('0x3e'),{'sessionId':_0x564907});return _0x3a27cf[_0x3b90('0x19')](0xc8)['json']({'error':![],'message':_0x3b90('0x3f')});})[_0x3b90('0x20')](handleError(_0x3a27cf));};exports['hold']=function(_0x1e9a21,_0x12e061){logger[_0x3b90('0x31')](_0x3b90('0x40'),_0x1e9a21[_0x3b90('0x2d')]);var _0x4908ea=holdValidation['validate'](_0x1e9a21[_0x3b90('0x2d')]);if(_0x4908ea['length']>0x0){return _0x12e061[_0x3b90('0x19')](0x190)[_0x3b90('0x2e')](_0x4908ea);}var _0x330002=_0x1e9a21[_0x3b90('0x2d')][_0x3b90('0x2f')];var _0x4b1634=_0x1e9a21['body'][_0x3b90('0x38')];return getAgent(_0x330002)[_0x3b90('0x1c')](function(_0x9e2ee5){logger['info'](_0x3b90('0x39'),_0x9e2ee5[_0x3b90('0x18')]);emit(util[_0x3b90('0x32')](_0x3b90('0x33'),_0x9e2ee5[_0x3b90('0x18')]),_0x3b90('0x41'),{'sessionId':_0x4b1634});return _0x12e061[_0x3b90('0x19')](0xc8)[_0x3b90('0x2e')]({'error':![],'message':_0x3b90('0x42')});})['catch'](handleError(_0x12e061));};exports[_0x3b90('0x43')]=function(_0x407784,_0x2b5b6f){logger['info'](_0x3b90('0x44'),_0x407784['body']);var _0x288fbb=unholdValidation[_0x3b90('0xe')](_0x407784[_0x3b90('0x2d')]);if(_0x288fbb['length']>0x0){return _0x2b5b6f[_0x3b90('0x19')](0x190)[_0x3b90('0x2e')](_0x288fbb);}var _0x5334b5=_0x407784['body'][_0x3b90('0x2f')];var _0x24337e=_0x407784[_0x3b90('0x2d')][_0x3b90('0x38')];return getAgent(_0x5334b5)['then'](function(_0x5ee7e2){logger[_0x3b90('0x31')](_0x3b90('0x39'),_0x5ee7e2[_0x3b90('0x18')]);emit(util[_0x3b90('0x32')](_0x3b90('0x33'),_0x5ee7e2[_0x3b90('0x18')]),_0x3b90('0x45'),{'sessionId':_0x24337e});return _0x2b5b6f[_0x3b90('0x19')](0xc8)[_0x3b90('0x2e')]({'error':![],'message':'unhold\x20executed!'});})[_0x3b90('0x20')](handleError(_0x2b5b6f));};exports[_0x3b90('0x46')]=function(_0x54243d,_0x1d211a){logger[_0x3b90('0x31')]('calls\x20fired:',_0x1d211a[_0x3b90('0x2d')]);var _0x16c30f=callsValidation[_0x3b90('0xe')](_0x54243d[_0x3b90('0x2d')]);if(_0x16c30f[_0x3b90('0x37')]>0x0){return _0x1d211a[_0x3b90('0x19')](0x190)[_0x3b90('0x2e')](_0x16c30f);}var _0x47c9d1=_0x54243d[_0x3b90('0x2d')][_0x3b90('0x2f')];var _0x32a179=respondWithRpcPromise(_0x3b90('0x24'));var _0x110411=getAgent(_0x47c9d1);return Promise[_0x3b90('0x25')]([_0x32a179,_0x110411])[_0x3b90('0x1c')](function(_0x34acd6){var _0x28ec05=_0x34acd6[0x0];var _0x3febfc=_0x34acd6[0x1];var _0x1b6662=_[_0x3b90('0x26')](_0x28ec05[_0x3b90('0x27')],function(_0x15f741){return _0x15f741[_0x3b90('0x28')]==_0x3febfc['id'];});return _0x1d211a['status'](0xc8)[_0x3b90('0x2e')]({'count':_0x1b6662['length'],'rows':_0x1b6662});})[_0x3b90('0x20')](handleError(_0x1d211a));};exports[_0x3b90('0x47')]=function(_0x25bdb2,_0x1bce2a){logger[_0x3b90('0x31')](_0x3b90('0x48'),_0x25bdb2['body']);var _0x35af6e=conferenceValidation[_0x3b90('0xe')](_0x25bdb2[_0x3b90('0x2d')]);if(_0x35af6e[_0x3b90('0x37')]>0x0){return _0x1bce2a[_0x3b90('0x19')](0x190)[_0x3b90('0x2e')](_0x35af6e);}var _0x5c7605=_0x25bdb2[_0x3b90('0x2d')][_0x3b90('0x2f')];return getAgent(_0x5c7605)[_0x3b90('0x1c')](function(_0x536da7){logger[_0x3b90('0x31')](_0x3b90('0x39'),_0x536da7[_0x3b90('0x18')]);emit(util[_0x3b90('0x32')](_0x3b90('0x33'),_0x536da7[_0x3b90('0x18')]),_0x3b90('0x49'));return _0x1bce2a[_0x3b90('0x19')](0xc8)[_0x3b90('0x2e')]({'error':![],'message':'conference\x20executed!'});})[_0x3b90('0x20')](handleError(_0x1bce2a));};exports['transfer']=function(_0x53d2d3,_0x3c29e0){logger[_0x3b90('0x31')]('transfer\x20fired:',_0x53d2d3[_0x3b90('0x2d')]);var _0x1a2592=transferValidation[_0x3b90('0xe')](_0x53d2d3[_0x3b90('0x2d')]);if(_0x1a2592[_0x3b90('0x37')]>0x0){return _0x3c29e0[_0x3b90('0x19')](0x190)[_0x3b90('0x2e')](_0x1a2592);}var _0x5441c4=_0x53d2d3['body'][_0x3b90('0x2f')];var _0x5e5efa=_0x53d2d3[_0x3b90('0x2d')]['sessionId'];var _0x1a6d33=_0x53d2d3['body']['transferNumber'];return getAgent(_0x5441c4)['then'](function(_0x2378ac){logger[_0x3b90('0x31')](_0x3b90('0x39'),_0x2378ac[_0x3b90('0x18')]);emit(util[_0x3b90('0x32')](_0x3b90('0x33'),_0x2378ac[_0x3b90('0x18')]),'webbar:transfer',{'sessionId':_0x5e5efa,'transferNumber':_0x1a6d33});return _0x3c29e0['status'](0xc8)['json']({'error':![],'message':_0x3b90('0x4a')});})[_0x3b90('0x20')](handleError(_0x3c29e0));};
\ No newline at end of file