Built motion from commit ded33658aad58fc8de845a8299a9db59a88cc353. Version 3.0.0...
[motion-next.git] / server / services / ami / server / index.js
1 const a1132_0x2ff7=['run','outboundUnknownCallsDay','faxAccounts','Interval','telephones','length','jayson/promise','updateStatusRealtime','SIP','timer','context','find','../ami','outboundRejectCallsDay','dialMethod','dialOriginateCallerIdNumber','username','log','outboundDropCallsDayTimeout','error','push','module','abandoned','asterisk','isNil','server','Channel\x20doesn\x27t\x20exist','dialOriginateTimeout','outboundBlacklistCallsDay','rec','outboundNoAnswerCallsDay','originated','content','catch','outboundAnswerAgiCallsDay','YYYY-MM-DD\x20HH:mm:ss','listen','QueuePause','isConnected','predictiveIntervalHitRate','loggedIn','erlangCallToSecond','voicequeuechannelhangup','outboundDropCallsDayACS','stop','Reload','outboundDropCallsDayCallersExit','http','ami\x20disconnected','command','format','predictiveIntervalAvgTalktime','startPredictive','queueChannels','monitors','destinationchannel','../../../config/environment','predictiveIntervalAvgHoldtime','RPC\x20listening\x20on\x20port:','dialPrefix','predictiveIntervalErlangCallsDroppedCalls','Redirect','strategy','waiting','loggedInDb','action','dialActive','voiceQueues','outboundNoSuchCallsDay','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','updateAcw','predictiveIntervalAnsweredCalls','uniqueid','outboundChannels','callerid','outboundReCallsDay','Event\x20name\x20mandatory','sumDuration','wav','map','dialOriginateCallerIdName','MixMonitor','checkAfterSend','event','%s.%s','custom:','outbound','erlangBusyFactor','predictiveIntervalTotalCalls','undefined','StopMixMonitor','util','StopMixMonitor\x20Success','join','pick','talking','exten','predictiveIntervalDroppedCallsCallersExit','unmanaged','predictiveIntervalDroppedCallsTimeout','startProgressive','pause','voicequeuechannel','toLowerCase','status','predictiveIntervalErlangCalls','Trunk','timers','erlangCalls','Action','filename','MixMonitor\x20Success','available','predictiveIntervalPauses','channels','active','name','channel','agents','mixmonitorid','outboundOriginateFailureCallsDay','/var/spool/asterisk/monitor/','message','erlangAbandonmentRate','127.0.0.1','send','outboundBusyCallsDay','moment','type','values','sumHoldTime','predictiveIntervalMultiplicativeFactor','validate','then','predictiveIntervalAvailable'];(function(_0x56f0da,_0x2ff79c){const _0x590bf0=function(_0x4ce10a){while(--_0x4ce10a){_0x56f0da['push'](_0x56f0da['shift']());}};_0x590bf0(++_0x2ff79c);}(a1132_0x2ff7,0xa3));const a1132_0x590b=function(_0x56f0da,_0x2ff79c){_0x56f0da=_0x56f0da-0x0;let _0x590bf0=a1132_0x2ff7[_0x56f0da];return _0x590bf0;};const _0x2252ea=a1132_0x590b;'use strict';const _=require('lodash'),util=require(_0x2252ea('0x3f')),jayson=require(_0x2252ea('0x71')),schema=require(_0x2252ea('0x68')),moment=require(_0x2252ea('0x63')),config=require(_0x2252ea('0x1c')),properties=require('../properties'),ami=require(_0x2252ea('0x77'));exports['listen']=function(_0x4ce10a,_0x106f42,_0x745ddf){return new Promise(function(_0x290666,_0x5e288b){const _0x5d2ab6=a1132_0x590b,_0x2f3e2f={'QueuePause':function(_0x41d55f){return new Promise(function(_0x211cb4){const _0x23b67c=a1132_0x590b,_0x211f4f=util[_0x23b67c('0x16')]('%s/%s',_0x23b67c('0x73'),_0x41d55f[_0x23b67c('0x58')]);_0x4ce10a[_0x23b67c('0x4f')]&&_0x4ce10a[_0x23b67c('0x4f')][_0x211f4f]&&_0x4ce10a[_0x23b67c('0x4f')][_0x211f4f][_0x23b67c('0x74')]&&_0x4ce10a[_0x23b67c('0x4f')][_0x211f4f][_0x23b67c('0x2a')](),_0x4ce10a['agents'][_0x211f4f]&&_0x4ce10a[_0x23b67c('0x5a')][_0x211f4f][_0x23b67c('0x72')]({'statePause':_0x41d55f[_0x23b67c('0x49')]?!![]:![]}),_0x211cb4({'code':0xc8,'message':_0x23b67c('0x9')});});},'Reload':function(_0x390f81){const _0x2dd74c=this;return new Promise(function(_0x4bf740,_0x477a4e){const _0x5dbd28=a1132_0x590b;if(ami[_0x5dbd28('0xa')]()==![])return _0x477a4e(_0x2dd74c[_0x5dbd28('0x7e')](0x1f4,[config[_0x5dbd28('0x82')]['ip'],config['asterisk'][_0x5dbd28('0x7b')],_0x5dbd28('0x14')][_0x5dbd28('0x41')]('\x20')));return _0x390f81=_[_0x5dbd28('0x42')](_0x390f81,_['keys'](properties[_0x5dbd28('0x80')])),_0x390f81[_0x5dbd28('0x25')]=_0x5dbd28('0x11'),ami[_0x5dbd28('0x51')](_0x390f81)['then'](function(_0x25df7b){const _0x21c7f4=_0x5dbd28;_0x4bf740({'code':0xc8,'message':_0x25df7b[_0x21c7f4('0x5e')]});})[_0x5dbd28('0x5')](function(_0x562db8){const _0x2426f1=_0x5dbd28;_0x477a4e(_0x2dd74c[_0x2426f1('0x7e')](0x1f5,_0x562db8[_0x2426f1('0x5e')]));});});},'Command':function(_0x5e2303){const _0x13b945=this;return new Promise(function(_0x1cc1cc,_0x33dff0){const _0x13773b=a1132_0x590b;if(ami[_0x13773b('0xa')]()==![])return _0x33dff0(_0x13b945['error'](0x1f4,[config[_0x13773b('0x82')]['ip'],config[_0x13773b('0x82')][_0x13773b('0x7b')],'ami\x20disconnected'][_0x13773b('0x41')]('\x20')));return _0x5e2303=_['pick'](_0x5e2303,_0x13773b('0x15')),_0x5e2303[_0x13773b('0x25')]='Command',ami[_0x13773b('0x51')](_0x5e2303)[_0x13773b('0x69')](function(_0xd1c1af){const _0x2fe528=_0x13773b;_0x1cc1cc({'code':0xc8,'message':_0xd1c1af[_0x2fe528('0x4')]});})[_0x13773b('0x5')](function(_0x55a8db){const _0x159726=_0x13773b;_0x33dff0(_0x13b945[_0x159726('0x7e')](0x1f5,_0x55a8db[_0x159726('0x5e')]));});});},'VoiceQueues':function(){return new Promise(function(_0x4675a9){const _0x1e4a4a=a1132_0x590b,_0x182fba=[];for(const _0x16174a in _0x4ce10a['voiceQueues']){if(typeof _0x4ce10a[_0x1e4a4a('0x27')][_0x16174a]!==_0x1e4a4a('0x3d')){const _0x490d1c=_0x4ce10a[_0x1e4a4a('0x27')][_0x16174a],_0x39ca86={'id':_0x490d1c['id'],'name':_0x490d1c[_0x1e4a4a('0x58')],'strategy':_0x490d1c[_0x1e4a4a('0x22')],'answered':_0x490d1c['answered'],'available':_0x490d1c[_0x1e4a4a('0x54')],'loggedIn':_0x490d1c[_0x1e4a4a('0xc')],'pTalking':_0x490d1c['pTalking'],'sumBillable':_0x490d1c['sumBillable'],'sumDuration':_0x490d1c[_0x1e4a4a('0x31')],'sumHoldTime':_0x490d1c[_0x1e4a4a('0x66')]||0x0,'talking':_0x490d1c[_0x1e4a4a('0x43')],'total':_0x490d1c['total'],'type':_0x490d1c[_0x1e4a4a('0x64')],'unmanaged':_0x490d1c[_0x1e4a4a('0x46')],'abandoned':_0x490d1c[_0x1e4a4a('0x81')],'waiting':_0x490d1c[_0x1e4a4a('0x23')],'loggedInDb':_0x490d1c[_0x1e4a4a('0x24')]};_0x490d1c[_0x1e4a4a('0x64')]==='outbound'&&(_0x39ca86['dialActive']=_0x490d1c[_0x1e4a4a('0x26')],_0x39ca86[_0x1e4a4a('0x79')]=_0x490d1c['dialMethod'],_0x39ca86[_0x1e4a4a('0x34')]=_0x490d1c['dialOriginateCallerIdName'],_0x39ca86[_0x1e4a4a('0x7a')]=_0x490d1c[_0x1e4a4a('0x7a')],_0x39ca86[_0x1e4a4a('0x86')]=_0x490d1c['dialOriginateTimeout'],_0x39ca86[_0x1e4a4a('0x1f')]=_0x490d1c['dialPrefix'],_0x39ca86[_0x1e4a4a('0x6')]=_0x490d1c['outboundAnswerAgiCallsDay'],_0x39ca86['outboundAnswerCallsDay']=_0x490d1c['outboundAnswerCallsDay'],_0x39ca86[_0x1e4a4a('0x0')]=_0x490d1c['outboundBlacklistCallsDay'],_0x39ca86[_0x1e4a4a('0x62')]=_0x490d1c[_0x1e4a4a('0x62')],_0x39ca86['outboundCongestionCallsDay']=_0x490d1c['outboundCongestionCallsDay'],_0x39ca86[_0x1e4a4a('0xf')]=_0x490d1c[_0x1e4a4a('0xf')],_0x39ca86['outboundDropCallsDayCallersExit']=_0x490d1c[_0x1e4a4a('0x12')],_0x39ca86[_0x1e4a4a('0x7d')]=_0x490d1c[_0x1e4a4a('0x7d')],_0x39ca86['outboundNoAnswerCallsDay']=_0x490d1c[_0x1e4a4a('0x2')],_0x39ca86[_0x1e4a4a('0x28')]=_0x490d1c['outboundNoSuchCallsDay'],_0x39ca86[_0x1e4a4a('0x5c')]=_0x490d1c[_0x1e4a4a('0x5c')],_0x39ca86[_0x1e4a4a('0x2f')]=_0x490d1c[_0x1e4a4a('0x2f')],_0x39ca86[_0x1e4a4a('0x78')]=_0x490d1c[_0x1e4a4a('0x78')],_0x39ca86[_0x1e4a4a('0x6c')]=_0x490d1c[_0x1e4a4a('0x6c')],_0x39ca86[_0x1e4a4a('0x2b')]=_0x490d1c['predictiveIntervalAnsweredCalls'],_0x39ca86[_0x1e4a4a('0x1d')]=_0x490d1c[_0x1e4a4a('0x1d')],_0x39ca86[_0x1e4a4a('0x17')]=_0x490d1c[_0x1e4a4a('0x17')],_0x39ca86[_0x1e4a4a('0x45')]=_0x490d1c[_0x1e4a4a('0x45')],_0x39ca86[_0x1e4a4a('0x47')]=_0x490d1c['predictiveIntervalDroppedCallsTimeout'],_0x39ca86[_0x1e4a4a('0x4d')]=_0x490d1c['predictiveIntervalErlangCalls'],_0x39ca86[_0x1e4a4a('0x20')]=_0x490d1c[_0x1e4a4a('0x20')],_0x39ca86['predictiveIntervalHitRate']=_0x490d1c[_0x1e4a4a('0xb')],_0x39ca86[_0x1e4a4a('0x67')]=_0x490d1c[_0x1e4a4a('0x67')],_0x39ca86[_0x1e4a4a('0x55')]=_0x490d1c[_0x1e4a4a('0x55')],_0x39ca86[_0x1e4a4a('0x6a')]=_0x490d1c[_0x1e4a4a('0x6a')],_0x39ca86[_0x1e4a4a('0x3c')]=_0x490d1c['predictiveIntervalTotalCalls'],_0x39ca86[_0x1e4a4a('0x5e')]=_0x490d1c[_0x1e4a4a('0x5e')],_0x39ca86[_0x1e4a4a('0x3')]=_0x490d1c[_0x1e4a4a('0x3')],_0x39ca86[_0x1e4a4a('0x50')]=_0x490d1c[_0x1e4a4a('0x50')],_0x39ca86[_0x1e4a4a('0xd')]=_0x490d1c[_0x1e4a4a('0xd')],_0x39ca86[_0x1e4a4a('0x5f')]=_0x490d1c[_0x1e4a4a('0x5f')],_0x39ca86['erlangBusyFactor']=_0x490d1c[_0x1e4a4a('0x3b')],_0x39ca86[_0x1e4a4a('0x18')]=_0x490d1c['startPredictive'],_0x39ca86[_0x1e4a4a('0x48')]=_0x490d1c[_0x1e4a4a('0x48')]),_0x490d1c[_0x1e4a4a('0x4e')]&&(_0x39ca86['Trunk']={'id':_0x490d1c['Trunk']['id'],'name':_0x490d1c['Trunk'][_0x1e4a4a('0x58')],'active':_0x490d1c[_0x1e4a4a('0x4e')][_0x1e4a4a('0x57')],'callerid':_0x490d1c[_0x1e4a4a('0x4e')][_0x1e4a4a('0x2e')]}),_0x490d1c['Interval']&&(_0x39ca86[_0x1e4a4a('0x6e')]={'id':_0x490d1c[_0x1e4a4a('0x6e')]['id'],'name':_0x490d1c['Interval'][_0x1e4a4a('0x58')]}),_0x182fba[_0x1e4a4a('0x7f')](_0x39ca86);}}_0x4675a9({'count':_0x182fba[_0x1e4a4a('0x70')],'rows':_0x182fba});});},'VoiceChannels':function(){return new Promise(function(_0x5ed533){const _0x252f51=a1132_0x590b,_0x24e782=_[_0x252f51('0x65')](_0x4ce10a['channels']);_0x5ed533({'count':_0x24e782['length'],'rows':_0x24e782});});},'VoiceChannelMixMonitor':function(_0x5842e2){const _0x846788=this;return new Promise(function(_0x316949,_0x53adea){const _0x26995e=a1132_0x590b;if(ami[_0x26995e('0xa')]()==![])return _0x53adea(_0x846788[_0x26995e('0x7e')](0x1f4,[config[_0x26995e('0x82')]['ip'],config[_0x26995e('0x82')]['username'],_0x26995e('0x14')]['join']('\x20')));const _0x137b7d=schema(properties['voicechannel'])['validate'](_0x5842e2);if(_0x137b7d[_0x26995e('0x70')]>0x0)return _0x53adea(_0x846788['error'](0x1f4,_['map'](_0x137b7d,_0x26995e('0x5e'))['join'](',\x20')));const _0x5d5800=_['find'](_0x4ce10a[_0x26995e('0x56')],{'uniqueid':_0x5842e2[_0x26995e('0x2c')]});if(_0x5d5800&&_0x5d5800[_0x26995e('0x59')]){const _0x4d5b7a=util['format'](_0x26995e('0x38'),_0x5842e2['filename']||_0x5842e2['uniqueid'],_0x5842e2[_0x26995e('0x16')]||_0x26995e('0x32'));return ami['Action']({'action':_0x26995e('0x35'),'channel':_0x5d5800[_0x26995e('0x59')],'file':_0x4d5b7a,'options':'ai(mixmonitorid)'})[_0x26995e('0x69')](function(_0x446924){const _0x7c7a39=_0x26995e,_0x14d366=_[_0x7c7a39('0x76')](_0x5d5800[_0x7c7a39('0x1a')],{'filename':_0x7c7a39('0x5d')+_0x4d5b7a[_0x7c7a39('0x4b')]()});_[_0x7c7a39('0x83')](_0x14d366)?_0x5d5800[_0x7c7a39('0x1a')][_0x7c7a39('0x7f')]({'filename':'/var/spool/asterisk/monitor/'+_0x4d5b7a[_0x7c7a39('0x4b')](),'createdAt':moment()['format'](_0x7c7a39('0x7')),'mixmonitorid':_0x446924[_0x7c7a39('0x5b')],'status':'rec'}):(_0x14d366['mixmonitorid']=_0x446924[_0x7c7a39('0x5b')],_0x14d366['status']=_0x7c7a39('0x1')),_0x316949({'code':0xc8,'message':[_0x5842e2['uniqueid'],_0x7c7a39('0x53'),_0x446924[_0x7c7a39('0x5b')]][_0x7c7a39('0x41')]('\x20'),'mixmonitorid':_0x446924[_0x7c7a39('0x5b')]});})[_0x26995e('0x5')](function(_0x5723b4){const _0x1b018d=_0x26995e;_0x53adea(_0x846788[_0x1b018d('0x7e')](0x1f5,[_0x5842e2[_0x1b018d('0x2c')],_0x5723b4[_0x1b018d('0x5e')]['toLowerCase']()][_0x1b018d('0x41')]('\x20')));});}else return _0x53adea(_0x846788[_0x26995e('0x7e')](0x1f5,_0x26995e('0x85')));});},'VoiceChannelStopMixMonitor':function(_0x3bc0c7){const _0x405b26=this;return new Promise(function(_0x443347,_0x2c6ff7){const _0x50141f=a1132_0x590b;if(ami['isConnected']()==![])return _0x2c6ff7(_0x405b26[_0x50141f('0x7e')](0x1f4,[config[_0x50141f('0x82')]['ip'],config[_0x50141f('0x82')]['username'],_0x50141f('0x14')]['join']('\x20')));const _0x42927f=schema(properties['voicechannel'])[_0x50141f('0x68')](_0x3bc0c7);if(_0x42927f[_0x50141f('0x70')]>0x0)return _0x2c6ff7(_0x405b26[_0x50141f('0x7e')](0x1f4,_[_0x50141f('0x33')](_0x42927f,'message')['join'](',\x20')));const _0x3aac37=_[_0x50141f('0x76')](_0x4ce10a[_0x50141f('0x56')],{'uniqueid':_0x3bc0c7[_0x50141f('0x2c')]});return _0x3aac37?Promise['resolve']()['then'](function(){const _0x548f94=_0x50141f;if(_0x3aac37['channel'])return ami['Action']({'action':_0x548f94('0x3e'),'channel':_0x3aac37[_0x548f94('0x59')],'mixmonitorid':_0x3bc0c7['mixmonitorid']})[_0x548f94('0x5')](function(){});})['then'](function(){const _0x596142=_0x50141f;if(_0x3aac37[_0x596142('0x1b')])return ami['Action']({'action':_0x596142('0x3e'),'channel':_0x3aac37['destinationchannel'],'mixmonitorid':_0x3bc0c7[_0x596142('0x5b')]})[_0x596142('0x5')](function(){});})[_0x50141f('0x69')](function(){const _0x36a030=_0x50141f,_0x2ef705=_[_0x36a030('0x76')](_0x3aac37['monitors'],{'mixmonitorid':_0x3bc0c7[_0x36a030('0x5b')]});_0x2ef705&&(_0x2ef705[_0x36a030('0x4c')]=_0x36a030('0x10'));})['then'](function(){const _0x269dce=_0x50141f,_0x2fe3cd=util[_0x269dce('0x16')]('%s.%s',_0x3bc0c7[_0x269dce('0x52')]||_0x3bc0c7[_0x269dce('0x2c')],_0x3bc0c7[_0x269dce('0x16')]||_0x269dce('0x32')),_0x56749c=_[_0x269dce('0x76')](_0x3aac37[_0x269dce('0x1a')],{'filename':_0x269dce('0x5d')+_0x2fe3cd[_0x269dce('0x4b')]()});_0x56749c&&(_0x56749c[_0x269dce('0x4c')]=_0x269dce('0x10'));})['then'](function(){const _0x38d99c=_0x50141f;_0x443347({'code':0xc8,'message':[_0x3bc0c7[_0x38d99c('0x2c')],_0x38d99c('0x40')][_0x38d99c('0x41')]('\x20')});})['catch'](function(_0x3f1a37){const _0xafe14d=_0x50141f;_0x2c6ff7(_0x405b26[_0xafe14d('0x7e')](0x1f5,[_0x3bc0c7[_0xafe14d('0x2c')],_0x3f1a37[_0xafe14d('0x5e')][_0xafe14d('0x4b')]()]['join']('\x20')));}):_0x2c6ff7(_0x405b26['error'](0x1f5,_0x50141f('0x85')));});},'VoiceQueuesChannels':function(){return new Promise(function(_0x34ad36){const _0x5d12b3=a1132_0x590b,_0x258c73=_['values'](_0x4ce10a[_0x5d12b3('0x19')]);_0x34ad36({'count':_0x258c73[_0x5d12b3('0x70')],'rows':_0x258c73});});},'VoiceQueuesChannel':function(_0x2e1a72){const _0x33fc3c=this;return new Promise(function(_0xf7b625,_0x3458cd){const _0x39ff75=a1132_0x590b,_0x970ad4=schema(properties[_0x39ff75('0x4a')])[_0x39ff75('0x68')](_0x2e1a72);if(_0x970ad4[_0x39ff75('0x70')]>0x0)return _0x3458cd(_0x33fc3c['error'](0x1f4,_[_0x39ff75('0x33')](_0x970ad4,'message')['join'](',\x20')));const _0xd70ca5=_[_0x39ff75('0x76')](_0x4ce10a[_0x39ff75('0x19')],{'uniqueid':_0x2e1a72['uniqueid']});if(_0xd70ca5)_0xf7b625(_0xd70ca5);else return _0x3458cd(_0x33fc3c[_0x39ff75('0x7e')](0x1f5,_0x39ff75('0x85')));});},'VoiceQueuesChannelHangup':function(_0x273771){const _0x4bfe16=this;return new Promise(function(_0x4f6696,_0x1a233f){const _0x9c5389=a1132_0x590b;if(ami[_0x9c5389('0xa')]()==![])return _0x1a233f(_0x4bfe16[_0x9c5389('0x7e')](0x1f4,[config[_0x9c5389('0x82')]['ip'],config['asterisk'][_0x9c5389('0x7b')],_0x9c5389('0x14')][_0x9c5389('0x41')]('\x20')));const _0x32f9d8=schema(properties[_0x9c5389('0xe')])[_0x9c5389('0x68')](_0x273771);if(_0x32f9d8[_0x9c5389('0x70')]>0x0)return _0x1a233f(_0x4bfe16[_0x9c5389('0x7e')](0x1f4,_['map'](_0x32f9d8,_0x9c5389('0x5e'))['join'](',\x20')));const _0x4321dc=_[_0x9c5389('0x76')](_0x4ce10a[_0x9c5389('0x19')],{'uniqueid':_0x273771[_0x9c5389('0x2c')]});return _0x4321dc&&_0x4321dc[_0x9c5389('0x59')]?ami[_0x9c5389('0x51')]({'action':'Hangup','channel':_0x4321dc[_0x9c5389('0x59')]})[_0x9c5389('0x69')](function(_0x4a05c4){const _0x5b3521=_0x9c5389;_0x4f6696({'code':0xc8,'message':[_0x273771[_0x5b3521('0x2c')],_0x4a05c4['message'][_0x5b3521('0x4b')]()]['join']('\x20')});})[_0x9c5389('0x5')](function(_0x352a67){const _0x427933=_0x9c5389;_0x1a233f(_0x4bfe16[_0x427933('0x7e')](0x1f5,[_0x273771[_0x427933('0x2c')],_0x352a67['message'][_0x427933('0x4b')]()]['join']('\x20')));}):_0x1a233f(_0x4bfe16['error'](0x1f5,_0x9c5389('0x85')));});},'VoiceQueuesChannelRedirect':function(_0x49d728){const _0x1bae9e=this;return new Promise(function(_0x327fc3,_0x1f2a33){const _0x17127b=a1132_0x590b;if(ami[_0x17127b('0xa')]()==![])return _0x1f2a33(_0x1bae9e['error'](0x1f4,[config[_0x17127b('0x82')]['ip'],config[_0x17127b('0x82')][_0x17127b('0x7b')],_0x17127b('0x14')][_0x17127b('0x41')]('\x20')));const _0x58776c=schema(properties['voicequeuechannelredirect'])[_0x17127b('0x68')](_0x49d728);if(_0x58776c[_0x17127b('0x70')]>0x0)return _0x1f2a33(_0x1bae9e['error'](0x1f4,_[_0x17127b('0x33')](_0x58776c,'message')[_0x17127b('0x41')](',\x20')));const _0x3d6bc0=_[_0x17127b('0x76')](_0x4ce10a['queueChannels'],{'uniqueid':_0x49d728['uniqueid']});return _0x3d6bc0&&_0x3d6bc0[_0x17127b('0x59')]?ami['Action']({'action':_0x17127b('0x21'),'channel':_0x3d6bc0['channel'],'exten':_0x49d728[_0x17127b('0x44')],'context':_0x49d728[_0x17127b('0x75')]||_0x3d6bc0[_0x17127b('0x75')],'priority':0x1})[_0x17127b('0x69')](function(_0x39220c){const _0xd0afe3=_0x17127b;_0x327fc3({'code':0xc8,'message':[_0x49d728[_0xd0afe3('0x2c')],_0x39220c['message']['toLowerCase']()][_0xd0afe3('0x41')]('\x20')});})[_0x17127b('0x5')](function(_0x2419be){const _0x478422=_0x17127b;_0x1f2a33(_0x1bae9e[_0x478422('0x7e')](0x1f5,[_0x49d728['uniqueid'],_0x2419be[_0x478422('0x5e')][_0x478422('0x4b')]()]['join']('\x20')));}):_0x1f2a33(_0x1bae9e[_0x17127b('0x7e')](0x1f5,_0x17127b('0x85')));});},'Agents':function(){return new Promise(function(_0x2382da){const _0x296830=a1132_0x590b,_0xab63b3=_['values'](_0x4ce10a[_0x296830('0x5a')]);_0x2382da({'count':_0xab63b3['length'],'rows':_0xab63b3});});},'Telephones':function(){return new Promise(function(_0xdea9f){const _0x17178e=a1132_0x590b,_0x262788=_[_0x17178e('0x65')](_0x4ce10a[_0x17178e('0x6f')]);_0xdea9f({'count':_0x262788[_0x17178e('0x70')],'rows':_0x262788});});},'Trunks':function(){return new Promise(function(_0x2cb0d4){const _0x54af04=a1132_0x590b,_0x5126a8=_[_0x54af04('0x65')](_0x4ce10a['trunks']);_0x2cb0d4({'count':_0x5126a8['length'],'rows':_0x5126a8});});},'OutboundChannels':function(){return new Promise(function(_0x6ce20f){const _0x4828e6=a1132_0x590b,_0x26b3de=_[_0x4828e6('0x65')](_0x4ce10a[_0x4828e6('0x2d')]);_0x6ce20f({'count':_0x26b3de['length'],'rows':_0x26b3de});});},'Outbound':function(){return new Promise(function(_0x4f2a24){const _0xf15b93=a1132_0x590b;_0x4f2a24(_0x4ce10a[_0xf15b93('0x3a')]);});},'Campaigns':function(){return new Promise(function(_0x389a71){const _0x268840=a1132_0x590b,_0x194850=_[_0x268840('0x65')](_0x4ce10a['campaigns']);_0x389a71({'count':_0x194850['length'],'rows':_0x194850});});},'VoiceQueuesPreview':function(_0x4767b8){const _0x4b03b5=this;return new Promise(function(_0x1d714c,_0x77c9ff){const _0x5d6aeb=a1132_0x590b;_0x106f42[_0x5d6aeb('0x6b')](_0x4767b8['id'])['then'](function(_0x2b18c0){const _0x4de31d=_0x5d6aeb;_0x1d714c({'code':0xc8,'message':_0x2b18c0[_0x4de31d('0x5e')]});})[_0x5d6aeb('0x5')](function(_0x2f9865){_0x77c9ff(_0x4b03b5['error'](0x1f4,_0x2f9865['message']));});});},'EventManager':function(_0x5bbbe1){const _0x5c37ab=this;return new Promise(function(_0x15c24e,_0x3594ee){const _0x3a6c02=a1132_0x590b;if(!_0x5bbbe1[_0x3a6c02('0x37')])return _0x3594ee(_0x5c37ab[_0x3a6c02('0x7e')](0x1f4,_0x3a6c02('0x30')));ami['emit'](_0x3a6c02('0x39')+_0x5bbbe1[_0x3a6c02('0x37')],_0x5bbbe1[_0x3a6c02('0x5e')]),_0x15c24e({'code':0xc8,'message':_0x5bbbe1});});},'FaxAccounts':function(){return new Promise(function(_0x26064b){const _0x223492=a1132_0x590b,_0x1e63f7=_[_0x223492('0x65')](_0x4ce10a[_0x223492('0x6d')]);_0x26064b({'count':_0x1e63f7['length'],'rows':_0x1e63f7});});},'SendFax':function(_0x567970){const _0x284602=this;return new Promise(function(_0xf04f6e,_0x255dd6){const _0x3ac560=a1132_0x590b;_0x745ddf[_0x3ac560('0x61')](_0x567970)['then'](function(_0xa50848){const _0x5f0483=_0x3ac560;_0xf04f6e({'code':0xc8,'message':_0xa50848[_0x5f0483('0x5e')]});})[_0x3ac560('0x5')](function(_0x5bab20){const _0x5698e6=_0x3ac560;_0x255dd6(_0x284602[_0x5698e6('0x7e')](0x1f4,_0x5bab20[_0x5698e6('0x5e')]));});});},'CheckAfterSend':function(_0x468b0e){const _0x2acaf3=this;return new Promise(function(_0x32a21b,_0xb9cbc0){const _0x2bb019=a1132_0x590b;_0x745ddf[_0x2bb019('0x36')](_0x468b0e)[_0x2bb019('0x69')](function(_0x598fc9){_0x32a21b({'code':0xc8,'message':_0x598fc9['message']});})[_0x2bb019('0x5')](function(_0xe01692){const _0x2ea7ab=_0x2bb019;_0xb9cbc0(_0x2acaf3[_0x2ea7ab('0x7e')](0x1f4,_0xe01692[_0x2ea7ab('0x5e')]));});});}},_0x4e2d9=jayson[_0x5d2ab6('0x84')](_0x2f3e2f)[_0x5d2ab6('0x13')]();_0x4e2d9['on'](_0x5d2ab6('0x7e'),function(_0x51d191){return _0x5e288b(_0x51d191);}),_0x4e2d9[_0x5d2ab6('0x8')](0x232a,_0x5d2ab6('0x60'),function(){const _0x3178e1=_0x5d2ab6;return console[_0x3178e1('0x7c')](_0x3178e1('0x29'),0x232a),_0x290666(_0x3178e1('0x1e')+0x232a);});});};