Built motion from commit (unavailable).|2.5.14
[motion2.git] / server / api / webbar / webbar.controller.js
index 713ba32..b7e9840 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf257=['number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','info','stringify','emit','handleError:','error','stack','name','status','send','NotFound','request','then','message','result','User','findOne','agent','all','filter','rows','UserId','length','\x20not\x20found!','originate','originate\x20fired:','body','userId','callerId','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','catch','hangup','hangup\x20fired:','sessionId','webbar:hangup','hangup\x20executed!','answer\x20fired:','hold','hold\x20fired:','webbar:hold','VoiceChannels','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transferNumber','webbar:transfer','transfer\x20executed!','../../mysqldb','../../config/environment','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf257,0x82));var _0x7f25=function(_0x3b8c63,_0x24a9c6){_0x3b8c63=_0x3b8c63-0x0;var _0x1a8e31=_0xf257[_0x3b8c63];return _0x1a8e31;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require(_0x7f25('0x0'))['db'];var config=require(_0x7f25('0x1'));var util=require(_0x7f25('0x2'));var BPromise=require(_0x7f25('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x7f25('0x4')][_0x7f25('0x5')]({'port':0x232a});var logger=require(_0x7f25('0x6'))(_0x7f25('0x7'));var Redis=require(_0x7f25('0x8'));config[_0x7f25('0x9')]=_[_0x7f25('0xa')](config[_0x7f25('0x9')],{'host':_0x7f25('0xb'),'port':0x18eb});var io=require(_0x7f25('0xc'))(new Redis(config[_0x7f25('0x9')]));var Schema=require(_0x7f25('0xd'));var originateValidation=new Schema({'userId':{'type':_0x7f25('0xe'),'required':[!![],_0x7f25('0xf')]},'callNumber':{'type':'string','required':[!![],_0x7f25('0x10')]},'callerId':{'type':_0x7f25('0x11')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x7f25('0xf')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x7f25('0xe'),'required':[!![],_0x7f25('0xf')]},'sessionId':{'type':_0x7f25('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x7f25('0xe'),'required':[!![],_0x7f25('0xf')]},'sessionId':{'type':_0x7f25('0x11'),'required':[!![],_0x7f25('0x12')]},'transferNumber':{'type':'string','required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x7f25('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x7f25('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x7f25('0xe'),'required':[!![],_0x7f25('0xf')]},'sessionId':{'type':_0x7f25('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x7f25('0xe'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0x3b5424,_0x230ad6,_0x24a312){logger[_0x7f25('0x13')](_0x3b5424,_0x230ad6,JSON[_0x7f25('0x14')](_0x24a312));io['to'](_0x3b5424)[_0x7f25('0x15')](_0x230ad6,_0x24a312);}function handleError(_0x19ad80){return function(_0x26d4aa){console['log'](_0x7f25('0x16'),_0x26d4aa,_0x26d4aa instanceof RangeError);logger[_0x7f25('0x17')](_0x26d4aa[_0x7f25('0x18')]);if(_0x26d4aa instanceof RangeError){if(_0x26d4aa[_0x7f25('0x19')]){delete _0x26d4aa[_0x7f25('0x19')];}_0x19ad80[_0x7f25('0x1a')](0x194)['send'](_0x26d4aa);}else{if(_0x26d4aa['name']){delete _0x26d4aa[_0x7f25('0x19')];}_0x19ad80[_0x7f25('0x1a')](0x1f4)[_0x7f25('0x1b')](_0x26d4aa);}};}function checkError(){return function(_0x3dc0c7){if(!_0x3dc0c7){throw new RangeError(_0x7f25('0x1c'));}return _0x3dc0c7;};}function respondWithRpcPromise(_0x334802,_0x6cf659){return new BPromise(function(_0x225948,_0x31bf5f){var _0x4be8b8=amiClient;return _0x4be8b8[_0x7f25('0x1d')](_0x334802,_0x6cf659)[_0x7f25('0x1e')](function(_0x456d84){if(_0x456d84[_0x7f25('0x17')]){if(_0x456d84[_0x7f25('0x17')]['code']===0x1f4){return _0x31bf5f(_0x456d84[_0x7f25('0x17')][_0x7f25('0x1f')]);}return _0x225948(_0x456d84[_0x7f25('0x17')]['message']);}else{_0x225948(_0x456d84[_0x7f25('0x20')]);}})['catch'](function(_0x467650){_0x31bf5f(_0x467650);});});}function getAgent(_0x2a504e){return db[_0x7f25('0x21')][_0x7f25('0x22')]({'where':{'id':_0x2a504e,'role':_0x7f25('0x23')}})[_0x7f25('0x1e')](checkError());}function getAgentCheckSession(_0x26babd,_0x337893){return new BPromise(function(_0x44116d,_0x30c7bc){var _0x531382=respondWithRpcPromise('VoiceChannels');var _0x3a6b2f=getAgent(_0x26babd);Promise[_0x7f25('0x24')]([_0x531382,_0x3a6b2f])['then'](function(_0xa373ee){var _0x340f1b=_0xa373ee[0x0];var _0x2bc378=_0xa373ee[0x1];var _0x22ecc0=_[_0x7f25('0x25')](_0x340f1b[_0x7f25('0x26')],function(_0x574099){return _0x574099[_0x7f25('0x27')]==_0x2bc378['id']&&_0x574099['sessionId']==_0x337893;});if(_0x22ecc0[_0x7f25('0x28')]==0x1){_0x44116d(_0x2bc378);}else{_0x30c7bc(new RangeError('sessionId\x20'+_0x337893+_0x7f25('0x29')));}});});}exports[_0x7f25('0x2a')]=function(_0x1521ef,_0x5389e5){logger[_0x7f25('0x13')](_0x7f25('0x2b'),_0x1521ef[_0x7f25('0x2c')]);var _0x43a7c2=originateValidation[_0x7f25('0xd')](_0x1521ef[_0x7f25('0x2c')]);if(_0x43a7c2[_0x7f25('0x28')]>0x0){return _0x5389e5[_0x7f25('0x1a')](0x190)['json'](_0x43a7c2);}var _0xf5197e=_0x1521ef[_0x7f25('0x2c')][_0x7f25('0x2d')];var _0x161688=_0x1521ef[_0x7f25('0x2c')]['callNumber'];var _0x4cc461=_0x1521ef['body'][_0x7f25('0x2e')];var _0x46d97b=_0x1521ef[_0x7f25('0x2c')]['callbackUrl'];return getAgent(_0xf5197e)[_0x7f25('0x1e')](function(_0x152e4b){logger['info'](_0x7f25('0x2f'),_0x152e4b['name']);emit(util[_0x7f25('0x30')](_0x7f25('0x31'),_0x152e4b['name']),_0x7f25('0x32'),{'callNumber':_0x161688,'callerId':_0x4cc461,'callbackUrl':_0x46d97b});return _0x5389e5[_0x7f25('0x1a')](0xc8)[_0x7f25('0x33')]({'error':![],'message':_0x7f25('0x34')});})[_0x7f25('0x35')](handleError(_0x5389e5));};exports[_0x7f25('0x36')]=function(_0x4b4a23,_0x1a4118){logger[_0x7f25('0x13')](_0x7f25('0x37'),_0x4b4a23['body']);var _0x29e0ac=hangupValidation[_0x7f25('0xd')](_0x4b4a23[_0x7f25('0x2c')]);if(_0x29e0ac[_0x7f25('0x28')]>0x0){return _0x1a4118[_0x7f25('0x1a')](0x190)['json'](_0x29e0ac);}var _0x4429b2=_0x4b4a23[_0x7f25('0x2c')][_0x7f25('0x2d')];var _0x26031b=_0x4b4a23[_0x7f25('0x2c')][_0x7f25('0x38')];return getAgent(_0x4429b2)[_0x7f25('0x1e')](function(_0x32585b){logger['info'](_0x7f25('0x2f'),_0x32585b['name']);emit(util[_0x7f25('0x30')](_0x7f25('0x31'),_0x32585b[_0x7f25('0x19')]),_0x7f25('0x39'),{'sessionId':_0x26031b});return _0x1a4118[_0x7f25('0x1a')](0xc8)['json']({'error':![],'message':_0x7f25('0x3a')});})['catch'](handleError(_0x1a4118));};exports['answer']=function(_0x55ff2e,_0x25d4cd){logger['info'](_0x7f25('0x3b'),_0x55ff2e[_0x7f25('0x2c')]);var _0x138439=answerValidation['validate'](_0x55ff2e['body']);if(_0x138439[_0x7f25('0x28')]>0x0){return _0x25d4cd[_0x7f25('0x1a')](0x190)[_0x7f25('0x33')](_0x138439);}var _0x22eb46=_0x55ff2e['body'][_0x7f25('0x2d')];var _0x5813fa=_0x55ff2e['body']['sessionId'];return getAgent(_0x22eb46)[_0x7f25('0x1e')](function(_0x50a272){logger[_0x7f25('0x13')](_0x7f25('0x2f'),_0x50a272[_0x7f25('0x19')]);emit(util[_0x7f25('0x30')](_0x7f25('0x31'),_0x50a272[_0x7f25('0x19')]),'webbar:answer',{'sessionId':_0x5813fa});return _0x25d4cd[_0x7f25('0x1a')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0x7f25('0x35')](handleError(_0x25d4cd));};exports[_0x7f25('0x3c')]=function(_0x28a586,_0xbb90fa){logger[_0x7f25('0x13')](_0x7f25('0x3d'),_0x28a586[_0x7f25('0x2c')]);var _0x550699=holdValidation['validate'](_0x28a586[_0x7f25('0x2c')]);if(_0x550699[_0x7f25('0x28')]>0x0){return _0xbb90fa['status'](0x190)[_0x7f25('0x33')](_0x550699);}var _0xc5875a=_0x28a586[_0x7f25('0x2c')]['userId'];var _0x160af9=_0x28a586['body'][_0x7f25('0x38')];return getAgent(_0xc5875a)[_0x7f25('0x1e')](function(_0x390905){logger['info'](_0x7f25('0x2f'),_0x390905[_0x7f25('0x19')]);emit(util[_0x7f25('0x30')](_0x7f25('0x31'),_0x390905['name']),_0x7f25('0x3e'),{'sessionId':_0x160af9});return _0xbb90fa[_0x7f25('0x1a')](0xc8)[_0x7f25('0x33')]({'error':![],'message':'hold\x20executed!'});})[_0x7f25('0x35')](handleError(_0xbb90fa));};exports['unhold']=function(_0x4b277c,_0x5677ec){logger['info']('unhold\x20fired:',_0x4b277c[_0x7f25('0x2c')]);var _0x20b808=unholdValidation[_0x7f25('0xd')](_0x4b277c[_0x7f25('0x2c')]);if(_0x20b808['length']>0x0){return _0x5677ec[_0x7f25('0x1a')](0x190)[_0x7f25('0x33')](_0x20b808);}var _0x4454ae=_0x4b277c[_0x7f25('0x2c')]['userId'];var _0x44f7f5=_0x4b277c[_0x7f25('0x2c')][_0x7f25('0x38')];return getAgent(_0x4454ae)['then'](function(_0x4e7d40){logger[_0x7f25('0x13')](_0x7f25('0x2f'),_0x4e7d40[_0x7f25('0x19')]);emit(util[_0x7f25('0x30')]('user:%s',_0x4e7d40[_0x7f25('0x19')]),'webbar:unhold',{'sessionId':_0x44f7f5});return _0x5677ec[_0x7f25('0x1a')](0xc8)[_0x7f25('0x33')]({'error':![],'message':'unhold\x20executed!'});})[_0x7f25('0x35')](handleError(_0x5677ec));};exports['calls']=function(_0x405eaa,_0x49ffb1){logger['info']('calls\x20fired:',_0x49ffb1[_0x7f25('0x2c')]);var _0xe6598d=callsValidation['validate'](_0x405eaa[_0x7f25('0x2c')]);if(_0xe6598d[_0x7f25('0x28')]>0x0){return _0x49ffb1[_0x7f25('0x1a')](0x190)['json'](_0xe6598d);}var _0x59061f=_0x405eaa['body']['userId'];var _0x2631ed=respondWithRpcPromise(_0x7f25('0x3f'));var _0x178aed=getAgent(_0x59061f);return Promise[_0x7f25('0x24')]([_0x2631ed,_0x178aed])[_0x7f25('0x1e')](function(_0x3ae219){var _0x242911=_0x3ae219[0x0];var _0x3638ce=_0x3ae219[0x1];var _0x9f1c53=_[_0x7f25('0x25')](_0x242911[_0x7f25('0x26')],function(_0x275845){return _0x275845[_0x7f25('0x27')]==_0x3638ce['id'];});return _0x49ffb1[_0x7f25('0x1a')](0xc8)['json']({'count':_0x9f1c53[_0x7f25('0x28')],'rows':_0x9f1c53});})[_0x7f25('0x35')](handleError(_0x49ffb1));};exports[_0x7f25('0x40')]=function(_0x552a59,_0x1c97e4){logger[_0x7f25('0x13')](_0x7f25('0x41'),_0x552a59['body']);var _0x5d3659=conferenceValidation[_0x7f25('0xd')](_0x552a59['body']);if(_0x5d3659['length']>0x0){return _0x1c97e4['status'](0x190)[_0x7f25('0x33')](_0x5d3659);}var _0x355578=_0x552a59[_0x7f25('0x2c')][_0x7f25('0x2d')];return getAgent(_0x355578)['then'](function(_0x7ca2e4){logger['info'](_0x7f25('0x2f'),_0x7ca2e4[_0x7f25('0x19')]);emit(util[_0x7f25('0x30')](_0x7f25('0x31'),_0x7ca2e4[_0x7f25('0x19')]),_0x7f25('0x42'));return _0x1c97e4['status'](0xc8)[_0x7f25('0x33')]({'error':![],'message':_0x7f25('0x43')});})[_0x7f25('0x35')](handleError(_0x1c97e4));};exports[_0x7f25('0x44')]=function(_0x31f61d,_0xfa4bde){logger['info']('transfer\x20fired:',_0x31f61d['body']);var _0x15ad7a=transferValidation[_0x7f25('0xd')](_0x31f61d[_0x7f25('0x2c')]);if(_0x15ad7a['length']>0x0){return _0xfa4bde[_0x7f25('0x1a')](0x190)['json'](_0x15ad7a);}var _0x22602e=_0x31f61d['body'][_0x7f25('0x2d')];var _0x571385=_0x31f61d[_0x7f25('0x2c')][_0x7f25('0x38')];var _0x4784d2=_0x31f61d[_0x7f25('0x2c')][_0x7f25('0x45')];return getAgent(_0x22602e)[_0x7f25('0x1e')](function(_0x3ad975){logger[_0x7f25('0x13')](_0x7f25('0x2f'),_0x3ad975[_0x7f25('0x19')]);emit(util['format'](_0x7f25('0x31'),_0x3ad975[_0x7f25('0x19')]),_0x7f25('0x46'),{'sessionId':_0x571385,'transferNumber':_0x4784d2});return _0xfa4bde[_0x7f25('0x1a')](0xc8)['json']({'error':![],'message':_0x7f25('0x47')});})[_0x7f25('0x35')](handleError(_0xfa4bde));};
\ No newline at end of file
+var _0x8ca7=['conference\x20fired:','conference\x20executed!','transfer','webbar:transfer','transfer\x20executed!','path','util','bluebird','jayson/promise','client','http','../../config/logger','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','log','handleError:','error','stack','name','send','NotFound','request','then','code','result','findOne','agent','VoiceChannels','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','info','originate\x20fired:','body','status','json','userId','callbackUrl','entityFound:','user:%s','catch','hangup','hangup\x20fired:','format','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','all','conference'];(function(_0x396014,_0x53e39f){var _0x4cd085=function(_0x2f5532){while(--_0x2f5532){_0x396014['push'](_0x396014['shift']());}};_0x4cd085(++_0x53e39f);}(_0x8ca7,0x9b));var _0x78ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ca7[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0x78ca('0x0'));var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require(_0x78ca('0x1'));var BPromise=require(_0x78ca('0x2'));var jayson=require(_0x78ca('0x3'));var amiClient=jayson[_0x78ca('0x4')][_0x78ca('0x5')]({'port':0x232a});var logger=require(_0x78ca('0x6'))('webbarapi');var Redis=require(_0x78ca('0x7'));config[_0x78ca('0x8')]=_[_0x78ca('0x9')](config[_0x78ca('0x8')],{'host':_0x78ca('0xa'),'port':0x18eb});var io=require(_0x78ca('0xb'))(new Redis(config[_0x78ca('0x8')]));var Schema=require(_0x78ca('0xc'));var originateValidation=new Schema({'userId':{'type':_0x78ca('0xd'),'required':[!![],_0x78ca('0xe')]},'callNumber':{'type':_0x78ca('0xf'),'required':[!![],_0x78ca('0x10')]},'callerId':{'type':_0x78ca('0xf')},'callbackUrl':{'type':_0x78ca('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x78ca('0xd'),'required':[!![],_0x78ca('0xe')]},'sessionId':{'type':_0x78ca('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x78ca('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x78ca('0xd'),'required':[!![],_0x78ca('0xe')]},'sessionId':{'type':_0x78ca('0xf'),'required':[!![],_0x78ca('0x11')]},'transferNumber':{'type':_0x78ca('0xf'),'required':[!![],_0x78ca('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x78ca('0xd'),'required':[!![],_0x78ca('0xe')]},'sessionId':{'type':_0x78ca('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x78ca('0xd'),'required':[!![],_0x78ca('0xe')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x78ca('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0x78ca('0xd'),'required':[!![],_0x78ca('0xe')]}});function emit(_0x3ead02,_0x14f2dd,_0x424ccb){logger['info'](_0x3ead02,_0x14f2dd,JSON[_0x78ca('0x13')](_0x424ccb));io['to'](_0x3ead02)[_0x78ca('0x14')](_0x14f2dd,_0x424ccb);}function handleError(_0x3a47c1){return function(_0x3eef71){console[_0x78ca('0x15')](_0x78ca('0x16'),_0x3eef71,_0x3eef71 instanceof RangeError);logger[_0x78ca('0x17')](_0x3eef71[_0x78ca('0x18')]);if(_0x3eef71 instanceof RangeError){if(_0x3eef71[_0x78ca('0x19')]){delete _0x3eef71[_0x78ca('0x19')];}_0x3a47c1['status'](0x194)[_0x78ca('0x1a')](_0x3eef71);}else{if(_0x3eef71[_0x78ca('0x19')]){delete _0x3eef71[_0x78ca('0x19')];}_0x3a47c1['status'](0x1f4)[_0x78ca('0x1a')](_0x3eef71);}};}function checkError(){return function(_0x16c93c){if(!_0x16c93c){throw new RangeError(_0x78ca('0x1b'));}return _0x16c93c;};}function respondWithRpcPromise(_0x13e236,_0xaa22b6){return new BPromise(function(_0x330006,_0x22ec7c){var _0x8665ef=amiClient;return _0x8665ef[_0x78ca('0x1c')](_0x13e236,_0xaa22b6)[_0x78ca('0x1d')](function(_0x8c4395){if(_0x8c4395[_0x78ca('0x17')]){if(_0x8c4395['error'][_0x78ca('0x1e')]===0x1f4){return _0x22ec7c(_0x8c4395[_0x78ca('0x17')]['message']);}return _0x330006(_0x8c4395[_0x78ca('0x17')]['message']);}else{_0x330006(_0x8c4395[_0x78ca('0x1f')]);}})['catch'](function(_0x4f5a97){_0x22ec7c(_0x4f5a97);});});}function getAgent(_0x4b3a16){return db['User'][_0x78ca('0x20')]({'where':{'id':_0x4b3a16,'role':_0x78ca('0x21')}})[_0x78ca('0x1d')](checkError());}function getAgentCheckSession(_0x8781e3,_0x24c450){return new BPromise(function(_0x163062,_0x1d5a61){var _0x3a95b4=respondWithRpcPromise(_0x78ca('0x22'));var _0x2a9f56=getAgent(_0x8781e3);Promise['all']([_0x3a95b4,_0x2a9f56])[_0x78ca('0x1d')](function(_0x120f86){var _0x42a0e3=_0x120f86[0x0];var _0x5aeaff=_0x120f86[0x1];var _0x3a51bc=_[_0x78ca('0x23')](_0x42a0e3[_0x78ca('0x24')],function(_0x2cf94e){return _0x2cf94e[_0x78ca('0x25')]==_0x5aeaff['id']&&_0x2cf94e[_0x78ca('0x26')]==_0x24c450;});if(_0x3a51bc[_0x78ca('0x27')]==0x1){_0x163062(_0x5aeaff);}else{_0x1d5a61(new RangeError(_0x78ca('0x28')+_0x24c450+_0x78ca('0x29')));}});});}exports['originate']=function(_0xc55094,_0xdf32e7){logger[_0x78ca('0x2a')](_0x78ca('0x2b'),_0xc55094['body']);var _0x2b42d4=originateValidation['validate'](_0xc55094[_0x78ca('0x2c')]);if(_0x2b42d4[_0x78ca('0x27')]>0x0){return _0xdf32e7[_0x78ca('0x2d')](0x190)[_0x78ca('0x2e')](_0x2b42d4);}var _0x35684d=_0xc55094[_0x78ca('0x2c')][_0x78ca('0x2f')];var _0x43ecc5=_0xc55094['body']['callNumber'];var _0x3f9f38=_0xc55094[_0x78ca('0x2c')]['callerId'];var _0x3a45de=_0xc55094['body'][_0x78ca('0x30')];return getAgent(_0x35684d)['then'](function(_0x39f76b){logger[_0x78ca('0x2a')](_0x78ca('0x31'),_0x39f76b[_0x78ca('0x19')]);emit(util['format'](_0x78ca('0x32'),_0x39f76b[_0x78ca('0x19')]),'webbar:originate',{'callNumber':_0x43ecc5,'callerId':_0x3f9f38,'callbackUrl':_0x3a45de});return _0xdf32e7[_0x78ca('0x2d')](0xc8)[_0x78ca('0x2e')]({'error':![],'message':'originate\x20executed!'});})[_0x78ca('0x33')](handleError(_0xdf32e7));};exports[_0x78ca('0x34')]=function(_0xabc9a9,_0x4cb93a){logger[_0x78ca('0x2a')](_0x78ca('0x35'),_0xabc9a9[_0x78ca('0x2c')]);var _0x2e6d06=hangupValidation[_0x78ca('0xc')](_0xabc9a9[_0x78ca('0x2c')]);if(_0x2e6d06[_0x78ca('0x27')]>0x0){return _0x4cb93a[_0x78ca('0x2d')](0x190)[_0x78ca('0x2e')](_0x2e6d06);}var _0x4e74fe=_0xabc9a9['body']['userId'];var _0x19f04d=_0xabc9a9['body'][_0x78ca('0x26')];return getAgent(_0x4e74fe)['then'](function(_0x5f58e7){logger[_0x78ca('0x2a')](_0x78ca('0x31'),_0x5f58e7[_0x78ca('0x19')]);emit(util[_0x78ca('0x36')](_0x78ca('0x32'),_0x5f58e7['name']),_0x78ca('0x37'),{'sessionId':_0x19f04d});return _0x4cb93a[_0x78ca('0x2d')](0xc8)[_0x78ca('0x2e')]({'error':![],'message':_0x78ca('0x38')});})['catch'](handleError(_0x4cb93a));};exports[_0x78ca('0x39')]=function(_0x310698,_0x4cbba8){logger['info'](_0x78ca('0x3a'),_0x310698[_0x78ca('0x2c')]);var _0x27017e=answerValidation[_0x78ca('0xc')](_0x310698[_0x78ca('0x2c')]);if(_0x27017e[_0x78ca('0x27')]>0x0){return _0x4cbba8[_0x78ca('0x2d')](0x190)[_0x78ca('0x2e')](_0x27017e);}var _0x59971a=_0x310698[_0x78ca('0x2c')][_0x78ca('0x2f')];var _0x12f1f2=_0x310698['body'][_0x78ca('0x26')];return getAgent(_0x59971a)['then'](function(_0xc34eef){logger['info'](_0x78ca('0x31'),_0xc34eef[_0x78ca('0x19')]);emit(util[_0x78ca('0x36')]('user:%s',_0xc34eef[_0x78ca('0x19')]),_0x78ca('0x3b'),{'sessionId':_0x12f1f2});return _0x4cbba8[_0x78ca('0x2d')](0xc8)[_0x78ca('0x2e')]({'error':![],'message':_0x78ca('0x3c')});})[_0x78ca('0x33')](handleError(_0x4cbba8));};exports[_0x78ca('0x3d')]=function(_0x3b909e,_0x10df82){logger[_0x78ca('0x2a')]('hold\x20fired:',_0x3b909e['body']);var _0x173126=holdValidation['validate'](_0x3b909e[_0x78ca('0x2c')]);if(_0x173126['length']>0x0){return _0x10df82[_0x78ca('0x2d')](0x190)[_0x78ca('0x2e')](_0x173126);}var _0x19608f=_0x3b909e[_0x78ca('0x2c')][_0x78ca('0x2f')];var _0x4100b1=_0x3b909e[_0x78ca('0x2c')][_0x78ca('0x26')];return getAgent(_0x19608f)[_0x78ca('0x1d')](function(_0x557c2f){logger[_0x78ca('0x2a')]('entityFound:',_0x557c2f[_0x78ca('0x19')]);emit(util[_0x78ca('0x36')]('user:%s',_0x557c2f['name']),'webbar:hold',{'sessionId':_0x4100b1});return _0x10df82[_0x78ca('0x2d')](0xc8)[_0x78ca('0x2e')]({'error':![],'message':_0x78ca('0x3e')});})['catch'](handleError(_0x10df82));};exports[_0x78ca('0x3f')]=function(_0x387529,_0x438154){logger[_0x78ca('0x2a')](_0x78ca('0x40'),_0x387529['body']);var _0x3c45ef=unholdValidation[_0x78ca('0xc')](_0x387529[_0x78ca('0x2c')]);if(_0x3c45ef[_0x78ca('0x27')]>0x0){return _0x438154[_0x78ca('0x2d')](0x190)['json'](_0x3c45ef);}var _0x487e39=_0x387529[_0x78ca('0x2c')][_0x78ca('0x2f')];var _0x3656d0=_0x387529['body'][_0x78ca('0x26')];return getAgent(_0x487e39)[_0x78ca('0x1d')](function(_0x179098){logger['info']('entityFound:',_0x179098[_0x78ca('0x19')]);emit(util[_0x78ca('0x36')](_0x78ca('0x32'),_0x179098[_0x78ca('0x19')]),'webbar:unhold',{'sessionId':_0x3656d0});return _0x438154[_0x78ca('0x2d')](0xc8)[_0x78ca('0x2e')]({'error':![],'message':_0x78ca('0x41')});})[_0x78ca('0x33')](handleError(_0x438154));};exports[_0x78ca('0x42')]=function(_0x39a714,_0x2deab0){logger['info'](_0x78ca('0x43'),_0x2deab0['body']);var _0x390ed8=callsValidation[_0x78ca('0xc')](_0x39a714['body']);if(_0x390ed8[_0x78ca('0x27')]>0x0){return _0x2deab0['status'](0x190)[_0x78ca('0x2e')](_0x390ed8);}var _0x532872=_0x39a714[_0x78ca('0x2c')]['userId'];var _0x419cba=respondWithRpcPromise('VoiceChannels');var _0x58688e=getAgent(_0x532872);return Promise[_0x78ca('0x44')]([_0x419cba,_0x58688e])[_0x78ca('0x1d')](function(_0xd72ef3){var _0x2db637=_0xd72ef3[0x0];var _0x3afbf6=_0xd72ef3[0x1];var _0x106622=_[_0x78ca('0x23')](_0x2db637[_0x78ca('0x24')],function(_0x4b2e38){return _0x4b2e38[_0x78ca('0x25')]==_0x3afbf6['id'];});return _0x2deab0[_0x78ca('0x2d')](0xc8)[_0x78ca('0x2e')]({'count':_0x106622[_0x78ca('0x27')],'rows':_0x106622});})['catch'](handleError(_0x2deab0));};exports[_0x78ca('0x45')]=function(_0x2748ec,_0xd7099e){logger['info'](_0x78ca('0x46'),_0x2748ec[_0x78ca('0x2c')]);var _0x425e4b=conferenceValidation[_0x78ca('0xc')](_0x2748ec[_0x78ca('0x2c')]);if(_0x425e4b['length']>0x0){return _0xd7099e[_0x78ca('0x2d')](0x190)[_0x78ca('0x2e')](_0x425e4b);}var _0x406202=_0x2748ec[_0x78ca('0x2c')][_0x78ca('0x2f')];return getAgent(_0x406202)[_0x78ca('0x1d')](function(_0x20a11b){logger[_0x78ca('0x2a')](_0x78ca('0x31'),_0x20a11b[_0x78ca('0x19')]);emit(util[_0x78ca('0x36')](_0x78ca('0x32'),_0x20a11b[_0x78ca('0x19')]),'webbar:conference');return _0xd7099e[_0x78ca('0x2d')](0xc8)[_0x78ca('0x2e')]({'error':![],'message':_0x78ca('0x47')});})['catch'](handleError(_0xd7099e));};exports[_0x78ca('0x48')]=function(_0x1f9121,_0x221ca9){logger['info']('transfer\x20fired:',_0x1f9121[_0x78ca('0x2c')]);var _0x21bd8e=transferValidation[_0x78ca('0xc')](_0x1f9121[_0x78ca('0x2c')]);if(_0x21bd8e[_0x78ca('0x27')]>0x0){return _0x221ca9[_0x78ca('0x2d')](0x190)[_0x78ca('0x2e')](_0x21bd8e);}var _0x3b715b=_0x1f9121[_0x78ca('0x2c')][_0x78ca('0x2f')];var _0x56c84c=_0x1f9121[_0x78ca('0x2c')][_0x78ca('0x26')];var _0x1ab40c=_0x1f9121[_0x78ca('0x2c')]['transferNumber'];return getAgent(_0x3b715b)[_0x78ca('0x1d')](function(_0x1da8dd){logger['info']('entityFound:',_0x1da8dd[_0x78ca('0x19')]);emit(util['format'](_0x78ca('0x32'),_0x1da8dd[_0x78ca('0x19')]),_0x78ca('0x49'),{'sessionId':_0x56c84c,'transferNumber':_0x1ab40c});return _0x221ca9[_0x78ca('0x2d')](0xc8)[_0x78ca('0x2e')]({'error':![],'message':_0x78ca('0x4a')});})[_0x78ca('0x33')](handleError(_0x221ca9));};
\ No newline at end of file