Built motion from commit ecf5ab8ec560fd4c6972692268e350fcef2f38e7. Version 3.0.0...
[motion-next.git] / server / services / ami / server / index.js
1 const a1132_0x1c95=['http','username','toLowerCase','erlangCallToSecond','rec','moment','erlangBusyFactor','ami\x20disconnected','values','predictiveIntervalAvailable','originated','predictiveIntervalPauses','waiting','predictiveIntervalDroppedCallsTimeout','dialPrefix','predictiveIntervalAnsweredCalls','/var/spool/asterisk/monitor/','stop','outbound','Action','error','outboundDropCallsDayTimeout','predictiveIntervalErlangCalls','util','event','campaigns','channels','pick','Hangup','name','voicechannel','outboundBusyCallsDay','outboundNoAnswerCallsDay','timers','predictiveIntervalMultiplicativeFactor','voicequeuechannel','custom:','talking','message','%s.%s','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','answered','server','dialOriginateCallerIdName','Redirect','loggedIn','content','Interval','join','exten','../../../config/environment','command','agents','StopMixMonitor','status','telephones','asterisk','../properties','Channel\x20doesn\x27t\x20exist','outboundBlacklistCallsDay','find','format','predictiveIntervalDroppedCallsCallersExit','type','Trunk','unmanaged','queueChannels','Reload','outboundReCallsDay','mixmonitorid','action','undefined','catch','outboundAnswerCallsDay','outboundUnknownCallsDay','trunks','127.0.0.1','predictiveIntervalAvgTalktime','outboundRejectCallsDay','strategy','send','validate','outboundNoSuchCallsDay','erlangAbandonmentRate','startProgressive','outboundOriginateFailureCallsDay','../ami','pTalking','predictiveIntervalHitRate','predictiveIntervalErlangCallsDroppedCalls','YYYY-MM-DD\x20HH:mm:ss','predictiveIntervalAvgHoldtime','timer','Event\x20name\x20mandatory','length','predictiveIntervalTotalCalls','listen','isConnected','dialMethod','lodash','SIP','available','sumDuration','voiceQueues','Command','run','outboundChannels','channel','startPredictive','erlangCalls','keys','outboundCongestionCallsDay','then','faxAccounts','active','loggedInDb','filename','destinationchannel','isNil','resolve','dialActive','map','push','monitors','dialOriginateCallerIdNumber','outboundDropCallsDayACS','dialOriginateTimeout','sumBillable','uniqueid','MixMonitor\x20Success','outboundAnswerAgiCallsDay','checkAfterSend'];(function(_0x24e591,_0x1c95ea){const _0x55808f=function(_0xe741e1){while(--_0xe741e1){_0x24e591['push'](_0x24e591['shift']());}};_0x55808f(++_0x1c95ea);}(a1132_0x1c95,0x8a));const a1132_0x5580=function(_0x24e591,_0x1c95ea){_0x24e591=_0x24e591-0x0;let _0x55808f=a1132_0x1c95[_0x24e591];return _0x55808f;};const _0x556c02=a1132_0x5580;'use strict';const _=require(_0x556c02('0x5d')),util=require(_0x556c02('0x11')),jayson=require('jayson/promise'),schema=require(_0x556c02('0x4b')),moment=require(_0x556c02('0x83')),config=require(_0x556c02('0x2c')),properties=require(_0x556c02('0x33')),ami=require(_0x556c02('0x50'));exports[_0x556c02('0x5a')]=function(_0xe741e1,_0xf0a71f,_0x897416){return new Promise(function(_0x12be20,_0x631683){const _0x329daa=a1132_0x5580,_0xe9ab2f={'QueuePause':function(_0x336ced){return new Promise(function(_0xcb2b81){const _0x4a49bd=a1132_0x5580,_0x12d075=util[_0x4a49bd('0x37')]('%s/%s',_0x4a49bd('0x5e'),_0x336ced['name']);_0xe741e1[_0x4a49bd('0x1b')]&&_0xe741e1[_0x4a49bd('0x1b')][_0x12d075]&&_0xe741e1[_0x4a49bd('0x1b')][_0x12d075][_0x4a49bd('0x56')]&&_0xe741e1[_0x4a49bd('0x1b')][_0x12d075]['updateAcw'](),_0xe741e1[_0x4a49bd('0x2e')][_0x12d075]&&_0xe741e1[_0x4a49bd('0x2e')][_0x12d075]['updateStatusRealtime']({'statePause':_0x336ced['pause']?!![]:![]}),_0xcb2b81({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x1156b1){const _0x5a5c16=this;return new Promise(function(_0x45ed5d,_0x457516){const _0x6e4850=a1132_0x5580;if(ami[_0x6e4850('0x5b')]()==![])return _0x457516(_0x5a5c16['error'](0x1f4,[config['asterisk']['ip'],config[_0x6e4850('0x32')][_0x6e4850('0x7f')],_0x6e4850('0x1')][_0x6e4850('0x2a')]('\x20')));return _0x1156b1=_[_0x6e4850('0x15')](_0x1156b1,_[_0x6e4850('0x68')](properties['module'])),_0x1156b1[_0x6e4850('0x40')]=_0x6e4850('0x3d'),ami[_0x6e4850('0xd')](_0x1156b1)[_0x6e4850('0x6a')](function(_0x30f7ee){_0x45ed5d({'code':0xc8,'message':_0x30f7ee['message']});})['catch'](function(_0x1d2bde){_0x457516(_0x5a5c16['error'](0x1f5,_0x1d2bde['message']));});});},'Command':function(_0x22b514){const _0x29e3ca=this;return new Promise(function(_0x22e240,_0x3e2f7f){const _0x851a30=a1132_0x5580;if(ami[_0x851a30('0x5b')]()==![])return _0x3e2f7f(_0x29e3ca[_0x851a30('0xe')](0x1f4,[config['asterisk']['ip'],config[_0x851a30('0x32')][_0x851a30('0x7f')],'ami\x20disconnected'][_0x851a30('0x2a')]('\x20')));return _0x22b514=_[_0x851a30('0x15')](_0x22b514,_0x851a30('0x2d')),_0x22b514['action']=_0x851a30('0x62'),ami[_0x851a30('0xd')](_0x22b514)[_0x851a30('0x6a')](function(_0x3b14e4){const _0x3bc1e1=_0x851a30;_0x22e240({'code':0xc8,'message':_0x3b14e4[_0x3bc1e1('0x28')]});})[_0x851a30('0x42')](function(_0x4721e9){const _0x3d8bf3=_0x851a30;_0x3e2f7f(_0x29e3ca[_0x3d8bf3('0xe')](0x1f5,_0x4721e9[_0x3d8bf3('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x4a6a25){const _0x5d8aaf=a1132_0x5580,_0x55e683=[];for(const _0x2ef3a0 in _0xe741e1[_0x5d8aaf('0x61')]){if(typeof _0xe741e1[_0x5d8aaf('0x61')][_0x2ef3a0]!==_0x5d8aaf('0x41')){const _0x1cda7d=_0xe741e1[_0x5d8aaf('0x61')][_0x2ef3a0],_0x3c010b={'id':_0x1cda7d['id'],'name':_0x1cda7d[_0x5d8aaf('0x17')],'strategy':_0x1cda7d[_0x5d8aaf('0x49')],'answered':_0x1cda7d[_0x5d8aaf('0x23')],'available':_0x1cda7d[_0x5d8aaf('0x5f')],'loggedIn':_0x1cda7d[_0x5d8aaf('0x27')],'pTalking':_0x1cda7d[_0x5d8aaf('0x51')],'sumBillable':_0x1cda7d[_0x5d8aaf('0x79')],'sumDuration':_0x1cda7d[_0x5d8aaf('0x60')],'sumHoldTime':_0x1cda7d['sumHoldTime']||0x0,'talking':_0x1cda7d[_0x5d8aaf('0x1f')],'total':_0x1cda7d['total'],'type':_0x1cda7d[_0x5d8aaf('0x39')],'unmanaged':_0x1cda7d[_0x5d8aaf('0x3b')],'abandoned':_0x1cda7d['abandoned'],'waiting':_0x1cda7d[_0x5d8aaf('0x6')],'loggedInDb':_0x1cda7d[_0x5d8aaf('0x6d')]};_0x1cda7d[_0x5d8aaf('0x39')]===_0x5d8aaf('0xc')&&(_0x3c010b[_0x5d8aaf('0x72')]=_0x1cda7d[_0x5d8aaf('0x72')],_0x3c010b[_0x5d8aaf('0x5c')]=_0x1cda7d[_0x5d8aaf('0x5c')],_0x3c010b[_0x5d8aaf('0x25')]=_0x1cda7d[_0x5d8aaf('0x25')],_0x3c010b[_0x5d8aaf('0x76')]=_0x1cda7d[_0x5d8aaf('0x76')],_0x3c010b[_0x5d8aaf('0x78')]=_0x1cda7d[_0x5d8aaf('0x78')],_0x3c010b['dialPrefix']=_0x1cda7d[_0x5d8aaf('0x8')],_0x3c010b[_0x5d8aaf('0x7c')]=_0x1cda7d['outboundAnswerAgiCallsDay'],_0x3c010b[_0x5d8aaf('0x43')]=_0x1cda7d[_0x5d8aaf('0x43')],_0x3c010b[_0x5d8aaf('0x35')]=_0x1cda7d['outboundBlacklistCallsDay'],_0x3c010b[_0x5d8aaf('0x19')]=_0x1cda7d[_0x5d8aaf('0x19')],_0x3c010b['outboundCongestionCallsDay']=_0x1cda7d[_0x5d8aaf('0x69')],_0x3c010b[_0x5d8aaf('0x77')]=_0x1cda7d['outboundDropCallsDayACS'],_0x3c010b['outboundDropCallsDayCallersExit']=_0x1cda7d['outboundDropCallsDayCallersExit'],_0x3c010b[_0x5d8aaf('0xf')]=_0x1cda7d[_0x5d8aaf('0xf')],_0x3c010b[_0x5d8aaf('0x1a')]=_0x1cda7d[_0x5d8aaf('0x1a')],_0x3c010b['outboundNoSuchCallsDay']=_0x1cda7d[_0x5d8aaf('0x4c')],_0x3c010b[_0x5d8aaf('0x4f')]=_0x1cda7d[_0x5d8aaf('0x4f')],_0x3c010b['outboundReCallsDay']=_0x1cda7d[_0x5d8aaf('0x3e')],_0x3c010b[_0x5d8aaf('0x48')]=_0x1cda7d[_0x5d8aaf('0x48')],_0x3c010b['outboundUnknownCallsDay']=_0x1cda7d[_0x5d8aaf('0x44')],_0x3c010b[_0x5d8aaf('0x9')]=_0x1cda7d[_0x5d8aaf('0x9')],_0x3c010b[_0x5d8aaf('0x55')]=_0x1cda7d['predictiveIntervalAvgHoldtime'],_0x3c010b[_0x5d8aaf('0x47')]=_0x1cda7d[_0x5d8aaf('0x47')],_0x3c010b[_0x5d8aaf('0x38')]=_0x1cda7d['predictiveIntervalDroppedCallsCallersExit'],_0x3c010b[_0x5d8aaf('0x7')]=_0x1cda7d[_0x5d8aaf('0x7')],_0x3c010b[_0x5d8aaf('0x10')]=_0x1cda7d[_0x5d8aaf('0x10')],_0x3c010b[_0x5d8aaf('0x53')]=_0x1cda7d[_0x5d8aaf('0x53')],_0x3c010b[_0x5d8aaf('0x52')]=_0x1cda7d['predictiveIntervalHitRate'],_0x3c010b[_0x5d8aaf('0x1c')]=_0x1cda7d[_0x5d8aaf('0x1c')],_0x3c010b[_0x5d8aaf('0x5')]=_0x1cda7d['predictiveIntervalPauses'],_0x3c010b[_0x5d8aaf('0x3')]=_0x1cda7d[_0x5d8aaf('0x3')],_0x3c010b[_0x5d8aaf('0x59')]=_0x1cda7d[_0x5d8aaf('0x59')],_0x3c010b['message']=_0x1cda7d[_0x5d8aaf('0x20')],_0x3c010b[_0x5d8aaf('0x4')]=_0x1cda7d[_0x5d8aaf('0x4')],_0x3c010b[_0x5d8aaf('0x67')]=_0x1cda7d['erlangCalls'],_0x3c010b[_0x5d8aaf('0x81')]=_0x1cda7d[_0x5d8aaf('0x81')],_0x3c010b['erlangAbandonmentRate']=_0x1cda7d[_0x5d8aaf('0x4d')],_0x3c010b[_0x5d8aaf('0x0')]=_0x1cda7d['erlangBusyFactor'],_0x3c010b[_0x5d8aaf('0x66')]=_0x1cda7d[_0x5d8aaf('0x66')],_0x3c010b[_0x5d8aaf('0x4e')]=_0x1cda7d[_0x5d8aaf('0x4e')]),_0x1cda7d[_0x5d8aaf('0x3a')]&&(_0x3c010b[_0x5d8aaf('0x3a')]={'id':_0x1cda7d[_0x5d8aaf('0x3a')]['id'],'name':_0x1cda7d[_0x5d8aaf('0x3a')][_0x5d8aaf('0x17')],'active':_0x1cda7d[_0x5d8aaf('0x3a')][_0x5d8aaf('0x6c')],'callerid':_0x1cda7d[_0x5d8aaf('0x3a')]['callerid']}),_0x1cda7d[_0x5d8aaf('0x29')]&&(_0x3c010b[_0x5d8aaf('0x29')]={'id':_0x1cda7d[_0x5d8aaf('0x29')]['id'],'name':_0x1cda7d[_0x5d8aaf('0x29')]['name']}),_0x55e683[_0x5d8aaf('0x74')](_0x3c010b);}}_0x4a6a25({'count':_0x55e683[_0x5d8aaf('0x58')],'rows':_0x55e683});});},'VoiceChannels':function(){return new Promise(function(_0x1df06e){const _0x5a6d57=a1132_0x5580,_0x516160=_[_0x5a6d57('0x2')](_0xe741e1[_0x5a6d57('0x14')]);_0x1df06e({'count':_0x516160[_0x5a6d57('0x58')],'rows':_0x516160});});},'VoiceChannelMixMonitor':function(_0x3897e9){const _0x36881d=this;return new Promise(function(_0x906299,_0x2e97dc){const _0x107c27=a1132_0x5580;if(ami['isConnected']()==![])return _0x2e97dc(_0x36881d[_0x107c27('0xe')](0x1f4,[config[_0x107c27('0x32')]['ip'],config[_0x107c27('0x32')][_0x107c27('0x7f')],_0x107c27('0x1')][_0x107c27('0x2a')]('\x20')));const _0x155843=schema(properties[_0x107c27('0x18')])[_0x107c27('0x4b')](_0x3897e9);if(_0x155843['length']>0x0)return _0x2e97dc(_0x36881d['error'](0x1f4,_[_0x107c27('0x73')](_0x155843,_0x107c27('0x20'))[_0x107c27('0x2a')](',\x20')));const _0x44c43b=_[_0x107c27('0x36')](_0xe741e1[_0x107c27('0x14')],{'uniqueid':_0x3897e9[_0x107c27('0x7a')]});if(_0x44c43b&&_0x44c43b['channel']){const _0x5123b8=util[_0x107c27('0x37')](_0x107c27('0x21'),_0x3897e9[_0x107c27('0x6e')]||_0x3897e9['uniqueid'],_0x3897e9[_0x107c27('0x37')]||'wav');return ami[_0x107c27('0xd')]({'action':'MixMonitor','channel':_0x44c43b[_0x107c27('0x65')],'file':_0x5123b8,'options':'ai(mixmonitorid)'})[_0x107c27('0x6a')](function(_0x4a4a2e){const _0x231227=_0x107c27,_0x3a67da=_['find'](_0x44c43b[_0x231227('0x75')],{'filename':_0x231227('0xa')+_0x5123b8[_0x231227('0x80')]()});_[_0x231227('0x70')](_0x3a67da)?_0x44c43b['monitors'][_0x231227('0x74')]({'filename':_0x231227('0xa')+_0x5123b8['toLowerCase'](),'createdAt':moment()[_0x231227('0x37')](_0x231227('0x54')),'mixmonitorid':_0x4a4a2e[_0x231227('0x3f')],'status':_0x231227('0x82')}):(_0x3a67da[_0x231227('0x3f')]=_0x4a4a2e['mixmonitorid'],_0x3a67da[_0x231227('0x30')]='rec'),_0x906299({'code':0xc8,'message':[_0x3897e9[_0x231227('0x7a')],_0x231227('0x7b'),_0x4a4a2e['mixmonitorid']][_0x231227('0x2a')]('\x20'),'mixmonitorid':_0x4a4a2e[_0x231227('0x3f')]});})['catch'](function(_0x39bf62){const _0x1e8155=_0x107c27;_0x2e97dc(_0x36881d['error'](0x1f5,[_0x3897e9[_0x1e8155('0x7a')],_0x39bf62[_0x1e8155('0x20')][_0x1e8155('0x80')]()][_0x1e8155('0x2a')]('\x20')));});}else return _0x2e97dc(_0x36881d[_0x107c27('0xe')](0x1f5,_0x107c27('0x34')));});},'VoiceChannelStopMixMonitor':function(_0x35c3e6){const _0x1b7112=this;return new Promise(function(_0x4eee1f,_0x111159){const _0x1ab0a2=a1132_0x5580;if(ami[_0x1ab0a2('0x5b')]()==![])return _0x111159(_0x1b7112[_0x1ab0a2('0xe')](0x1f4,[config[_0x1ab0a2('0x32')]['ip'],config[_0x1ab0a2('0x32')][_0x1ab0a2('0x7f')],_0x1ab0a2('0x1')][_0x1ab0a2('0x2a')]('\x20')));const _0x451018=schema(properties[_0x1ab0a2('0x18')])[_0x1ab0a2('0x4b')](_0x35c3e6);if(_0x451018['length']>0x0)return _0x111159(_0x1b7112[_0x1ab0a2('0xe')](0x1f4,_['map'](_0x451018,_0x1ab0a2('0x20'))[_0x1ab0a2('0x2a')](',\x20')));const _0x2f3f57=_[_0x1ab0a2('0x36')](_0xe741e1['channels'],{'uniqueid':_0x35c3e6[_0x1ab0a2('0x7a')]});return _0x2f3f57?Promise[_0x1ab0a2('0x71')]()[_0x1ab0a2('0x6a')](function(){const _0x5768f8=_0x1ab0a2;if(_0x2f3f57[_0x5768f8('0x65')])return ami[_0x5768f8('0xd')]({'action':_0x5768f8('0x2f'),'channel':_0x2f3f57[_0x5768f8('0x65')],'mixmonitorid':_0x35c3e6['mixmonitorid']})['catch'](function(){});})[_0x1ab0a2('0x6a')](function(){const _0x388a67=_0x1ab0a2;if(_0x2f3f57[_0x388a67('0x6f')])return ami[_0x388a67('0xd')]({'action':'StopMixMonitor','channel':_0x2f3f57['destinationchannel'],'mixmonitorid':_0x35c3e6[_0x388a67('0x3f')]})[_0x388a67('0x42')](function(){});})[_0x1ab0a2('0x6a')](function(){const _0x4e1982=_0x1ab0a2,_0x392400=_[_0x4e1982('0x36')](_0x2f3f57[_0x4e1982('0x75')],{'mixmonitorid':_0x35c3e6[_0x4e1982('0x3f')]});_0x392400&&(_0x392400[_0x4e1982('0x30')]='stop');})[_0x1ab0a2('0x6a')](function(){const _0x3ef0ca=_0x1ab0a2,_0x146eae=util[_0x3ef0ca('0x37')](_0x3ef0ca('0x21'),_0x35c3e6[_0x3ef0ca('0x6e')]||_0x35c3e6[_0x3ef0ca('0x7a')],_0x35c3e6['format']||'wav'),_0xdce5fd=_[_0x3ef0ca('0x36')](_0x2f3f57['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x146eae[_0x3ef0ca('0x80')]()});_0xdce5fd&&(_0xdce5fd['status']=_0x3ef0ca('0xb'));})['then'](function(){const _0x483c37=_0x1ab0a2;_0x4eee1f({'code':0xc8,'message':[_0x35c3e6[_0x483c37('0x7a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x1ab0a2('0x42')](function(_0x3753ad){const _0x5dffa1=_0x1ab0a2;_0x111159(_0x1b7112[_0x5dffa1('0xe')](0x1f5,[_0x35c3e6[_0x5dffa1('0x7a')],_0x3753ad[_0x5dffa1('0x20')][_0x5dffa1('0x80')]()]['join']('\x20')));}):_0x111159(_0x1b7112[_0x1ab0a2('0xe')](0x1f5,_0x1ab0a2('0x34')));});},'VoiceQueuesChannels':function(){return new Promise(function(_0x293215){const _0x5e19ef=a1132_0x5580,_0x35f06f=_[_0x5e19ef('0x2')](_0xe741e1[_0x5e19ef('0x3c')]);_0x293215({'count':_0x35f06f['length'],'rows':_0x35f06f});});},'VoiceQueuesChannel':function(_0x5edf68){const _0x5406c5=this;return new Promise(function(_0xa55d,_0x86f0c5){const _0x169418=a1132_0x5580,_0x4182ef=schema(properties[_0x169418('0x1d')])['validate'](_0x5edf68);if(_0x4182ef[_0x169418('0x58')]>0x0)return _0x86f0c5(_0x5406c5[_0x169418('0xe')](0x1f4,_[_0x169418('0x73')](_0x4182ef,_0x169418('0x20'))['join'](',\x20')));const _0x1513ae=_['find'](_0xe741e1['queueChannels'],{'uniqueid':_0x5edf68[_0x169418('0x7a')]});if(_0x1513ae)_0xa55d(_0x1513ae);else return _0x86f0c5(_0x5406c5[_0x169418('0xe')](0x1f5,_0x169418('0x34')));});},'VoiceQueuesChannelHangup':function(_0x38fc9e){const _0x47efd5=this;return new Promise(function(_0xcdf79b,_0x5d4e9e){const _0x30102a=a1132_0x5580;if(ami['isConnected']()==![])return _0x5d4e9e(_0x47efd5[_0x30102a('0xe')](0x1f4,[config['asterisk']['ip'],config[_0x30102a('0x32')][_0x30102a('0x7f')],'ami\x20disconnected'][_0x30102a('0x2a')]('\x20')));const _0x2aca66=schema(properties['voicequeuechannelhangup'])[_0x30102a('0x4b')](_0x38fc9e);if(_0x2aca66['length']>0x0)return _0x5d4e9e(_0x47efd5[_0x30102a('0xe')](0x1f4,_[_0x30102a('0x73')](_0x2aca66,_0x30102a('0x20'))[_0x30102a('0x2a')](',\x20')));const _0xce7612=_['find'](_0xe741e1[_0x30102a('0x3c')],{'uniqueid':_0x38fc9e[_0x30102a('0x7a')]});return _0xce7612&&_0xce7612[_0x30102a('0x65')]?ami[_0x30102a('0xd')]({'action':_0x30102a('0x16'),'channel':_0xce7612[_0x30102a('0x65')]})['then'](function(_0x50f1ec){const _0x4dda1e=_0x30102a;_0xcdf79b({'code':0xc8,'message':[_0x38fc9e['uniqueid'],_0x50f1ec[_0x4dda1e('0x20')][_0x4dda1e('0x80')]()]['join']('\x20')});})[_0x30102a('0x42')](function(_0x228c50){const _0x3787ab=_0x30102a;_0x5d4e9e(_0x47efd5[_0x3787ab('0xe')](0x1f5,[_0x38fc9e[_0x3787ab('0x7a')],_0x228c50['message']['toLowerCase']()][_0x3787ab('0x2a')]('\x20')));}):_0x5d4e9e(_0x47efd5[_0x30102a('0xe')](0x1f5,_0x30102a('0x34')));});},'VoiceQueuesChannelRedirect':function(_0x1bc7ac){const _0x19abe4=this;return new Promise(function(_0x94e067,_0x7e68d6){const _0x408373=a1132_0x5580;if(ami['isConnected']()==![])return _0x7e68d6(_0x19abe4[_0x408373('0xe')](0x1f4,[config['asterisk']['ip'],config[_0x408373('0x32')]['username'],_0x408373('0x1')][_0x408373('0x2a')]('\x20')));const _0x561587=schema(properties['voicequeuechannelredirect'])[_0x408373('0x4b')](_0x1bc7ac);if(_0x561587[_0x408373('0x58')]>0x0)return _0x7e68d6(_0x19abe4['error'](0x1f4,_[_0x408373('0x73')](_0x561587,'message')['join'](',\x20')));const _0x4232f7=_['find'](_0xe741e1[_0x408373('0x3c')],{'uniqueid':_0x1bc7ac[_0x408373('0x7a')]});return _0x4232f7&&_0x4232f7[_0x408373('0x65')]?ami[_0x408373('0xd')]({'action':_0x408373('0x26'),'channel':_0x4232f7[_0x408373('0x65')],'exten':_0x1bc7ac[_0x408373('0x2b')],'context':_0x1bc7ac['context']||_0x4232f7['context'],'priority':0x1})[_0x408373('0x6a')](function(_0x33ffc9){const _0x20a0ba=_0x408373;_0x94e067({'code':0xc8,'message':[_0x1bc7ac['uniqueid'],_0x33ffc9['message'][_0x20a0ba('0x80')]()]['join']('\x20')});})[_0x408373('0x42')](function(_0x1b935c){const _0x431932=_0x408373;_0x7e68d6(_0x19abe4[_0x431932('0xe')](0x1f5,[_0x1bc7ac[_0x431932('0x7a')],_0x1b935c['message'][_0x431932('0x80')]()][_0x431932('0x2a')]('\x20')));}):_0x7e68d6(_0x19abe4['error'](0x1f5,_0x408373('0x34')));});},'Agents':function(){return new Promise(function(_0x2f2ef3){const _0x526578=a1132_0x5580,_0x7bf5da=_[_0x526578('0x2')](_0xe741e1['agents']);_0x2f2ef3({'count':_0x7bf5da['length'],'rows':_0x7bf5da});});},'Telephones':function(){return new Promise(function(_0x263200){const _0x5dbde2=a1132_0x5580,_0x1a7c01=_[_0x5dbde2('0x2')](_0xe741e1[_0x5dbde2('0x31')]);_0x263200({'count':_0x1a7c01[_0x5dbde2('0x58')],'rows':_0x1a7c01});});},'Trunks':function(){return new Promise(function(_0x5934ad){const _0x54a8b1=a1132_0x5580,_0xa8dbe9=_[_0x54a8b1('0x2')](_0xe741e1[_0x54a8b1('0x45')]);_0x5934ad({'count':_0xa8dbe9['length'],'rows':_0xa8dbe9});});},'OutboundChannels':function(){return new Promise(function(_0x13d11d){const _0x27ce2d=a1132_0x5580,_0x57aa63=_['values'](_0xe741e1[_0x27ce2d('0x64')]);_0x13d11d({'count':_0x57aa63['length'],'rows':_0x57aa63});});},'Outbound':function(){return new Promise(function(_0x360627){const _0x372dde=a1132_0x5580;_0x360627(_0xe741e1[_0x372dde('0xc')]);});},'Campaigns':function(){return new Promise(function(_0x51e050){const _0x90a39d=a1132_0x5580,_0x19d919=_[_0x90a39d('0x2')](_0xe741e1[_0x90a39d('0x13')]);_0x51e050({'count':_0x19d919[_0x90a39d('0x58')],'rows':_0x19d919});});},'VoiceQueuesPreview':function(_0x4b4e9d){const _0x4b1ed9=this;return new Promise(function(_0x2a6a1c,_0x5c7daa){const _0x15ef05=a1132_0x5580;_0xf0a71f[_0x15ef05('0x63')](_0x4b4e9d['id'])[_0x15ef05('0x6a')](function(_0x441d23){const _0x282d8c=_0x15ef05;_0x2a6a1c({'code':0xc8,'message':_0x441d23[_0x282d8c('0x20')]});})[_0x15ef05('0x42')](function(_0x2eeace){const _0x4d9304=_0x15ef05;_0x5c7daa(_0x4b1ed9[_0x4d9304('0xe')](0x1f4,_0x2eeace['message']));});});},'EventManager':function(_0x3f7742){const _0x451cf1=this;return new Promise(function(_0x55304e,_0xef8a7c){const _0x5d24d3=a1132_0x5580;if(!_0x3f7742[_0x5d24d3('0x12')])return _0xef8a7c(_0x451cf1[_0x5d24d3('0xe')](0x1f4,_0x5d24d3('0x57')));ami['emit'](_0x5d24d3('0x1e')+_0x3f7742[_0x5d24d3('0x12')],_0x3f7742[_0x5d24d3('0x20')]),_0x55304e({'code':0xc8,'message':_0x3f7742});});},'FaxAccounts':function(){return new Promise(function(_0x40f56e){const _0x21ab75=a1132_0x5580,_0x186422=_[_0x21ab75('0x2')](_0xe741e1[_0x21ab75('0x6b')]);_0x40f56e({'count':_0x186422['length'],'rows':_0x186422});});},'SendFax':function(_0x14e450){const _0x37545c=this;return new Promise(function(_0x46c294,_0x1ce64a){const _0x5254af=a1132_0x5580;_0x897416[_0x5254af('0x4a')](_0x14e450)[_0x5254af('0x6a')](function(_0x1005eb){const _0x10a7fc=_0x5254af;_0x46c294({'code':0xc8,'message':_0x1005eb[_0x10a7fc('0x20')]});})['catch'](function(_0x46957a){const _0x4fd32d=_0x5254af;_0x1ce64a(_0x37545c[_0x4fd32d('0xe')](0x1f4,_0x46957a[_0x4fd32d('0x20')]));});});},'CheckAfterSend':function(_0xe1c002){const _0x32c992=this;return new Promise(function(_0xea97b0,_0x3819e4){const _0x58676b=a1132_0x5580;_0x897416[_0x58676b('0x7d')](_0xe1c002)[_0x58676b('0x6a')](function(_0x5d054c){const _0x24fe82=_0x58676b;_0xea97b0({'code':0xc8,'message':_0x5d054c[_0x24fe82('0x20')]});})['catch'](function(_0x659b71){const _0x24910f=_0x58676b;_0x3819e4(_0x32c992[_0x24910f('0xe')](0x1f4,_0x659b71[_0x24910f('0x20')]));});});}},_0xf8b1bb=jayson[_0x329daa('0x24')](_0xe9ab2f)[_0x329daa('0x7e')]();_0xf8b1bb['on'](_0x329daa('0xe'),function(_0xb4a172){return _0x631683(_0xb4a172);}),_0xf8b1bb[_0x329daa('0x5a')](0x232a,_0x329daa('0x46'),function(){const _0x42c88d=_0x329daa;return console['log'](_0x42c88d('0x22'),0x232a),_0x12be20('RPC\x20listening\x20on\x20port:'+0x232a);});});};