Built motion from commit e6806ed6.|2.6.0
[motion2.git] / server / api / webbar / webbar.controller.js
index fe5520c..b5dc261 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1a35=['handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','User','agent','all','filter','rows','UserId','length','\x20not\x20found!','originate','originate\x20fired:','body','validate','json','userId','callNumber','callbackUrl','entityFound:','user:%s','originate\x20executed!','sessionId','format','webbar:hangup','hangup\x20executed!','hold\x20fired:','catch','unhold','webbar:unhold','unhold\x20executed!','VoiceChannels','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x1a35,0x102));var _0x51a3=function(_0x40a909,_0x31d6d4){_0x40a909=_0x40a909-0x0;var _0x25f06f=_0x1a35[_0x40a909];return _0x25f06f;};'use strict';var path=require(_0x51a3('0x0'));var fs=require('fs');var _=require(_0x51a3('0x1'));var db=require(_0x51a3('0x2'))['db'];var config=require(_0x51a3('0x3'));var util=require('util');var BPromise=require(_0x51a3('0x4'));var jayson=require(_0x51a3('0x5'));var amiClient=jayson[_0x51a3('0x6')]['http']({'port':0x232a});var logger=require(_0x51a3('0x7'))(_0x51a3('0x8'));var Redis=require(_0x51a3('0x9'));config[_0x51a3('0xa')]=_[_0x51a3('0xb')](config[_0x51a3('0xa')],{'host':_0x51a3('0xc'),'port':0x18eb});var io=require(_0x51a3('0xd'))(new Redis(config[_0x51a3('0xa')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x51a3('0xe'),'required':[!![],_0x51a3('0xf')]},'callNumber':{'type':_0x51a3('0x10'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x51a3('0x10')},'callbackUrl':{'type':_0x51a3('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0x51a3('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x51a3('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x51a3('0xf')]},'sessionId':{'type':'string','required':[!![],_0x51a3('0x11')]}});var transferValidation=new Schema({'userId':{'type':_0x51a3('0xe'),'required':[!![],_0x51a3('0xf')]},'sessionId':{'type':_0x51a3('0x10'),'required':[!![],_0x51a3('0x11')]},'transferNumber':{'type':_0x51a3('0x10'),'required':[!![],_0x51a3('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x51a3('0xe'),'required':[!![],_0x51a3('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x51a3('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x51a3('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x51a3('0xe'),'required':[!![],_0x51a3('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x51a3('0xe'),'required':[!![],_0x51a3('0xf')]}});function emit(_0x735b7c,_0x4a986b,_0x30ae28){logger[_0x51a3('0x13')](_0x735b7c,_0x4a986b,JSON[_0x51a3('0x14')](_0x30ae28));io['to'](_0x735b7c)['emit'](_0x4a986b,_0x30ae28);}function handleError(_0x43c631){return function(_0x257019){console[_0x51a3('0x15')](_0x51a3('0x16'),_0x257019,_0x257019 instanceof RangeError);logger[_0x51a3('0x17')](_0x257019[_0x51a3('0x18')]);if(_0x257019 instanceof RangeError){if(_0x257019[_0x51a3('0x19')]){delete _0x257019['name'];}_0x43c631['status'](0x194)['send'](_0x257019);}else{if(_0x257019[_0x51a3('0x19')]){delete _0x257019['name'];}_0x43c631[_0x51a3('0x1a')](0x1f4)[_0x51a3('0x1b')](_0x257019);}};}function checkError(){return function(_0x325b94){if(!_0x325b94){throw new RangeError(_0x51a3('0x1c'));}return _0x325b94;};}function respondWithRpcPromise(_0x1ae722,_0x5292c8){return new BPromise(function(_0x24f7d6,_0x987a9e){var _0x4fe0c5=amiClient;return _0x4fe0c5[_0x51a3('0x1d')](_0x1ae722,_0x5292c8)[_0x51a3('0x1e')](function(_0x1f1723){if(_0x1f1723[_0x51a3('0x17')]){if(_0x1f1723[_0x51a3('0x17')][_0x51a3('0x1f')]===0x1f4){return _0x987a9e(_0x1f1723['error']['message']);}return _0x24f7d6(_0x1f1723['error'][_0x51a3('0x20')]);}else{_0x24f7d6(_0x1f1723[_0x51a3('0x21')]);}})['catch'](function(_0x3c8624){_0x987a9e(_0x3c8624);});});}function getAgent(_0xb326df){return db[_0x51a3('0x22')]['findOne']({'where':{'id':_0xb326df,'role':_0x51a3('0x23')}})[_0x51a3('0x1e')](checkError());}function getAgentCheckSession(_0x4a0a80,_0x5a8b44){return new BPromise(function(_0x2ce41e,_0x4bc617){var _0x1d4685=respondWithRpcPromise('VoiceChannels');var _0x15d5cd=getAgent(_0x4a0a80);Promise[_0x51a3('0x24')]([_0x1d4685,_0x15d5cd])[_0x51a3('0x1e')](function(_0x4a20eb){var _0x594b0e=_0x4a20eb[0x0];var _0x53a36a=_0x4a20eb[0x1];var _0x14b982=_[_0x51a3('0x25')](_0x594b0e[_0x51a3('0x26')],function(_0x5a3660){return _0x5a3660[_0x51a3('0x27')]==_0x53a36a['id']&&_0x5a3660['sessionId']==_0x5a8b44;});if(_0x14b982[_0x51a3('0x28')]==0x1){_0x2ce41e(_0x53a36a);}else{_0x4bc617(new RangeError('sessionId\x20'+_0x5a8b44+_0x51a3('0x29')));}});});}exports[_0x51a3('0x2a')]=function(_0x3eb8c0,_0x1ee527){logger[_0x51a3('0x13')](_0x51a3('0x2b'),_0x3eb8c0[_0x51a3('0x2c')]);var _0x154bfb=originateValidation[_0x51a3('0x2d')](_0x3eb8c0[_0x51a3('0x2c')]);if(_0x154bfb['length']>0x0){return _0x1ee527[_0x51a3('0x1a')](0x190)[_0x51a3('0x2e')](_0x154bfb);}var _0x434f5d=_0x3eb8c0[_0x51a3('0x2c')][_0x51a3('0x2f')];var _0x181763=_0x3eb8c0[_0x51a3('0x2c')][_0x51a3('0x30')];var _0x99707b=_0x3eb8c0[_0x51a3('0x2c')]['callerId'];var _0x31a752=_0x3eb8c0[_0x51a3('0x2c')][_0x51a3('0x31')];return getAgent(_0x434f5d)[_0x51a3('0x1e')](function(_0x55813c){logger[_0x51a3('0x13')](_0x51a3('0x32'),_0x55813c[_0x51a3('0x19')]);emit(util['format'](_0x51a3('0x33'),_0x55813c[_0x51a3('0x19')]),'webbar:originate',{'callNumber':_0x181763,'callerId':_0x99707b,'callbackUrl':_0x31a752});return _0x1ee527[_0x51a3('0x1a')](0xc8)[_0x51a3('0x2e')]({'error':![],'message':_0x51a3('0x34')});})['catch'](handleError(_0x1ee527));};exports['hangup']=function(_0xefe6d3,_0x2f8cd0){logger[_0x51a3('0x13')]('hangup\x20fired:',_0xefe6d3['body']);var _0x51bfbf=hangupValidation[_0x51a3('0x2d')](_0xefe6d3[_0x51a3('0x2c')]);if(_0x51bfbf['length']>0x0){return _0x2f8cd0[_0x51a3('0x1a')](0x190)[_0x51a3('0x2e')](_0x51bfbf);}var _0x1e0ed9=_0xefe6d3[_0x51a3('0x2c')][_0x51a3('0x2f')];var _0x16711b=_0xefe6d3[_0x51a3('0x2c')][_0x51a3('0x35')];return getAgent(_0x1e0ed9)[_0x51a3('0x1e')](function(_0x3e2ec9){logger[_0x51a3('0x13')](_0x51a3('0x32'),_0x3e2ec9[_0x51a3('0x19')]);emit(util[_0x51a3('0x36')](_0x51a3('0x33'),_0x3e2ec9[_0x51a3('0x19')]),_0x51a3('0x37'),{'sessionId':_0x16711b});return _0x2f8cd0[_0x51a3('0x1a')](0xc8)[_0x51a3('0x2e')]({'error':![],'message':_0x51a3('0x38')});})['catch'](handleError(_0x2f8cd0));};exports['answer']=function(_0x43f33a,_0x49fbe5){logger[_0x51a3('0x13')]('answer\x20fired:',_0x43f33a[_0x51a3('0x2c')]);var _0x52c54f=answerValidation['validate'](_0x43f33a[_0x51a3('0x2c')]);if(_0x52c54f[_0x51a3('0x28')]>0x0){return _0x49fbe5[_0x51a3('0x1a')](0x190)[_0x51a3('0x2e')](_0x52c54f);}var _0x4d69ab=_0x43f33a[_0x51a3('0x2c')][_0x51a3('0x2f')];var _0x39be90=_0x43f33a['body']['sessionId'];return getAgent(_0x4d69ab)[_0x51a3('0x1e')](function(_0x42d70d){logger[_0x51a3('0x13')](_0x51a3('0x32'),_0x42d70d[_0x51a3('0x19')]);emit(util[_0x51a3('0x36')](_0x51a3('0x33'),_0x42d70d[_0x51a3('0x19')]),'webbar:answer',{'sessionId':_0x39be90});return _0x49fbe5[_0x51a3('0x1a')](0xc8)[_0x51a3('0x2e')]({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0x49fbe5));};exports['hold']=function(_0x4b5d4d,_0x58fbe7){logger[_0x51a3('0x13')](_0x51a3('0x39'),_0x4b5d4d[_0x51a3('0x2c')]);var _0x33fbc9=holdValidation['validate'](_0x4b5d4d[_0x51a3('0x2c')]);if(_0x33fbc9[_0x51a3('0x28')]>0x0){return _0x58fbe7[_0x51a3('0x1a')](0x190)[_0x51a3('0x2e')](_0x33fbc9);}var _0xa1a207=_0x4b5d4d[_0x51a3('0x2c')][_0x51a3('0x2f')];var _0x1a7a02=_0x4b5d4d[_0x51a3('0x2c')][_0x51a3('0x35')];return getAgent(_0xa1a207)[_0x51a3('0x1e')](function(_0x25ac86){logger[_0x51a3('0x13')](_0x51a3('0x32'),_0x25ac86[_0x51a3('0x19')]);emit(util['format']('user:%s',_0x25ac86[_0x51a3('0x19')]),'webbar:hold',{'sessionId':_0x1a7a02});return _0x58fbe7[_0x51a3('0x1a')](0xc8)[_0x51a3('0x2e')]({'error':![],'message':'hold\x20executed!'});})[_0x51a3('0x3a')](handleError(_0x58fbe7));};exports[_0x51a3('0x3b')]=function(_0x487c61,_0x123328){logger[_0x51a3('0x13')]('unhold\x20fired:',_0x487c61['body']);var _0x905f98=unholdValidation[_0x51a3('0x2d')](_0x487c61[_0x51a3('0x2c')]);if(_0x905f98[_0x51a3('0x28')]>0x0){return _0x123328[_0x51a3('0x1a')](0x190)[_0x51a3('0x2e')](_0x905f98);}var _0x1d1fd9=_0x487c61[_0x51a3('0x2c')][_0x51a3('0x2f')];var _0x5616d4=_0x487c61['body']['sessionId'];return getAgent(_0x1d1fd9)[_0x51a3('0x1e')](function(_0x1fe8c9){logger['info'](_0x51a3('0x32'),_0x1fe8c9['name']);emit(util[_0x51a3('0x36')](_0x51a3('0x33'),_0x1fe8c9[_0x51a3('0x19')]),_0x51a3('0x3c'),{'sessionId':_0x5616d4});return _0x123328[_0x51a3('0x1a')](0xc8)[_0x51a3('0x2e')]({'error':![],'message':_0x51a3('0x3d')});})[_0x51a3('0x3a')](handleError(_0x123328));};exports['calls']=function(_0x1c48ad,_0x2120f0){logger[_0x51a3('0x13')]('calls\x20fired:',_0x2120f0[_0x51a3('0x2c')]);var _0x1dce11=callsValidation['validate'](_0x1c48ad[_0x51a3('0x2c')]);if(_0x1dce11[_0x51a3('0x28')]>0x0){return _0x2120f0[_0x51a3('0x1a')](0x190)[_0x51a3('0x2e')](_0x1dce11);}var _0x3fff3a=_0x1c48ad[_0x51a3('0x2c')][_0x51a3('0x2f')];var _0x5d260e=respondWithRpcPromise(_0x51a3('0x3e'));var _0x2ed051=getAgent(_0x3fff3a);return Promise[_0x51a3('0x24')]([_0x5d260e,_0x2ed051])[_0x51a3('0x1e')](function(_0x235fef){var _0x105575=_0x235fef[0x0];var _0x5d9315=_0x235fef[0x1];var _0x2e03bf=_[_0x51a3('0x25')](_0x105575[_0x51a3('0x26')],function(_0x35b02e){return _0x35b02e[_0x51a3('0x27')]==_0x5d9315['id'];});return _0x2120f0[_0x51a3('0x1a')](0xc8)[_0x51a3('0x2e')]({'count':_0x2e03bf['length'],'rows':_0x2e03bf});})['catch'](handleError(_0x2120f0));};exports[_0x51a3('0x3f')]=function(_0x1d6ff4,_0x37275e){logger['info'](_0x51a3('0x40'),_0x1d6ff4[_0x51a3('0x2c')]);var _0x10220e=conferenceValidation[_0x51a3('0x2d')](_0x1d6ff4[_0x51a3('0x2c')]);if(_0x10220e['length']>0x0){return _0x37275e[_0x51a3('0x1a')](0x190)[_0x51a3('0x2e')](_0x10220e);}var _0x28180f=_0x1d6ff4[_0x51a3('0x2c')]['userId'];return getAgent(_0x28180f)[_0x51a3('0x1e')](function(_0x1de406){logger[_0x51a3('0x13')](_0x51a3('0x32'),_0x1de406[_0x51a3('0x19')]);emit(util[_0x51a3('0x36')]('user:%s',_0x1de406[_0x51a3('0x19')]),'webbar:conference');return _0x37275e['status'](0xc8)[_0x51a3('0x2e')]({'error':![],'message':_0x51a3('0x41')});})[_0x51a3('0x3a')](handleError(_0x37275e));};exports[_0x51a3('0x42')]=function(_0x3027ed,_0x41a5bc){logger[_0x51a3('0x13')](_0x51a3('0x43'),_0x3027ed[_0x51a3('0x2c')]);var _0x38d206=transferValidation[_0x51a3('0x2d')](_0x3027ed[_0x51a3('0x2c')]);if(_0x38d206[_0x51a3('0x28')]>0x0){return _0x41a5bc['status'](0x190)[_0x51a3('0x2e')](_0x38d206);}var _0x5820d3=_0x3027ed[_0x51a3('0x2c')][_0x51a3('0x2f')];var _0x12da55=_0x3027ed[_0x51a3('0x2c')]['sessionId'];var _0x1c9524=_0x3027ed[_0x51a3('0x2c')][_0x51a3('0x44')];return getAgent(_0x5820d3)[_0x51a3('0x1e')](function(_0x2997af){logger[_0x51a3('0x13')](_0x51a3('0x32'),_0x2997af[_0x51a3('0x19')]);emit(util[_0x51a3('0x36')](_0x51a3('0x33'),_0x2997af[_0x51a3('0x19')]),_0x51a3('0x45'),{'sessionId':_0x12da55,'transferNumber':_0x1c9524});return _0x41a5bc[_0x51a3('0x1a')](0xc8)[_0x51a3('0x2e')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x41a5bc));};
\ No newline at end of file
+var _0x37f8=['string','callNumber\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','handleError:','error','stack','name','send','status','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','\x20not\x20found!','originate','originate\x20fired:','length','json','body','callbackUrl','entityFound:','format','user:%s','hangup','hangup\x20fired:','sessionId','info','hangup\x20executed!','answer','answer\x20fired:','userId','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','webbar:transfer','lodash','../../mysqldb','../../config/environment','util','jayson/promise','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required'];(function(_0x34eabc,_0x51d411){var _0x43e72f=function(_0x5619e8){while(--_0x5619e8){_0x34eabc['push'](_0x34eabc['shift']());}};_0x43e72f(++_0x51d411);}(_0x37f8,0xd2));var _0x837f=function(_0xced668,_0x2396b2){_0xced668=_0xced668-0x0;var _0x3bfd62=_0x37f8[_0xced668];return _0x3bfd62;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x837f('0x0'));var db=require(_0x837f('0x1'))['db'];var config=require(_0x837f('0x2'));var util=require(_0x837f('0x3'));var BPromise=require('bluebird');var jayson=require(_0x837f('0x4'));var amiClient=jayson['client']['http']({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require('ioredis');config[_0x837f('0x5')]=_[_0x837f('0x6')](config[_0x837f('0x5')],{'host':_0x837f('0x7'),'port':0x18eb});var io=require(_0x837f('0x8'))(new Redis(config[_0x837f('0x5')]));var Schema=require(_0x837f('0x9'));var originateValidation=new Schema({'userId':{'type':_0x837f('0xa'),'required':[!![],_0x837f('0xb')]},'callNumber':{'type':_0x837f('0xc'),'required':[!![],_0x837f('0xd')]},'callerId':{'type':_0x837f('0xc')},'callbackUrl':{'type':_0x837f('0xc')}});var hangupValidation=new Schema({'userId':{'type':_0x837f('0xa'),'required':[!![],_0x837f('0xb')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x837f('0xa'),'required':[!![],_0x837f('0xb')]},'sessionId':{'type':_0x837f('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x837f('0xa'),'required':[!![],_0x837f('0xb')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x837f('0xc'),'required':[!![],_0x837f('0xe')]}});var holdValidation=new Schema({'userId':{'type':_0x837f('0xa'),'required':[!![],_0x837f('0xb')]},'sessionId':{'type':_0x837f('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x837f('0xb')]},'sessionId':{'type':_0x837f('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x837f('0xa'),'required':[!![],_0x837f('0xb')]}});var conferenceValidation=new Schema({'userId':{'type':_0x837f('0xa'),'required':[!![],_0x837f('0xb')]}});function emit(_0x546352,_0x11f37a,_0x2f2617){logger['info'](_0x546352,_0x11f37a,JSON[_0x837f('0xf')](_0x2f2617));io['to'](_0x546352)[_0x837f('0x10')](_0x11f37a,_0x2f2617);}function handleError(_0x28baaf){return function(_0x1d17b3){console['log'](_0x837f('0x11'),_0x1d17b3,_0x1d17b3 instanceof RangeError);logger[_0x837f('0x12')](_0x1d17b3[_0x837f('0x13')]);if(_0x1d17b3 instanceof RangeError){if(_0x1d17b3[_0x837f('0x14')]){delete _0x1d17b3[_0x837f('0x14')];}_0x28baaf['status'](0x194)[_0x837f('0x15')](_0x1d17b3);}else{if(_0x1d17b3[_0x837f('0x14')]){delete _0x1d17b3[_0x837f('0x14')];}_0x28baaf[_0x837f('0x16')](0x1f4)[_0x837f('0x15')](_0x1d17b3);}};}function checkError(){return function(_0x55dc1e){if(!_0x55dc1e){throw new RangeError(_0x837f('0x17'));}return _0x55dc1e;};}function respondWithRpcPromise(_0x37d7e0,_0x287c6e){return new BPromise(function(_0xe68eb1,_0xa0af78){var _0x237656=amiClient;return _0x237656[_0x837f('0x18')](_0x37d7e0,_0x287c6e)[_0x837f('0x19')](function(_0x11a9b3){if(_0x11a9b3[_0x837f('0x12')]){if(_0x11a9b3[_0x837f('0x12')][_0x837f('0x1a')]===0x1f4){return _0xa0af78(_0x11a9b3[_0x837f('0x12')][_0x837f('0x1b')]);}return _0xe68eb1(_0x11a9b3[_0x837f('0x12')][_0x837f('0x1b')]);}else{_0xe68eb1(_0x11a9b3[_0x837f('0x1c')]);}})[_0x837f('0x1d')](function(_0x1a6f26){_0xa0af78(_0x1a6f26);});});}function getAgent(_0x3af34f){return db[_0x837f('0x1e')][_0x837f('0x1f')]({'where':{'id':_0x3af34f,'role':_0x837f('0x20')}})['then'](checkError());}function getAgentCheckSession(_0x3f467d,_0x2df32d){return new BPromise(function(_0x4290e6,_0x5d7af3){var _0x530f6d=respondWithRpcPromise(_0x837f('0x21'));var _0x1ab2e4=getAgent(_0x3f467d);Promise[_0x837f('0x22')]([_0x530f6d,_0x1ab2e4])[_0x837f('0x19')](function(_0x30a3d9){var _0x387533=_0x30a3d9[0x0];var _0x323565=_0x30a3d9[0x1];var _0x507984=_[_0x837f('0x23')](_0x387533[_0x837f('0x24')],function(_0x266871){return _0x266871[_0x837f('0x25')]==_0x323565['id']&&_0x266871['sessionId']==_0x2df32d;});if(_0x507984['length']==0x1){_0x4290e6(_0x323565);}else{_0x5d7af3(new RangeError('sessionId\x20'+_0x2df32d+_0x837f('0x26')));}});});}exports[_0x837f('0x27')]=function(_0x2f6ab5,_0x422498){logger['info'](_0x837f('0x28'),_0x2f6ab5['body']);var _0x3997ab=originateValidation['validate'](_0x2f6ab5['body']);if(_0x3997ab[_0x837f('0x29')]>0x0){return _0x422498[_0x837f('0x16')](0x190)[_0x837f('0x2a')](_0x3997ab);}var _0x5200a9=_0x2f6ab5[_0x837f('0x2b')]['userId'];var _0x56ddfc=_0x2f6ab5[_0x837f('0x2b')]['callNumber'];var _0x2c3337=_0x2f6ab5[_0x837f('0x2b')]['callerId'];var _0x245342=_0x2f6ab5[_0x837f('0x2b')][_0x837f('0x2c')];return getAgent(_0x5200a9)[_0x837f('0x19')](function(_0x26bde0){logger['info'](_0x837f('0x2d'),_0x26bde0[_0x837f('0x14')]);emit(util[_0x837f('0x2e')](_0x837f('0x2f'),_0x26bde0[_0x837f('0x14')]),'webbar:originate',{'callNumber':_0x56ddfc,'callerId':_0x2c3337,'callbackUrl':_0x245342});return _0x422498['status'](0xc8)[_0x837f('0x2a')]({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x422498));};exports[_0x837f('0x30')]=function(_0x1c7352,_0x554b11){logger['info'](_0x837f('0x31'),_0x1c7352[_0x837f('0x2b')]);var _0x1e0584=hangupValidation['validate'](_0x1c7352[_0x837f('0x2b')]);if(_0x1e0584[_0x837f('0x29')]>0x0){return _0x554b11[_0x837f('0x16')](0x190)[_0x837f('0x2a')](_0x1e0584);}var _0x2ed1de=_0x1c7352['body']['userId'];var _0x3a9566=_0x1c7352[_0x837f('0x2b')][_0x837f('0x32')];return getAgent(_0x2ed1de)['then'](function(_0x5e001c){logger[_0x837f('0x33')](_0x837f('0x2d'),_0x5e001c[_0x837f('0x14')]);emit(util['format'](_0x837f('0x2f'),_0x5e001c[_0x837f('0x14')]),'webbar:hangup',{'sessionId':_0x3a9566});return _0x554b11['status'](0xc8)['json']({'error':![],'message':_0x837f('0x34')});})[_0x837f('0x1d')](handleError(_0x554b11));};exports[_0x837f('0x35')]=function(_0x4591db,_0x15e50d){logger[_0x837f('0x33')](_0x837f('0x36'),_0x4591db[_0x837f('0x2b')]);var _0xdbd892=answerValidation[_0x837f('0x9')](_0x4591db['body']);if(_0xdbd892[_0x837f('0x29')]>0x0){return _0x15e50d[_0x837f('0x16')](0x190)['json'](_0xdbd892);}var _0xc2e307=_0x4591db[_0x837f('0x2b')][_0x837f('0x37')];var _0x443e7c=_0x4591db[_0x837f('0x2b')][_0x837f('0x32')];return getAgent(_0xc2e307)['then'](function(_0x24c03c){logger[_0x837f('0x33')](_0x837f('0x2d'),_0x24c03c[_0x837f('0x14')]);emit(util[_0x837f('0x2e')](_0x837f('0x2f'),_0x24c03c[_0x837f('0x14')]),_0x837f('0x38'),{'sessionId':_0x443e7c});return _0x15e50d['status'](0xc8)[_0x837f('0x2a')]({'error':![],'message':_0x837f('0x39')});})['catch'](handleError(_0x15e50d));};exports[_0x837f('0x3a')]=function(_0x400ccd,_0x5ce967){logger[_0x837f('0x33')](_0x837f('0x3b'),_0x400ccd[_0x837f('0x2b')]);var _0x45af4a=holdValidation[_0x837f('0x9')](_0x400ccd[_0x837f('0x2b')]);if(_0x45af4a['length']>0x0){return _0x5ce967[_0x837f('0x16')](0x190)['json'](_0x45af4a);}var _0x1146ef=_0x400ccd[_0x837f('0x2b')][_0x837f('0x37')];var _0x39ce8b=_0x400ccd[_0x837f('0x2b')][_0x837f('0x32')];return getAgent(_0x1146ef)['then'](function(_0x554f74){logger['info'](_0x837f('0x2d'),_0x554f74[_0x837f('0x14')]);emit(util['format'](_0x837f('0x2f'),_0x554f74['name']),_0x837f('0x3c'),{'sessionId':_0x39ce8b});return _0x5ce967[_0x837f('0x16')](0xc8)[_0x837f('0x2a')]({'error':![],'message':_0x837f('0x3d')});})[_0x837f('0x1d')](handleError(_0x5ce967));};exports[_0x837f('0x3e')]=function(_0x4d9156,_0x23406b){logger['info'](_0x837f('0x3f'),_0x4d9156[_0x837f('0x2b')]);var _0x3734a6=unholdValidation['validate'](_0x4d9156[_0x837f('0x2b')]);if(_0x3734a6[_0x837f('0x29')]>0x0){return _0x23406b[_0x837f('0x16')](0x190)[_0x837f('0x2a')](_0x3734a6);}var _0x1dec94=_0x4d9156[_0x837f('0x2b')]['userId'];var _0x5446d8=_0x4d9156[_0x837f('0x2b')][_0x837f('0x32')];return getAgent(_0x1dec94)[_0x837f('0x19')](function(_0x4c36f0){logger[_0x837f('0x33')]('entityFound:',_0x4c36f0[_0x837f('0x14')]);emit(util['format'](_0x837f('0x2f'),_0x4c36f0[_0x837f('0x14')]),_0x837f('0x40'),{'sessionId':_0x5446d8});return _0x23406b[_0x837f('0x16')](0xc8)[_0x837f('0x2a')]({'error':![],'message':_0x837f('0x41')});})[_0x837f('0x1d')](handleError(_0x23406b));};exports[_0x837f('0x42')]=function(_0x2322d8,_0x3b9899){logger[_0x837f('0x33')](_0x837f('0x43'),_0x3b9899['body']);var _0x4ade1b=callsValidation[_0x837f('0x9')](_0x2322d8['body']);if(_0x4ade1b[_0x837f('0x29')]>0x0){return _0x3b9899[_0x837f('0x16')](0x190)[_0x837f('0x2a')](_0x4ade1b);}var _0x11bde4=_0x2322d8[_0x837f('0x2b')][_0x837f('0x37')];var _0x438d93=respondWithRpcPromise(_0x837f('0x21'));var _0x145e5d=getAgent(_0x11bde4);return Promise[_0x837f('0x22')]([_0x438d93,_0x145e5d])[_0x837f('0x19')](function(_0x13d01a){var _0x2b528a=_0x13d01a[0x0];var _0x48440f=_0x13d01a[0x1];var _0x476acd=_[_0x837f('0x23')](_0x2b528a[_0x837f('0x24')],function(_0x5acfab){return _0x5acfab[_0x837f('0x25')]==_0x48440f['id'];});return _0x3b9899[_0x837f('0x16')](0xc8)[_0x837f('0x2a')]({'count':_0x476acd[_0x837f('0x29')],'rows':_0x476acd});})[_0x837f('0x1d')](handleError(_0x3b9899));};exports[_0x837f('0x44')]=function(_0x536075,_0x48fa74){logger[_0x837f('0x33')](_0x837f('0x45'),_0x536075[_0x837f('0x2b')]);var _0x5a2868=conferenceValidation[_0x837f('0x9')](_0x536075[_0x837f('0x2b')]);if(_0x5a2868[_0x837f('0x29')]>0x0){return _0x48fa74[_0x837f('0x16')](0x190)['json'](_0x5a2868);}var _0x35f2f3=_0x536075[_0x837f('0x2b')][_0x837f('0x37')];return getAgent(_0x35f2f3)['then'](function(_0x53c966){logger['info'](_0x837f('0x2d'),_0x53c966[_0x837f('0x14')]);emit(util[_0x837f('0x2e')](_0x837f('0x2f'),_0x53c966[_0x837f('0x14')]),_0x837f('0x46'));return _0x48fa74[_0x837f('0x16')](0xc8)[_0x837f('0x2a')]({'error':![],'message':_0x837f('0x47')});})[_0x837f('0x1d')](handleError(_0x48fa74));};exports[_0x837f('0x48')]=function(_0x1022a7,_0x1b6747){logger[_0x837f('0x33')]('transfer\x20fired:',_0x1022a7['body']);var _0x50a01e=transferValidation[_0x837f('0x9')](_0x1022a7[_0x837f('0x2b')]);if(_0x50a01e[_0x837f('0x29')]>0x0){return _0x1b6747[_0x837f('0x16')](0x190)[_0x837f('0x2a')](_0x50a01e);}var _0xf00bc5=_0x1022a7['body'][_0x837f('0x37')];var _0x239981=_0x1022a7['body'][_0x837f('0x32')];var _0x1d43f6=_0x1022a7[_0x837f('0x2b')]['transferNumber'];return getAgent(_0xf00bc5)[_0x837f('0x19')](function(_0x365bff){logger[_0x837f('0x33')]('entityFound:',_0x365bff['name']);emit(util[_0x837f('0x2e')]('user:%s',_0x365bff[_0x837f('0x14')]),_0x837f('0x49'),{'sessionId':_0x239981,'transferNumber':_0x1d43f6});return _0x1b6747[_0x837f('0x16')](0xc8)[_0x837f('0x2a')]({'error':![],'message':'transfer\x20executed!'});})[_0x837f('0x1d')](handleError(_0x1b6747));};
\ No newline at end of file