Built motion from commit 4a18b36e645f5fa4a517d36f9783bde259878164. Version 3.0.0...
[motion-next.git] / server / services / ami / server / index.js
1 const a1133_0xc79e=['checkAfterSend','validate','format','Interval','values','exten','Hangup','voiceQueues','outboundBlacklistCallsDay','Command','server','predictiveIntervalAnsweredCalls','channels','dialOriginateCallerIdName','MixMonitor','monitors','message','username','dialMethod','outboundOriginateFailureCallsDay','outboundNoAnswerCallsDay','erlangBusyFactor','%s.%s','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','predictiveIntervalAvgTalktime','QueuePause','predictiveIntervalAvailable','isNil','telephones','voicequeuechannel','predictiveIntervalMultiplicativeFactor','Channel\x20doesn\x27t\x20exist','util','/var/spool/asterisk/monitor/','moment','%s/%s','loggedInDb','SIP','isConnected','outboundAnswerCallsDay','listen','erlangCalls','push','error','abandoned','toLowerCase','outboundDropCallsDayTimeout','voicequeuechannelredirect','outboundBusyCallsDay','startProgressive','ami\x20disconnected','name','predictiveIntervalTotalCalls','dialOriginateTimeout','predictiveIntervalPauses','127.0.0.1','../../../config/environment','action','lodash','predictiveIntervalAvgHoldtime','unmanaged','module','sumDuration','length','predictiveIntervalErlangCallsDroppedCalls','status','wav','StopMixMonitor','updateStatusRealtime','uniqueid','outboundNoSuchCallsDay','run','filename','Action','find','catch','pTalking','custom:','emit','join','originated','predictiveIntervalDroppedCallsTimeout','rec','callerid','outboundChannels','http','startPredictive','stop','dialPrefix','MixMonitor\x20Success','updateAcw','map','pick','content','waiting','predictiveIntervalErlangCalls','faxAccounts','predictiveIntervalHitRate','ai(mixmonitorid)','erlangAbandonmentRate','send','context','dialActive','trunks','Trunk','../ami','outboundUnknownCallsDay','available','StopMixMonitor\x20Success','voicechannel','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','outboundRejectCallsDay','dialOriginateCallerIdNumber','sumBillable','event','agents','asterisk','outbound','then','queueChannels','erlangCallToSecond','strategy','timers','destinationchannel','mixmonitorid','../properties','RPC\x20listening\x20on\x20port:','jayson/promise','channel','Redirect'];(function(_0x2e231a,_0xc79eb7){const _0x4a64fc=function(_0x43e8db){while(--_0x43e8db){_0x2e231a['push'](_0x2e231a['shift']());}};_0x4a64fc(++_0xc79eb7);}(a1133_0xc79e,0x1b5));const a1133_0x4a64=function(_0x2e231a,_0xc79eb7){_0x2e231a=_0x2e231a-0x0;let _0x4a64fc=a1133_0xc79e[_0x2e231a];return _0x4a64fc;};const _0x18f597=a1133_0x4a64;'use strict';const _=require(_0x18f597('0x12')),util=require(_0x18f597('0x7c')),jayson=require(_0x18f597('0x58')),schema=require(_0x18f597('0x5c')),moment=require(_0x18f597('0x7e')),config=require(_0x18f597('0x10')),properties=require(_0x18f597('0x56')),ami=require(_0x18f597('0x41'));exports[_0x18f597('0x0')]=function(_0x43e8db,_0x453fab,_0x2a10ed){return new Promise(function(_0x2a3a8c,_0xc6f5a5){const _0x5047d9=a1133_0x4a64,_0x3eef16={'QueuePause':function(_0x462573){return new Promise(function(_0x16b0fc){const _0x4e8379=a1133_0x4a64,_0x55e8cf=util['format'](_0x4e8379('0x7f'),_0x4e8379('0x81'),_0x462573[_0x4e8379('0xb')]);_0x43e8db[_0x4e8379('0x53')]&&_0x43e8db[_0x4e8379('0x53')][_0x55e8cf]&&_0x43e8db[_0x4e8379('0x53')][_0x55e8cf]['timer']&&_0x43e8db['timers'][_0x55e8cf][_0x4e8379('0x32')](),_0x43e8db['agents'][_0x55e8cf]&&_0x43e8db[_0x4e8379('0x4c')][_0x55e8cf][_0x4e8379('0x1c')]({'statePause':_0x462573['pause']?!![]:![]}),_0x16b0fc({'code':0xc8,'message':_0x4e8379('0x75')});});},'Reload':function(_0x47c0e8){const _0x9cd69c=this;return new Promise(function(_0x2e59c1,_0x523543){const _0x634698=a1133_0x4a64;if(ami[_0x634698('0x82')]()==![])return _0x523543(_0x9cd69c[_0x634698('0x3')](0x1f4,[config[_0x634698('0x4d')]['ip'],config[_0x634698('0x4d')][_0x634698('0x6c')],'ami\x20disconnected'][_0x634698('0x27')]('\x20')));return _0x47c0e8=_[_0x634698('0x34')](_0x47c0e8,_['keys'](properties[_0x634698('0x15')])),_0x47c0e8[_0x634698('0x11')]='Reload',ami[_0x634698('0x21')](_0x47c0e8)['then'](function(_0x585ac5){const _0x2a9210=_0x634698;_0x2e59c1({'code':0xc8,'message':_0x585ac5[_0x2a9210('0x6b')]});})['catch'](function(_0x4b3849){const _0x1b4b6e=_0x634698;_0x523543(_0x9cd69c[_0x1b4b6e('0x3')](0x1f5,_0x4b3849[_0x1b4b6e('0x6b')]));});});},'Command':function(_0x523d90){const _0x50f9e9=this;return new Promise(function(_0x35c259,_0xab358e){const _0x3032c2=a1133_0x4a64;if(ami['isConnected']()==![])return _0xab358e(_0x50f9e9['error'](0x1f4,[config[_0x3032c2('0x4d')]['ip'],config[_0x3032c2('0x4d')][_0x3032c2('0x6c')],_0x3032c2('0xa')]['join']('\x20')));return _0x523d90=_[_0x3032c2('0x34')](_0x523d90,'command'),_0x523d90[_0x3032c2('0x11')]=_0x3032c2('0x64'),ami[_0x3032c2('0x21')](_0x523d90)[_0x3032c2('0x4f')](function(_0x76b979){const _0x5e9b56=_0x3032c2;_0x35c259({'code':0xc8,'message':_0x76b979[_0x5e9b56('0x35')]});})[_0x3032c2('0x23')](function(_0x34bd37){const _0x5b819e=_0x3032c2;_0xab358e(_0x50f9e9[_0x5b819e('0x3')](0x1f5,_0x34bd37[_0x5b819e('0x6b')]));});});},'VoiceQueues':function(){return new Promise(function(_0x192ed7){const _0x5b0ed2=a1133_0x4a64,_0x1103e6=[];for(const _0x2dc188 in _0x43e8db[_0x5b0ed2('0x62')]){if(typeof _0x43e8db['voiceQueues'][_0x2dc188]!=='undefined'){const _0x3e7205=_0x43e8db[_0x5b0ed2('0x62')][_0x2dc188],_0x44e74b={'id':_0x3e7205['id'],'name':_0x3e7205['name'],'strategy':_0x3e7205[_0x5b0ed2('0x52')],'answered':_0x3e7205['answered'],'available':_0x3e7205[_0x5b0ed2('0x43')],'loggedIn':_0x3e7205['loggedIn'],'pTalking':_0x3e7205[_0x5b0ed2('0x24')],'sumBillable':_0x3e7205[_0x5b0ed2('0x4a')],'sumDuration':_0x3e7205[_0x5b0ed2('0x16')],'sumHoldTime':_0x3e7205['sumHoldTime']||0x0,'talking':_0x3e7205['talking'],'total':_0x3e7205['total'],'type':_0x3e7205['type'],'unmanaged':_0x3e7205[_0x5b0ed2('0x14')],'abandoned':_0x3e7205[_0x5b0ed2('0x4')],'waiting':_0x3e7205[_0x5b0ed2('0x36')],'loggedInDb':_0x3e7205[_0x5b0ed2('0x80')]};_0x3e7205['type']===_0x5b0ed2('0x4e')&&(_0x44e74b[_0x5b0ed2('0x3e')]=_0x3e7205[_0x5b0ed2('0x3e')],_0x44e74b[_0x5b0ed2('0x6d')]=_0x3e7205[_0x5b0ed2('0x6d')],_0x44e74b['dialOriginateCallerIdName']=_0x3e7205[_0x5b0ed2('0x68')],_0x44e74b[_0x5b0ed2('0x49')]=_0x3e7205[_0x5b0ed2('0x49')],_0x44e74b[_0x5b0ed2('0xd')]=_0x3e7205[_0x5b0ed2('0xd')],_0x44e74b[_0x5b0ed2('0x30')]=_0x3e7205['dialPrefix'],_0x44e74b['outboundAnswerAgiCallsDay']=_0x3e7205['outboundAnswerAgiCallsDay'],_0x44e74b[_0x5b0ed2('0x83')]=_0x3e7205[_0x5b0ed2('0x83')],_0x44e74b[_0x5b0ed2('0x63')]=_0x3e7205['outboundBlacklistCallsDay'],_0x44e74b[_0x5b0ed2('0x8')]=_0x3e7205['outboundBusyCallsDay'],_0x44e74b['outboundCongestionCallsDay']=_0x3e7205['outboundCongestionCallsDay'],_0x44e74b[_0x5b0ed2('0x73')]=_0x3e7205['outboundDropCallsDayACS'],_0x44e74b[_0x5b0ed2('0x72')]=_0x3e7205[_0x5b0ed2('0x72')],_0x44e74b[_0x5b0ed2('0x6')]=_0x3e7205[_0x5b0ed2('0x6')],_0x44e74b[_0x5b0ed2('0x6f')]=_0x3e7205[_0x5b0ed2('0x6f')],_0x44e74b[_0x5b0ed2('0x1e')]=_0x3e7205[_0x5b0ed2('0x1e')],_0x44e74b[_0x5b0ed2('0x6e')]=_0x3e7205[_0x5b0ed2('0x6e')],_0x44e74b[_0x5b0ed2('0x47')]=_0x3e7205[_0x5b0ed2('0x47')],_0x44e74b[_0x5b0ed2('0x48')]=_0x3e7205[_0x5b0ed2('0x48')],_0x44e74b[_0x5b0ed2('0x42')]=_0x3e7205[_0x5b0ed2('0x42')],_0x44e74b['predictiveIntervalAnsweredCalls']=_0x3e7205[_0x5b0ed2('0x66')],_0x44e74b[_0x5b0ed2('0x13')]=_0x3e7205[_0x5b0ed2('0x13')],_0x44e74b[_0x5b0ed2('0x74')]=_0x3e7205['predictiveIntervalAvgTalktime'],_0x44e74b['predictiveIntervalDroppedCallsCallersExit']=_0x3e7205['predictiveIntervalDroppedCallsCallersExit'],_0x44e74b[_0x5b0ed2('0x29')]=_0x3e7205['predictiveIntervalDroppedCallsTimeout'],_0x44e74b[_0x5b0ed2('0x37')]=_0x3e7205['predictiveIntervalErlangCalls'],_0x44e74b['predictiveIntervalErlangCallsDroppedCalls']=_0x3e7205[_0x5b0ed2('0x18')],_0x44e74b[_0x5b0ed2('0x39')]=_0x3e7205[_0x5b0ed2('0x39')],_0x44e74b[_0x5b0ed2('0x7a')]=_0x3e7205[_0x5b0ed2('0x7a')],_0x44e74b[_0x5b0ed2('0xe')]=_0x3e7205['predictiveIntervalPauses'],_0x44e74b[_0x5b0ed2('0x76')]=_0x3e7205[_0x5b0ed2('0x76')],_0x44e74b[_0x5b0ed2('0xc')]=_0x3e7205[_0x5b0ed2('0xc')],_0x44e74b['message']=_0x3e7205['message'],_0x44e74b[_0x5b0ed2('0x28')]=_0x3e7205['originated'],_0x44e74b[_0x5b0ed2('0x1')]=_0x3e7205[_0x5b0ed2('0x1')],_0x44e74b[_0x5b0ed2('0x51')]=_0x3e7205[_0x5b0ed2('0x51')],_0x44e74b[_0x5b0ed2('0x3b')]=_0x3e7205['erlangAbandonmentRate'],_0x44e74b[_0x5b0ed2('0x70')]=_0x3e7205[_0x5b0ed2('0x70')],_0x44e74b[_0x5b0ed2('0x2e')]=_0x3e7205[_0x5b0ed2('0x2e')],_0x44e74b[_0x5b0ed2('0x9')]=_0x3e7205[_0x5b0ed2('0x9')]),_0x3e7205[_0x5b0ed2('0x40')]&&(_0x44e74b[_0x5b0ed2('0x40')]={'id':_0x3e7205[_0x5b0ed2('0x40')]['id'],'name':_0x3e7205['Trunk'][_0x5b0ed2('0xb')],'active':_0x3e7205[_0x5b0ed2('0x40')]['active'],'callerid':_0x3e7205[_0x5b0ed2('0x40')][_0x5b0ed2('0x2b')]}),_0x3e7205['Interval']&&(_0x44e74b['Interval']={'id':_0x3e7205[_0x5b0ed2('0x5e')]['id'],'name':_0x3e7205[_0x5b0ed2('0x5e')]['name']}),_0x1103e6[_0x5b0ed2('0x2')](_0x44e74b);}}_0x192ed7({'count':_0x1103e6[_0x5b0ed2('0x17')],'rows':_0x1103e6});});},'VoiceChannels':function(){return new Promise(function(_0x2877a0){const _0x3b2865=a1133_0x4a64,_0x3ccf92=_[_0x3b2865('0x5f')](_0x43e8db['channels']);_0x2877a0({'count':_0x3ccf92[_0x3b2865('0x17')],'rows':_0x3ccf92});});},'VoiceChannelMixMonitor':function(_0x34eeba){const _0x739911=this;return new Promise(function(_0x2150eb,_0x3ac4cf){const _0x37ed36=a1133_0x4a64;if(ami['isConnected']()==![])return _0x3ac4cf(_0x739911[_0x37ed36('0x3')](0x1f4,[config[_0x37ed36('0x4d')]['ip'],config[_0x37ed36('0x4d')][_0x37ed36('0x6c')],_0x37ed36('0xa')][_0x37ed36('0x27')]('\x20')));const _0x1519b8=schema(properties[_0x37ed36('0x45')])[_0x37ed36('0x5c')](_0x34eeba);if(_0x1519b8[_0x37ed36('0x17')]>0x0)return _0x3ac4cf(_0x739911[_0x37ed36('0x3')](0x1f4,_['map'](_0x1519b8,_0x37ed36('0x6b'))['join'](',\x20')));const _0x317a21=_[_0x37ed36('0x22')](_0x43e8db['channels'],{'uniqueid':_0x34eeba[_0x37ed36('0x1d')]});if(_0x317a21&&_0x317a21['channel']){const _0x19dcdc=util[_0x37ed36('0x5d')](_0x37ed36('0x71'),_0x34eeba[_0x37ed36('0x20')]||_0x34eeba[_0x37ed36('0x1d')],_0x34eeba['format']||_0x37ed36('0x1a'));return ami[_0x37ed36('0x21')]({'action':_0x37ed36('0x69'),'channel':_0x317a21[_0x37ed36('0x59')],'file':_0x19dcdc,'options':_0x37ed36('0x3a')})[_0x37ed36('0x4f')](function(_0x214cf0){const _0x21b9a9=_0x37ed36,_0x5e5d11=_['find'](_0x317a21[_0x21b9a9('0x6a')],{'filename':_0x21b9a9('0x7d')+_0x19dcdc[_0x21b9a9('0x5')]()});_[_0x21b9a9('0x77')](_0x5e5d11)?_0x317a21['monitors'][_0x21b9a9('0x2')]({'filename':'/var/spool/asterisk/monitor/'+_0x19dcdc['toLowerCase'](),'createdAt':moment()[_0x21b9a9('0x5d')](_0x21b9a9('0x46')),'mixmonitorid':_0x214cf0[_0x21b9a9('0x55')],'status':_0x21b9a9('0x2a')}):(_0x5e5d11[_0x21b9a9('0x55')]=_0x214cf0[_0x21b9a9('0x55')],_0x5e5d11[_0x21b9a9('0x19')]=_0x21b9a9('0x2a')),_0x2150eb({'code':0xc8,'message':[_0x34eeba['uniqueid'],_0x21b9a9('0x31'),_0x214cf0[_0x21b9a9('0x55')]]['join']('\x20'),'mixmonitorid':_0x214cf0[_0x21b9a9('0x55')]});})[_0x37ed36('0x23')](function(_0x32141f){const _0x426b7e=_0x37ed36;_0x3ac4cf(_0x739911[_0x426b7e('0x3')](0x1f5,[_0x34eeba['uniqueid'],_0x32141f['message'][_0x426b7e('0x5')]()][_0x426b7e('0x27')]('\x20')));});}else return _0x3ac4cf(_0x739911[_0x37ed36('0x3')](0x1f5,_0x37ed36('0x7b')));});},'VoiceChannelStopMixMonitor':function(_0x2ff0a6){const _0xddc260=this;return new Promise(function(_0x41144a,_0x50ca24){const _0x19dc8f=a1133_0x4a64;if(ami[_0x19dc8f('0x82')]()==![])return _0x50ca24(_0xddc260[_0x19dc8f('0x3')](0x1f4,[config[_0x19dc8f('0x4d')]['ip'],config[_0x19dc8f('0x4d')][_0x19dc8f('0x6c')],_0x19dc8f('0xa')]['join']('\x20')));const _0x451bf5=schema(properties[_0x19dc8f('0x45')])['validate'](_0x2ff0a6);if(_0x451bf5[_0x19dc8f('0x17')]>0x0)return _0x50ca24(_0xddc260['error'](0x1f4,_[_0x19dc8f('0x33')](_0x451bf5,_0x19dc8f('0x6b'))[_0x19dc8f('0x27')](',\x20')));const _0x4942e0=_[_0x19dc8f('0x22')](_0x43e8db[_0x19dc8f('0x67')],{'uniqueid':_0x2ff0a6['uniqueid']});return _0x4942e0?Promise['resolve']()[_0x19dc8f('0x4f')](function(){const _0x19033c=_0x19dc8f;if(_0x4942e0['channel'])return ami[_0x19033c('0x21')]({'action':_0x19033c('0x1b'),'channel':_0x4942e0['channel'],'mixmonitorid':_0x2ff0a6[_0x19033c('0x55')]})[_0x19033c('0x23')](function(){});})['then'](function(){const _0x864fa4=_0x19dc8f;if(_0x4942e0[_0x864fa4('0x54')])return ami[_0x864fa4('0x21')]({'action':_0x864fa4('0x1b'),'channel':_0x4942e0['destinationchannel'],'mixmonitorid':_0x2ff0a6[_0x864fa4('0x55')]})[_0x864fa4('0x23')](function(){});})[_0x19dc8f('0x4f')](function(){const _0xe3553d=_0x19dc8f,_0x4d76b9=_[_0xe3553d('0x22')](_0x4942e0[_0xe3553d('0x6a')],{'mixmonitorid':_0x2ff0a6[_0xe3553d('0x55')]});_0x4d76b9&&(_0x4d76b9[_0xe3553d('0x19')]=_0xe3553d('0x2f'));})[_0x19dc8f('0x4f')](function(){const _0x228d43=_0x19dc8f,_0xc21dd5=util[_0x228d43('0x5d')](_0x228d43('0x71'),_0x2ff0a6[_0x228d43('0x20')]||_0x2ff0a6[_0x228d43('0x1d')],_0x2ff0a6['format']||_0x228d43('0x1a')),_0x1f727e=_[_0x228d43('0x22')](_0x4942e0['monitors'],{'filename':_0x228d43('0x7d')+_0xc21dd5[_0x228d43('0x5')]()});_0x1f727e&&(_0x1f727e['status']='stop');})['then'](function(){const _0xc0184c=_0x19dc8f;_0x41144a({'code':0xc8,'message':[_0x2ff0a6[_0xc0184c('0x1d')],_0xc0184c('0x44')]['join']('\x20')});})[_0x19dc8f('0x23')](function(_0x5cab26){const _0x8e3fc5=_0x19dc8f;_0x50ca24(_0xddc260[_0x8e3fc5('0x3')](0x1f5,[_0x2ff0a6[_0x8e3fc5('0x1d')],_0x5cab26[_0x8e3fc5('0x6b')]['toLowerCase']()][_0x8e3fc5('0x27')]('\x20')));}):_0x50ca24(_0xddc260[_0x19dc8f('0x3')](0x1f5,_0x19dc8f('0x7b')));});},'VoiceQueuesChannels':function(){return new Promise(function(_0x31caea){const _0x55d60c=a1133_0x4a64,_0x55ec53=_[_0x55d60c('0x5f')](_0x43e8db['queueChannels']);_0x31caea({'count':_0x55ec53['length'],'rows':_0x55ec53});});},'VoiceQueuesChannel':function(_0x52f310){const _0x34d607=this;return new Promise(function(_0x1d2a33,_0x52390d){const _0x1ce2c8=a1133_0x4a64,_0x2e1473=schema(properties[_0x1ce2c8('0x79')])[_0x1ce2c8('0x5c')](_0x52f310);if(_0x2e1473[_0x1ce2c8('0x17')]>0x0)return _0x52390d(_0x34d607['error'](0x1f4,_[_0x1ce2c8('0x33')](_0x2e1473,_0x1ce2c8('0x6b'))[_0x1ce2c8('0x27')](',\x20')));const _0x23cc23=_[_0x1ce2c8('0x22')](_0x43e8db['queueChannels'],{'uniqueid':_0x52f310[_0x1ce2c8('0x1d')]});if(_0x23cc23)_0x1d2a33(_0x23cc23);else return _0x52390d(_0x34d607[_0x1ce2c8('0x3')](0x1f5,_0x1ce2c8('0x7b')));});},'VoiceQueuesChannelHangup':function(_0x3d7feb){const _0x55027e=this;return new Promise(function(_0x19aba8,_0x13bcef){const _0xa6a55=a1133_0x4a64;if(ami['isConnected']()==![])return _0x13bcef(_0x55027e[_0xa6a55('0x3')](0x1f4,[config[_0xa6a55('0x4d')]['ip'],config[_0xa6a55('0x4d')]['username'],_0xa6a55('0xa')]['join']('\x20')));const _0x504ff5=schema(properties['voicequeuechannelhangup'])[_0xa6a55('0x5c')](_0x3d7feb);if(_0x504ff5['length']>0x0)return _0x13bcef(_0x55027e['error'](0x1f4,_[_0xa6a55('0x33')](_0x504ff5,'message')['join'](',\x20')));const _0x2b904b=_[_0xa6a55('0x22')](_0x43e8db[_0xa6a55('0x50')],{'uniqueid':_0x3d7feb['uniqueid']});return _0x2b904b&&_0x2b904b[_0xa6a55('0x59')]?ami[_0xa6a55('0x21')]({'action':_0xa6a55('0x61'),'channel':_0x2b904b[_0xa6a55('0x59')]})[_0xa6a55('0x4f')](function(_0x5c8270){const _0xa61f4c=_0xa6a55;_0x19aba8({'code':0xc8,'message':[_0x3d7feb['uniqueid'],_0x5c8270[_0xa61f4c('0x6b')][_0xa61f4c('0x5')]()][_0xa61f4c('0x27')]('\x20')});})[_0xa6a55('0x23')](function(_0x32ee33){const _0x438afc=_0xa6a55;_0x13bcef(_0x55027e[_0x438afc('0x3')](0x1f5,[_0x3d7feb[_0x438afc('0x1d')],_0x32ee33[_0x438afc('0x6b')][_0x438afc('0x5')]()][_0x438afc('0x27')]('\x20')));}):_0x13bcef(_0x55027e['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));});},'VoiceQueuesChannelRedirect':function(_0x62945c){const _0x3d55f5=this;return new Promise(function(_0x48b1e6,_0x3065cb){const _0x12f68e=a1133_0x4a64;if(ami[_0x12f68e('0x82')]()==![])return _0x3065cb(_0x3d55f5['error'](0x1f4,[config[_0x12f68e('0x4d')]['ip'],config['asterisk'][_0x12f68e('0x6c')],_0x12f68e('0xa')]['join']('\x20')));const _0x428fbb=schema(properties[_0x12f68e('0x7')])['validate'](_0x62945c);if(_0x428fbb['length']>0x0)return _0x3065cb(_0x3d55f5['error'](0x1f4,_[_0x12f68e('0x33')](_0x428fbb,_0x12f68e('0x6b'))[_0x12f68e('0x27')](',\x20')));const _0x13dfff=_['find'](_0x43e8db[_0x12f68e('0x50')],{'uniqueid':_0x62945c[_0x12f68e('0x1d')]});return _0x13dfff&&_0x13dfff[_0x12f68e('0x59')]?ami[_0x12f68e('0x21')]({'action':_0x12f68e('0x5a'),'channel':_0x13dfff[_0x12f68e('0x59')],'exten':_0x62945c[_0x12f68e('0x60')],'context':_0x62945c[_0x12f68e('0x3d')]||_0x13dfff[_0x12f68e('0x3d')],'priority':0x1})['then'](function(_0x418b75){const _0x19614b=_0x12f68e;_0x48b1e6({'code':0xc8,'message':[_0x62945c[_0x19614b('0x1d')],_0x418b75['message'][_0x19614b('0x5')]()]['join']('\x20')});})['catch'](function(_0x40dedb){const _0x57c219=_0x12f68e;_0x3065cb(_0x3d55f5[_0x57c219('0x3')](0x1f5,[_0x62945c['uniqueid'],_0x40dedb['message'][_0x57c219('0x5')]()][_0x57c219('0x27')]('\x20')));}):_0x3065cb(_0x3d55f5['error'](0x1f5,_0x12f68e('0x7b')));});},'Agents':function(){return new Promise(function(_0x1c182d){const _0x3ff8b4=a1133_0x4a64,_0x29391f=_['values'](_0x43e8db[_0x3ff8b4('0x4c')]);_0x1c182d({'count':_0x29391f[_0x3ff8b4('0x17')],'rows':_0x29391f});});},'Telephones':function(){return new Promise(function(_0x1bd6b0){const _0x2b2a57=a1133_0x4a64,_0x383e5f=_[_0x2b2a57('0x5f')](_0x43e8db[_0x2b2a57('0x78')]);_0x1bd6b0({'count':_0x383e5f[_0x2b2a57('0x17')],'rows':_0x383e5f});});},'Trunks':function(){return new Promise(function(_0x2e8a9d){const _0x4ba55b=a1133_0x4a64,_0x2f182f=_[_0x4ba55b('0x5f')](_0x43e8db[_0x4ba55b('0x3f')]);_0x2e8a9d({'count':_0x2f182f[_0x4ba55b('0x17')],'rows':_0x2f182f});});},'OutboundChannels':function(){return new Promise(function(_0xada452){const _0x42d5bd=a1133_0x4a64,_0x3692a6=_[_0x42d5bd('0x5f')](_0x43e8db[_0x42d5bd('0x2c')]);_0xada452({'count':_0x3692a6[_0x42d5bd('0x17')],'rows':_0x3692a6});});},'Outbound':function(){return new Promise(function(_0x1125fc){const _0x187bb7=a1133_0x4a64;_0x1125fc(_0x43e8db[_0x187bb7('0x4e')]);});},'Campaigns':function(){return new Promise(function(_0x5a9d04){const _0x5aa3a1=_['values'](_0x43e8db['campaigns']);_0x5a9d04({'count':_0x5aa3a1['length'],'rows':_0x5aa3a1});});},'VoiceQueuesPreview':function(_0x2bfa1e){const _0x37113a=this;return new Promise(function(_0x51ddd8,_0x1bbbbc){const _0x195419=a1133_0x4a64;_0x453fab[_0x195419('0x1f')](_0x2bfa1e['id'])['then'](function(_0x2d0584){const _0x433bfd=_0x195419;_0x51ddd8({'code':0xc8,'message':_0x2d0584[_0x433bfd('0x6b')]});})[_0x195419('0x23')](function(_0x49e01c){const _0x27c28e=_0x195419;_0x1bbbbc(_0x37113a[_0x27c28e('0x3')](0x1f4,_0x49e01c[_0x27c28e('0x6b')]));});});},'EventManager':function(_0x5cad44){const _0x5689d1=this;return new Promise(function(_0x26cf04,_0x19079e){const _0x42e64b=a1133_0x4a64;if(!_0x5cad44['event'])return _0x19079e(_0x5689d1[_0x42e64b('0x3')](0x1f4,'Event\x20name\x20mandatory'));ami[_0x42e64b('0x26')](_0x42e64b('0x25')+_0x5cad44[_0x42e64b('0x4b')],_0x5cad44[_0x42e64b('0x6b')]),_0x26cf04({'code':0xc8,'message':_0x5cad44});});},'FaxAccounts':function(){return new Promise(function(_0x54b3e7){const _0xab3cb2=a1133_0x4a64,_0xcf044f=_['values'](_0x43e8db[_0xab3cb2('0x38')]);_0x54b3e7({'count':_0xcf044f[_0xab3cb2('0x17')],'rows':_0xcf044f});});},'SendFax':function(_0x1f9913){const _0x277c70=this;return new Promise(function(_0x3f9958,_0x17307e){const _0x15eafa=a1133_0x4a64;_0x2a10ed[_0x15eafa('0x3c')](_0x1f9913)[_0x15eafa('0x4f')](function(_0x470e5e){const _0x13d2aa=_0x15eafa;_0x3f9958({'code':0xc8,'message':_0x470e5e[_0x13d2aa('0x6b')]});})[_0x15eafa('0x23')](function(_0x287eca){const _0x5709a3=_0x15eafa;_0x17307e(_0x277c70[_0x5709a3('0x3')](0x1f4,_0x287eca[_0x5709a3('0x6b')]));});});},'CheckAfterSend':function(_0x52d719){const _0x320f61=this;return new Promise(function(_0x317189,_0x453e03){const _0x3fa52f=a1133_0x4a64;_0x2a10ed[_0x3fa52f('0x5b')](_0x52d719)[_0x3fa52f('0x4f')](function(_0x27c4ef){_0x317189({'code':0xc8,'message':_0x27c4ef['message']});})[_0x3fa52f('0x23')](function(_0xf7bb78){_0x453e03(_0x320f61['error'](0x1f4,_0xf7bb78['message']));});});}},_0x5b0423=jayson[_0x5047d9('0x65')](_0x3eef16)[_0x5047d9('0x2d')]();_0x5b0423['on'](_0x5047d9('0x3'),function(_0x48e953){return _0xc6f5a5(_0x48e953);}),_0x5b0423[_0x5047d9('0x0')](0x232a,_0x5047d9('0xf'),function(){const _0x52b828=_0x5047d9;return console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a),_0x2a3a8c(_0x52b828('0x57')+0x232a);});});};