Built motion from commit ecdc8e66766c75b1b08288b0ea13eb12d42606b4. Version 3.0.0...
[motion-next.git] / server / services / ami / server / index.js
1 const a1132_0x41b4=['abandoned','ai(mixmonitorid)','/var/spool/asterisk/monitor/','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','outboundBlacklistCallsDay','voicequeuechannel','outboundChannels','Command','predictiveIntervalPauses','values','context','RPC\x20listening\x20on\x20port:','emit','uniqueid','isConnected','SIP','StopMixMonitor\x20Success','sumBillable','message','then','listen','startPredictive','predictiveIntervalMultiplicativeFactor','mixmonitorid','log','outboundBusyCallsDay','predictiveIntervalHitRate','sumDuration','outbound','dialActive','wav','action','pause','predictiveIntervalErlangCallsDroppedCalls','custom:','outboundNoAnswerCallsDay','QueuePause','telephones','validate','Channel\x20doesn\x27t\x20exist','updateStatusRealtime','loggedIn','push','outboundCongestionCallsDay','stop','available','asterisk','erlangBusyFactor','predictiveIntervalAvgTalktime','pTalking','rec','waiting','%s/%s','predictiveIntervalDroppedCallsCallersExit','voicequeuechannelhangup','content','lodash','dialMethod','Interval','channels','status','find','Action','predictiveIntervalErlangCalls','predictiveIntervalAvailable','Redirect','monitors','erlangCalls','queueChannels','../../../config/environment','map','undefined','Event\x20name\x20mandatory','module','format','answered','run','catch','resolve','outboundUnknownCallsDay','timers','%s.%s','127.0.0.1','trunks','callerid','Reload','voiceQueues','erlangAbandonmentRate','erlangCallToSecond','outboundDropCallsDayCallersExit','outboundAnswerCallsDay','../properties','keys','util','dialOriginateCallerIdName','outboundReCallsDay','predictiveIntervalDroppedCallsTimeout','Trunk','faxAccounts','MixMonitor','toLowerCase','campaigns','command','pick','name','active','outboundNoSuchCallsDay','moment','startProgressive','unmanaged','destinationchannel','outboundDropCallsDayTimeout','outboundRejectCallsDay','timer','length','outboundDropCallsDayACS','server','voicequeuechannelredirect','send','checkAfterSend','agents','join','predictiveIntervalTotalCalls','strategy','ami\x20disconnected','outboundAnswerAgiCallsDay','../ami','username','error','channel','talking','StopMixMonitor','event','voicechannel','dialPrefix','http','dialOriginateCallerIdNumber','Hangup','predictiveIntervalAvgHoldtime','exten'];(function(_0x207a05,_0x41b43c){const _0x43d785=function(_0x2e0129){while(--_0x2e0129){_0x207a05['push'](_0x207a05['shift']());}};_0x43d785(++_0x41b43c);}(a1132_0x41b4,0x173));const a1132_0x43d7=function(_0x207a05,_0x41b43c){_0x207a05=_0x207a05-0x0;let _0x43d785=a1132_0x41b4[_0x207a05];return _0x43d785;};const _0x5efa2e=a1132_0x43d7;'use strict';const _=require(_0x5efa2e('0x69')),util=require(_0x5efa2e('0x2')),jayson=require('jayson/promise'),schema=require(_0x5efa2e('0x57')),moment=require(_0x5efa2e('0x10')),config=require(_0x5efa2e('0x76')),properties=require(_0x5efa2e('0x0')),ami=require(_0x5efa2e('0x23'));exports[_0x5efa2e('0x45')]=function(_0x2e0129,_0x16f55c,_0x3015d5){return new Promise(function(_0x56082f,_0x250be4){const _0xdfb9e7=a1132_0x43d7,_0x35e9a0={'QueuePause':function(_0x12463e){return new Promise(function(_0x1c2768){const _0x3ccbe7=a1132_0x43d7,_0x5dd81a=util[_0x3ccbe7('0x7b')](_0x3ccbe7('0x65'),_0x3ccbe7('0x40'),_0x12463e[_0x3ccbe7('0xd')]);_0x2e0129[_0x3ccbe7('0x81')]&&_0x2e0129['timers'][_0x5dd81a]&&_0x2e0129['timers'][_0x5dd81a][_0x3ccbe7('0x16')]&&_0x2e0129[_0x3ccbe7('0x81')][_0x5dd81a]['updateAcw'](),_0x2e0129[_0x3ccbe7('0x1d')][_0x5dd81a]&&_0x2e0129[_0x3ccbe7('0x1d')][_0x5dd81a][_0x3ccbe7('0x59')]({'statePause':_0x12463e[_0x3ccbe7('0x51')]?!![]:![]}),_0x1c2768({'code':0xc8,'message':_0x3ccbe7('0x55')});});},'Reload':function(_0x428a82){const _0xf7ce2a=this;return new Promise(function(_0x2d17bc,_0x33c588){const _0x769f25=a1132_0x43d7;if(ami[_0x769f25('0x3f')]()==![])return _0x33c588(_0xf7ce2a[_0x769f25('0x25')](0x1f4,[config[_0x769f25('0x5f')]['ip'],config[_0x769f25('0x5f')][_0x769f25('0x24')],_0x769f25('0x21')]['join']('\x20')));return _0x428a82=_[_0x769f25('0xc')](_0x428a82,_[_0x769f25('0x1')](properties[_0x769f25('0x7a')])),_0x428a82[_0x769f25('0x50')]=_0x769f25('0x86'),ami[_0x769f25('0x6f')](_0x428a82)[_0x769f25('0x44')](function(_0x461468){const _0x23ca3e=_0x769f25;_0x2d17bc({'code':0xc8,'message':_0x461468[_0x23ca3e('0x43')]});})[_0x769f25('0x7e')](function(_0x354df0){const _0x45ac69=_0x769f25;_0x33c588(_0xf7ce2a[_0x45ac69('0x25')](0x1f5,_0x354df0[_0x45ac69('0x43')]));});});},'Command':function(_0x1d35b1){const _0x558763=this;return new Promise(function(_0x10ff34,_0x3885d4){const _0x2186a1=a1132_0x43d7;if(ami[_0x2186a1('0x3f')]()==![])return _0x3885d4(_0x558763[_0x2186a1('0x25')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x2186a1('0x24')],_0x2186a1('0x21')][_0x2186a1('0x1e')]('\x20')));return _0x1d35b1=_[_0x2186a1('0xc')](_0x1d35b1,_0x2186a1('0xb')),_0x1d35b1[_0x2186a1('0x50')]=_0x2186a1('0x38'),ami[_0x2186a1('0x6f')](_0x1d35b1)[_0x2186a1('0x44')](function(_0x5e0d6a){const _0x2d72a9=_0x2186a1;_0x10ff34({'code':0xc8,'message':_0x5e0d6a[_0x2d72a9('0x68')]});})[_0x2186a1('0x7e')](function(_0x41ab14){const _0x52de08=_0x2186a1;_0x3885d4(_0x558763[_0x52de08('0x25')](0x1f5,_0x41ab14[_0x52de08('0x43')]));});});},'VoiceQueues':function(){return new Promise(function(_0x190fc4){const _0x11afa1=a1132_0x43d7,_0x1b5b3a=[];for(const _0x599a97 in _0x2e0129[_0x11afa1('0x87')]){if(typeof _0x2e0129['voiceQueues'][_0x599a97]!==_0x11afa1('0x78')){const _0x57c296=_0x2e0129[_0x11afa1('0x87')][_0x599a97],_0x25c80c={'id':_0x57c296['id'],'name':_0x57c296[_0x11afa1('0xd')],'strategy':_0x57c296[_0x11afa1('0x20')],'answered':_0x57c296[_0x11afa1('0x7c')],'available':_0x57c296[_0x11afa1('0x5e')],'loggedIn':_0x57c296[_0x11afa1('0x5a')],'pTalking':_0x57c296[_0x11afa1('0x62')],'sumBillable':_0x57c296[_0x11afa1('0x42')],'sumDuration':_0x57c296[_0x11afa1('0x4c')],'sumHoldTime':_0x57c296['sumHoldTime']||0x0,'talking':_0x57c296[_0x11afa1('0x27')],'total':_0x57c296['total'],'type':_0x57c296['type'],'unmanaged':_0x57c296[_0x11afa1('0x12')],'abandoned':_0x57c296[_0x11afa1('0x31')],'waiting':_0x57c296[_0x11afa1('0x64')],'loggedInDb':_0x57c296['loggedInDb']};_0x57c296['type']==='outbound'&&(_0x25c80c['dialActive']=_0x57c296[_0x11afa1('0x4e')],_0x25c80c[_0x11afa1('0x6a')]=_0x57c296[_0x11afa1('0x6a')],_0x25c80c[_0x11afa1('0x3')]=_0x57c296[_0x11afa1('0x3')],_0x25c80c[_0x11afa1('0x2d')]=_0x57c296[_0x11afa1('0x2d')],_0x25c80c['dialOriginateTimeout']=_0x57c296['dialOriginateTimeout'],_0x25c80c[_0x11afa1('0x2b')]=_0x57c296[_0x11afa1('0x2b')],_0x25c80c[_0x11afa1('0x22')]=_0x57c296['outboundAnswerAgiCallsDay'],_0x25c80c['outboundAnswerCallsDay']=_0x57c296[_0x11afa1('0x8b')],_0x25c80c[_0x11afa1('0x35')]=_0x57c296['outboundBlacklistCallsDay'],_0x25c80c[_0x11afa1('0x4a')]=_0x57c296[_0x11afa1('0x4a')],_0x25c80c[_0x11afa1('0x5c')]=_0x57c296[_0x11afa1('0x5c')],_0x25c80c[_0x11afa1('0x18')]=_0x57c296[_0x11afa1('0x18')],_0x25c80c[_0x11afa1('0x8a')]=_0x57c296[_0x11afa1('0x8a')],_0x25c80c['outboundDropCallsDayTimeout']=_0x57c296[_0x11afa1('0x14')],_0x25c80c[_0x11afa1('0x54')]=_0x57c296[_0x11afa1('0x54')],_0x25c80c[_0x11afa1('0xf')]=_0x57c296[_0x11afa1('0xf')],_0x25c80c['outboundOriginateFailureCallsDay']=_0x57c296['outboundOriginateFailureCallsDay'],_0x25c80c[_0x11afa1('0x4')]=_0x57c296['outboundReCallsDay'],_0x25c80c['outboundRejectCallsDay']=_0x57c296[_0x11afa1('0x15')],_0x25c80c[_0x11afa1('0x80')]=_0x57c296[_0x11afa1('0x80')],_0x25c80c['predictiveIntervalAnsweredCalls']=_0x57c296['predictiveIntervalAnsweredCalls'],_0x25c80c[_0x11afa1('0x2f')]=_0x57c296[_0x11afa1('0x2f')],_0x25c80c[_0x11afa1('0x61')]=_0x57c296[_0x11afa1('0x61')],_0x25c80c[_0x11afa1('0x66')]=_0x57c296['predictiveIntervalDroppedCallsCallersExit'],_0x25c80c[_0x11afa1('0x5')]=_0x57c296[_0x11afa1('0x5')],_0x25c80c[_0x11afa1('0x70')]=_0x57c296[_0x11afa1('0x70')],_0x25c80c[_0x11afa1('0x52')]=_0x57c296[_0x11afa1('0x52')],_0x25c80c[_0x11afa1('0x4b')]=_0x57c296[_0x11afa1('0x4b')],_0x25c80c[_0x11afa1('0x47')]=_0x57c296[_0x11afa1('0x47')],_0x25c80c[_0x11afa1('0x39')]=_0x57c296['predictiveIntervalPauses'],_0x25c80c[_0x11afa1('0x71')]=_0x57c296[_0x11afa1('0x71')],_0x25c80c[_0x11afa1('0x1f')]=_0x57c296['predictiveIntervalTotalCalls'],_0x25c80c[_0x11afa1('0x43')]=_0x57c296[_0x11afa1('0x43')],_0x25c80c['originated']=_0x57c296['originated'],_0x25c80c[_0x11afa1('0x74')]=_0x57c296['erlangCalls'],_0x25c80c[_0x11afa1('0x89')]=_0x57c296[_0x11afa1('0x89')],_0x25c80c[_0x11afa1('0x88')]=_0x57c296[_0x11afa1('0x88')],_0x25c80c[_0x11afa1('0x60')]=_0x57c296['erlangBusyFactor'],_0x25c80c[_0x11afa1('0x46')]=_0x57c296[_0x11afa1('0x46')],_0x25c80c[_0x11afa1('0x11')]=_0x57c296[_0x11afa1('0x11')]),_0x57c296['Trunk']&&(_0x25c80c[_0x11afa1('0x6')]={'id':_0x57c296['Trunk']['id'],'name':_0x57c296[_0x11afa1('0x6')][_0x11afa1('0xd')],'active':_0x57c296[_0x11afa1('0x6')][_0x11afa1('0xe')],'callerid':_0x57c296[_0x11afa1('0x6')][_0x11afa1('0x85')]}),_0x57c296[_0x11afa1('0x6b')]&&(_0x25c80c[_0x11afa1('0x6b')]={'id':_0x57c296['Interval']['id'],'name':_0x57c296[_0x11afa1('0x6b')]['name']}),_0x1b5b3a[_0x11afa1('0x5b')](_0x25c80c);}}_0x190fc4({'count':_0x1b5b3a[_0x11afa1('0x17')],'rows':_0x1b5b3a});});},'VoiceChannels':function(){return new Promise(function(_0x329a9b){const _0x33e1d9=a1132_0x43d7,_0x4b4373=_['values'](_0x2e0129['channels']);_0x329a9b({'count':_0x4b4373[_0x33e1d9('0x17')],'rows':_0x4b4373});});},'VoiceChannelMixMonitor':function(_0x237df7){const _0x43e814=this;return new Promise(function(_0x4df972,_0x6343d7){const _0x34578f=a1132_0x43d7;if(ami['isConnected']()==![])return _0x6343d7(_0x43e814[_0x34578f('0x25')](0x1f4,[config['asterisk']['ip'],config[_0x34578f('0x5f')][_0x34578f('0x24')],_0x34578f('0x21')][_0x34578f('0x1e')]('\x20')));const _0x79cde2=schema(properties[_0x34578f('0x2a')])[_0x34578f('0x57')](_0x237df7);if(_0x79cde2[_0x34578f('0x17')]>0x0)return _0x6343d7(_0x43e814[_0x34578f('0x25')](0x1f4,_[_0x34578f('0x77')](_0x79cde2,_0x34578f('0x43'))['join'](',\x20')));const _0x35c1f8=_['find'](_0x2e0129[_0x34578f('0x6c')],{'uniqueid':_0x237df7[_0x34578f('0x3e')]});if(_0x35c1f8&&_0x35c1f8[_0x34578f('0x26')]){const _0x120068=util[_0x34578f('0x7b')](_0x34578f('0x82'),_0x237df7['filename']||_0x237df7['uniqueid'],_0x237df7[_0x34578f('0x7b')]||_0x34578f('0x4f'));return ami[_0x34578f('0x6f')]({'action':_0x34578f('0x8'),'channel':_0x35c1f8[_0x34578f('0x26')],'file':_0x120068,'options':_0x34578f('0x32')})['then'](function(_0xae4e2d){const _0x137eee=_0x34578f,_0x590e28=_[_0x137eee('0x6e')](_0x35c1f8[_0x137eee('0x73')],{'filename':'/var/spool/asterisk/monitor/'+_0x120068['toLowerCase']()});_['isNil'](_0x590e28)?_0x35c1f8['monitors'][_0x137eee('0x5b')]({'filename':'/var/spool/asterisk/monitor/'+_0x120068['toLowerCase'](),'createdAt':moment()[_0x137eee('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0xae4e2d[_0x137eee('0x48')],'status':_0x137eee('0x63')}):(_0x590e28[_0x137eee('0x48')]=_0xae4e2d[_0x137eee('0x48')],_0x590e28[_0x137eee('0x6d')]='rec'),_0x4df972({'code':0xc8,'message':[_0x237df7[_0x137eee('0x3e')],'MixMonitor\x20Success',_0xae4e2d['mixmonitorid']]['join']('\x20'),'mixmonitorid':_0xae4e2d[_0x137eee('0x48')]});})[_0x34578f('0x7e')](function(_0x532a97){const _0x501af2=_0x34578f;_0x6343d7(_0x43e814['error'](0x1f5,[_0x237df7[_0x501af2('0x3e')],_0x532a97[_0x501af2('0x43')][_0x501af2('0x9')]()][_0x501af2('0x1e')]('\x20')));});}else return _0x6343d7(_0x43e814['error'](0x1f5,_0x34578f('0x58')));});},'VoiceChannelStopMixMonitor':function(_0x3cadef){const _0x2680c7=this;return new Promise(function(_0x261d2a,_0x216165){const _0x5c8c3b=a1132_0x43d7;if(ami[_0x5c8c3b('0x3f')]()==![])return _0x216165(_0x2680c7[_0x5c8c3b('0x25')](0x1f4,[config[_0x5c8c3b('0x5f')]['ip'],config['asterisk'][_0x5c8c3b('0x24')],'ami\x20disconnected']['join']('\x20')));const _0x1795f6=schema(properties[_0x5c8c3b('0x2a')])[_0x5c8c3b('0x57')](_0x3cadef);if(_0x1795f6[_0x5c8c3b('0x17')]>0x0)return _0x216165(_0x2680c7['error'](0x1f4,_['map'](_0x1795f6,'message')[_0x5c8c3b('0x1e')](',\x20')));const _0x36863d=_[_0x5c8c3b('0x6e')](_0x2e0129[_0x5c8c3b('0x6c')],{'uniqueid':_0x3cadef[_0x5c8c3b('0x3e')]});return _0x36863d?Promise[_0x5c8c3b('0x7f')]()[_0x5c8c3b('0x44')](function(){const _0x2a9ba9=_0x5c8c3b;if(_0x36863d[_0x2a9ba9('0x26')])return ami[_0x2a9ba9('0x6f')]({'action':_0x2a9ba9('0x28'),'channel':_0x36863d['channel'],'mixmonitorid':_0x3cadef[_0x2a9ba9('0x48')]})[_0x2a9ba9('0x7e')](function(){});})['then'](function(){const _0x19cb2c=_0x5c8c3b;if(_0x36863d[_0x19cb2c('0x13')])return ami['Action']({'action':_0x19cb2c('0x28'),'channel':_0x36863d[_0x19cb2c('0x13')],'mixmonitorid':_0x3cadef[_0x19cb2c('0x48')]})[_0x19cb2c('0x7e')](function(){});})[_0x5c8c3b('0x44')](function(){const _0x2d922e=_0x5c8c3b,_0x53dbb4=_[_0x2d922e('0x6e')](_0x36863d[_0x2d922e('0x73')],{'mixmonitorid':_0x3cadef[_0x2d922e('0x48')]});_0x53dbb4&&(_0x53dbb4[_0x2d922e('0x6d')]='stop');})['then'](function(){const _0x2aac9b=_0x5c8c3b,_0x5e22f5=util[_0x2aac9b('0x7b')](_0x2aac9b('0x82'),_0x3cadef['filename']||_0x3cadef[_0x2aac9b('0x3e')],_0x3cadef[_0x2aac9b('0x7b')]||_0x2aac9b('0x4f')),_0x2e37df=_['find'](_0x36863d[_0x2aac9b('0x73')],{'filename':_0x2aac9b('0x33')+_0x5e22f5[_0x2aac9b('0x9')]()});_0x2e37df&&(_0x2e37df['status']=_0x2aac9b('0x5d'));})[_0x5c8c3b('0x44')](function(){const _0x277239=_0x5c8c3b;_0x261d2a({'code':0xc8,'message':[_0x3cadef[_0x277239('0x3e')],_0x277239('0x41')][_0x277239('0x1e')]('\x20')});})[_0x5c8c3b('0x7e')](function(_0x4a4192){const _0x176c82=_0x5c8c3b;_0x216165(_0x2680c7[_0x176c82('0x25')](0x1f5,[_0x3cadef[_0x176c82('0x3e')],_0x4a4192[_0x176c82('0x43')]['toLowerCase']()][_0x176c82('0x1e')]('\x20')));}):_0x216165(_0x2680c7[_0x5c8c3b('0x25')](0x1f5,_0x5c8c3b('0x58')));});},'VoiceQueuesChannels':function(){return new Promise(function(_0x3fc66e){const _0x13bad6=a1132_0x43d7,_0x44dd28=_[_0x13bad6('0x3a')](_0x2e0129[_0x13bad6('0x75')]);_0x3fc66e({'count':_0x44dd28['length'],'rows':_0x44dd28});});},'VoiceQueuesChannel':function(_0x3d8924){const _0x29a53f=this;return new Promise(function(_0x22e6bf,_0x3fd500){const _0x47e546=a1132_0x43d7,_0x494b78=schema(properties[_0x47e546('0x36')])[_0x47e546('0x57')](_0x3d8924);if(_0x494b78[_0x47e546('0x17')]>0x0)return _0x3fd500(_0x29a53f[_0x47e546('0x25')](0x1f4,_['map'](_0x494b78,_0x47e546('0x43'))[_0x47e546('0x1e')](',\x20')));const _0x663bdf=_['find'](_0x2e0129[_0x47e546('0x75')],{'uniqueid':_0x3d8924[_0x47e546('0x3e')]});if(_0x663bdf)_0x22e6bf(_0x663bdf);else return _0x3fd500(_0x29a53f['error'](0x1f5,_0x47e546('0x58')));});},'VoiceQueuesChannelHangup':function(_0xfdb47a){const _0x4084c1=this;return new Promise(function(_0x29dee3,_0x20ee4f){const _0x3d5306=a1132_0x43d7;if(ami['isConnected']()==![])return _0x20ee4f(_0x4084c1[_0x3d5306('0x25')](0x1f4,[config[_0x3d5306('0x5f')]['ip'],config['asterisk'][_0x3d5306('0x24')],'ami\x20disconnected'][_0x3d5306('0x1e')]('\x20')));const _0x12d88c=schema(properties[_0x3d5306('0x67')])[_0x3d5306('0x57')](_0xfdb47a);if(_0x12d88c[_0x3d5306('0x17')]>0x0)return _0x20ee4f(_0x4084c1[_0x3d5306('0x25')](0x1f4,_['map'](_0x12d88c,_0x3d5306('0x43'))[_0x3d5306('0x1e')](',\x20')));const _0x5004e4=_[_0x3d5306('0x6e')](_0x2e0129[_0x3d5306('0x75')],{'uniqueid':_0xfdb47a[_0x3d5306('0x3e')]});return _0x5004e4&&_0x5004e4[_0x3d5306('0x26')]?ami[_0x3d5306('0x6f')]({'action':_0x3d5306('0x2e'),'channel':_0x5004e4['channel']})[_0x3d5306('0x44')](function(_0x2b75a3){const _0x30c0f6=_0x3d5306;_0x29dee3({'code':0xc8,'message':[_0xfdb47a[_0x30c0f6('0x3e')],_0x2b75a3[_0x30c0f6('0x43')][_0x30c0f6('0x9')]()][_0x30c0f6('0x1e')]('\x20')});})['catch'](function(_0x40b483){const _0xf64068=_0x3d5306;_0x20ee4f(_0x4084c1['error'](0x1f5,[_0xfdb47a[_0xf64068('0x3e')],_0x40b483['message'][_0xf64068('0x9')]()][_0xf64068('0x1e')]('\x20')));}):_0x20ee4f(_0x4084c1[_0x3d5306('0x25')](0x1f5,'Channel\x20doesn\x27t\x20exist'));});},'VoiceQueuesChannelRedirect':function(_0x171521){const _0x345b1c=this;return new Promise(function(_0x503a82,_0x4e4a67){const _0x579e0d=a1132_0x43d7;if(ami['isConnected']()==![])return _0x4e4a67(_0x345b1c[_0x579e0d('0x25')](0x1f4,[config[_0x579e0d('0x5f')]['ip'],config[_0x579e0d('0x5f')]['username'],'ami\x20disconnected'][_0x579e0d('0x1e')]('\x20')));const _0x4602c7=schema(properties[_0x579e0d('0x1a')])[_0x579e0d('0x57')](_0x171521);if(_0x4602c7[_0x579e0d('0x17')]>0x0)return _0x4e4a67(_0x345b1c[_0x579e0d('0x25')](0x1f4,_[_0x579e0d('0x77')](_0x4602c7,_0x579e0d('0x43'))['join'](',\x20')));const _0x2538e2=_[_0x579e0d('0x6e')](_0x2e0129[_0x579e0d('0x75')],{'uniqueid':_0x171521['uniqueid']});return _0x2538e2&&_0x2538e2['channel']?ami[_0x579e0d('0x6f')]({'action':_0x579e0d('0x72'),'channel':_0x2538e2[_0x579e0d('0x26')],'exten':_0x171521[_0x579e0d('0x30')],'context':_0x171521['context']||_0x2538e2[_0x579e0d('0x3b')],'priority':0x1})[_0x579e0d('0x44')](function(_0xbe9526){const _0x3efc5e=_0x579e0d;_0x503a82({'code':0xc8,'message':[_0x171521[_0x3efc5e('0x3e')],_0xbe9526[_0x3efc5e('0x43')][_0x3efc5e('0x9')]()][_0x3efc5e('0x1e')]('\x20')});})[_0x579e0d('0x7e')](function(_0x43f1e1){const _0x2f512e=_0x579e0d;_0x4e4a67(_0x345b1c[_0x2f512e('0x25')](0x1f5,[_0x171521[_0x2f512e('0x3e')],_0x43f1e1[_0x2f512e('0x43')][_0x2f512e('0x9')]()][_0x2f512e('0x1e')]('\x20')));}):_0x4e4a67(_0x345b1c['error'](0x1f5,_0x579e0d('0x58')));});},'Agents':function(){return new Promise(function(_0x7ab96a){const _0x4988a4=a1132_0x43d7,_0x1aa064=_[_0x4988a4('0x3a')](_0x2e0129[_0x4988a4('0x1d')]);_0x7ab96a({'count':_0x1aa064[_0x4988a4('0x17')],'rows':_0x1aa064});});},'Telephones':function(){return new Promise(function(_0x150fe6){const _0x3211b2=a1132_0x43d7,_0x289525=_[_0x3211b2('0x3a')](_0x2e0129[_0x3211b2('0x56')]);_0x150fe6({'count':_0x289525['length'],'rows':_0x289525});});},'Trunks':function(){return new Promise(function(_0x220891){const _0x190665=a1132_0x43d7,_0x2ae8d3=_[_0x190665('0x3a')](_0x2e0129[_0x190665('0x84')]);_0x220891({'count':_0x2ae8d3[_0x190665('0x17')],'rows':_0x2ae8d3});});},'OutboundChannels':function(){return new Promise(function(_0x102fd3){const _0x2da2c9=a1132_0x43d7,_0x325798=_[_0x2da2c9('0x3a')](_0x2e0129[_0x2da2c9('0x37')]);_0x102fd3({'count':_0x325798[_0x2da2c9('0x17')],'rows':_0x325798});});},'Outbound':function(){return new Promise(function(_0x4956cd){const _0x9a512f=a1132_0x43d7;_0x4956cd(_0x2e0129[_0x9a512f('0x4d')]);});},'Campaigns':function(){return new Promise(function(_0x4186c9){const _0x22cb5c=a1132_0x43d7,_0x3d3761=_[_0x22cb5c('0x3a')](_0x2e0129[_0x22cb5c('0xa')]);_0x4186c9({'count':_0x3d3761[_0x22cb5c('0x17')],'rows':_0x3d3761});});},'VoiceQueuesPreview':function(_0x4c2f88){const _0x261281=this;return new Promise(function(_0x305c03,_0x33902d){const _0x4b752a=a1132_0x43d7;_0x16f55c[_0x4b752a('0x7d')](_0x4c2f88['id'])[_0x4b752a('0x44')](function(_0x37981f){const _0x39bf7c=_0x4b752a;_0x305c03({'code':0xc8,'message':_0x37981f[_0x39bf7c('0x43')]});})['catch'](function(_0x230ea5){const _0x395514=_0x4b752a;_0x33902d(_0x261281[_0x395514('0x25')](0x1f4,_0x230ea5[_0x395514('0x43')]));});});},'EventManager':function(_0x142f0c){const _0x80bfea=this;return new Promise(function(_0x1e8cba,_0x18263f){const _0xfca78a=a1132_0x43d7;if(!_0x142f0c[_0xfca78a('0x29')])return _0x18263f(_0x80bfea['error'](0x1f4,_0xfca78a('0x79')));ami[_0xfca78a('0x3d')](_0xfca78a('0x53')+_0x142f0c[_0xfca78a('0x29')],_0x142f0c[_0xfca78a('0x43')]),_0x1e8cba({'code':0xc8,'message':_0x142f0c});});},'FaxAccounts':function(){return new Promise(function(_0x5bb94a){const _0xf80ad8=a1132_0x43d7,_0x33bcd2=_[_0xf80ad8('0x3a')](_0x2e0129[_0xf80ad8('0x7')]);_0x5bb94a({'count':_0x33bcd2[_0xf80ad8('0x17')],'rows':_0x33bcd2});});},'SendFax':function(_0x2f4465){const _0x349fe9=this;return new Promise(function(_0x4b72a7,_0x109ab3){const _0x4920fe=a1132_0x43d7;_0x3015d5[_0x4920fe('0x1b')](_0x2f4465)[_0x4920fe('0x44')](function(_0x59d06b){_0x4b72a7({'code':0xc8,'message':_0x59d06b['message']});})[_0x4920fe('0x7e')](function(_0x2d0dbd){const _0xc09d7f=_0x4920fe;_0x109ab3(_0x349fe9[_0xc09d7f('0x25')](0x1f4,_0x2d0dbd[_0xc09d7f('0x43')]));});});},'CheckAfterSend':function(_0x5a642f){const _0x3e97d0=this;return new Promise(function(_0x369b3c,_0x43fc99){const _0xb51e92=a1132_0x43d7;_0x3015d5[_0xb51e92('0x1c')](_0x5a642f)[_0xb51e92('0x44')](function(_0x53ba3e){const _0x5eef9a=_0xb51e92;_0x369b3c({'code':0xc8,'message':_0x53ba3e[_0x5eef9a('0x43')]});})[_0xb51e92('0x7e')](function(_0x347d70){const _0x327a73=_0xb51e92;_0x43fc99(_0x3e97d0[_0x327a73('0x25')](0x1f4,_0x347d70[_0x327a73('0x43')]));});});}},_0x4ece68=jayson[_0xdfb9e7('0x19')](_0x35e9a0)[_0xdfb9e7('0x2c')]();_0x4ece68['on'](_0xdfb9e7('0x25'),function(_0x361dfa){return _0x250be4(_0x361dfa);}),_0x4ece68[_0xdfb9e7('0x45')](0x232a,_0xdfb9e7('0x83'),function(){const _0x1c311c=_0xdfb9e7;return console[_0x1c311c('0x49')](_0x1c311c('0x34'),0x232a),_0x56082f(_0x1c311c('0x3c')+0x232a);});});};