Built motion from commit (unavailable).|2.5.31
[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 _0x5de0=['validate','uniqueid','channel','filename','wav','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','catch','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','destinationchannel','stop','%s.%s','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','Redirect','values','telephones','Event\x20name\x20mandatory','custom:','event','faxAccounts','send','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','format','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','action','Reload','Action','then','message','pick','command','content','voiceQueues','hasOwnProperty','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','abandoned','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','channels','voicechannel'];(function(_0x2286e2,_0x298116){var _0x270d9c=function(_0xa060f){while(--_0xa060f){_0x2286e2['push'](_0x2286e2['shift']());}};_0x270d9c(++_0x298116);}(_0x5de0,0xaf));var _0x05de=function(_0x18edd1,_0x5b6c4b){_0x18edd1=_0x18edd1-0x0;var _0x2da59e=_0x5de0[_0x18edd1];return _0x2da59e;};'use strict';var _=require(_0x05de('0x0'));var util=require(_0x05de('0x1'));var jayson=require(_0x05de('0x2'));var schema=require('validate');var BPromise=require(_0x05de('0x3'));var moment=require(_0x05de('0x4'));var config=require(_0x05de('0x5'));var properties=require(_0x05de('0x6'));var ami=require(_0x05de('0x7'));exports['listen']=function(_0x473ecb,_0x263950,_0x536c94){return new BPromise(function(_0x30b896,_0x5f1f42){var _0x53edc0={'QueuePause':function(_0x3eaba8){return new Promise(function(_0x43f39a,_0x43aa21){var _0x1b31b5=util[_0x05de('0x8')]('%s/%s',_0x05de('0x9'),_0x3eaba8[_0x05de('0xa')]);if(_0x473ecb['timers']&&_0x473ecb[_0x05de('0xb')][_0x1b31b5]&&_0x473ecb[_0x05de('0xb')][_0x1b31b5][_0x05de('0xc')]){_0x473ecb[_0x05de('0xb')][_0x1b31b5][_0x05de('0xd')]();}if(_0x473ecb[_0x05de('0xe')][_0x1b31b5]){_0x473ecb['agents'][_0x1b31b5][_0x05de('0xf')]({'statePause':_0x3eaba8[_0x05de('0x10')]?!![]:![]});}_0x43f39a({'code':0xc8,'message':_0x05de('0x11')});});},'Reload':function(_0xd63c76){var _0xd1599e=this;return new Promise(function(_0x5ac509,_0x283da7){if(ami[_0x05de('0x12')]()==![]){return _0x283da7(_0xd1599e[_0x05de('0x13')](0x1f4,[config[_0x05de('0x14')]['ip'],config[_0x05de('0x14')][_0x05de('0x15')],_0x05de('0x16')][_0x05de('0x17')]('\x20')));}_0xd63c76=_['pick'](_0xd63c76,_['keys'](properties['module']));_0xd63c76[_0x05de('0x18')]=_0x05de('0x19');return ami[_0x05de('0x1a')](_0xd63c76)[_0x05de('0x1b')](function(_0x28865d){_0x5ac509({'code':0xc8,'message':_0x28865d['message']});})['catch'](function(_0x3e0b2a){_0x283da7(_0xd1599e['error'](0x1f5,_0x3e0b2a[_0x05de('0x1c')]));});});},'Command':function(_0x1689ce){var _0x2b3db0=this;return new Promise(function(_0x11915a,_0x555e0b){if(ami[_0x05de('0x12')]()==![]){return _0x555e0b(_0x2b3db0[_0x05de('0x13')](0x1f4,[config[_0x05de('0x14')]['ip'],config[_0x05de('0x14')][_0x05de('0x15')],_0x05de('0x16')]['join']('\x20')));}_0x1689ce=_[_0x05de('0x1d')](_0x1689ce,_0x05de('0x1e'));_0x1689ce[_0x05de('0x18')]='Command';return ami[_0x05de('0x1a')](_0x1689ce)['then'](function(_0x68b4fe){_0x11915a({'code':0xc8,'message':_0x68b4fe[_0x05de('0x1f')]});})['catch'](function(_0x192b9c){_0x555e0b(_0x2b3db0[_0x05de('0x13')](0x1f5,_0x192b9c[_0x05de('0x1c')]));});});},'VoiceQueues':function(_0x38c307){return new Promise(function(_0x5ad6c0,_0x3515f7){var _0x551497=[];for(var _0x13dc0c in _0x473ecb['voiceQueues']){if(_0x473ecb[_0x05de('0x20')][_0x05de('0x21')](_0x13dc0c)){var _0x112439=_0x473ecb['voiceQueues'][_0x13dc0c];var _0x10819d={'id':_0x112439['id'],'name':_0x112439[_0x05de('0xa')],'strategy':_0x112439['strategy'],'answered':_0x112439[_0x05de('0x22')],'available':_0x112439[_0x05de('0x23')],'loggedIn':_0x112439[_0x05de('0x24')],'pTalking':_0x112439[_0x05de('0x25')],'sumBillable':_0x112439[_0x05de('0x26')],'sumDuration':_0x112439[_0x05de('0x27')],'sumHoldTime':_0x112439[_0x05de('0x28')]||0x0,'talking':_0x112439[_0x05de('0x29')],'total':_0x112439[_0x05de('0x2a')],'type':_0x112439[_0x05de('0x2b')],'unmanaged':_0x112439['unmanaged'],'abandoned':_0x112439[_0x05de('0x2c')],'waiting':_0x112439['waiting'],'loggedInDb':_0x112439['loggedInDb']};if(_0x112439[_0x05de('0x2b')]===_0x05de('0x2d')){_0x10819d['dialActive']=_0x112439[_0x05de('0x2e')];_0x10819d['dialMethod']=_0x112439[_0x05de('0x2f')];_0x10819d[_0x05de('0x30')]=_0x112439['dialOriginateCallerIdName'];_0x10819d[_0x05de('0x31')]=_0x112439[_0x05de('0x31')];_0x10819d['dialOriginateTimeout']=_0x112439['dialOriginateTimeout'];_0x10819d[_0x05de('0x32')]=_0x112439[_0x05de('0x32')];_0x10819d[_0x05de('0x33')]=_0x112439[_0x05de('0x33')];_0x10819d[_0x05de('0x34')]=_0x112439['outboundAnswerAgiCallsDay'];_0x10819d[_0x05de('0x35')]=_0x112439[_0x05de('0x35')];_0x10819d[_0x05de('0x36')]=_0x112439[_0x05de('0x36')];_0x10819d[_0x05de('0x37')]=_0x112439['outboundBusyCallsDay'];_0x10819d[_0x05de('0x38')]=_0x112439[_0x05de('0x38')];_0x10819d[_0x05de('0x39')]=_0x112439[_0x05de('0x39')];_0x10819d[_0x05de('0x3a')]=_0x112439[_0x05de('0x3a')];_0x10819d[_0x05de('0x3b')]=_0x112439[_0x05de('0x3b')];_0x10819d['outboundNoAnswerCallsDay']=_0x112439[_0x05de('0x3c')];_0x10819d[_0x05de('0x3d')]=_0x112439[_0x05de('0x3d')];_0x10819d['outboundOriginateFailureCallsDay']=_0x112439[_0x05de('0x3e')];_0x10819d[_0x05de('0x3f')]=_0x112439[_0x05de('0x3f')];_0x10819d['outboundRejectCallsDay']=_0x112439[_0x05de('0x40')];_0x10819d[_0x05de('0x41')]=_0x112439[_0x05de('0x41')];_0x10819d[_0x05de('0x42')]=_0x112439[_0x05de('0x42')];_0x10819d[_0x05de('0x43')]=_0x112439[_0x05de('0x43')];_0x10819d[_0x05de('0x44')]=_0x112439['predictiveIntervalAvgTalktime'];_0x10819d[_0x05de('0x45')]=_0x112439[_0x05de('0x45')];_0x10819d[_0x05de('0x46')]=_0x112439[_0x05de('0x46')];_0x10819d['predictiveIntervalErlangCalls']=_0x112439['predictiveIntervalErlangCalls'];_0x10819d[_0x05de('0x47')]=_0x112439['predictiveIntervalErlangCallsDroppedCalls'];_0x10819d[_0x05de('0x48')]=_0x112439[_0x05de('0x48')];_0x10819d[_0x05de('0x49')]=_0x112439[_0x05de('0x49')];_0x10819d[_0x05de('0x4a')]=_0x112439['predictiveIntervalPauses'];_0x10819d['predictiveIntervalAvailable']=_0x112439['predictiveIntervalAvailable'];_0x10819d['predictiveIntervalTotalCalls']=_0x112439[_0x05de('0x4b')];_0x10819d[_0x05de('0x1c')]=_0x112439['message'];_0x10819d[_0x05de('0x4c')]=_0x112439[_0x05de('0x4c')];_0x10819d['erlangCalls']=_0x112439['erlangCalls'];_0x10819d[_0x05de('0x4d')]=_0x112439[_0x05de('0x4d')];_0x10819d[_0x05de('0x4e')]=_0x112439['erlangAbandonmentRate'];_0x10819d[_0x05de('0x4f')]=_0x112439[_0x05de('0x4f')];_0x10819d[_0x05de('0x50')]=_0x112439['startPredictive'];_0x10819d['startProgressive']=_0x112439[_0x05de('0x51')];}if(_0x112439[_0x05de('0x52')]){_0x10819d['Trunk']={'id':_0x112439['Trunk']['id'],'name':_0x112439[_0x05de('0x52')][_0x05de('0xa')],'active':_0x112439[_0x05de('0x52')][_0x05de('0x53')],'callerid':_0x112439[_0x05de('0x52')][_0x05de('0x54')]};}if(_0x112439[_0x05de('0x55')]){_0x10819d[_0x05de('0x55')]={'id':_0x112439[_0x05de('0x55')]['id'],'name':_0x112439['Interval'][_0x05de('0xa')]};}_0x551497[_0x05de('0x56')](_0x10819d);}}_0x5ad6c0({'count':_0x551497[_0x05de('0x57')],'rows':_0x551497});});},'UpdateVoiceQueue':function(_0x2285e4){return new Promise(function(_0x124ffe,_0x5a41e1){var _0xe6cd4f=_[_0x05de('0x58')](_0x473ecb[_0x05de('0x20')],{'id':parseInt(_0x2285e4['id'])});var _0x3840e7=_[_0x05de('0x59')](_0x2285e4,['id']);if(_0xe6cd4f){for(var _0x2d5e65 in _0x3840e7){if(typeof _0x3840e7[_0x2d5e65]!==_0x05de('0x5a')&&typeof _0xe6cd4f[_0x2d5e65]!==_0x05de('0x5a')){_0xe6cd4f[_0x2d5e65]=_0x3840e7[_0x2d5e65];}}_0x124ffe(_0xe6cd4f);}else{_0x5a41e1();}});},'VoiceChannels':function(_0x50f6d0){return new Promise(function(_0x2aabe3,_0x5e520a){var _0x12a0a6=_['values'](_0x473ecb[_0x05de('0x5b')]);_0x2aabe3({'count':_0x12a0a6['length'],'rows':_0x12a0a6});});},'VoiceChannelMixMonitor':function(_0x91e31e){var _0x15e200=this;return new Promise(function(_0x2c11f4,_0x35fcda){if(ami['isConnected']()==![]){return _0x35fcda(_0x15e200[_0x05de('0x13')](0x1f4,[config[_0x05de('0x14')]['ip'],config[_0x05de('0x14')][_0x05de('0x15')],_0x05de('0x16')][_0x05de('0x17')]('\x20')));}var _0x2f640b=schema(properties[_0x05de('0x5c')])[_0x05de('0x5d')](_0x91e31e);if(_0x2f640b[_0x05de('0x57')]>0x0){return _0x35fcda(_0x15e200[_0x05de('0x13')](0x1f4,_['map'](_0x2f640b,_0x05de('0x1c'))['join'](',\x20')));}var _0x2ed02c=_[_0x05de('0x58')](_0x473ecb[_0x05de('0x5b')],{'uniqueid':_0x91e31e[_0x05de('0x5e')]});if(_0x2ed02c&&_0x2ed02c[_0x05de('0x5f')]){var _0x5c64e3=util[_0x05de('0x8')]('%s.%s',_0x91e31e[_0x05de('0x60')]||_0x91e31e[_0x05de('0x5e')],_0x91e31e[_0x05de('0x8')]||_0x05de('0x61'));return ami['Action']({'action':'MixMonitor','channel':_0x2ed02c[_0x05de('0x5f')],'file':_0x5c64e3,'options':_0x05de('0x62')})[_0x05de('0x1b')](function(_0x5f3edd){var _0x13eaf8=_['find'](_0x2ed02c[_0x05de('0x63')],{'filename':_0x05de('0x64')+_0x5c64e3[_0x05de('0x65')]()});if(_[_0x05de('0x66')](_0x13eaf8)){_0x2ed02c['monitors']['push']({'filename':_0x05de('0x64')+_0x5c64e3[_0x05de('0x65')](),'createdAt':moment()['format'](_0x05de('0x67')),'mixmonitorid':_0x5f3edd['mixmonitorid'],'status':_0x05de('0x68')});}else{_0x13eaf8['mixmonitorid']=_0x5f3edd[_0x05de('0x69')];_0x13eaf8[_0x05de('0x6a')]='rec';}_0x2c11f4({'code':0xc8,'message':[_0x91e31e[_0x05de('0x5e')],_0x05de('0x6b'),_0x5f3edd[_0x05de('0x69')]][_0x05de('0x17')]('\x20'),'mixmonitorid':_0x5f3edd[_0x05de('0x69')]});})[_0x05de('0x6c')](function(_0x2e652f){_0x35fcda(_0x15e200[_0x05de('0x13')](0x1f5,[_0x91e31e[_0x05de('0x5e')],_0x2e652f[_0x05de('0x1c')][_0x05de('0x65')]()][_0x05de('0x17')]('\x20')));});}else{return _0x35fcda(_0x15e200[_0x05de('0x13')](0x1f5,_0x05de('0x6d')));}});},'VoiceChannelStopMixMonitor':function(_0x118a56){var _0x4a6066=this;return new Promise(function(_0x533223,_0x242a36){if(ami[_0x05de('0x12')]()==![]){return _0x242a36(_0x4a6066[_0x05de('0x13')](0x1f4,[config[_0x05de('0x14')]['ip'],config[_0x05de('0x14')]['username'],_0x05de('0x16')][_0x05de('0x17')]('\x20')));}var _0x2250d2=schema(properties[_0x05de('0x5c')])[_0x05de('0x5d')](_0x118a56);if(_0x2250d2['length']>0x0){return _0x242a36(_0x4a6066[_0x05de('0x13')](0x1f4,_[_0x05de('0x6e')](_0x2250d2,_0x05de('0x1c'))[_0x05de('0x17')](',\x20')));}var _0x43adc7=_[_0x05de('0x58')](_0x473ecb[_0x05de('0x5b')],{'uniqueid':_0x118a56['uniqueid']});if(_0x43adc7){return BPromise[_0x05de('0x6f')]()[_0x05de('0x1b')](function(){if(_0x43adc7[_0x05de('0x5f')]){return ami[_0x05de('0x1a')]({'action':_0x05de('0x70'),'channel':_0x43adc7[_0x05de('0x5f')],'mixmonitorid':_0x118a56[_0x05de('0x69')]})[_0x05de('0x6c')](function(_0x503059){});}})[_0x05de('0x1b')](function(){if(_0x43adc7[_0x05de('0x71')]){return ami[_0x05de('0x1a')]({'action':'StopMixMonitor','channel':_0x43adc7[_0x05de('0x71')],'mixmonitorid':_0x118a56[_0x05de('0x69')]})[_0x05de('0x6c')](function(_0x5e2f32){});}})[_0x05de('0x1b')](function(_0x3aa7ec){var _0x5f42c1=_['find'](_0x43adc7[_0x05de('0x63')],{'mixmonitorid':_0x118a56[_0x05de('0x69')]});if(_0x5f42c1){_0x5f42c1[_0x05de('0x6a')]=_0x05de('0x72');}})[_0x05de('0x1b')](function(){var _0x502819=util['format'](_0x05de('0x73'),_0x118a56[_0x05de('0x60')]||_0x118a56[_0x05de('0x5e')],_0x118a56['format']||_0x05de('0x61'));var _0x18723d=_[_0x05de('0x58')](_0x43adc7[_0x05de('0x63')],{'filename':_0x05de('0x64')+_0x502819[_0x05de('0x65')]()});if(_0x18723d){_0x18723d['status']=_0x05de('0x72');}})[_0x05de('0x1b')](function(){_0x533223({'code':0xc8,'message':[_0x118a56[_0x05de('0x5e')],_0x05de('0x74')][_0x05de('0x17')]('\x20')});})[_0x05de('0x6c')](function(_0x2f19f0){_0x242a36(_0x4a6066[_0x05de('0x13')](0x1f5,[_0x118a56['uniqueid'],_0x2f19f0[_0x05de('0x1c')][_0x05de('0x65')]()][_0x05de('0x17')]('\x20')));});}else{return _0x242a36(_0x4a6066[_0x05de('0x13')](0x1f5,_0x05de('0x6d')));}});},'VoiceQueuesChannels':function(_0x33ff49){return new Promise(function(_0x4ce722,_0x5ca354){var _0x3b0cc1=_['values'](_0x473ecb[_0x05de('0x75')]);_0x4ce722({'count':_0x3b0cc1[_0x05de('0x57')],'rows':_0x3b0cc1});});},'VoiceQueuesChannel':function(_0x106d30){var _0x42442b=this;return new Promise(function(_0x636b1d,_0x4fbcc0){var _0x5e3ff6=schema(properties[_0x05de('0x76')])['validate'](_0x106d30);if(_0x5e3ff6[_0x05de('0x57')]>0x0){return _0x4fbcc0(_0x42442b[_0x05de('0x13')](0x1f4,_[_0x05de('0x6e')](_0x5e3ff6,'message')[_0x05de('0x17')](',\x20')));}var _0x5d66a1=_[_0x05de('0x58')](_0x473ecb[_0x05de('0x75')],{'uniqueid':_0x106d30[_0x05de('0x5e')]});if(_0x5d66a1){_0x636b1d(_0x5d66a1);}else{return _0x4fbcc0(_0x42442b['error'](0x1f5,_0x05de('0x6d')));}});},'VoiceQueuesChannelHangup':function(_0x1e0cf8){var _0x526fec=this;return new Promise(function(_0x2954c8,_0x348d8c){if(ami[_0x05de('0x12')]()==![]){return _0x348d8c(_0x526fec['error'](0x1f4,[config[_0x05de('0x14')]['ip'],config[_0x05de('0x14')][_0x05de('0x15')],_0x05de('0x16')][_0x05de('0x17')]('\x20')));}var _0xef5129=schema(properties[_0x05de('0x77')])[_0x05de('0x5d')](_0x1e0cf8);if(_0xef5129[_0x05de('0x57')]>0x0){return _0x348d8c(_0x526fec[_0x05de('0x13')](0x1f4,_[_0x05de('0x6e')](_0xef5129,_0x05de('0x1c'))[_0x05de('0x17')](',\x20')));}var _0x4bf260=_[_0x05de('0x58')](_0x473ecb[_0x05de('0x75')],{'uniqueid':_0x1e0cf8[_0x05de('0x5e')]});if(_0x4bf260&&_0x4bf260['channel']){return ami['Action']({'action':_0x05de('0x78'),'channel':_0x4bf260[_0x05de('0x5f')]})[_0x05de('0x1b')](function(_0x190042){_0x2954c8({'code':0xc8,'message':[_0x1e0cf8[_0x05de('0x5e')],_0x190042[_0x05de('0x1c')][_0x05de('0x65')]()][_0x05de('0x17')]('\x20')});})[_0x05de('0x6c')](function(_0x488c8){_0x348d8c(_0x526fec[_0x05de('0x13')](0x1f5,[_0x1e0cf8['uniqueid'],_0x488c8[_0x05de('0x1c')][_0x05de('0x65')]()][_0x05de('0x17')]('\x20')));});}else{return _0x348d8c(_0x526fec[_0x05de('0x13')](0x1f5,_0x05de('0x6d')));}});},'VoiceQueuesChannelRedirect':function(_0x30c75a){var _0xe234dc=this;return new Promise(function(_0x2ec8e4,_0x24fe1b){if(ami['isConnected']()==![]){return _0x24fe1b(_0xe234dc[_0x05de('0x13')](0x1f4,[config[_0x05de('0x14')]['ip'],config[_0x05de('0x14')][_0x05de('0x15')],_0x05de('0x16')][_0x05de('0x17')]('\x20')));}var _0x14257c=schema(properties['voicequeuechannelredirect'])[_0x05de('0x5d')](_0x30c75a);if(_0x14257c[_0x05de('0x57')]>0x0){return _0x24fe1b(_0xe234dc[_0x05de('0x13')](0x1f4,_['map'](_0x14257c,_0x05de('0x1c'))['join'](',\x20')));}var _0x12c6db=_['find'](_0x473ecb[_0x05de('0x75')],{'uniqueid':_0x30c75a['uniqueid']});if(_0x12c6db&&_0x12c6db[_0x05de('0x5f')]){return ami[_0x05de('0x1a')]({'action':_0x05de('0x79'),'channel':_0x12c6db[_0x05de('0x5f')],'exten':_0x30c75a['exten'],'context':_0x30c75a['context']||_0x12c6db['context'],'priority':0x1})['then'](function(_0x3d3c81){_0x2ec8e4({'code':0xc8,'message':[_0x30c75a['uniqueid'],_0x3d3c81[_0x05de('0x1c')][_0x05de('0x65')]()][_0x05de('0x17')]('\x20')});})[_0x05de('0x6c')](function(_0x29c1d2){_0x24fe1b(_0xe234dc['error'](0x1f5,[_0x30c75a['uniqueid'],_0x29c1d2[_0x05de('0x1c')][_0x05de('0x65')]()][_0x05de('0x17')]('\x20')));});}else{return _0x24fe1b(_0xe234dc[_0x05de('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x514a05){return new Promise(function(_0x40b7eb,_0x4cac31){var _0x5ec93a=_[_0x05de('0x7a')](_0x473ecb['agents']);_0x40b7eb({'count':_0x5ec93a[_0x05de('0x57')],'rows':_0x5ec93a});});},'Telephones':function(_0x59b118){return new Promise(function(_0x324d54,_0x5b5d3a){var _0x3e4b58=_[_0x05de('0x7a')](_0x473ecb[_0x05de('0x7b')]);_0x324d54({'count':_0x3e4b58[_0x05de('0x57')],'rows':_0x3e4b58});});},'Trunks':function(_0x56238f){return new Promise(function(_0x5ef06d,_0x1b88ee){var _0x5603df=_[_0x05de('0x7a')](_0x473ecb['trunks']);_0x5ef06d({'count':_0x5603df[_0x05de('0x57')],'rows':_0x5603df});});},'OutboundChannels':function(_0x5ddc9b){return new Promise(function(_0x392cba,_0x4c3427){var _0x118af3=_[_0x05de('0x7a')](_0x473ecb['outboundChannels']);_0x392cba({'count':_0x118af3[_0x05de('0x57')],'rows':_0x118af3});});},'Outbound':function(_0x2f7835){return new Promise(function(_0x5cb60e,_0x5ac4db){_0x5cb60e(_0x473ecb[_0x05de('0x2d')]);});},'Campaigns':function(_0x5c3ca4){return new Promise(function(_0x1282a2,_0x5f0eeb){var _0x4daa5d=_[_0x05de('0x7a')](_0x473ecb['campaigns']);_0x1282a2({'count':_0x4daa5d[_0x05de('0x57')],'rows':_0x4daa5d});});},'VoiceQueuesPreview':function(_0x1ac001){var _0x131765=this;return new Promise(function(_0x5d58e8,_0x9c765f){_0x263950['run'](_0x1ac001['id'])[_0x05de('0x1b')](function(_0x481687){_0x5d58e8({'code':0xc8,'message':_0x481687['message']});})[_0x05de('0x6c')](function(_0x1720e4){_0x9c765f(_0x131765[_0x05de('0x13')](0x1f4,_0x1720e4['message']));});});},'EventManager':function(_0x909cd4){var _0x5ebb25=this;return new Promise(function(_0x3cc7e9,_0x39e9fd){if(!_0x909cd4['event']){return _0x39e9fd(_0x5ebb25[_0x05de('0x13')](0x1f4,_0x05de('0x7c')));}ami['emit'](_0x05de('0x7d')+_0x909cd4[_0x05de('0x7e')],_0x909cd4['message']);_0x3cc7e9({'code':0xc8,'message':_0x909cd4});});},'FaxAccounts':function(_0x2341ac){return new Promise(function(_0x3a6c23,_0x433802){var _0x269f00=_['values'](_0x473ecb[_0x05de('0x7f')]);_0x3a6c23({'count':_0x269f00[_0x05de('0x57')],'rows':_0x269f00});});},'SendFax':function(_0x406255){var _0x454ac1=this;return new Promise(function(_0x90e769,_0x5958d2){_0x536c94[_0x05de('0x80')](_0x406255)[_0x05de('0x1b')](function(_0x3fd059){_0x90e769({'code':0xc8,'message':_0x3fd059[_0x05de('0x1c')]});})[_0x05de('0x6c')](function(_0x39ae5f){_0x5958d2(_0x454ac1[_0x05de('0x13')](0x1f4,_0x39ae5f['message']));});});},'CheckAfterSend':function(_0x54a826){var _0x41f356=this;return new Promise(function(_0x10fa09,_0x532a32){_0x536c94['checkAfterSend'](_0x54a826)['then'](function(_0x57831f){_0x10fa09({'code':0xc8,'message':_0x57831f['message']});})[_0x05de('0x6c')](function(_0x2b92a3){_0x532a32(_0x41f356[_0x05de('0x13')](0x1f4,_0x2b92a3[_0x05de('0x1c')]));});});}};var _0x96f98f=jayson['server'](_0x53edc0)[_0x05de('0x81')]();_0x96f98f['on'](_0x05de('0x13'),function(_0x51dd4b){return _0x5f1f42(_0x51dd4b);});_0x96f98f['listen'](0x232a,_0x05de('0x82'),function(){console[_0x05de('0x83')](_0x05de('0x84'),0x232a);return _0x30b896(_0x05de('0x85')+0x232a);});});};