Built motion from commit (unavailable).|2.5.9
[motion2.git] / server / api / webbar / webbar.controller.js
index 6bf62fe..0bd419b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x96a2=['webbar:transfer','transfer\x20executed!','path','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','emit','error','name','status','NotFound','request','then','code','message','result','catch','User','agent','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','info','body','json','userId','callerId','callbackUrl','entityFound:','webbar:originate','hangup\x20fired:','format','user:%s','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls\x20fired:','VoiceChannels','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x96a2,0x96));var _0x296a=function(_0x1cf522,_0x211d5c){_0x1cf522=_0x1cf522-0x0;var _0x4c5630=_0x96a2[_0x1cf522];return _0x4c5630;};'use strict';var path=require(_0x296a('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x296a('0x1'))['db'];var config=require(_0x296a('0x2'));var util=require(_0x296a('0x3'));var BPromise=require(_0x296a('0x4'));var jayson=require(_0x296a('0x5'));var amiClient=jayson[_0x296a('0x6')][_0x296a('0x7')]({'port':0x232a});var logger=require(_0x296a('0x8'))(_0x296a('0x9'));var Redis=require(_0x296a('0xa'));config[_0x296a('0xb')]=_[_0x296a('0xc')](config[_0x296a('0xb')],{'host':_0x296a('0xd'),'port':0x18eb});var io=require(_0x296a('0xe'))(new Redis(config[_0x296a('0xb')]));var Schema=require(_0x296a('0xf'));var originateValidation=new Schema({'userId':{'type':_0x296a('0x10'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x296a('0x11'),'required':[!![],_0x296a('0x12')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x296a('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0x296a('0x10'),'required':[!![],_0x296a('0x13')]},'sessionId':{'type':_0x296a('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x296a('0x10'),'required':[!![],_0x296a('0x13')]},'sessionId':{'type':_0x296a('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x296a('0x13')]},'sessionId':{'type':_0x296a('0x11'),'required':[!![],_0x296a('0x14')]},'transferNumber':{'type':_0x296a('0x11'),'required':[!![],_0x296a('0x15')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x296a('0x13')]},'sessionId':{'type':_0x296a('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x296a('0x13')]},'sessionId':{'type':_0x296a('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x296a('0x10'),'required':[!![],_0x296a('0x13')]}});var conferenceValidation=new Schema({'userId':{'type':_0x296a('0x10'),'required':[!![],_0x296a('0x13')]}});function emit(_0x5c1f54,_0x15d62f,_0x4c0358){logger['info'](_0x5c1f54,_0x15d62f,JSON['stringify'](_0x4c0358));io['to'](_0x5c1f54)[_0x296a('0x16')](_0x15d62f,_0x4c0358);}function handleError(_0x38e7a1){return function(_0x2b82d6){console['log']('handleError:',_0x2b82d6,_0x2b82d6 instanceof RangeError);logger[_0x296a('0x17')](_0x2b82d6['stack']);if(_0x2b82d6 instanceof RangeError){if(_0x2b82d6[_0x296a('0x18')]){delete _0x2b82d6[_0x296a('0x18')];}_0x38e7a1[_0x296a('0x19')](0x194)['send'](_0x2b82d6);}else{if(_0x2b82d6[_0x296a('0x18')]){delete _0x2b82d6[_0x296a('0x18')];}_0x38e7a1[_0x296a('0x19')](0x1f4)['send'](_0x2b82d6);}};}function checkError(){return function(_0x5ff8f2){if(!_0x5ff8f2){throw new RangeError(_0x296a('0x1a'));}return _0x5ff8f2;};}function respondWithRpcPromise(_0x543489,_0x573132){return new BPromise(function(_0x2a2971,_0x3750c7){var _0x3be956=amiClient;return _0x3be956[_0x296a('0x1b')](_0x543489,_0x573132)[_0x296a('0x1c')](function(_0x16f287){if(_0x16f287[_0x296a('0x17')]){if(_0x16f287[_0x296a('0x17')][_0x296a('0x1d')]===0x1f4){return _0x3750c7(_0x16f287[_0x296a('0x17')][_0x296a('0x1e')]);}return _0x2a2971(_0x16f287[_0x296a('0x17')][_0x296a('0x1e')]);}else{_0x2a2971(_0x16f287[_0x296a('0x1f')]);}})[_0x296a('0x20')](function(_0x529eb8){_0x3750c7(_0x529eb8);});});}function getAgent(_0x2b47d6){return db[_0x296a('0x21')]['findOne']({'where':{'id':_0x2b47d6,'role':_0x296a('0x22')}})[_0x296a('0x1c')](checkError());}function getAgentCheckSession(_0x10bcad,_0x5b5430){return new BPromise(function(_0x24b280,_0x13d76f){var _0x502944=respondWithRpcPromise('VoiceChannels');var _0x15e9ac=getAgent(_0x10bcad);Promise[_0x296a('0x23')]([_0x502944,_0x15e9ac])[_0x296a('0x1c')](function(_0x583548){var _0x571c26=_0x583548[0x0];var _0x18d372=_0x583548[0x1];var _0x327260=_[_0x296a('0x24')](_0x571c26[_0x296a('0x25')],function(_0x11278b){return _0x11278b[_0x296a('0x26')]==_0x18d372['id']&&_0x11278b[_0x296a('0x27')]==_0x5b5430;});if(_0x327260[_0x296a('0x28')]==0x1){_0x24b280(_0x18d372);}else{_0x13d76f(new RangeError(_0x296a('0x29')+_0x5b5430+_0x296a('0x2a')));}});});}exports['originate']=function(_0x4562e9,_0x589817){logger[_0x296a('0x2b')]('originate\x20fired:',_0x4562e9[_0x296a('0x2c')]);var _0x403595=originateValidation[_0x296a('0xf')](_0x4562e9[_0x296a('0x2c')]);if(_0x403595[_0x296a('0x28')]>0x0){return _0x589817['status'](0x190)[_0x296a('0x2d')](_0x403595);}var _0x2d918b=_0x4562e9[_0x296a('0x2c')][_0x296a('0x2e')];var _0x5be6b6=_0x4562e9[_0x296a('0x2c')]['callNumber'];var _0x5d7303=_0x4562e9['body'][_0x296a('0x2f')];var _0x2c3c21=_0x4562e9[_0x296a('0x2c')][_0x296a('0x30')];return getAgent(_0x2d918b)['then'](function(_0x3a93d6){logger[_0x296a('0x2b')](_0x296a('0x31'),_0x3a93d6[_0x296a('0x18')]);emit(util['format']('user:%s',_0x3a93d6['name']),_0x296a('0x32'),{'callNumber':_0x5be6b6,'callerId':_0x5d7303,'callbackUrl':_0x2c3c21});return _0x589817[_0x296a('0x19')](0xc8)[_0x296a('0x2d')]({'error':![],'message':'originate\x20executed!'});})[_0x296a('0x20')](handleError(_0x589817));};exports['hangup']=function(_0x5610dc,_0x220673){logger[_0x296a('0x2b')](_0x296a('0x33'),_0x5610dc[_0x296a('0x2c')]);var _0x5bd882=hangupValidation[_0x296a('0xf')](_0x5610dc[_0x296a('0x2c')]);if(_0x5bd882['length']>0x0){return _0x220673[_0x296a('0x19')](0x190)['json'](_0x5bd882);}var _0x53d83b=_0x5610dc['body'][_0x296a('0x2e')];var _0x44eda9=_0x5610dc['body'][_0x296a('0x27')];return getAgent(_0x53d83b)[_0x296a('0x1c')](function(_0x14c4fc){logger[_0x296a('0x2b')](_0x296a('0x31'),_0x14c4fc[_0x296a('0x18')]);emit(util[_0x296a('0x34')](_0x296a('0x35'),_0x14c4fc[_0x296a('0x18')]),_0x296a('0x36'),{'sessionId':_0x44eda9});return _0x220673['status'](0xc8)[_0x296a('0x2d')]({'error':![],'message':_0x296a('0x37')});})['catch'](handleError(_0x220673));};exports[_0x296a('0x38')]=function(_0x5f2368,_0x5893e1){logger[_0x296a('0x2b')](_0x296a('0x39'),_0x5f2368[_0x296a('0x2c')]);var _0x2255bc=answerValidation[_0x296a('0xf')](_0x5f2368[_0x296a('0x2c')]);if(_0x2255bc[_0x296a('0x28')]>0x0){return _0x5893e1[_0x296a('0x19')](0x190)[_0x296a('0x2d')](_0x2255bc);}var _0xb59bd9=_0x5f2368[_0x296a('0x2c')][_0x296a('0x2e')];var _0x6ff8f1=_0x5f2368[_0x296a('0x2c')][_0x296a('0x27')];return getAgent(_0xb59bd9)[_0x296a('0x1c')](function(_0x5a51ee){logger['info'](_0x296a('0x31'),_0x5a51ee['name']);emit(util[_0x296a('0x34')]('user:%s',_0x5a51ee[_0x296a('0x18')]),_0x296a('0x3a'),{'sessionId':_0x6ff8f1});return _0x5893e1['status'](0xc8)[_0x296a('0x2d')]({'error':![],'message':'answer\x20executed!'});})[_0x296a('0x20')](handleError(_0x5893e1));};exports[_0x296a('0x3b')]=function(_0x51468c,_0x10673a){logger[_0x296a('0x2b')]('hold\x20fired:',_0x51468c[_0x296a('0x2c')]);var _0x298f0f=holdValidation[_0x296a('0xf')](_0x51468c[_0x296a('0x2c')]);if(_0x298f0f[_0x296a('0x28')]>0x0){return _0x10673a[_0x296a('0x19')](0x190)[_0x296a('0x2d')](_0x298f0f);}var _0x3fcb86=_0x51468c[_0x296a('0x2c')][_0x296a('0x2e')];var _0x4116ab=_0x51468c[_0x296a('0x2c')][_0x296a('0x27')];return getAgent(_0x3fcb86)[_0x296a('0x1c')](function(_0x23aefa){logger[_0x296a('0x2b')]('entityFound:',_0x23aefa[_0x296a('0x18')]);emit(util[_0x296a('0x34')](_0x296a('0x35'),_0x23aefa[_0x296a('0x18')]),_0x296a('0x3c'),{'sessionId':_0x4116ab});return _0x10673a[_0x296a('0x19')](0xc8)[_0x296a('0x2d')]({'error':![],'message':_0x296a('0x3d')});})['catch'](handleError(_0x10673a));};exports[_0x296a('0x3e')]=function(_0xcb620a,_0x162b91){logger[_0x296a('0x2b')](_0x296a('0x3f'),_0xcb620a['body']);var _0x58e66e=unholdValidation[_0x296a('0xf')](_0xcb620a[_0x296a('0x2c')]);if(_0x58e66e[_0x296a('0x28')]>0x0){return _0x162b91[_0x296a('0x19')](0x190)[_0x296a('0x2d')](_0x58e66e);}var _0x1740e8=_0xcb620a[_0x296a('0x2c')][_0x296a('0x2e')];var _0x3f404e=_0xcb620a['body'][_0x296a('0x27')];return getAgent(_0x1740e8)[_0x296a('0x1c')](function(_0x5f1fa){logger['info'](_0x296a('0x31'),_0x5f1fa[_0x296a('0x18')]);emit(util[_0x296a('0x34')](_0x296a('0x35'),_0x5f1fa[_0x296a('0x18')]),_0x296a('0x40'),{'sessionId':_0x3f404e});return _0x162b91[_0x296a('0x19')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0x296a('0x20')](handleError(_0x162b91));};exports['calls']=function(_0x1117b2,_0x2cfc7b){logger[_0x296a('0x2b')](_0x296a('0x41'),_0x2cfc7b[_0x296a('0x2c')]);var _0x2b2c45=callsValidation[_0x296a('0xf')](_0x1117b2[_0x296a('0x2c')]);if(_0x2b2c45[_0x296a('0x28')]>0x0){return _0x2cfc7b[_0x296a('0x19')](0x190)['json'](_0x2b2c45);}var _0x3b9ffe=_0x1117b2[_0x296a('0x2c')][_0x296a('0x2e')];var _0xd2aa69=respondWithRpcPromise(_0x296a('0x42'));var _0x571da2=getAgent(_0x3b9ffe);return Promise[_0x296a('0x23')]([_0xd2aa69,_0x571da2])[_0x296a('0x1c')](function(_0x2593cd){var _0x173668=_0x2593cd[0x0];var _0x2be2bf=_0x2593cd[0x1];var _0x2748a6=_[_0x296a('0x24')](_0x173668[_0x296a('0x25')],function(_0x182995){return _0x182995[_0x296a('0x26')]==_0x2be2bf['id'];});return _0x2cfc7b['status'](0xc8)['json']({'count':_0x2748a6[_0x296a('0x28')],'rows':_0x2748a6});})[_0x296a('0x20')](handleError(_0x2cfc7b));};exports['conference']=function(_0x119629,_0x47b7e3){logger[_0x296a('0x2b')](_0x296a('0x43'),_0x119629[_0x296a('0x2c')]);var _0x561d89=conferenceValidation[_0x296a('0xf')](_0x119629['body']);if(_0x561d89[_0x296a('0x28')]>0x0){return _0x47b7e3[_0x296a('0x19')](0x190)['json'](_0x561d89);}var _0x12fe88=_0x119629[_0x296a('0x2c')][_0x296a('0x2e')];return getAgent(_0x12fe88)[_0x296a('0x1c')](function(_0x1cca9a){logger[_0x296a('0x2b')]('entityFound:',_0x1cca9a[_0x296a('0x18')]);emit(util[_0x296a('0x34')](_0x296a('0x35'),_0x1cca9a[_0x296a('0x18')]),'webbar:conference');return _0x47b7e3[_0x296a('0x19')](0xc8)[_0x296a('0x2d')]({'error':![],'message':_0x296a('0x44')});})[_0x296a('0x20')](handleError(_0x47b7e3));};exports[_0x296a('0x45')]=function(_0x5e97c5,_0x356b33){logger[_0x296a('0x2b')](_0x296a('0x46'),_0x5e97c5[_0x296a('0x2c')]);var _0x1f73b8=transferValidation[_0x296a('0xf')](_0x5e97c5[_0x296a('0x2c')]);if(_0x1f73b8[_0x296a('0x28')]>0x0){return _0x356b33['status'](0x190)['json'](_0x1f73b8);}var _0x12f6a4=_0x5e97c5['body'][_0x296a('0x2e')];var _0x445f4f=_0x5e97c5[_0x296a('0x2c')][_0x296a('0x27')];var _0x13c938=_0x5e97c5[_0x296a('0x2c')][_0x296a('0x47')];return getAgent(_0x12f6a4)[_0x296a('0x1c')](function(_0x1420d9){logger['info'](_0x296a('0x31'),_0x1420d9[_0x296a('0x18')]);emit(util['format'](_0x296a('0x35'),_0x1420d9[_0x296a('0x18')]),_0x296a('0x48'),{'sessionId':_0x445f4f,'transferNumber':_0x13c938});return _0x356b33[_0x296a('0x19')](0xc8)[_0x296a('0x2d')]({'error':![],'message':_0x296a('0x49')});})[_0x296a('0x20')](handleError(_0x356b33));};
\ No newline at end of file
+var _0x170f=['callerId','callbackUrl','entityFound:','webbar:originate','hangup\x20fired:','json','format','user:%s','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','catch','hold','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','UserId','webbar:conference','conference\x20executed!','transfer','transferNumber','webbar:transfer','path','lodash','../../mysqldb','../../config/environment','util','client','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','error','stack','name','status','send','NotFound','request','then','code','message','findOne','agent','filter','rows','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','userId'];(function(_0x152449,_0x49f41d){var _0x5b58b2=function(_0x226c30){while(--_0x226c30){_0x152449['push'](_0x152449['shift']());}};_0x5b58b2(++_0x49f41d);}(_0x170f,0x65));var _0xf170=function(_0x358806,_0x322b66){_0x358806=_0x358806-0x0;var _0x19fdcb=_0x170f[_0x358806];return _0x19fdcb;};'use strict';var path=require(_0xf170('0x0'));var fs=require('fs');var _=require(_0xf170('0x1'));var db=require(_0xf170('0x2'))['db'];var config=require(_0xf170('0x3'));var util=require(_0xf170('0x4'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var amiClient=jayson[_0xf170('0x5')]['http']({'port':0x232a});var logger=require('../../config/logger')(_0xf170('0x6'));var Redis=require(_0xf170('0x7'));config[_0xf170('0x8')]=_[_0xf170('0x9')](config[_0xf170('0x8')],{'host':_0xf170('0xa'),'port':0x18eb});var io=require(_0xf170('0xb'))(new Redis(config[_0xf170('0x8')]));var Schema=require(_0xf170('0xc'));var originateValidation=new Schema({'userId':{'type':_0xf170('0xd'),'required':[!![],_0xf170('0xe')]},'callNumber':{'type':_0xf170('0xf'),'required':[!![],_0xf170('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xf170('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf170('0xd'),'required':[!![],_0xf170('0xe')]},'sessionId':{'type':_0xf170('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xf170('0xd'),'required':[!![],_0xf170('0xe')]},'sessionId':{'type':'string','required':[!![],_0xf170('0x11')]},'transferNumber':{'type':_0xf170('0xf'),'required':[!![],_0xf170('0x12')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf170('0xe')]},'sessionId':{'type':_0xf170('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xf170('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xf170('0xd'),'required':[!![],_0xf170('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xf170('0xd'),'required':[!![],_0xf170('0xe')]}});function emit(_0x2fc80a,_0x15a2d7,_0x323d69){logger[_0xf170('0x13')](_0x2fc80a,_0x15a2d7,JSON[_0xf170('0x14')](_0x323d69));io['to'](_0x2fc80a)[_0xf170('0x15')](_0x15a2d7,_0x323d69);}function handleError(_0x93af04){return function(_0x2bac8e){console['log']('handleError:',_0x2bac8e,_0x2bac8e instanceof RangeError);logger[_0xf170('0x16')](_0x2bac8e[_0xf170('0x17')]);if(_0x2bac8e instanceof RangeError){if(_0x2bac8e[_0xf170('0x18')]){delete _0x2bac8e[_0xf170('0x18')];}_0x93af04[_0xf170('0x19')](0x194)[_0xf170('0x1a')](_0x2bac8e);}else{if(_0x2bac8e[_0xf170('0x18')]){delete _0x2bac8e[_0xf170('0x18')];}_0x93af04[_0xf170('0x19')](0x1f4)[_0xf170('0x1a')](_0x2bac8e);}};}function checkError(){return function(_0x1f555a){if(!_0x1f555a){throw new RangeError(_0xf170('0x1b'));}return _0x1f555a;};}function respondWithRpcPromise(_0xa6abfd,_0x429ffa){return new BPromise(function(_0x27a34a,_0x1d1fa1){var _0x1c0032=amiClient;return _0x1c0032[_0xf170('0x1c')](_0xa6abfd,_0x429ffa)[_0xf170('0x1d')](function(_0x407e95){if(_0x407e95[_0xf170('0x16')]){if(_0x407e95[_0xf170('0x16')][_0xf170('0x1e')]===0x1f4){return _0x1d1fa1(_0x407e95[_0xf170('0x16')][_0xf170('0x1f')]);}return _0x27a34a(_0x407e95[_0xf170('0x16')][_0xf170('0x1f')]);}else{_0x27a34a(_0x407e95['result']);}})['catch'](function(_0xbb7745){_0x1d1fa1(_0xbb7745);});});}function getAgent(_0x1f9739){return db['User'][_0xf170('0x20')]({'where':{'id':_0x1f9739,'role':_0xf170('0x21')}})['then'](checkError());}function getAgentCheckSession(_0x2cd2c7,_0x491e3f){return new BPromise(function(_0x1cc2af,_0x398b70){var _0x4d420c=respondWithRpcPromise('VoiceChannels');var _0x5a63bb=getAgent(_0x2cd2c7);Promise['all']([_0x4d420c,_0x5a63bb])[_0xf170('0x1d')](function(_0x1ae240){var _0x28ffb8=_0x1ae240[0x0];var _0x5326e5=_0x1ae240[0x1];var _0x5dfe57=_[_0xf170('0x22')](_0x28ffb8[_0xf170('0x23')],function(_0x4164fd){return _0x4164fd['UserId']==_0x5326e5['id']&&_0x4164fd[_0xf170('0x24')]==_0x491e3f;});if(_0x5dfe57[_0xf170('0x25')]==0x1){_0x1cc2af(_0x5326e5);}else{_0x398b70(new RangeError('sessionId\x20'+_0x491e3f+_0xf170('0x26')));}});});}exports[_0xf170('0x27')]=function(_0x21e699,_0x3a8478){logger[_0xf170('0x13')](_0xf170('0x28'),_0x21e699[_0xf170('0x29')]);var _0x1af1d9=originateValidation[_0xf170('0xc')](_0x21e699[_0xf170('0x29')]);if(_0x1af1d9['length']>0x0){return _0x3a8478[_0xf170('0x19')](0x190)['json'](_0x1af1d9);}var _0x2ec04f=_0x21e699['body'][_0xf170('0x2a')];var _0x4cd13c=_0x21e699[_0xf170('0x29')]['callNumber'];var _0x2205bd=_0x21e699[_0xf170('0x29')][_0xf170('0x2b')];var _0x36151d=_0x21e699[_0xf170('0x29')][_0xf170('0x2c')];return getAgent(_0x2ec04f)['then'](function(_0x45f63b){logger['info'](_0xf170('0x2d'),_0x45f63b[_0xf170('0x18')]);emit(util['format']('user:%s',_0x45f63b[_0xf170('0x18')]),_0xf170('0x2e'),{'callNumber':_0x4cd13c,'callerId':_0x2205bd,'callbackUrl':_0x36151d});return _0x3a8478[_0xf170('0x19')](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x3a8478));};exports['hangup']=function(_0x4a7bff,_0x56866d){logger[_0xf170('0x13')](_0xf170('0x2f'),_0x4a7bff[_0xf170('0x29')]);var _0x32cad0=hangupValidation[_0xf170('0xc')](_0x4a7bff[_0xf170('0x29')]);if(_0x32cad0[_0xf170('0x25')]>0x0){return _0x56866d[_0xf170('0x19')](0x190)[_0xf170('0x30')](_0x32cad0);}var _0x30e48c=_0x4a7bff[_0xf170('0x29')][_0xf170('0x2a')];var _0x159aa5=_0x4a7bff[_0xf170('0x29')]['sessionId'];return getAgent(_0x30e48c)[_0xf170('0x1d')](function(_0x3e08e9){logger[_0xf170('0x13')](_0xf170('0x2d'),_0x3e08e9[_0xf170('0x18')]);emit(util[_0xf170('0x31')](_0xf170('0x32'),_0x3e08e9['name']),'webbar:hangup',{'sessionId':_0x159aa5});return _0x56866d[_0xf170('0x19')](0xc8)[_0xf170('0x30')]({'error':![],'message':_0xf170('0x33')});})['catch'](handleError(_0x56866d));};exports[_0xf170('0x34')]=function(_0x25706e,_0x8837d5){logger[_0xf170('0x13')](_0xf170('0x35'),_0x25706e[_0xf170('0x29')]);var _0x4f2f71=answerValidation[_0xf170('0xc')](_0x25706e['body']);if(_0x4f2f71[_0xf170('0x25')]>0x0){return _0x8837d5[_0xf170('0x19')](0x190)[_0xf170('0x30')](_0x4f2f71);}var _0x3bad8c=_0x25706e[_0xf170('0x29')][_0xf170('0x2a')];var _0x2b3f41=_0x25706e[_0xf170('0x29')]['sessionId'];return getAgent(_0x3bad8c)[_0xf170('0x1d')](function(_0x47663e){logger['info'](_0xf170('0x2d'),_0x47663e[_0xf170('0x18')]);emit(util['format'](_0xf170('0x32'),_0x47663e['name']),_0xf170('0x36'),{'sessionId':_0x2b3f41});return _0x8837d5[_0xf170('0x19')](0xc8)[_0xf170('0x30')]({'error':![],'message':'answer\x20executed!'});})[_0xf170('0x37')](handleError(_0x8837d5));};exports[_0xf170('0x38')]=function(_0x3525a1,_0x1c6ec7){logger[_0xf170('0x13')]('hold\x20fired:',_0x3525a1[_0xf170('0x29')]);var _0x1b57f4=holdValidation[_0xf170('0xc')](_0x3525a1['body']);if(_0x1b57f4[_0xf170('0x25')]>0x0){return _0x1c6ec7['status'](0x190)[_0xf170('0x30')](_0x1b57f4);}var _0x49d4bc=_0x3525a1['body'][_0xf170('0x2a')];var _0xceb3b3=_0x3525a1[_0xf170('0x29')][_0xf170('0x24')];return getAgent(_0x49d4bc)[_0xf170('0x1d')](function(_0x4abf55){logger['info'](_0xf170('0x2d'),_0x4abf55[_0xf170('0x18')]);emit(util[_0xf170('0x31')]('user:%s',_0x4abf55[_0xf170('0x18')]),_0xf170('0x39'),{'sessionId':_0xceb3b3});return _0x1c6ec7['status'](0xc8)[_0xf170('0x30')]({'error':![],'message':_0xf170('0x3a')});})[_0xf170('0x37')](handleError(_0x1c6ec7));};exports[_0xf170('0x3b')]=function(_0x575f1b,_0x5768b2){logger[_0xf170('0x13')](_0xf170('0x3c'),_0x575f1b['body']);var _0x1178a5=unholdValidation[_0xf170('0xc')](_0x575f1b[_0xf170('0x29')]);if(_0x1178a5[_0xf170('0x25')]>0x0){return _0x5768b2[_0xf170('0x19')](0x190)[_0xf170('0x30')](_0x1178a5);}var _0x591708=_0x575f1b[_0xf170('0x29')]['userId'];var _0x46b837=_0x575f1b[_0xf170('0x29')][_0xf170('0x24')];return getAgent(_0x591708)[_0xf170('0x1d')](function(_0x90a8c6){logger['info'](_0xf170('0x2d'),_0x90a8c6[_0xf170('0x18')]);emit(util[_0xf170('0x31')]('user:%s',_0x90a8c6[_0xf170('0x18')]),_0xf170('0x3d'),{'sessionId':_0x46b837});return _0x5768b2[_0xf170('0x19')](0xc8)[_0xf170('0x30')]({'error':![],'message':_0xf170('0x3e')});})[_0xf170('0x37')](handleError(_0x5768b2));};exports[_0xf170('0x3f')]=function(_0x3a73b7,_0x3bd3cf){logger[_0xf170('0x13')](_0xf170('0x40'),_0x3bd3cf['body']);var _0x19d056=callsValidation[_0xf170('0xc')](_0x3a73b7[_0xf170('0x29')]);if(_0x19d056[_0xf170('0x25')]>0x0){return _0x3bd3cf[_0xf170('0x19')](0x190)[_0xf170('0x30')](_0x19d056);}var _0x28c7b1=_0x3a73b7[_0xf170('0x29')]['userId'];var _0x2aba2f=respondWithRpcPromise(_0xf170('0x41'));var _0x1eacee=getAgent(_0x28c7b1);return Promise['all']([_0x2aba2f,_0x1eacee])[_0xf170('0x1d')](function(_0x2880d8){var _0x78686b=_0x2880d8[0x0];var _0x17b46c=_0x2880d8[0x1];var _0x5ea868=_[_0xf170('0x22')](_0x78686b['rows'],function(_0x1a17fa){return _0x1a17fa[_0xf170('0x42')]==_0x17b46c['id'];});return _0x3bd3cf[_0xf170('0x19')](0xc8)[_0xf170('0x30')]({'count':_0x5ea868[_0xf170('0x25')],'rows':_0x5ea868});})[_0xf170('0x37')](handleError(_0x3bd3cf));};exports['conference']=function(_0x4bfa46,_0x45095e){logger[_0xf170('0x13')]('conference\x20fired:',_0x4bfa46[_0xf170('0x29')]);var _0x1e7136=conferenceValidation[_0xf170('0xc')](_0x4bfa46[_0xf170('0x29')]);if(_0x1e7136[_0xf170('0x25')]>0x0){return _0x45095e[_0xf170('0x19')](0x190)[_0xf170('0x30')](_0x1e7136);}var _0x17c7d8=_0x4bfa46[_0xf170('0x29')][_0xf170('0x2a')];return getAgent(_0x17c7d8)[_0xf170('0x1d')](function(_0x447b8e){logger['info'](_0xf170('0x2d'),_0x447b8e['name']);emit(util['format'](_0xf170('0x32'),_0x447b8e[_0xf170('0x18')]),_0xf170('0x43'));return _0x45095e[_0xf170('0x19')](0xc8)['json']({'error':![],'message':_0xf170('0x44')});})['catch'](handleError(_0x45095e));};exports[_0xf170('0x45')]=function(_0x302b69,_0x71ca98){logger[_0xf170('0x13')]('transfer\x20fired:',_0x302b69[_0xf170('0x29')]);var _0x4a2a06=transferValidation[_0xf170('0xc')](_0x302b69[_0xf170('0x29')]);if(_0x4a2a06[_0xf170('0x25')]>0x0){return _0x71ca98[_0xf170('0x19')](0x190)[_0xf170('0x30')](_0x4a2a06);}var _0x2573ca=_0x302b69[_0xf170('0x29')]['userId'];var _0x3469e3=_0x302b69[_0xf170('0x29')][_0xf170('0x24')];var _0x303c7b=_0x302b69[_0xf170('0x29')][_0xf170('0x46')];return getAgent(_0x2573ca)[_0xf170('0x1d')](function(_0x1a1d16){logger[_0xf170('0x13')]('entityFound:',_0x1a1d16[_0xf170('0x18')]);emit(util['format'](_0xf170('0x32'),_0x1a1d16[_0xf170('0x18')]),_0xf170('0x47'),{'sessionId':_0x3469e3,'transferNumber':_0x303c7b});return _0x71ca98['status'](0xc8)[_0xf170('0x30')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x71ca98));};
\ No newline at end of file