Built motion from commit b51cdcb3f2cb46634587ce1d55ea1b8f32dacea6. Version 3.0.0...
[motion-next.git] / server / services / ami / server / index.js
index 5522529..da883d8 100644 (file)
@@ -1 +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);});});};
\ No newline at end of file
+const a1132_0x116d=['channels','startPredictive','asterisk','message','action','name','channel','destinationchannel','outboundDropCallsDayCallersExit','voicechannel','Event\x20name\x20mandatory','outboundCongestionCallsDay','Redirect','dialOriginateCallerIdName','checkAfterSend','wav','voicequeuechannelhangup','trunks','predictiveIntervalErlangCallsDroppedCalls','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','%s/%s','context','startProgressive','exten','ami\x20disconnected','outboundRejectCallsDay','toLowerCase','%s.%s','outboundNoSuchCallsDay','erlangCalls','dialOriginateCallerIdNumber','total','outboundReCallsDay','outboundBlacklistCallsDay','answered','updateAcw','module','StopMixMonitor','strategy','dialPrefix','predictiveIntervalTotalCalls','send','StopMixMonitor\x20Success','dialMethod','pause','waiting','MixMonitor','voicequeuechannel','queueChannels','validate','Action','sumBillable','timer','util','mixmonitorid','Channel\x20doesn\x27t\x20exist','sumDuration','monitors','ai(mixmonitorid)','isConnected','map','SIP','Trunk','outboundChannels','updateStatusRealtime','emit','predictiveIntervalAvailable','predictiveIntervalPauses','error','dialOriginateTimeout','voiceQueues','filename','values','erlangBusyFactor','listen','run','predictiveIntervalErlangCalls','username','predictiveIntervalAnsweredCalls','QueuePause','loggedIn','predictiveIntervalAvgTalktime','originated','command','keys','MixMonitor\x20Success','catch','predictiveIntervalDroppedCallsCallersExit','outboundAnswerCallsDay','outbound','lodash','RPC\x20listening\x20on\x20port:','outboundNoAnswerCallsDay','predictiveIntervalDroppedCallsTimeout','status','erlangCallToSecond','pick','jayson/promise','format','outboundBusyCallsDay','voicequeuechannelredirect','join','faxAccounts','length','talking','outboundDropCallsDayACS','predictiveIntervalAvgHoldtime','predictiveIntervalMultiplicativeFactor','Hangup','push','callerid','outboundUnknownCallsDay','event','uniqueid','log','agents','Command','../../../config/environment','undefined','resolve','../ami','/var/spool/asterisk/monitor/','Reload','find','unmanaged','sumHoldTime','then','loggedInDb','outboundAnswerAgiCallsDay','content','outboundOriginateFailureCallsDay','timers','127.0.0.1','active','isNil','abandoned','rec','Interval','YYYY-MM-DD\x20HH:mm:ss','predictiveIntervalHitRate','campaigns','outboundDropCallsDayTimeout','erlangAbandonmentRate'];(function(_0x18495b,_0x116d2d){const _0x5069c3=function(_0x2768b5){while(--_0x2768b5){_0x18495b['push'](_0x18495b['shift']());}};_0x5069c3(++_0x116d2d);}(a1132_0x116d,0x10a));const a1132_0x5069=function(_0x18495b,_0x116d2d){_0x18495b=_0x18495b-0x0;let _0x5069c3=a1132_0x116d[_0x18495b];return _0x5069c3;};const _0x1d24d4=a1132_0x5069;'use strict';const _=require(_0x1d24d4('0x6e')),util=require(_0x1d24d4('0x49')),jayson=require(_0x1d24d4('0x75')),schema=require('validate'),moment=require('moment'),config=require(_0x1d24d4('0x89')),properties=require('../properties'),ami=require(_0x1d24d4('0x8c'));exports[_0x1d24d4('0x5e')]=function(_0x2768b5,_0x2b931c,_0x43bc91){return new Promise(function(_0x20d97c,_0x31f748){const _0x1c2716=a1132_0x5069,_0x437d23={'QueuePause':function(_0x7c46b2){return new Promise(function(_0x8a9b25){const _0x3edd80=a1132_0x5069,_0x2faf1a=util[_0x3edd80('0x76')](_0x3edd80('0x28'),_0x3edd80('0x51'),_0x7c46b2[_0x3edd80('0x19')]);_0x2768b5[_0x3edd80('0x8')]&&_0x2768b5['timers'][_0x2faf1a]&&_0x2768b5[_0x3edd80('0x8')][_0x2faf1a][_0x3edd80('0x48')]&&_0x2768b5[_0x3edd80('0x8')][_0x2faf1a][_0x3edd80('0x37')](),_0x2768b5[_0x3edd80('0x87')][_0x2faf1a]&&_0x2768b5['agents'][_0x2faf1a][_0x3edd80('0x54')]({'statePause':_0x7c46b2[_0x3edd80('0x40')]?!![]:![]}),_0x8a9b25({'code':0xc8,'message':_0x3edd80('0x63')});});},'Reload':function(_0x519255){const _0x5a4fa0=this;return new Promise(function(_0x390f29,_0x1b810c){const _0x84bfbf=a1132_0x5069;if(ami[_0x84bfbf('0x4f')]()==![])return _0x1b810c(_0x5a4fa0[_0x84bfbf('0x58')](0x1f4,[config[_0x84bfbf('0x16')]['ip'],config['asterisk'][_0x84bfbf('0x61')],'ami\x20disconnected'][_0x84bfbf('0x79')]('\x20')));return _0x519255=_[_0x84bfbf('0x74')](_0x519255,_[_0x84bfbf('0x68')](properties[_0x84bfbf('0x38')])),_0x519255[_0x84bfbf('0x18')]=_0x84bfbf('0x8e'),ami[_0x84bfbf('0x46')](_0x519255)['then'](function(_0x350a41){const _0x365867=_0x84bfbf;_0x390f29({'code':0xc8,'message':_0x350a41[_0x365867('0x17')]});})['catch'](function(_0x2876f5){const _0x3cd26b=_0x84bfbf;_0x1b810c(_0x5a4fa0[_0x3cd26b('0x58')](0x1f5,_0x2876f5[_0x3cd26b('0x17')]));});});},'Command':function(_0x17c18e){const _0x31ea1e=this;return new Promise(function(_0x304a01,_0x40820a){const _0x12b0fa=a1132_0x5069;if(ami[_0x12b0fa('0x4f')]()==![])return _0x40820a(_0x31ea1e['error'](0x1f4,[config[_0x12b0fa('0x16')]['ip'],config['asterisk'][_0x12b0fa('0x61')],_0x12b0fa('0x2c')]['join']('\x20')));return _0x17c18e=_[_0x12b0fa('0x74')](_0x17c18e,_0x12b0fa('0x67')),_0x17c18e['action']=_0x12b0fa('0x88'),ami[_0x12b0fa('0x46')](_0x17c18e)['then'](function(_0x45a606){const _0xc8ad0e=_0x12b0fa;_0x304a01({'code':0xc8,'message':_0x45a606[_0xc8ad0e('0x6')]});})[_0x12b0fa('0x6a')](function(_0x1293cf){const _0x2ea17d=_0x12b0fa;_0x40820a(_0x31ea1e[_0x2ea17d('0x58')](0x1f5,_0x1293cf[_0x2ea17d('0x17')]));});});},'VoiceQueues':function(){return new Promise(function(_0x146e8c){const _0x7c1fd9=a1132_0x5069,_0x49714e=[];for(const _0x3876ea in _0x2768b5[_0x7c1fd9('0x5a')]){if(typeof _0x2768b5[_0x7c1fd9('0x5a')][_0x3876ea]!==_0x7c1fd9('0x8a')){const _0x2426d3=_0x2768b5['voiceQueues'][_0x3876ea],_0x1c70cf={'id':_0x2426d3['id'],'name':_0x2426d3[_0x7c1fd9('0x19')],'strategy':_0x2426d3[_0x7c1fd9('0x3a')],'answered':_0x2426d3[_0x7c1fd9('0x36')],'available':_0x2426d3['available'],'loggedIn':_0x2426d3[_0x7c1fd9('0x64')],'pTalking':_0x2426d3['pTalking'],'sumBillable':_0x2426d3[_0x7c1fd9('0x47')],'sumDuration':_0x2426d3[_0x7c1fd9('0x4c')],'sumHoldTime':_0x2426d3[_0x7c1fd9('0x2')]||0x0,'talking':_0x2426d3[_0x7c1fd9('0x7c')],'total':_0x2426d3[_0x7c1fd9('0x33')],'type':_0x2426d3['type'],'unmanaged':_0x2426d3[_0x7c1fd9('0x1')],'abandoned':_0x2426d3[_0x7c1fd9('0xc')],'waiting':_0x2426d3[_0x7c1fd9('0x41')],'loggedInDb':_0x2426d3[_0x7c1fd9('0x4')]};_0x2426d3['type']==='outbound'&&(_0x1c70cf['dialActive']=_0x2426d3['dialActive'],_0x1c70cf[_0x7c1fd9('0x3f')]=_0x2426d3[_0x7c1fd9('0x3f')],_0x1c70cf[_0x7c1fd9('0x21')]=_0x2426d3['dialOriginateCallerIdName'],_0x1c70cf['dialOriginateCallerIdNumber']=_0x2426d3[_0x7c1fd9('0x32')],_0x1c70cf['dialOriginateTimeout']=_0x2426d3[_0x7c1fd9('0x59')],_0x1c70cf[_0x7c1fd9('0x3b')]=_0x2426d3[_0x7c1fd9('0x3b')],_0x1c70cf[_0x7c1fd9('0x5')]=_0x2426d3['outboundAnswerAgiCallsDay'],_0x1c70cf['outboundAnswerCallsDay']=_0x2426d3[_0x7c1fd9('0x6c')],_0x1c70cf[_0x7c1fd9('0x35')]=_0x2426d3[_0x7c1fd9('0x35')],_0x1c70cf[_0x7c1fd9('0x77')]=_0x2426d3[_0x7c1fd9('0x77')],_0x1c70cf[_0x7c1fd9('0x1f')]=_0x2426d3[_0x7c1fd9('0x1f')],_0x1c70cf[_0x7c1fd9('0x7d')]=_0x2426d3[_0x7c1fd9('0x7d')],_0x1c70cf[_0x7c1fd9('0x1c')]=_0x2426d3[_0x7c1fd9('0x1c')],_0x1c70cf[_0x7c1fd9('0x12')]=_0x2426d3[_0x7c1fd9('0x12')],_0x1c70cf[_0x7c1fd9('0x70')]=_0x2426d3[_0x7c1fd9('0x70')],_0x1c70cf[_0x7c1fd9('0x30')]=_0x2426d3[_0x7c1fd9('0x30')],_0x1c70cf[_0x7c1fd9('0x7')]=_0x2426d3[_0x7c1fd9('0x7')],_0x1c70cf[_0x7c1fd9('0x34')]=_0x2426d3[_0x7c1fd9('0x34')],_0x1c70cf[_0x7c1fd9('0x2d')]=_0x2426d3['outboundRejectCallsDay'],_0x1c70cf[_0x7c1fd9('0x83')]=_0x2426d3['outboundUnknownCallsDay'],_0x1c70cf['predictiveIntervalAnsweredCalls']=_0x2426d3[_0x7c1fd9('0x62')],_0x1c70cf[_0x7c1fd9('0x7e')]=_0x2426d3['predictiveIntervalAvgHoldtime'],_0x1c70cf[_0x7c1fd9('0x65')]=_0x2426d3[_0x7c1fd9('0x65')],_0x1c70cf[_0x7c1fd9('0x6b')]=_0x2426d3['predictiveIntervalDroppedCallsCallersExit'],_0x1c70cf[_0x7c1fd9('0x71')]=_0x2426d3[_0x7c1fd9('0x71')],_0x1c70cf['predictiveIntervalErlangCalls']=_0x2426d3[_0x7c1fd9('0x60')],_0x1c70cf['predictiveIntervalErlangCallsDroppedCalls']=_0x2426d3[_0x7c1fd9('0x26')],_0x1c70cf[_0x7c1fd9('0x10')]=_0x2426d3[_0x7c1fd9('0x10')],_0x1c70cf[_0x7c1fd9('0x7f')]=_0x2426d3[_0x7c1fd9('0x7f')],_0x1c70cf[_0x7c1fd9('0x57')]=_0x2426d3[_0x7c1fd9('0x57')],_0x1c70cf[_0x7c1fd9('0x56')]=_0x2426d3['predictiveIntervalAvailable'],_0x1c70cf['predictiveIntervalTotalCalls']=_0x2426d3[_0x7c1fd9('0x3c')],_0x1c70cf[_0x7c1fd9('0x17')]=_0x2426d3[_0x7c1fd9('0x17')],_0x1c70cf[_0x7c1fd9('0x66')]=_0x2426d3[_0x7c1fd9('0x66')],_0x1c70cf[_0x7c1fd9('0x31')]=_0x2426d3[_0x7c1fd9('0x31')],_0x1c70cf[_0x7c1fd9('0x73')]=_0x2426d3[_0x7c1fd9('0x73')],_0x1c70cf[_0x7c1fd9('0x13')]=_0x2426d3[_0x7c1fd9('0x13')],_0x1c70cf[_0x7c1fd9('0x5d')]=_0x2426d3[_0x7c1fd9('0x5d')],_0x1c70cf[_0x7c1fd9('0x15')]=_0x2426d3['startPredictive'],_0x1c70cf[_0x7c1fd9('0x2a')]=_0x2426d3[_0x7c1fd9('0x2a')]),_0x2426d3['Trunk']&&(_0x1c70cf[_0x7c1fd9('0x52')]={'id':_0x2426d3['Trunk']['id'],'name':_0x2426d3[_0x7c1fd9('0x52')]['name'],'active':_0x2426d3[_0x7c1fd9('0x52')][_0x7c1fd9('0xa')],'callerid':_0x2426d3[_0x7c1fd9('0x52')][_0x7c1fd9('0x82')]}),_0x2426d3[_0x7c1fd9('0xe')]&&(_0x1c70cf[_0x7c1fd9('0xe')]={'id':_0x2426d3[_0x7c1fd9('0xe')]['id'],'name':_0x2426d3[_0x7c1fd9('0xe')][_0x7c1fd9('0x19')]}),_0x49714e[_0x7c1fd9('0x81')](_0x1c70cf);}}_0x146e8c({'count':_0x49714e['length'],'rows':_0x49714e});});},'VoiceChannels':function(){return new Promise(function(_0x17591a){const _0x3514e7=_['values'](_0x2768b5['channels']);_0x17591a({'count':_0x3514e7['length'],'rows':_0x3514e7});});},'VoiceChannelMixMonitor':function(_0x1df5ef){const _0x405eb5=this;return new Promise(function(_0x23cdfc,_0x32a7a1){const _0x58ecc9=a1132_0x5069;if(ami[_0x58ecc9('0x4f')]()==![])return _0x32a7a1(_0x405eb5[_0x58ecc9('0x58')](0x1f4,[config[_0x58ecc9('0x16')]['ip'],config[_0x58ecc9('0x16')][_0x58ecc9('0x61')],_0x58ecc9('0x2c')][_0x58ecc9('0x79')]('\x20')));const _0x169fae=schema(properties[_0x58ecc9('0x1d')])[_0x58ecc9('0x45')](_0x1df5ef);if(_0x169fae[_0x58ecc9('0x7b')]>0x0)return _0x32a7a1(_0x405eb5[_0x58ecc9('0x58')](0x1f4,_[_0x58ecc9('0x50')](_0x169fae,_0x58ecc9('0x17'))[_0x58ecc9('0x79')](',\x20')));const _0x4d90fb=_['find'](_0x2768b5[_0x58ecc9('0x14')],{'uniqueid':_0x1df5ef[_0x58ecc9('0x85')]});if(_0x4d90fb&&_0x4d90fb[_0x58ecc9('0x1a')]){const _0x401cf5=util[_0x58ecc9('0x76')](_0x58ecc9('0x2f'),_0x1df5ef[_0x58ecc9('0x5b')]||_0x1df5ef[_0x58ecc9('0x85')],_0x1df5ef['format']||_0x58ecc9('0x23'));return ami[_0x58ecc9('0x46')]({'action':_0x58ecc9('0x42'),'channel':_0x4d90fb[_0x58ecc9('0x1a')],'file':_0x401cf5,'options':_0x58ecc9('0x4e')})[_0x58ecc9('0x3')](function(_0x375c8d){const _0x4a7f94=_0x58ecc9,_0x64c4f8=_[_0x4a7f94('0x0')](_0x4d90fb[_0x4a7f94('0x4d')],{'filename':_0x4a7f94('0x8d')+_0x401cf5[_0x4a7f94('0x2e')]()});_[_0x4a7f94('0xb')](_0x64c4f8)?_0x4d90fb[_0x4a7f94('0x4d')][_0x4a7f94('0x81')]({'filename':'/var/spool/asterisk/monitor/'+_0x401cf5[_0x4a7f94('0x2e')](),'createdAt':moment()['format'](_0x4a7f94('0xf')),'mixmonitorid':_0x375c8d[_0x4a7f94('0x4a')],'status':_0x4a7f94('0xd')}):(_0x64c4f8[_0x4a7f94('0x4a')]=_0x375c8d[_0x4a7f94('0x4a')],_0x64c4f8[_0x4a7f94('0x72')]=_0x4a7f94('0xd')),_0x23cdfc({'code':0xc8,'message':[_0x1df5ef[_0x4a7f94('0x85')],_0x4a7f94('0x69'),_0x375c8d['mixmonitorid']][_0x4a7f94('0x79')]('\x20'),'mixmonitorid':_0x375c8d[_0x4a7f94('0x4a')]});})[_0x58ecc9('0x6a')](function(_0x1cee8d){const _0x235d31=_0x58ecc9;_0x32a7a1(_0x405eb5[_0x235d31('0x58')](0x1f5,[_0x1df5ef[_0x235d31('0x85')],_0x1cee8d[_0x235d31('0x17')]['toLowerCase']()][_0x235d31('0x79')]('\x20')));});}else return _0x32a7a1(_0x405eb5[_0x58ecc9('0x58')](0x1f5,_0x58ecc9('0x4b')));});},'VoiceChannelStopMixMonitor':function(_0x486684){const _0x127884=this;return new Promise(function(_0x417f39,_0x3f4cec){const _0x49687e=a1132_0x5069;if(ami[_0x49687e('0x4f')]()==![])return _0x3f4cec(_0x127884['error'](0x1f4,[config['asterisk']['ip'],config[_0x49687e('0x16')]['username'],'ami\x20disconnected'][_0x49687e('0x79')]('\x20')));const _0x41a215=schema(properties['voicechannel'])['validate'](_0x486684);if(_0x41a215[_0x49687e('0x7b')]>0x0)return _0x3f4cec(_0x127884[_0x49687e('0x58')](0x1f4,_[_0x49687e('0x50')](_0x41a215,_0x49687e('0x17'))[_0x49687e('0x79')](',\x20')));const _0x227258=_[_0x49687e('0x0')](_0x2768b5[_0x49687e('0x14')],{'uniqueid':_0x486684[_0x49687e('0x85')]});return _0x227258?Promise[_0x49687e('0x8b')]()[_0x49687e('0x3')](function(){const _0x394cc1=_0x49687e;if(_0x227258[_0x394cc1('0x1a')])return ami[_0x394cc1('0x46')]({'action':'StopMixMonitor','channel':_0x227258[_0x394cc1('0x1a')],'mixmonitorid':_0x486684[_0x394cc1('0x4a')]})['catch'](function(){});})[_0x49687e('0x3')](function(){const _0x378db0=_0x49687e;if(_0x227258[_0x378db0('0x1b')])return ami[_0x378db0('0x46')]({'action':_0x378db0('0x39'),'channel':_0x227258[_0x378db0('0x1b')],'mixmonitorid':_0x486684[_0x378db0('0x4a')]})[_0x378db0('0x6a')](function(){});})[_0x49687e('0x3')](function(){const _0x49e1a1=_0x49687e,_0x5ac313=_['find'](_0x227258[_0x49e1a1('0x4d')],{'mixmonitorid':_0x486684['mixmonitorid']});_0x5ac313&&(_0x5ac313['status']='stop');})[_0x49687e('0x3')](function(){const _0x2c8548=_0x49687e,_0x3113a4=util[_0x2c8548('0x76')](_0x2c8548('0x2f'),_0x486684[_0x2c8548('0x5b')]||_0x486684[_0x2c8548('0x85')],_0x486684[_0x2c8548('0x76')]||_0x2c8548('0x23')),_0x4d9143=_['find'](_0x227258['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x3113a4['toLowerCase']()});_0x4d9143&&(_0x4d9143[_0x2c8548('0x72')]='stop');})[_0x49687e('0x3')](function(){const _0x3c2bae=_0x49687e;_0x417f39({'code':0xc8,'message':[_0x486684[_0x3c2bae('0x85')],_0x3c2bae('0x3e')][_0x3c2bae('0x79')]('\x20')});})[_0x49687e('0x6a')](function(_0xe7ed35){const _0x549b04=_0x49687e;_0x3f4cec(_0x127884[_0x549b04('0x58')](0x1f5,[_0x486684['uniqueid'],_0xe7ed35[_0x549b04('0x17')]['toLowerCase']()]['join']('\x20')));}):_0x3f4cec(_0x127884[_0x49687e('0x58')](0x1f5,_0x49687e('0x4b')));});},'VoiceQueuesChannels':function(){return new Promise(function(_0x1a474c){const _0x3cb7e4=a1132_0x5069,_0x4f2559=_[_0x3cb7e4('0x5c')](_0x2768b5[_0x3cb7e4('0x44')]);_0x1a474c({'count':_0x4f2559[_0x3cb7e4('0x7b')],'rows':_0x4f2559});});},'VoiceQueuesChannel':function(_0x46351c){const _0x3cb767=this;return new Promise(function(_0x3731d7,_0x5a5bcf){const _0x48543f=a1132_0x5069,_0x1767e0=schema(properties[_0x48543f('0x43')])[_0x48543f('0x45')](_0x46351c);if(_0x1767e0[_0x48543f('0x7b')]>0x0)return _0x5a5bcf(_0x3cb767['error'](0x1f4,_[_0x48543f('0x50')](_0x1767e0,_0x48543f('0x17'))[_0x48543f('0x79')](',\x20')));const _0x5bc118=_[_0x48543f('0x0')](_0x2768b5['queueChannels'],{'uniqueid':_0x46351c[_0x48543f('0x85')]});if(_0x5bc118)_0x3731d7(_0x5bc118);else return _0x5a5bcf(_0x3cb767[_0x48543f('0x58')](0x1f5,'Channel\x20doesn\x27t\x20exist'));});},'VoiceQueuesChannelHangup':function(_0x3e7f4d){const _0x29bdfb=this;return new Promise(function(_0x3fb927,_0xa64bb){const _0x15dae9=a1132_0x5069;if(ami[_0x15dae9('0x4f')]()==![])return _0xa64bb(_0x29bdfb[_0x15dae9('0x58')](0x1f4,[config[_0x15dae9('0x16')]['ip'],config[_0x15dae9('0x16')]['username'],'ami\x20disconnected'][_0x15dae9('0x79')]('\x20')));const _0x165c8a=schema(properties[_0x15dae9('0x24')])[_0x15dae9('0x45')](_0x3e7f4d);if(_0x165c8a[_0x15dae9('0x7b')]>0x0)return _0xa64bb(_0x29bdfb[_0x15dae9('0x58')](0x1f4,_[_0x15dae9('0x50')](_0x165c8a,_0x15dae9('0x17'))[_0x15dae9('0x79')](',\x20')));const _0x4a7368=_[_0x15dae9('0x0')](_0x2768b5['queueChannels'],{'uniqueid':_0x3e7f4d[_0x15dae9('0x85')]});return _0x4a7368&&_0x4a7368[_0x15dae9('0x1a')]?ami[_0x15dae9('0x46')]({'action':_0x15dae9('0x80'),'channel':_0x4a7368[_0x15dae9('0x1a')]})[_0x15dae9('0x3')](function(_0x4dd7f8){const _0x359bba=_0x15dae9;_0x3fb927({'code':0xc8,'message':[_0x3e7f4d[_0x359bba('0x85')],_0x4dd7f8['message'][_0x359bba('0x2e')]()]['join']('\x20')});})['catch'](function(_0x873329){const _0x382c5e=_0x15dae9;_0xa64bb(_0x29bdfb['error'](0x1f5,[_0x3e7f4d[_0x382c5e('0x85')],_0x873329[_0x382c5e('0x17')][_0x382c5e('0x2e')]()][_0x382c5e('0x79')]('\x20')));}):_0xa64bb(_0x29bdfb[_0x15dae9('0x58')](0x1f5,_0x15dae9('0x4b')));});},'VoiceQueuesChannelRedirect':function(_0x4c94b6){const _0x53c703=this;return new Promise(function(_0xa6c469,_0x4f8eda){const _0xcfb806=a1132_0x5069;if(ami['isConnected']()==![])return _0x4f8eda(_0x53c703['error'](0x1f4,[config[_0xcfb806('0x16')]['ip'],config[_0xcfb806('0x16')]['username'],_0xcfb806('0x2c')][_0xcfb806('0x79')]('\x20')));const _0x58fd12=schema(properties[_0xcfb806('0x78')])[_0xcfb806('0x45')](_0x4c94b6);if(_0x58fd12[_0xcfb806('0x7b')]>0x0)return _0x4f8eda(_0x53c703[_0xcfb806('0x58')](0x1f4,_[_0xcfb806('0x50')](_0x58fd12,_0xcfb806('0x17'))[_0xcfb806('0x79')](',\x20')));const _0x34eb8c=_['find'](_0x2768b5[_0xcfb806('0x44')],{'uniqueid':_0x4c94b6[_0xcfb806('0x85')]});return _0x34eb8c&&_0x34eb8c['channel']?ami['Action']({'action':_0xcfb806('0x20'),'channel':_0x34eb8c['channel'],'exten':_0x4c94b6[_0xcfb806('0x2b')],'context':_0x4c94b6[_0xcfb806('0x29')]||_0x34eb8c['context'],'priority':0x1})['then'](function(_0x309154){const _0x1eebdc=_0xcfb806;_0xa6c469({'code':0xc8,'message':[_0x4c94b6[_0x1eebdc('0x85')],_0x309154[_0x1eebdc('0x17')][_0x1eebdc('0x2e')]()]['join']('\x20')});})[_0xcfb806('0x6a')](function(_0x147db2){const _0x22b27a=_0xcfb806;_0x4f8eda(_0x53c703[_0x22b27a('0x58')](0x1f5,[_0x4c94b6[_0x22b27a('0x85')],_0x147db2['message'][_0x22b27a('0x2e')]()]['join']('\x20')));}):_0x4f8eda(_0x53c703[_0xcfb806('0x58')](0x1f5,'Channel\x20doesn\x27t\x20exist'));});},'Agents':function(){return new Promise(function(_0x3b2470){const _0x4edc50=a1132_0x5069,_0x4b5a8b=_[_0x4edc50('0x5c')](_0x2768b5[_0x4edc50('0x87')]);_0x3b2470({'count':_0x4b5a8b[_0x4edc50('0x7b')],'rows':_0x4b5a8b});});},'Telephones':function(){return new Promise(function(_0x36d758){const _0x385c08=_['values'](_0x2768b5['telephones']);_0x36d758({'count':_0x385c08['length'],'rows':_0x385c08});});},'Trunks':function(){return new Promise(function(_0x1cce89){const _0x540f5e=a1132_0x5069,_0x3a7a7e=_[_0x540f5e('0x5c')](_0x2768b5[_0x540f5e('0x25')]);_0x1cce89({'count':_0x3a7a7e[_0x540f5e('0x7b')],'rows':_0x3a7a7e});});},'OutboundChannels':function(){return new Promise(function(_0x210255){const _0x5e9256=a1132_0x5069,_0x34c547=_[_0x5e9256('0x5c')](_0x2768b5[_0x5e9256('0x53')]);_0x210255({'count':_0x34c547[_0x5e9256('0x7b')],'rows':_0x34c547});});},'Outbound':function(){return new Promise(function(_0x8b7f57){const _0x110b64=a1132_0x5069;_0x8b7f57(_0x2768b5[_0x110b64('0x6d')]);});},'Campaigns':function(){return new Promise(function(_0x5e89b4){const _0x52e869=a1132_0x5069,_0x2644d3=_[_0x52e869('0x5c')](_0x2768b5[_0x52e869('0x11')]);_0x5e89b4({'count':_0x2644d3[_0x52e869('0x7b')],'rows':_0x2644d3});});},'VoiceQueuesPreview':function(_0x315fc9){const _0x443f14=this;return new Promise(function(_0xfd934e,_0x527555){const _0x5755be=a1132_0x5069;_0x2b931c[_0x5755be('0x5f')](_0x315fc9['id'])[_0x5755be('0x3')](function(_0x396840){const _0x37ee95=_0x5755be;_0xfd934e({'code':0xc8,'message':_0x396840[_0x37ee95('0x17')]});})[_0x5755be('0x6a')](function(_0x3b80a9){_0x527555(_0x443f14['error'](0x1f4,_0x3b80a9['message']));});});},'EventManager':function(_0x50eb8c){const _0x4b34de=this;return new Promise(function(_0xa9666e,_0x569ab7){const _0xb0f1e6=a1132_0x5069;if(!_0x50eb8c[_0xb0f1e6('0x84')])return _0x569ab7(_0x4b34de[_0xb0f1e6('0x58')](0x1f4,_0xb0f1e6('0x1e')));ami[_0xb0f1e6('0x55')]('custom:'+_0x50eb8c['event'],_0x50eb8c['message']),_0xa9666e({'code':0xc8,'message':_0x50eb8c});});},'FaxAccounts':function(){return new Promise(function(_0x1b4695){const _0xad7b49=a1132_0x5069,_0x5f50e6=_['values'](_0x2768b5[_0xad7b49('0x7a')]);_0x1b4695({'count':_0x5f50e6['length'],'rows':_0x5f50e6});});},'SendFax':function(_0x74937f){const _0x3c941a=this;return new Promise(function(_0x4ea6d9,_0x24e3c5){const _0x46dce8=a1132_0x5069;_0x43bc91[_0x46dce8('0x3d')](_0x74937f)[_0x46dce8('0x3')](function(_0x1dd661){const _0x1fa2eb=_0x46dce8;_0x4ea6d9({'code':0xc8,'message':_0x1dd661[_0x1fa2eb('0x17')]});})['catch'](function(_0x2486a7){const _0x36cd31=_0x46dce8;_0x24e3c5(_0x3c941a['error'](0x1f4,_0x2486a7[_0x36cd31('0x17')]));});});},'CheckAfterSend':function(_0x5adcd0){const _0xa7d614=this;return new Promise(function(_0x5bc1ec,_0xec7d03){const _0x30cc82=a1132_0x5069;_0x43bc91[_0x30cc82('0x22')](_0x5adcd0)[_0x30cc82('0x3')](function(_0x42b6b1){const _0x11312d=_0x30cc82;_0x5bc1ec({'code':0xc8,'message':_0x42b6b1[_0x11312d('0x17')]});})['catch'](function(_0x23e0c7){const _0x179e2b=_0x30cc82;_0xec7d03(_0xa7d614[_0x179e2b('0x58')](0x1f4,_0x23e0c7[_0x179e2b('0x17')]));});});}},_0x2f6e8f=jayson['server'](_0x437d23)['http']();_0x2f6e8f['on']('error',function(_0x1f2e08){return _0x31f748(_0x1f2e08);}),_0x2f6e8f[_0x1c2716('0x5e')](0x232a,_0x1c2716('0x9'),function(){const _0x588da8=_0x1c2716;return console[_0x588da8('0x86')](_0x588da8('0x27'),0x232a),_0x20d97c(_0x588da8('0x6f')+0x232a);});});};
\ No newline at end of file