Built motion from commit 538092ac.|2.6.10
[motion2.git] / server / services / ami / server / index.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x85b5=['format','%s/%s','name','timers','timer','updateAcw','agents','pause','isConnected','error','asterisk','username','ami\x20disconnected','join','keys','module','Action','message','catch','command','action','then','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','type','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','Interval','push','omit','undefined','values','channels','length','find','uniqueid','%s.%s','wav','MixMonitor','channel','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','Channel\x20doesn\x27t\x20exist','voicechannel','map','resolve','destinationchannel','StopMixMonitor','status','stop','filename','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','validate','../../../config/environment','listen'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x85b5,0x7f));var _0x585b=function(_0x1a79ed,_0x47f3bf){_0x1a79ed=_0x1a79ed-0x0;var _0x593291=_0x85b5[_0x1a79ed];return _0x593291;};'use strict';var _=require(_0x585b('0x0'));var util=require(_0x585b('0x1'));var jayson=require('jayson/promise');var schema=require(_0x585b('0x2'));var moment=require('moment');var config=require(_0x585b('0x3'));var properties=require('../properties');var ami=require('../ami');exports[_0x585b('0x4')]=function(_0x4f37a9,_0x3c7651,_0x26ccfb){return new Promise(function(_0x9ccfca,_0x5b9e48){var _0x1605b5={'QueuePause':function(_0x55ffb3){return new Promise(function(_0x432e2d){var _0x2f8895=util[_0x585b('0x5')](_0x585b('0x6'),'SIP',_0x55ffb3[_0x585b('0x7')]);if(_0x4f37a9[_0x585b('0x8')]&&_0x4f37a9[_0x585b('0x8')][_0x2f8895]&&_0x4f37a9[_0x585b('0x8')][_0x2f8895][_0x585b('0x9')]){_0x4f37a9[_0x585b('0x8')][_0x2f8895][_0x585b('0xa')]();}if(_0x4f37a9['agents'][_0x2f8895]){_0x4f37a9[_0x585b('0xb')][_0x2f8895]['updateStatusRealtime']({'statePause':_0x55ffb3[_0x585b('0xc')]?!![]:![]});}_0x432e2d({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x16d608){var _0x35bda0=this;return new Promise(function(_0x19336c,_0x56fd9c){if(ami[_0x585b('0xd')]()==![]){return _0x56fd9c(_0x35bda0[_0x585b('0xe')](0x1f4,[config[_0x585b('0xf')]['ip'],config[_0x585b('0xf')][_0x585b('0x10')],_0x585b('0x11')][_0x585b('0x12')]('\x20')));}_0x16d608=_['pick'](_0x16d608,_[_0x585b('0x13')](properties[_0x585b('0x14')]));_0x16d608['action']='Reload';return ami[_0x585b('0x15')](_0x16d608)['then'](function(_0x5edd12){_0x19336c({'code':0xc8,'message':_0x5edd12[_0x585b('0x16')]});})[_0x585b('0x17')](function(_0x20c4ba){_0x56fd9c(_0x35bda0['error'](0x1f5,_0x20c4ba[_0x585b('0x16')]));});});},'Command':function(_0x14648f){var _0x326a4e=this;return new Promise(function(_0x31f5c2,_0x562886){if(ami[_0x585b('0xd')]()==![]){return _0x562886(_0x326a4e[_0x585b('0xe')](0x1f4,[config[_0x585b('0xf')]['ip'],config['asterisk']['username'],_0x585b('0x11')]['join']('\x20')));}_0x14648f=_['pick'](_0x14648f,_0x585b('0x18'));_0x14648f[_0x585b('0x19')]='Command';return ami[_0x585b('0x15')](_0x14648f)[_0x585b('0x1a')](function(_0x48998c){_0x31f5c2({'code':0xc8,'message':_0x48998c[_0x585b('0x1b')]});})[_0x585b('0x17')](function(_0x2122e0){_0x562886(_0x326a4e['error'](0x1f5,_0x2122e0[_0x585b('0x16')]));});});},'VoiceQueues':function(){return new Promise(function(_0x48940e){var _0x3c861c=[];for(var _0x10dd42 in _0x4f37a9[_0x585b('0x1c')]){if(_0x4f37a9[_0x585b('0x1c')][_0x585b('0x1d')](_0x10dd42)){var _0x1b1241=_0x4f37a9[_0x585b('0x1c')][_0x10dd42];var _0x799947={'id':_0x1b1241['id'],'name':_0x1b1241[_0x585b('0x7')],'strategy':_0x1b1241[_0x585b('0x1e')],'answered':_0x1b1241[_0x585b('0x1f')],'available':_0x1b1241[_0x585b('0x20')],'loggedIn':_0x1b1241[_0x585b('0x21')],'pTalking':_0x1b1241[_0x585b('0x22')],'sumBillable':_0x1b1241[_0x585b('0x23')],'sumDuration':_0x1b1241['sumDuration'],'sumHoldTime':_0x1b1241[_0x585b('0x24')]||0x0,'talking':_0x1b1241[_0x585b('0x25')],'total':_0x1b1241[_0x585b('0x26')],'type':_0x1b1241[_0x585b('0x27')],'unmanaged':_0x1b1241['unmanaged'],'abandoned':_0x1b1241['abandoned'],'waiting':_0x1b1241[_0x585b('0x28')],'loggedInDb':_0x1b1241[_0x585b('0x29')]};if(_0x1b1241['type']===_0x585b('0x2a')){_0x799947[_0x585b('0x2b')]=_0x1b1241['dialActive'];_0x799947[_0x585b('0x2c')]=_0x1b1241[_0x585b('0x2c')];_0x799947[_0x585b('0x2d')]=_0x1b1241[_0x585b('0x2d')];_0x799947[_0x585b('0x2e')]=_0x1b1241[_0x585b('0x2e')];_0x799947[_0x585b('0x2f')]=_0x1b1241[_0x585b('0x2f')];_0x799947[_0x585b('0x30')]=_0x1b1241[_0x585b('0x30')];_0x799947['temp']=_0x1b1241[_0x585b('0x31')];_0x799947[_0x585b('0x32')]=_0x1b1241[_0x585b('0x32')];_0x799947['outboundAnswerCallsDay']=_0x1b1241[_0x585b('0x33')];_0x799947[_0x585b('0x34')]=_0x1b1241[_0x585b('0x34')];_0x799947['outboundBusyCallsDay']=_0x1b1241[_0x585b('0x35')];_0x799947[_0x585b('0x36')]=_0x1b1241[_0x585b('0x36')];_0x799947[_0x585b('0x37')]=_0x1b1241['outboundDropCallsDayACS'];_0x799947['outboundDropCallsDayCallersExit']=_0x1b1241[_0x585b('0x38')];_0x799947[_0x585b('0x39')]=_0x1b1241[_0x585b('0x39')];_0x799947[_0x585b('0x3a')]=_0x1b1241[_0x585b('0x3a')];_0x799947['outboundNoSuchCallsDay']=_0x1b1241[_0x585b('0x3b')];_0x799947[_0x585b('0x3c')]=_0x1b1241[_0x585b('0x3c')];_0x799947[_0x585b('0x3d')]=_0x1b1241[_0x585b('0x3d')];_0x799947['outboundRejectCallsDay']=_0x1b1241['outboundRejectCallsDay'];_0x799947['outboundUnknownCallsDay']=_0x1b1241[_0x585b('0x3e')];_0x799947[_0x585b('0x3f')]=_0x1b1241[_0x585b('0x3f')];_0x799947[_0x585b('0x40')]=_0x1b1241[_0x585b('0x40')];_0x799947[_0x585b('0x41')]=_0x1b1241[_0x585b('0x41')];_0x799947[_0x585b('0x42')]=_0x1b1241[_0x585b('0x42')];_0x799947['predictiveIntervalDroppedCallsTimeout']=_0x1b1241[_0x585b('0x43')];_0x799947[_0x585b('0x44')]=_0x1b1241['predictiveIntervalErlangCalls'];_0x799947[_0x585b('0x45')]=_0x1b1241[_0x585b('0x45')];_0x799947[_0x585b('0x46')]=_0x1b1241[_0x585b('0x46')];_0x799947[_0x585b('0x47')]=_0x1b1241[_0x585b('0x47')];_0x799947['predictiveIntervalPauses']=_0x1b1241[_0x585b('0x48')];_0x799947[_0x585b('0x49')]=_0x1b1241[_0x585b('0x49')];_0x799947[_0x585b('0x4a')]=_0x1b1241[_0x585b('0x4a')];_0x799947[_0x585b('0x16')]=_0x1b1241[_0x585b('0x16')];_0x799947[_0x585b('0x4b')]=_0x1b1241['originated'];_0x799947[_0x585b('0x4c')]=_0x1b1241[_0x585b('0x4c')];_0x799947[_0x585b('0x4d')]=_0x1b1241['erlangCallToSecond'];_0x799947[_0x585b('0x4e')]=_0x1b1241[_0x585b('0x4e')];_0x799947[_0x585b('0x4f')]=_0x1b1241['erlangBusyFactor'];_0x799947[_0x585b('0x50')]=_0x1b1241[_0x585b('0x50')];_0x799947['startProgressive']=_0x1b1241['startProgressive'];}if(_0x1b1241[_0x585b('0x51')]){_0x799947['Trunk']={'id':_0x1b1241[_0x585b('0x51')]['id'],'name':_0x1b1241['Trunk'][_0x585b('0x7')],'active':_0x1b1241[_0x585b('0x51')]['active'],'callerid':_0x1b1241[_0x585b('0x51')]['callerid']};}if(_0x1b1241['Interval']){_0x799947['Interval']={'id':_0x1b1241[_0x585b('0x52')]['id'],'name':_0x1b1241['Interval'][_0x585b('0x7')]};}_0x3c861c[_0x585b('0x53')](_0x799947);}}_0x48940e({'count':_0x3c861c['length'],'rows':_0x3c861c});});},'UpdateVoiceQueue':function(_0x16b80a){return new Promise(function(_0x3d707f,_0x891252){var _0x4f087c=_['find'](_0x4f37a9['voiceQueues'],{'id':parseInt(_0x16b80a['id'])});var _0x2f1d2e=_[_0x585b('0x54')](_0x16b80a,['id']);if(_0x4f087c){for(var _0xa008dc in _0x2f1d2e){if(typeof _0x2f1d2e[_0xa008dc]!==_0x585b('0x55')&&typeof _0x4f087c[_0xa008dc]!=='undefined'){_0x4f087c[_0xa008dc]=_0x2f1d2e[_0xa008dc];}}_0x3d707f(_0x4f087c);}else{_0x891252();}});},'VoiceChannels':function(){return new Promise(function(_0x21eba3){var _0xf9c56d=_[_0x585b('0x56')](_0x4f37a9[_0x585b('0x57')]);_0x21eba3({'count':_0xf9c56d['length'],'rows':_0xf9c56d});});},'VoiceChannelMixMonitor':function(_0x41f22a){var _0x39c2e0=this;return new Promise(function(_0x36eb61,_0x5bf8b4){if(ami[_0x585b('0xd')]()==![]){return _0x5bf8b4(_0x39c2e0['error'](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x585b('0x10')],'ami\x20disconnected'][_0x585b('0x12')]('\x20')));}var _0x54ab6f=schema(properties['voicechannel'])['validate'](_0x41f22a);if(_0x54ab6f[_0x585b('0x58')]>0x0){return _0x5bf8b4(_0x39c2e0[_0x585b('0xe')](0x1f4,_['map'](_0x54ab6f,'message')[_0x585b('0x12')](',\x20')));}var _0x40dd9f=_[_0x585b('0x59')](_0x4f37a9['channels'],{'uniqueid':_0x41f22a[_0x585b('0x5a')]});if(_0x40dd9f&&_0x40dd9f['channel']){var _0x44234e=util['format'](_0x585b('0x5b'),_0x41f22a['filename']||_0x41f22a[_0x585b('0x5a')],_0x41f22a['format']||_0x585b('0x5c'));return ami[_0x585b('0x15')]({'action':_0x585b('0x5d'),'channel':_0x40dd9f[_0x585b('0x5e')],'file':_0x44234e,'options':_0x585b('0x5f')})['then'](function(_0xec885c){var _0x2ef157=_[_0x585b('0x59')](_0x40dd9f[_0x585b('0x60')],{'filename':_0x585b('0x61')+_0x44234e[_0x585b('0x62')]()});if(_['isNil'](_0x2ef157)){_0x40dd9f[_0x585b('0x60')][_0x585b('0x53')]({'filename':_0x585b('0x61')+_0x44234e[_0x585b('0x62')](),'createdAt':moment()['format'](_0x585b('0x63')),'mixmonitorid':_0xec885c[_0x585b('0x64')],'status':_0x585b('0x65')});}else{_0x2ef157['mixmonitorid']=_0xec885c['mixmonitorid'];_0x2ef157['status']='rec';}_0x36eb61({'code':0xc8,'message':[_0x41f22a['uniqueid'],'MixMonitor\x20Success',_0xec885c[_0x585b('0x64')]][_0x585b('0x12')]('\x20'),'mixmonitorid':_0xec885c[_0x585b('0x64')]});})['catch'](function(_0x1efe6b){_0x5bf8b4(_0x39c2e0[_0x585b('0xe')](0x1f5,[_0x41f22a[_0x585b('0x5a')],_0x1efe6b[_0x585b('0x16')]['toLowerCase']()][_0x585b('0x12')]('\x20')));});}else{return _0x5bf8b4(_0x39c2e0[_0x585b('0xe')](0x1f5,_0x585b('0x66')));}});},'VoiceChannelStopMixMonitor':function(_0x136ba9){var _0xe4f07b=this;return new Promise(function(_0x3d5b4a,_0x214869){if(ami['isConnected']()==![]){return _0x214869(_0xe4f07b[_0x585b('0xe')](0x1f4,[config[_0x585b('0xf')]['ip'],config[_0x585b('0xf')][_0x585b('0x10')],_0x585b('0x11')][_0x585b('0x12')]('\x20')));}var _0x13678f=schema(properties[_0x585b('0x67')])[_0x585b('0x2')](_0x136ba9);if(_0x13678f[_0x585b('0x58')]>0x0){return _0x214869(_0xe4f07b[_0x585b('0xe')](0x1f4,_[_0x585b('0x68')](_0x13678f,_0x585b('0x16'))[_0x585b('0x12')](',\x20')));}var _0x4ded11=_[_0x585b('0x59')](_0x4f37a9['channels'],{'uniqueid':_0x136ba9[_0x585b('0x5a')]});if(_0x4ded11){return Promise[_0x585b('0x69')]()['then'](function(){if(_0x4ded11[_0x585b('0x5e')]){return ami[_0x585b('0x15')]({'action':'StopMixMonitor','channel':_0x4ded11['channel'],'mixmonitorid':_0x136ba9['mixmonitorid']})['catch'](function(){});}})['then'](function(){if(_0x4ded11[_0x585b('0x6a')]){return ami['Action']({'action':_0x585b('0x6b'),'channel':_0x4ded11[_0x585b('0x6a')],'mixmonitorid':_0x136ba9[_0x585b('0x64')]})[_0x585b('0x17')](function(){});}})[_0x585b('0x1a')](function(){var _0x3275c4=_['find'](_0x4ded11['monitors'],{'mixmonitorid':_0x136ba9['mixmonitorid']});if(_0x3275c4){_0x3275c4[_0x585b('0x6c')]=_0x585b('0x6d');}})[_0x585b('0x1a')](function(){var _0x117a66=util[_0x585b('0x5')]('%s.%s',_0x136ba9[_0x585b('0x6e')]||_0x136ba9[_0x585b('0x5a')],_0x136ba9[_0x585b('0x5')]||_0x585b('0x5c'));var _0xd23f61=_['find'](_0x4ded11[_0x585b('0x60')],{'filename':_0x585b('0x61')+_0x117a66[_0x585b('0x62')]()});if(_0xd23f61){_0xd23f61[_0x585b('0x6c')]=_0x585b('0x6d');}})['then'](function(){_0x3d5b4a({'code':0xc8,'message':[_0x136ba9[_0x585b('0x5a')],_0x585b('0x6f')][_0x585b('0x12')]('\x20')});})[_0x585b('0x17')](function(_0x4ab991){_0x214869(_0xe4f07b[_0x585b('0xe')](0x1f5,[_0x136ba9[_0x585b('0x5a')],_0x4ab991[_0x585b('0x16')][_0x585b('0x62')]()][_0x585b('0x12')]('\x20')));});}else{return _0x214869(_0xe4f07b[_0x585b('0xe')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(){return new Promise(function(_0x362070){var _0x56f7f4=_[_0x585b('0x56')](_0x4f37a9[_0x585b('0x70')]);_0x362070({'count':_0x56f7f4[_0x585b('0x58')],'rows':_0x56f7f4});});},'VoiceQueuesChannel':function(_0x5a4373){var _0x257703=this;return new Promise(function(_0x11bd7b,_0x424658){var _0x21ad2b=schema(properties[_0x585b('0x71')])[_0x585b('0x2')](_0x5a4373);if(_0x21ad2b[_0x585b('0x58')]>0x0){return _0x424658(_0x257703['error'](0x1f4,_[_0x585b('0x68')](_0x21ad2b,_0x585b('0x16'))[_0x585b('0x12')](',\x20')));}var _0x23f7b0=_[_0x585b('0x59')](_0x4f37a9['queueChannels'],{'uniqueid':_0x5a4373[_0x585b('0x5a')]});if(_0x23f7b0){_0x11bd7b(_0x23f7b0);}else{return _0x424658(_0x257703[_0x585b('0xe')](0x1f5,_0x585b('0x66')));}});},'VoiceQueuesChannelHangup':function(_0x252397){var _0x518155=this;return new Promise(function(_0x284bf9,_0x17644f){if(ami[_0x585b('0xd')]()==![]){return _0x17644f(_0x518155[_0x585b('0xe')](0x1f4,[config[_0x585b('0xf')]['ip'],config[_0x585b('0xf')]['username'],'ami\x20disconnected'][_0x585b('0x12')]('\x20')));}var _0x2112e=schema(properties['voicequeuechannelhangup'])[_0x585b('0x2')](_0x252397);if(_0x2112e[_0x585b('0x58')]>0x0){return _0x17644f(_0x518155[_0x585b('0xe')](0x1f4,_[_0x585b('0x68')](_0x2112e,'message')['join'](',\x20')));}var _0x16808b=_['find'](_0x4f37a9[_0x585b('0x70')],{'uniqueid':_0x252397[_0x585b('0x5a')]});if(_0x16808b&&_0x16808b['channel']){return ami['Action']({'action':_0x585b('0x72'),'channel':_0x16808b[_0x585b('0x5e')]})[_0x585b('0x1a')](function(_0x34cee5){_0x284bf9({'code':0xc8,'message':[_0x252397[_0x585b('0x5a')],_0x34cee5[_0x585b('0x16')][_0x585b('0x62')]()][_0x585b('0x12')]('\x20')});})['catch'](function(_0x3d1c26){_0x17644f(_0x518155['error'](0x1f5,[_0x252397['uniqueid'],_0x3d1c26[_0x585b('0x16')][_0x585b('0x62')]()]['join']('\x20')));});}else{return _0x17644f(_0x518155[_0x585b('0xe')](0x1f5,_0x585b('0x66')));}});},'VoiceQueuesChannelRedirect':function(_0x4c55b5){var _0xfa879a=this;return new Promise(function(_0x1f4d1e,_0x583f4a){if(ami[_0x585b('0xd')]()==![]){return _0x583f4a(_0xfa879a[_0x585b('0xe')](0x1f4,[config['asterisk']['ip'],config[_0x585b('0xf')]['username'],_0x585b('0x11')][_0x585b('0x12')]('\x20')));}var _0x22367f=schema(properties[_0x585b('0x73')])[_0x585b('0x2')](_0x4c55b5);if(_0x22367f[_0x585b('0x58')]>0x0){return _0x583f4a(_0xfa879a[_0x585b('0xe')](0x1f4,_[_0x585b('0x68')](_0x22367f,_0x585b('0x16'))[_0x585b('0x12')](',\x20')));}var _0x17bf88=_[_0x585b('0x59')](_0x4f37a9[_0x585b('0x70')],{'uniqueid':_0x4c55b5[_0x585b('0x5a')]});if(_0x17bf88&&_0x17bf88['channel']){return ami[_0x585b('0x15')]({'action':_0x585b('0x74'),'channel':_0x17bf88[_0x585b('0x5e')],'exten':_0x4c55b5[_0x585b('0x75')],'context':_0x4c55b5[_0x585b('0x76')]||_0x17bf88[_0x585b('0x76')],'priority':0x1})[_0x585b('0x1a')](function(_0x18a997){_0x1f4d1e({'code':0xc8,'message':[_0x4c55b5[_0x585b('0x5a')],_0x18a997['message'][_0x585b('0x62')]()][_0x585b('0x12')]('\x20')});})[_0x585b('0x17')](function(_0x27bc68){_0x583f4a(_0xfa879a[_0x585b('0xe')](0x1f5,[_0x4c55b5[_0x585b('0x5a')],_0x27bc68['message'][_0x585b('0x62')]()][_0x585b('0x12')]('\x20')));});}else{return _0x583f4a(_0xfa879a[_0x585b('0xe')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x47aca4){return new Promise(function(_0x1ee917){var _0x44f336=_[_0x585b('0x56')](_0x4f37a9[_0x585b('0xb')]);if(_0x47aca4&&_0x47aca4['id']){var _0x5a0f9f=_[_0x585b('0x59')](_0x44f336,function(_0x227aac){return _0x227aac['id']===_0x47aca4['id'];});_0x1ee917(_0x5a0f9f);}else{_0x1ee917({'count':_0x44f336[_0x585b('0x58')],'rows':_0x44f336});}});},'Telephones':function(){return new Promise(function(_0x2c8150){var _0x1860c0=_[_0x585b('0x56')](_0x4f37a9[_0x585b('0x77')]);_0x2c8150({'count':_0x1860c0['length'],'rows':_0x1860c0});});},'Trunks':function(){return new Promise(function(_0x145bf5){var _0x5f58de=_[_0x585b('0x56')](_0x4f37a9[_0x585b('0x78')]);_0x145bf5({'count':_0x5f58de['length'],'rows':_0x5f58de});});},'OutboundChannels':function(){return new Promise(function(_0x1fc8b2){var _0x2f6407=_[_0x585b('0x56')](_0x4f37a9[_0x585b('0x79')]);_0x1fc8b2({'count':_0x2f6407[_0x585b('0x58')],'rows':_0x2f6407});});},'Outbound':function(){return new Promise(function(_0xeb2a1e){_0xeb2a1e(_0x4f37a9[_0x585b('0x2a')]);});},'Campaigns':function(){return new Promise(function(_0x52bfa6){var _0x5dfc52=_[_0x585b('0x56')](_0x4f37a9[_0x585b('0x7a')]);_0x52bfa6({'count':_0x5dfc52[_0x585b('0x58')],'rows':_0x5dfc52});});},'VoiceQueuesPreview':function(_0x31cc88){var _0x2b2e3c=this;return new Promise(function(_0x5b83d6,_0x2ed882){_0x3c7651['run'](_0x31cc88['id'])[_0x585b('0x1a')](function(_0xcbc665){_0x5b83d6({'code':0xc8,'message':_0xcbc665[_0x585b('0x16')]});})[_0x585b('0x17')](function(_0x14d919){_0x2ed882(_0x2b2e3c['error'](0x1f4,_0x14d919[_0x585b('0x16')]));});});},'EventManager':function(_0x407d42){var _0x1dafe=this;return new Promise(function(_0x246fc3,_0x17b210){if(!_0x407d42[_0x585b('0x7b')]){return _0x17b210(_0x1dafe[_0x585b('0xe')](0x1f4,_0x585b('0x7c')));}ami['emit']('custom:'+_0x407d42[_0x585b('0x7b')],_0x407d42['message']);_0x246fc3({'code':0xc8,'message':_0x407d42});});},'FaxAccounts':function(){return new Promise(function(_0x264cf4){var _0x5f165b=_[_0x585b('0x56')](_0x4f37a9[_0x585b('0x7d')]);_0x264cf4({'count':_0x5f165b['length'],'rows':_0x5f165b});});},'SendFax':function(_0x41c464){var _0x5d9a36=this;return new Promise(function(_0x3d11e4,_0x42a0b7){_0x26ccfb[_0x585b('0x7e')](_0x41c464)[_0x585b('0x1a')](function(_0x427867){_0x3d11e4({'code':0xc8,'message':_0x427867[_0x585b('0x16')]});})[_0x585b('0x17')](function(_0x2e25dc){_0x42a0b7(_0x5d9a36['error'](0x1f4,_0x2e25dc[_0x585b('0x16')]));});});},'CheckAfterSend':function(_0x2d2fa5){var _0x2b6ee1=this;return new Promise(function(_0x9a500d,_0x1571b0){_0x26ccfb[_0x585b('0x7f')](_0x2d2fa5)['then'](function(_0x508d55){_0x9a500d({'code':0xc8,'message':_0x508d55[_0x585b('0x16')]});})[_0x585b('0x17')](function(_0x534f43){_0x1571b0(_0x2b6ee1[_0x585b('0xe')](0x1f4,_0x534f43[_0x585b('0x16')]));});});}};var _0x44b792=jayson[_0x585b('0x80')](_0x1605b5)[_0x585b('0x81')]();_0x44b792['on']('error',function(_0x39086e){return _0x5b9e48(_0x39086e);});_0x44b792[_0x585b('0x4')](0x232a,'127.0.0.1',function(){console[_0x585b('0x82')](_0x585b('0x83'),0x232a);return _0x9ccfca('RPC\x20listening\x20on\x20port:'+0x232a);});});};