8bf8c46c04430f11bcc3dfc0f6a0af7e62a69acb
[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 _0xd5b7=['telephones','trunks','campaigns','event','Event\x20name\x20mandatory','custom:','faxAccounts','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','action','Reload','message','catch','command','Command','Action','then','voiceQueues','hasOwnProperty','strategy','answered','pTalking','sumDuration','sumHoldTime','talking','total','type','abandoned','waiting','outbound','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','values','channels','length','voicechannel','map','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','find','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','validate','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','Redirect','exten','context'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xd5b7,0x1af));var _0x7d5b=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xd5b7[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0x7d5b('0x0'));var util=require(_0x7d5b('0x1'));var jayson=require(_0x7d5b('0x2'));var schema=require('validate');var BPromise=require(_0x7d5b('0x3'));var moment=require(_0x7d5b('0x4'));var config=require(_0x7d5b('0x5'));var properties=require(_0x7d5b('0x6'));var ami=require(_0x7d5b('0x7'));exports[_0x7d5b('0x8')]=function(_0x5461a1,_0x493a66,_0x2781eb){return new BPromise(function(_0x3928fa,_0x3dd62e){var _0x33018b={'QueuePause':function(_0x56d9e9){return new Promise(function(_0x384862,_0x32c8b4){var _0x559e6d=util[_0x7d5b('0x9')](_0x7d5b('0xa'),_0x7d5b('0xb'),_0x56d9e9[_0x7d5b('0xc')]);if(_0x5461a1[_0x7d5b('0xd')]&&_0x5461a1[_0x7d5b('0xd')][_0x559e6d]&&_0x5461a1[_0x7d5b('0xd')][_0x559e6d][_0x7d5b('0xe')]){_0x5461a1['timers'][_0x559e6d][_0x7d5b('0xf')]();}if(_0x5461a1[_0x7d5b('0x10')][_0x559e6d]){_0x5461a1[_0x7d5b('0x10')][_0x559e6d][_0x7d5b('0x11')]({'statePause':_0x56d9e9[_0x7d5b('0x12')]?!![]:![]});}_0x384862({'code':0xc8,'message':_0x7d5b('0x13')});});},'Reload':function(_0x424ca5){var _0xfbc2aa=this;return new Promise(function(_0x19224a,_0x522b61){if(ami[_0x7d5b('0x14')]()==![]){return _0x522b61(_0xfbc2aa[_0x7d5b('0x15')](0x1f4,[config['asterisk']['ip'],config[_0x7d5b('0x16')][_0x7d5b('0x17')],_0x7d5b('0x18')][_0x7d5b('0x19')]('\x20')));}_0x424ca5=_[_0x7d5b('0x1a')](_0x424ca5,_[_0x7d5b('0x1b')](properties['module']));_0x424ca5[_0x7d5b('0x1c')]=_0x7d5b('0x1d');return ami['Action'](_0x424ca5)['then'](function(_0x330417){_0x19224a({'code':0xc8,'message':_0x330417[_0x7d5b('0x1e')]});})[_0x7d5b('0x1f')](function(_0x302565){_0x522b61(_0xfbc2aa['error'](0x1f5,_0x302565[_0x7d5b('0x1e')]));});});},'Command':function(_0x5587c2){var _0x2f7af3=this;return new Promise(function(_0x4e7a76,_0x3a0ddc){if(ami[_0x7d5b('0x14')]()==![]){return _0x3a0ddc(_0x2f7af3['error'](0x1f4,[config[_0x7d5b('0x16')]['ip'],config[_0x7d5b('0x16')]['username'],_0x7d5b('0x18')]['join']('\x20')));}_0x5587c2=_[_0x7d5b('0x1a')](_0x5587c2,_0x7d5b('0x20'));_0x5587c2[_0x7d5b('0x1c')]=_0x7d5b('0x21');return ami[_0x7d5b('0x22')](_0x5587c2)[_0x7d5b('0x23')](function(_0x4bf821){_0x4e7a76({'code':0xc8,'message':_0x4bf821['content']});})[_0x7d5b('0x1f')](function(_0x1484cf){_0x3a0ddc(_0x2f7af3[_0x7d5b('0x15')](0x1f5,_0x1484cf[_0x7d5b('0x1e')]));});});},'VoiceQueues':function(_0x663fc8){return new Promise(function(_0x5c2b03,_0x1ea68c){var _0x35abd6=[];for(var _0x3bd087 in _0x5461a1[_0x7d5b('0x24')]){if(_0x5461a1[_0x7d5b('0x24')][_0x7d5b('0x25')](_0x3bd087)){var _0x211709=_0x5461a1['voiceQueues'][_0x3bd087];var _0x1150ff={'id':_0x211709['id'],'name':_0x211709[_0x7d5b('0xc')],'strategy':_0x211709[_0x7d5b('0x26')],'answered':_0x211709[_0x7d5b('0x27')],'available':_0x211709['available'],'loggedIn':_0x211709['loggedIn'],'pTalking':_0x211709[_0x7d5b('0x28')],'sumBillable':_0x211709['sumBillable'],'sumDuration':_0x211709[_0x7d5b('0x29')],'sumHoldTime':_0x211709[_0x7d5b('0x2a')]||0x0,'talking':_0x211709[_0x7d5b('0x2b')],'total':_0x211709[_0x7d5b('0x2c')],'type':_0x211709[_0x7d5b('0x2d')],'unmanaged':_0x211709['unmanaged'],'abandoned':_0x211709[_0x7d5b('0x2e')],'waiting':_0x211709[_0x7d5b('0x2f')],'loggedInDb':_0x211709['loggedInDb']};if(_0x211709[_0x7d5b('0x2d')]===_0x7d5b('0x30')){_0x1150ff[_0x7d5b('0x31')]=_0x211709[_0x7d5b('0x31')];_0x1150ff['dialMethod']=_0x211709['dialMethod'];_0x1150ff[_0x7d5b('0x32')]=_0x211709[_0x7d5b('0x32')];_0x1150ff[_0x7d5b('0x33')]=_0x211709[_0x7d5b('0x33')];_0x1150ff['dialOriginateTimeout']=_0x211709[_0x7d5b('0x34')];_0x1150ff[_0x7d5b('0x35')]=_0x211709[_0x7d5b('0x35')];_0x1150ff[_0x7d5b('0x36')]=_0x211709[_0x7d5b('0x36')];_0x1150ff['outboundAnswerCallsDay']=_0x211709[_0x7d5b('0x37')];_0x1150ff[_0x7d5b('0x38')]=_0x211709['outboundBlacklistCallsDay'];_0x1150ff[_0x7d5b('0x39')]=_0x211709[_0x7d5b('0x39')];_0x1150ff[_0x7d5b('0x3a')]=_0x211709[_0x7d5b('0x3a')];_0x1150ff[_0x7d5b('0x3b')]=_0x211709[_0x7d5b('0x3b')];_0x1150ff[_0x7d5b('0x3c')]=_0x211709['outboundDropCallsDayCallersExit'];_0x1150ff[_0x7d5b('0x3d')]=_0x211709[_0x7d5b('0x3d')];_0x1150ff[_0x7d5b('0x3e')]=_0x211709[_0x7d5b('0x3e')];_0x1150ff[_0x7d5b('0x3f')]=_0x211709['outboundNoSuchCallsDay'];_0x1150ff[_0x7d5b('0x40')]=_0x211709[_0x7d5b('0x40')];_0x1150ff[_0x7d5b('0x41')]=_0x211709['outboundReCallsDay'];_0x1150ff['outboundRejectCallsDay']=_0x211709[_0x7d5b('0x42')];_0x1150ff[_0x7d5b('0x43')]=_0x211709[_0x7d5b('0x43')];_0x1150ff['predictiveIntervalAnsweredCalls']=_0x211709['predictiveIntervalAnsweredCalls'];_0x1150ff[_0x7d5b('0x44')]=_0x211709[_0x7d5b('0x44')];_0x1150ff[_0x7d5b('0x45')]=_0x211709[_0x7d5b('0x45')];_0x1150ff[_0x7d5b('0x46')]=_0x211709[_0x7d5b('0x46')];_0x1150ff[_0x7d5b('0x47')]=_0x211709[_0x7d5b('0x47')];_0x1150ff[_0x7d5b('0x48')]=_0x211709[_0x7d5b('0x48')];_0x1150ff[_0x7d5b('0x49')]=_0x211709[_0x7d5b('0x49')];_0x1150ff[_0x7d5b('0x4a')]=_0x211709[_0x7d5b('0x4a')];_0x1150ff[_0x7d5b('0x4b')]=_0x211709[_0x7d5b('0x4b')];_0x1150ff[_0x7d5b('0x4c')]=_0x211709['predictiveIntervalPauses'];_0x1150ff['predictiveIntervalAvailable']=_0x211709['predictiveIntervalAvailable'];_0x1150ff[_0x7d5b('0x4d')]=_0x211709[_0x7d5b('0x4d')];_0x1150ff[_0x7d5b('0x1e')]=_0x211709['message'];_0x1150ff['originated']=_0x211709[_0x7d5b('0x4e')];_0x1150ff['erlangCalls']=_0x211709[_0x7d5b('0x4f')];_0x1150ff[_0x7d5b('0x50')]=_0x211709[_0x7d5b('0x50')];_0x1150ff[_0x7d5b('0x51')]=_0x211709[_0x7d5b('0x51')];_0x1150ff[_0x7d5b('0x52')]=_0x211709[_0x7d5b('0x52')];_0x1150ff[_0x7d5b('0x53')]=_0x211709[_0x7d5b('0x53')];_0x1150ff[_0x7d5b('0x54')]=_0x211709[_0x7d5b('0x54')];}if(_0x211709[_0x7d5b('0x55')]){_0x1150ff[_0x7d5b('0x55')]={'id':_0x211709['Trunk']['id'],'name':_0x211709[_0x7d5b('0x55')]['name'],'active':_0x211709[_0x7d5b('0x55')][_0x7d5b('0x56')],'callerid':_0x211709[_0x7d5b('0x55')][_0x7d5b('0x57')]};}if(_0x211709[_0x7d5b('0x58')]){_0x1150ff['Interval']={'id':_0x211709['Interval']['id'],'name':_0x211709['Interval']['name']};}_0x35abd6[_0x7d5b('0x59')](_0x1150ff);}}_0x5c2b03({'count':_0x35abd6['length'],'rows':_0x35abd6});});},'VoiceChannels':function(_0x2abd92){return new Promise(function(_0x52ab0b,_0x148c30){var _0x4fcb7e=_[_0x7d5b('0x5a')](_0x5461a1[_0x7d5b('0x5b')]);_0x52ab0b({'count':_0x4fcb7e[_0x7d5b('0x5c')],'rows':_0x4fcb7e});});},'VoiceChannelMixMonitor':function(_0x31fd2b){var _0xe23b46=this;return new Promise(function(_0x215a45,_0x27145a){if(ami[_0x7d5b('0x14')]()==![]){return _0x27145a(_0xe23b46[_0x7d5b('0x15')](0x1f4,[config['asterisk']['ip'],config[_0x7d5b('0x16')][_0x7d5b('0x17')],_0x7d5b('0x18')][_0x7d5b('0x19')]('\x20')));}var _0x2547b9=schema(properties[_0x7d5b('0x5d')])['validate'](_0x31fd2b);if(_0x2547b9['length']>0x0){return _0x27145a(_0xe23b46[_0x7d5b('0x15')](0x1f4,_[_0x7d5b('0x5e')](_0x2547b9,_0x7d5b('0x1e'))[_0x7d5b('0x19')](',\x20')));}var _0x54d18f=_['find'](_0x5461a1[_0x7d5b('0x5b')],{'uniqueid':_0x31fd2b[_0x7d5b('0x5f')]});if(_0x54d18f&&_0x54d18f[_0x7d5b('0x60')]){var _0x5543a5=util[_0x7d5b('0x9')](_0x7d5b('0x61'),_0x31fd2b[_0x7d5b('0x62')]||_0x31fd2b[_0x7d5b('0x5f')],_0x31fd2b[_0x7d5b('0x9')]||_0x7d5b('0x63'));return ami[_0x7d5b('0x22')]({'action':_0x7d5b('0x64'),'channel':_0x54d18f['channel'],'file':_0x5543a5,'options':_0x7d5b('0x65')})[_0x7d5b('0x23')](function(_0x125ff3){var _0x221732=_[_0x7d5b('0x66')](_0x54d18f[_0x7d5b('0x67')],{'filename':_0x7d5b('0x68')+_0x5543a5[_0x7d5b('0x69')]()});if(_['isNil'](_0x221732)){_0x54d18f[_0x7d5b('0x67')][_0x7d5b('0x59')]({'filename':'/var/spool/asterisk/monitor/'+_0x5543a5['toLowerCase'](),'createdAt':moment()['format'](_0x7d5b('0x6a')),'mixmonitorid':_0x125ff3[_0x7d5b('0x6b')],'status':_0x7d5b('0x6c')});}else{_0x221732[_0x7d5b('0x6b')]=_0x125ff3[_0x7d5b('0x6b')];_0x221732[_0x7d5b('0x6d')]=_0x7d5b('0x6c');}_0x215a45({'code':0xc8,'message':[_0x31fd2b[_0x7d5b('0x5f')],_0x7d5b('0x6e'),_0x125ff3[_0x7d5b('0x6b')]][_0x7d5b('0x19')]('\x20'),'mixmonitorid':_0x125ff3[_0x7d5b('0x6b')]});})['catch'](function(_0x4af97a){_0x27145a(_0xe23b46[_0x7d5b('0x15')](0x1f5,[_0x31fd2b[_0x7d5b('0x5f')],_0x4af97a['message']['toLowerCase']()][_0x7d5b('0x19')]('\x20')));});}else{return _0x27145a(_0xe23b46[_0x7d5b('0x15')](0x1f5,_0x7d5b('0x6f')));}});},'VoiceChannelStopMixMonitor':function(_0x56d161){var _0xb72cc6=this;return new Promise(function(_0x35e3ae,_0x53e16c){if(ami[_0x7d5b('0x14')]()==![]){return _0x53e16c(_0xb72cc6[_0x7d5b('0x15')](0x1f4,[config['asterisk']['ip'],config[_0x7d5b('0x16')][_0x7d5b('0x17')],_0x7d5b('0x18')]['join']('\x20')));}var _0x4d6729=schema(properties['voicechannel'])[_0x7d5b('0x70')](_0x56d161);if(_0x4d6729['length']>0x0){return _0x53e16c(_0xb72cc6[_0x7d5b('0x15')](0x1f4,_['map'](_0x4d6729,'message')[_0x7d5b('0x19')](',\x20')));}var _0x601bc8=_[_0x7d5b('0x66')](_0x5461a1[_0x7d5b('0x5b')],{'uniqueid':_0x56d161[_0x7d5b('0x5f')]});if(_0x601bc8){return BPromise[_0x7d5b('0x71')]()[_0x7d5b('0x23')](function(){if(_0x601bc8['channel']){return ami[_0x7d5b('0x22')]({'action':'StopMixMonitor','channel':_0x601bc8[_0x7d5b('0x60')],'mixmonitorid':_0x56d161[_0x7d5b('0x6b')]})[_0x7d5b('0x1f')](function(_0x11ca26){});}})['then'](function(){if(_0x601bc8['destinationchannel']){return ami[_0x7d5b('0x22')]({'action':_0x7d5b('0x72'),'channel':_0x601bc8[_0x7d5b('0x73')],'mixmonitorid':_0x56d161['mixmonitorid']})[_0x7d5b('0x1f')](function(_0x28aed5){});}})[_0x7d5b('0x23')](function(_0x3c6161){var _0x48f5dd=_[_0x7d5b('0x66')](_0x601bc8['monitors'],{'mixmonitorid':_0x56d161['mixmonitorid']});if(_0x48f5dd){_0x48f5dd[_0x7d5b('0x6d')]=_0x7d5b('0x74');}})[_0x7d5b('0x23')](function(){var _0x5eefa3=util[_0x7d5b('0x9')](_0x7d5b('0x61'),_0x56d161['filename']||_0x56d161['uniqueid'],_0x56d161[_0x7d5b('0x9')]||'wav');var _0x4f11d9=_[_0x7d5b('0x66')](_0x601bc8[_0x7d5b('0x67')],{'filename':_0x7d5b('0x68')+_0x5eefa3[_0x7d5b('0x69')]()});if(_0x4f11d9){_0x4f11d9[_0x7d5b('0x6d')]='stop';}})[_0x7d5b('0x23')](function(){_0x35e3ae({'code':0xc8,'message':[_0x56d161[_0x7d5b('0x5f')],_0x7d5b('0x75')][_0x7d5b('0x19')]('\x20')});})[_0x7d5b('0x1f')](function(_0x4f9848){_0x53e16c(_0xb72cc6[_0x7d5b('0x15')](0x1f5,[_0x56d161[_0x7d5b('0x5f')],_0x4f9848[_0x7d5b('0x1e')][_0x7d5b('0x69')]()][_0x7d5b('0x19')]('\x20')));});}else{return _0x53e16c(_0xb72cc6[_0x7d5b('0x15')](0x1f5,_0x7d5b('0x6f')));}});},'VoiceQueuesChannels':function(_0x19f3f0){return new Promise(function(_0x23d423,_0x17f68f){var _0xb79878=_[_0x7d5b('0x5a')](_0x5461a1[_0x7d5b('0x76')]);_0x23d423({'count':_0xb79878[_0x7d5b('0x5c')],'rows':_0xb79878});});},'VoiceQueuesChannel':function(_0x5c90fe){var _0xaba9c0=this;return new Promise(function(_0x1c5b09,_0xcd4c01){var _0x2a6536=schema(properties[_0x7d5b('0x77')])[_0x7d5b('0x70')](_0x5c90fe);if(_0x2a6536['length']>0x0){return _0xcd4c01(_0xaba9c0[_0x7d5b('0x15')](0x1f4,_[_0x7d5b('0x5e')](_0x2a6536,'message')[_0x7d5b('0x19')](',\x20')));}var _0x454276=_['find'](_0x5461a1['queueChannels'],{'uniqueid':_0x5c90fe['uniqueid']});if(_0x454276){_0x1c5b09(_0x454276);}else{return _0xcd4c01(_0xaba9c0['error'](0x1f5,_0x7d5b('0x6f')));}});},'VoiceQueuesChannelHangup':function(_0x34bc7c){var _0xa03a30=this;return new Promise(function(_0x3d74ee,_0x3397be){if(ami[_0x7d5b('0x14')]()==![]){return _0x3397be(_0xa03a30[_0x7d5b('0x15')](0x1f4,[config[_0x7d5b('0x16')]['ip'],config[_0x7d5b('0x16')][_0x7d5b('0x17')],_0x7d5b('0x18')][_0x7d5b('0x19')]('\x20')));}var _0x30e9b8=schema(properties[_0x7d5b('0x78')])['validate'](_0x34bc7c);if(_0x30e9b8[_0x7d5b('0x5c')]>0x0){return _0x3397be(_0xa03a30[_0x7d5b('0x15')](0x1f4,_[_0x7d5b('0x5e')](_0x30e9b8,_0x7d5b('0x1e'))[_0x7d5b('0x19')](',\x20')));}var _0x3cff62=_['find'](_0x5461a1[_0x7d5b('0x76')],{'uniqueid':_0x34bc7c[_0x7d5b('0x5f')]});if(_0x3cff62&&_0x3cff62[_0x7d5b('0x60')]){return ami[_0x7d5b('0x22')]({'action':_0x7d5b('0x79'),'channel':_0x3cff62[_0x7d5b('0x60')]})['then'](function(_0x2b0b62){_0x3d74ee({'code':0xc8,'message':[_0x34bc7c['uniqueid'],_0x2b0b62[_0x7d5b('0x1e')][_0x7d5b('0x69')]()][_0x7d5b('0x19')]('\x20')});})[_0x7d5b('0x1f')](function(_0x55a692){_0x3397be(_0xa03a30['error'](0x1f5,[_0x34bc7c['uniqueid'],_0x55a692[_0x7d5b('0x1e')][_0x7d5b('0x69')]()][_0x7d5b('0x19')]('\x20')));});}else{return _0x3397be(_0xa03a30[_0x7d5b('0x15')](0x1f5,_0x7d5b('0x6f')));}});},'VoiceQueuesChannelRedirect':function(_0x4daa4f){var _0x1000b7=this;return new Promise(function(_0xd852ad,_0x55f868){if(ami['isConnected']()==![]){return _0x55f868(_0x1000b7[_0x7d5b('0x15')](0x1f4,[config[_0x7d5b('0x16')]['ip'],config[_0x7d5b('0x16')]['username'],_0x7d5b('0x18')]['join']('\x20')));}var _0x1a9933=schema(properties['voicequeuechannelredirect'])[_0x7d5b('0x70')](_0x4daa4f);if(_0x1a9933[_0x7d5b('0x5c')]>0x0){return _0x55f868(_0x1000b7[_0x7d5b('0x15')](0x1f4,_['map'](_0x1a9933,_0x7d5b('0x1e'))[_0x7d5b('0x19')](',\x20')));}var _0x7c8273=_[_0x7d5b('0x66')](_0x5461a1[_0x7d5b('0x76')],{'uniqueid':_0x4daa4f[_0x7d5b('0x5f')]});if(_0x7c8273&&_0x7c8273['channel']){return ami[_0x7d5b('0x22')]({'action':_0x7d5b('0x7a'),'channel':_0x7c8273[_0x7d5b('0x60')],'exten':_0x4daa4f[_0x7d5b('0x7b')],'context':_0x4daa4f[_0x7d5b('0x7c')]||_0x7c8273[_0x7d5b('0x7c')],'priority':0x1})['then'](function(_0x32ac87){_0xd852ad({'code':0xc8,'message':[_0x4daa4f['uniqueid'],_0x32ac87[_0x7d5b('0x1e')][_0x7d5b('0x69')]()][_0x7d5b('0x19')]('\x20')});})[_0x7d5b('0x1f')](function(_0x46f536){_0x55f868(_0x1000b7['error'](0x1f5,[_0x4daa4f[_0x7d5b('0x5f')],_0x46f536[_0x7d5b('0x1e')][_0x7d5b('0x69')]()][_0x7d5b('0x19')]('\x20')));});}else{return _0x55f868(_0x1000b7[_0x7d5b('0x15')](0x1f5,_0x7d5b('0x6f')));}});},'Agents':function(_0x4eaf0f){return new Promise(function(_0x429f52,_0x43531e){var _0x27e280=_[_0x7d5b('0x5a')](_0x5461a1[_0x7d5b('0x10')]);_0x429f52({'count':_0x27e280[_0x7d5b('0x5c')],'rows':_0x27e280});});},'Telephones':function(_0x960292){return new Promise(function(_0x132259,_0x591b92){var _0x950552=_[_0x7d5b('0x5a')](_0x5461a1[_0x7d5b('0x7d')]);_0x132259({'count':_0x950552[_0x7d5b('0x5c')],'rows':_0x950552});});},'Trunks':function(_0x46b4ce){return new Promise(function(_0x357328,_0x2831fb){var _0x9c8ae4=_[_0x7d5b('0x5a')](_0x5461a1[_0x7d5b('0x7e')]);_0x357328({'count':_0x9c8ae4[_0x7d5b('0x5c')],'rows':_0x9c8ae4});});},'OutboundChannels':function(_0x2f2777){return new Promise(function(_0x45eaef,_0x483160){var _0x2f9cfd=_[_0x7d5b('0x5a')](_0x5461a1['outboundChannels']);_0x45eaef({'count':_0x2f9cfd['length'],'rows':_0x2f9cfd});});},'Outbound':function(_0x484f3e){return new Promise(function(_0x2ba215,_0x3588d4){_0x2ba215(_0x5461a1[_0x7d5b('0x30')]);});},'Campaigns':function(_0xdf93e6){return new Promise(function(_0x25e915,_0x3aa063){var _0x2aa00d=_[_0x7d5b('0x5a')](_0x5461a1[_0x7d5b('0x7f')]);_0x25e915({'count':_0x2aa00d[_0x7d5b('0x5c')],'rows':_0x2aa00d});});},'VoiceQueuesPreview':function(_0x5362a2){var _0x13fe71=this;return new Promise(function(_0x3dc4e8,_0x11a82f){_0x493a66['run'](_0x5362a2['id'])[_0x7d5b('0x23')](function(_0x28ad48){_0x3dc4e8({'code':0xc8,'message':_0x28ad48['message']});})['catch'](function(_0x580684){_0x11a82f(_0x13fe71['error'](0x1f4,_0x580684[_0x7d5b('0x1e')]));});});},'EventManager':function(_0x26cd10){var _0x54c346=this;return new Promise(function(_0x26cf5e,_0xbe7d45){if(!_0x26cd10[_0x7d5b('0x80')]){return _0xbe7d45(_0x54c346[_0x7d5b('0x15')](0x1f4,_0x7d5b('0x81')));}ami['emit'](_0x7d5b('0x82')+_0x26cd10[_0x7d5b('0x80')],_0x26cd10[_0x7d5b('0x1e')]);_0x26cf5e({'code':0xc8,'message':_0x26cd10});});},'FaxAccounts':function(_0x413845){return new Promise(function(_0x5d0cd6,_0x181f08){var _0x1d52cd=_[_0x7d5b('0x5a')](_0x5461a1[_0x7d5b('0x83')]);_0x5d0cd6({'count':_0x1d52cd[_0x7d5b('0x5c')],'rows':_0x1d52cd});});},'SendFax':function(_0x3074b6){var _0x273bb8=this;return new Promise(function(_0x5957ec,_0x15bf16){_0x2781eb['send'](_0x3074b6)['then'](function(_0x475c0c){_0x5957ec({'code':0xc8,'message':_0x475c0c['message']});})[_0x7d5b('0x1f')](function(_0x54efbe){_0x15bf16(_0x273bb8['error'](0x1f4,_0x54efbe[_0x7d5b('0x1e')]));});});},'CheckAfterSend':function(_0x511bd7){var _0x15d2bc=this;return new Promise(function(_0x1a87be,_0x3c9187){_0x2781eb[_0x7d5b('0x84')](_0x511bd7)[_0x7d5b('0x23')](function(_0x4f5d32){_0x1a87be({'code':0xc8,'message':_0x4f5d32['message']});})['catch'](function(_0x3a65d2){_0x3c9187(_0x15d2bc[_0x7d5b('0x15')](0x1f4,_0x3a65d2[_0x7d5b('0x1e')]));});});}};var _0x433ca6=jayson[_0x7d5b('0x85')](_0x33018b)[_0x7d5b('0x86')]();_0x433ca6['on'](_0x7d5b('0x15'),function(_0x4b594c){return _0x3dd62e(_0x4b594c);});_0x433ca6[_0x7d5b('0x8')](0x232a,_0x7d5b('0x87'),function(){console[_0x7d5b('0x88')](_0x7d5b('0x89'),0x232a);return _0x3928fa(_0x7d5b('0x8a')+0x232a);});});};