Built motion from commit e6806ed6.|2.6.0
[motion2.git] / server / api / webbar / webbar.controller.js
index d607fb0..b5dc261 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4ab0=['number','userId\x20is\x20required','string','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','message','result','catch','User','agent','then','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','callNumber','callerId','callbackUrl','format','user:%s','webbar:originate','json','originate\x20executed!','hangup','hangup\x20fired:','userId','entityFound:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird','http','../../config/logger','ioredis','redis','localhost','socket.io-emitter','validate'];(function(_0x422baa,_0x98d34a){var _0x31c810=function(_0xa554fe){while(--_0xa554fe){_0x422baa['push'](_0x422baa['shift']());}};_0x31c810(++_0x98d34a);}(_0x4ab0,0xd5));var _0x04ab=function(_0x1513c6,_0x164e02){_0x1513c6=_0x1513c6-0x0;var _0x5cc8d7=_0x4ab0[_0x1513c6];return _0x5cc8d7;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x04ab('0x0'));var db=require(_0x04ab('0x1'))['db'];var config=require(_0x04ab('0x2'));var util=require(_0x04ab('0x3'));var BPromise=require(_0x04ab('0x4'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x04ab('0x5')]({'port':0x232a});var logger=require(_0x04ab('0x6'))('webbarapi');var Redis=require(_0x04ab('0x7'));config[_0x04ab('0x8')]=_['defaults'](config[_0x04ab('0x8')],{'host':_0x04ab('0x9'),'port':0x18eb});var io=require(_0x04ab('0xa'))(new Redis(config['redis']));var Schema=require(_0x04ab('0xb'));var originateValidation=new Schema({'userId':{'type':_0x04ab('0xc'),'required':[!![],_0x04ab('0xd')]},'callNumber':{'type':_0x04ab('0xe'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x04ab('0xe')},'callbackUrl':{'type':_0x04ab('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x04ab('0xc'),'required':[!![],_0x04ab('0xd')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x04ab('0xc'),'required':[!![],_0x04ab('0xd')]},'sessionId':{'type':_0x04ab('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x04ab('0xc'),'required':[!![],_0x04ab('0xd')]},'sessionId':{'type':_0x04ab('0xe'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x04ab('0xe'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x04ab('0xc'),'required':[!![],_0x04ab('0xd')]},'sessionId':{'type':_0x04ab('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x04ab('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x04ab('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0x04ab('0xc'),'required':[!![],_0x04ab('0xd')]}});function emit(_0x2b10b0,_0x16d633,_0x3e9a05){logger[_0x04ab('0xf')](_0x2b10b0,_0x16d633,JSON[_0x04ab('0x10')](_0x3e9a05));io['to'](_0x2b10b0)[_0x04ab('0x11')](_0x16d633,_0x3e9a05);}function handleError(_0x205600){return function(_0x5ce43c){console[_0x04ab('0x12')](_0x04ab('0x13'),_0x5ce43c,_0x5ce43c instanceof RangeError);logger[_0x04ab('0x14')](_0x5ce43c[_0x04ab('0x15')]);if(_0x5ce43c instanceof RangeError){if(_0x5ce43c[_0x04ab('0x16')]){delete _0x5ce43c[_0x04ab('0x16')];}_0x205600[_0x04ab('0x17')](0x194)[_0x04ab('0x18')](_0x5ce43c);}else{if(_0x5ce43c[_0x04ab('0x16')]){delete _0x5ce43c['name'];}_0x205600[_0x04ab('0x17')](0x1f4)['send'](_0x5ce43c);}};}function checkError(){return function(_0x412b52){if(!_0x412b52){throw new RangeError(_0x04ab('0x19'));}return _0x412b52;};}function respondWithRpcPromise(_0x15236a,_0x4f5499){return new BPromise(function(_0x15a36b,_0x1c08f4){var _0xf6275e=amiClient;return _0xf6275e['request'](_0x15236a,_0x4f5499)['then'](function(_0xc8358e){if(_0xc8358e[_0x04ab('0x14')]){if(_0xc8358e['error']['code']===0x1f4){return _0x1c08f4(_0xc8358e[_0x04ab('0x14')][_0x04ab('0x1a')]);}return _0x15a36b(_0xc8358e[_0x04ab('0x14')][_0x04ab('0x1a')]);}else{_0x15a36b(_0xc8358e[_0x04ab('0x1b')]);}})[_0x04ab('0x1c')](function(_0x21d9b7){_0x1c08f4(_0x21d9b7);});});}function getAgent(_0x46cec5){return db[_0x04ab('0x1d')]['findOne']({'where':{'id':_0x46cec5,'role':_0x04ab('0x1e')}})[_0x04ab('0x1f')](checkError());}function getAgentCheckSession(_0x115fa6,_0x9ea90c){return new BPromise(function(_0x590c28,_0x530a1c){var _0x2a498b=respondWithRpcPromise('VoiceChannels');var _0x404eae=getAgent(_0x115fa6);Promise[_0x04ab('0x20')]([_0x2a498b,_0x404eae])[_0x04ab('0x1f')](function(_0x3c25fb){var _0x12385b=_0x3c25fb[0x0];var _0x5596fc=_0x3c25fb[0x1];var _0x47f9be=_[_0x04ab('0x21')](_0x12385b[_0x04ab('0x22')],function(_0x28e77b){return _0x28e77b[_0x04ab('0x23')]==_0x5596fc['id']&&_0x28e77b[_0x04ab('0x24')]==_0x9ea90c;});if(_0x47f9be[_0x04ab('0x25')]==0x1){_0x590c28(_0x5596fc);}else{_0x530a1c(new RangeError(_0x04ab('0x26')+_0x9ea90c+_0x04ab('0x27')));}});});}exports[_0x04ab('0x28')]=function(_0x766754,_0x1d2e50){logger[_0x04ab('0xf')](_0x04ab('0x29'),_0x766754['body']);var _0x38c7f3=originateValidation[_0x04ab('0xb')](_0x766754['body']);if(_0x38c7f3[_0x04ab('0x25')]>0x0){return _0x1d2e50[_0x04ab('0x17')](0x190)['json'](_0x38c7f3);}var _0x45ee8c=_0x766754[_0x04ab('0x2a')]['userId'];var _0x69e081=_0x766754[_0x04ab('0x2a')][_0x04ab('0x2b')];var _0x3b61d0=_0x766754[_0x04ab('0x2a')][_0x04ab('0x2c')];var _0x538cf7=_0x766754[_0x04ab('0x2a')][_0x04ab('0x2d')];return getAgent(_0x45ee8c)[_0x04ab('0x1f')](function(_0x4fb442){logger[_0x04ab('0xf')]('entityFound:',_0x4fb442['name']);emit(util[_0x04ab('0x2e')](_0x04ab('0x2f'),_0x4fb442['name']),_0x04ab('0x30'),{'callNumber':_0x69e081,'callerId':_0x3b61d0,'callbackUrl':_0x538cf7});return _0x1d2e50['status'](0xc8)[_0x04ab('0x31')]({'error':![],'message':_0x04ab('0x32')});})[_0x04ab('0x1c')](handleError(_0x1d2e50));};exports[_0x04ab('0x33')]=function(_0x1c3a2c,_0x4018fa){logger[_0x04ab('0xf')](_0x04ab('0x34'),_0x1c3a2c[_0x04ab('0x2a')]);var _0x4783c9=hangupValidation[_0x04ab('0xb')](_0x1c3a2c[_0x04ab('0x2a')]);if(_0x4783c9['length']>0x0){return _0x4018fa[_0x04ab('0x17')](0x190)[_0x04ab('0x31')](_0x4783c9);}var _0x597c24=_0x1c3a2c['body'][_0x04ab('0x35')];var _0x206f0d=_0x1c3a2c[_0x04ab('0x2a')][_0x04ab('0x24')];return getAgent(_0x597c24)['then'](function(_0x1d7d44){logger[_0x04ab('0xf')](_0x04ab('0x36'),_0x1d7d44[_0x04ab('0x16')]);emit(util['format'](_0x04ab('0x2f'),_0x1d7d44[_0x04ab('0x16')]),_0x04ab('0x37'),{'sessionId':_0x206f0d});return _0x4018fa[_0x04ab('0x17')](0xc8)[_0x04ab('0x31')]({'error':![],'message':_0x04ab('0x38')});})[_0x04ab('0x1c')](handleError(_0x4018fa));};exports[_0x04ab('0x39')]=function(_0x489dfe,_0x52244c){logger[_0x04ab('0xf')](_0x04ab('0x3a'),_0x489dfe[_0x04ab('0x2a')]);var _0x46a7c5=answerValidation[_0x04ab('0xb')](_0x489dfe['body']);if(_0x46a7c5[_0x04ab('0x25')]>0x0){return _0x52244c[_0x04ab('0x17')](0x190)[_0x04ab('0x31')](_0x46a7c5);}var _0x5c8a12=_0x489dfe[_0x04ab('0x2a')][_0x04ab('0x35')];var _0x437f7a=_0x489dfe[_0x04ab('0x2a')][_0x04ab('0x24')];return getAgent(_0x5c8a12)[_0x04ab('0x1f')](function(_0x1bda0d){logger[_0x04ab('0xf')](_0x04ab('0x36'),_0x1bda0d[_0x04ab('0x16')]);emit(util['format'](_0x04ab('0x2f'),_0x1bda0d[_0x04ab('0x16')]),_0x04ab('0x3b'),{'sessionId':_0x437f7a});return _0x52244c[_0x04ab('0x17')](0xc8)[_0x04ab('0x31')]({'error':![],'message':_0x04ab('0x3c')});})['catch'](handleError(_0x52244c));};exports[_0x04ab('0x3d')]=function(_0xc9c74b,_0x18e2a2){logger[_0x04ab('0xf')]('hold\x20fired:',_0xc9c74b[_0x04ab('0x2a')]);var _0x17ce1b=holdValidation[_0x04ab('0xb')](_0xc9c74b[_0x04ab('0x2a')]);if(_0x17ce1b[_0x04ab('0x25')]>0x0){return _0x18e2a2['status'](0x190)[_0x04ab('0x31')](_0x17ce1b);}var _0x15b995=_0xc9c74b['body']['userId'];var _0x42b20f=_0xc9c74b[_0x04ab('0x2a')][_0x04ab('0x24')];return getAgent(_0x15b995)[_0x04ab('0x1f')](function(_0x1c4aa2){logger[_0x04ab('0xf')](_0x04ab('0x36'),_0x1c4aa2['name']);emit(util[_0x04ab('0x2e')](_0x04ab('0x2f'),_0x1c4aa2[_0x04ab('0x16')]),'webbar:hold',{'sessionId':_0x42b20f});return _0x18e2a2[_0x04ab('0x17')](0xc8)[_0x04ab('0x31')]({'error':![],'message':'hold\x20executed!'});})[_0x04ab('0x1c')](handleError(_0x18e2a2));};exports['unhold']=function(_0xc9db25,_0x4bc4f6){logger[_0x04ab('0xf')]('unhold\x20fired:',_0xc9db25['body']);var _0x2952ce=unholdValidation[_0x04ab('0xb')](_0xc9db25[_0x04ab('0x2a')]);if(_0x2952ce['length']>0x0){return _0x4bc4f6['status'](0x190)[_0x04ab('0x31')](_0x2952ce);}var _0x3611dd=_0xc9db25[_0x04ab('0x2a')]['userId'];var _0x2907b1=_0xc9db25['body'][_0x04ab('0x24')];return getAgent(_0x3611dd)[_0x04ab('0x1f')](function(_0x171008){logger['info'](_0x04ab('0x36'),_0x171008[_0x04ab('0x16')]);emit(util[_0x04ab('0x2e')](_0x04ab('0x2f'),_0x171008[_0x04ab('0x16')]),_0x04ab('0x3e'),{'sessionId':_0x2907b1});return _0x4bc4f6[_0x04ab('0x17')](0xc8)[_0x04ab('0x31')]({'error':![],'message':_0x04ab('0x3f')});})[_0x04ab('0x1c')](handleError(_0x4bc4f6));};exports[_0x04ab('0x40')]=function(_0x56b443,_0x3ecf57){logger['info'](_0x04ab('0x41'),_0x3ecf57[_0x04ab('0x2a')]);var _0x5cfa36=callsValidation['validate'](_0x56b443[_0x04ab('0x2a')]);if(_0x5cfa36[_0x04ab('0x25')]>0x0){return _0x3ecf57[_0x04ab('0x17')](0x190)[_0x04ab('0x31')](_0x5cfa36);}var _0x44bb89=_0x56b443[_0x04ab('0x2a')][_0x04ab('0x35')];var _0x466119=respondWithRpcPromise(_0x04ab('0x42'));var _0x4936cf=getAgent(_0x44bb89);return Promise[_0x04ab('0x20')]([_0x466119,_0x4936cf])[_0x04ab('0x1f')](function(_0x1b2b4c){var _0x590cf8=_0x1b2b4c[0x0];var _0x2b7e82=_0x1b2b4c[0x1];var _0x28c06e=_[_0x04ab('0x21')](_0x590cf8['rows'],function(_0x2d60c8){return _0x2d60c8[_0x04ab('0x23')]==_0x2b7e82['id'];});return _0x3ecf57[_0x04ab('0x17')](0xc8)[_0x04ab('0x31')]({'count':_0x28c06e['length'],'rows':_0x28c06e});})[_0x04ab('0x1c')](handleError(_0x3ecf57));};exports['conference']=function(_0x811a23,_0x331b3a){logger['info'](_0x04ab('0x43'),_0x811a23['body']);var _0x387dc8=conferenceValidation[_0x04ab('0xb')](_0x811a23[_0x04ab('0x2a')]);if(_0x387dc8[_0x04ab('0x25')]>0x0){return _0x331b3a['status'](0x190)[_0x04ab('0x31')](_0x387dc8);}var _0x110eaa=_0x811a23[_0x04ab('0x2a')][_0x04ab('0x35')];return getAgent(_0x110eaa)[_0x04ab('0x1f')](function(_0x266f2c){logger[_0x04ab('0xf')](_0x04ab('0x36'),_0x266f2c[_0x04ab('0x16')]);emit(util[_0x04ab('0x2e')](_0x04ab('0x2f'),_0x266f2c[_0x04ab('0x16')]),_0x04ab('0x44'));return _0x331b3a[_0x04ab('0x17')](0xc8)[_0x04ab('0x31')]({'error':![],'message':_0x04ab('0x45')});})[_0x04ab('0x1c')](handleError(_0x331b3a));};exports[_0x04ab('0x46')]=function(_0x18f5c9,_0x40a1eb){logger[_0x04ab('0xf')](_0x04ab('0x47'),_0x18f5c9['body']);var _0x379b90=transferValidation['validate'](_0x18f5c9[_0x04ab('0x2a')]);if(_0x379b90[_0x04ab('0x25')]>0x0){return _0x40a1eb[_0x04ab('0x17')](0x190)['json'](_0x379b90);}var _0x2e0665=_0x18f5c9[_0x04ab('0x2a')][_0x04ab('0x35')];var _0x4a24a4=_0x18f5c9[_0x04ab('0x2a')][_0x04ab('0x24')];var _0x1df4c0=_0x18f5c9['body'][_0x04ab('0x48')];return getAgent(_0x2e0665)[_0x04ab('0x1f')](function(_0x549a99){logger[_0x04ab('0xf')]('entityFound:',_0x549a99['name']);emit(util[_0x04ab('0x2e')](_0x04ab('0x2f'),_0x549a99[_0x04ab('0x16')]),_0x04ab('0x49'),{'sessionId':_0x4a24a4,'transferNumber':_0x1df4c0});return _0x40a1eb[_0x04ab('0x17')](0xc8)[_0x04ab('0x31')]({'error':![],'message':_0x04ab('0x4a')});})['catch'](handleError(_0x40a1eb));};
\ 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