Built motion from commit (unavailable).|2.5.4
[motion2.git] / server / services / ami / server / index.js
index 367484f..e8d6c45 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x004d=['module','action','Reload','Action','then','message','catch','error','isConnected','ami\x20disconnected','command','content','voiceQueues','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','total','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','values','channels','voicechannel','map','find','uniqueid','channel','format','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','validate','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','context','trunks','outbound','run','event','emit','custom:','faxAccounts','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','moment','../../../config/environment','../ami','listen','%s/%s','name','timers','timer','updateAcw','agents','QueuePause','asterisk','username','join','pick'];(function(_0x4f4b99,_0xb89ce6){var _0x489dfe=function(_0x14578c){while(--_0x14578c){_0x4f4b99['push'](_0x4f4b99['shift']());}};_0x489dfe(++_0xb89ce6);}(_0x004d,0xfb));var _0xd004=function(_0x28c40e,_0x2d2390){_0x28c40e=_0x28c40e-0x0;var _0x53380c=_0x004d[_0x28c40e];return _0x53380c;};'use strict';var _=require(_0xd004('0x0'));var util=require(_0xd004('0x1'));var jayson=require(_0xd004('0x2'));var schema=require('validate');var BPromise=require(_0xd004('0x3'));var moment=require(_0xd004('0x4'));var config=require(_0xd004('0x5'));var properties=require('../properties');var ami=require(_0xd004('0x6'));exports[_0xd004('0x7')]=function(_0x2392aa,_0x15ba36,_0x16889f){return new BPromise(function(_0x37af7b,_0x3de0b5){var _0x1a82d7={'QueuePause':function(_0x6f5d1){return new Promise(function(_0x1ab23b,_0x45699a){var _0x404772=util['format'](_0xd004('0x8'),'SIP',_0x6f5d1[_0xd004('0x9')]);if(_0x2392aa[_0xd004('0xa')]&&_0x2392aa[_0xd004('0xa')][_0x404772]&&_0x2392aa['timers'][_0x404772][_0xd004('0xb')]){_0x2392aa[_0xd004('0xa')][_0x404772][_0xd004('0xc')]();}if(_0x2392aa[_0xd004('0xd')][_0x404772]){_0x2392aa[_0xd004('0xd')][_0x404772]['updateStatusRealtime']({'statePause':_0x6f5d1['pause']?!![]:![]});}_0x1ab23b({'code':0xc8,'message':_0xd004('0xe')});});},'Reload':function(_0x1149b8){var _0x55e5c2=this;return new Promise(function(_0x127292,_0x465c05){if(ami['isConnected']()==![]){return _0x465c05(_0x55e5c2['error'](0x1f4,[config[_0xd004('0xf')]['ip'],config[_0xd004('0xf')][_0xd004('0x10')],'ami\x20disconnected'][_0xd004('0x11')]('\x20')));}_0x1149b8=_[_0xd004('0x12')](_0x1149b8,_['keys'](properties[_0xd004('0x13')]));_0x1149b8[_0xd004('0x14')]=_0xd004('0x15');return ami[_0xd004('0x16')](_0x1149b8)[_0xd004('0x17')](function(_0x117c3e){_0x127292({'code':0xc8,'message':_0x117c3e[_0xd004('0x18')]});})[_0xd004('0x19')](function(_0x2581f2){_0x465c05(_0x55e5c2[_0xd004('0x1a')](0x1f5,_0x2581f2['message']));});});},'Command':function(_0x1a1283){var _0x389d63=this;return new Promise(function(_0x4cfa64,_0x477ec1){if(ami[_0xd004('0x1b')]()==![]){return _0x477ec1(_0x389d63['error'](0x1f4,[config[_0xd004('0xf')]['ip'],config[_0xd004('0xf')]['username'],_0xd004('0x1c')][_0xd004('0x11')]('\x20')));}_0x1a1283=_[_0xd004('0x12')](_0x1a1283,_0xd004('0x1d'));_0x1a1283['action']='Command';return ami[_0xd004('0x16')](_0x1a1283)['then'](function(_0x6e0a0e){_0x4cfa64({'code':0xc8,'message':_0x6e0a0e[_0xd004('0x1e')]});})[_0xd004('0x19')](function(_0x146ea5){_0x477ec1(_0x389d63[_0xd004('0x1a')](0x1f5,_0x146ea5['message']));});});},'VoiceQueues':function(_0x3cb7d6){return new Promise(function(_0x15b001,_0x170b97){var _0x4a1b43=[];for(var _0x16d5b6 in _0x2392aa[_0xd004('0x1f')]){if(_0x2392aa['voiceQueues']['hasOwnProperty'](_0x16d5b6)){var _0x1388c1=_0x2392aa['voiceQueues'][_0x16d5b6];var _0x2a8572={'id':_0x1388c1['id'],'name':_0x1388c1[_0xd004('0x9')],'strategy':_0x1388c1['strategy'],'answered':_0x1388c1[_0xd004('0x20')],'available':_0x1388c1[_0xd004('0x21')],'loggedIn':_0x1388c1[_0xd004('0x22')],'pTalking':_0x1388c1[_0xd004('0x23')],'sumBillable':_0x1388c1[_0xd004('0x24')],'sumDuration':_0x1388c1['sumDuration'],'sumHoldTime':_0x1388c1[_0xd004('0x25')]||0x0,'talking':_0x1388c1['talking'],'total':_0x1388c1[_0xd004('0x26')],'type':_0x1388c1[_0xd004('0x27')],'unmanaged':_0x1388c1[_0xd004('0x28')],'abandoned':_0x1388c1[_0xd004('0x29')],'waiting':_0x1388c1[_0xd004('0x2a')],'loggedInDb':_0x1388c1[_0xd004('0x2b')]};if(_0x1388c1[_0xd004('0x27')]==='outbound'){_0x2a8572[_0xd004('0x2c')]=_0x1388c1[_0xd004('0x2c')];_0x2a8572[_0xd004('0x2d')]=_0x1388c1[_0xd004('0x2d')];_0x2a8572['dialOriginateCallerIdName']=_0x1388c1['dialOriginateCallerIdName'];_0x2a8572['dialOriginateCallerIdNumber']=_0x1388c1[_0xd004('0x2e')];_0x2a8572[_0xd004('0x2f')]=_0x1388c1[_0xd004('0x2f')];_0x2a8572[_0xd004('0x30')]=_0x1388c1[_0xd004('0x30')];_0x2a8572[_0xd004('0x31')]=_0x1388c1[_0xd004('0x31')];_0x2a8572['outboundAnswerCallsDay']=_0x1388c1[_0xd004('0x32')];_0x2a8572[_0xd004('0x33')]=_0x1388c1[_0xd004('0x33')];_0x2a8572[_0xd004('0x34')]=_0x1388c1[_0xd004('0x34')];_0x2a8572[_0xd004('0x35')]=_0x1388c1[_0xd004('0x35')];_0x2a8572[_0xd004('0x36')]=_0x1388c1['outboundDropCallsDayACS'];_0x2a8572[_0xd004('0x37')]=_0x1388c1[_0xd004('0x37')];_0x2a8572[_0xd004('0x38')]=_0x1388c1[_0xd004('0x38')];_0x2a8572[_0xd004('0x39')]=_0x1388c1[_0xd004('0x39')];_0x2a8572[_0xd004('0x3a')]=_0x1388c1[_0xd004('0x3a')];_0x2a8572['outboundOriginateFailureCallsDay']=_0x1388c1[_0xd004('0x3b')];_0x2a8572[_0xd004('0x3c')]=_0x1388c1[_0xd004('0x3c')];_0x2a8572['outboundRejectCallsDay']=_0x1388c1['outboundRejectCallsDay'];_0x2a8572['outboundUnknownCallsDay']=_0x1388c1[_0xd004('0x3d')];_0x2a8572['predictiveIntervalAnsweredCalls']=_0x1388c1[_0xd004('0x3e')];_0x2a8572[_0xd004('0x3f')]=_0x1388c1['predictiveIntervalAvgHoldtime'];_0x2a8572[_0xd004('0x40')]=_0x1388c1[_0xd004('0x40')];_0x2a8572[_0xd004('0x41')]=_0x1388c1['predictiveIntervalDroppedCallsCallersExit'];_0x2a8572[_0xd004('0x42')]=_0x1388c1[_0xd004('0x42')];_0x2a8572[_0xd004('0x43')]=_0x1388c1[_0xd004('0x43')];_0x2a8572[_0xd004('0x44')]=_0x1388c1['predictiveIntervalErlangCallsDroppedCalls'];_0x2a8572[_0xd004('0x45')]=_0x1388c1[_0xd004('0x45')];_0x2a8572[_0xd004('0x46')]=_0x1388c1['predictiveIntervalMultiplicativeFactor'];_0x2a8572[_0xd004('0x47')]=_0x1388c1[_0xd004('0x47')];_0x2a8572[_0xd004('0x48')]=_0x1388c1[_0xd004('0x48')];_0x2a8572[_0xd004('0x49')]=_0x1388c1[_0xd004('0x49')];_0x2a8572[_0xd004('0x18')]=_0x1388c1['message'];_0x2a8572[_0xd004('0x4a')]=_0x1388c1[_0xd004('0x4a')];_0x2a8572[_0xd004('0x4b')]=_0x1388c1[_0xd004('0x4b')];_0x2a8572[_0xd004('0x4c')]=_0x1388c1[_0xd004('0x4c')];_0x2a8572[_0xd004('0x4d')]=_0x1388c1['erlangAbandonmentRate'];_0x2a8572[_0xd004('0x4e')]=_0x1388c1[_0xd004('0x4e')];_0x2a8572[_0xd004('0x4f')]=_0x1388c1['startPredictive'];_0x2a8572[_0xd004('0x50')]=_0x1388c1[_0xd004('0x50')];}if(_0x1388c1[_0xd004('0x51')]){_0x2a8572[_0xd004('0x51')]={'id':_0x1388c1[_0xd004('0x51')]['id'],'name':_0x1388c1[_0xd004('0x51')][_0xd004('0x9')],'active':_0x1388c1['Trunk'][_0xd004('0x52')],'callerid':_0x1388c1['Trunk'][_0xd004('0x53')]};}if(_0x1388c1[_0xd004('0x54')]){_0x2a8572[_0xd004('0x54')]={'id':_0x1388c1[_0xd004('0x54')]['id'],'name':_0x1388c1[_0xd004('0x54')]['name']};}_0x4a1b43[_0xd004('0x55')](_0x2a8572);}}_0x15b001({'count':_0x4a1b43[_0xd004('0x56')],'rows':_0x4a1b43});});},'VoiceChannels':function(_0x58ee0a){return new Promise(function(_0x2678db,_0x210ebc){var _0x3bc093=_[_0xd004('0x57')](_0x2392aa[_0xd004('0x58')]);_0x2678db({'count':_0x3bc093[_0xd004('0x56')],'rows':_0x3bc093});});},'VoiceChannelMixMonitor':function(_0x54cfaa){var _0x1277f4=this;return new Promise(function(_0x103f0d,_0x532d6d){if(ami[_0xd004('0x1b')]()==![]){return _0x532d6d(_0x1277f4[_0xd004('0x1a')](0x1f4,[config['asterisk']['ip'],config[_0xd004('0xf')][_0xd004('0x10')],_0xd004('0x1c')]['join']('\x20')));}var _0x32b6d2=schema(properties[_0xd004('0x59')])['validate'](_0x54cfaa);if(_0x32b6d2['length']>0x0){return _0x532d6d(_0x1277f4[_0xd004('0x1a')](0x1f4,_[_0xd004('0x5a')](_0x32b6d2,_0xd004('0x18'))['join'](',\x20')));}var _0x858974=_[_0xd004('0x5b')](_0x2392aa[_0xd004('0x58')],{'uniqueid':_0x54cfaa[_0xd004('0x5c')]});if(_0x858974&&_0x858974[_0xd004('0x5d')]){var _0x2ebcfb=util[_0xd004('0x5e')](_0xd004('0x5f'),_0x54cfaa[_0xd004('0x60')]||_0x54cfaa[_0xd004('0x5c')],_0x54cfaa[_0xd004('0x5e')]||_0xd004('0x61'));return ami[_0xd004('0x16')]({'action':_0xd004('0x62'),'channel':_0x858974[_0xd004('0x5d')],'file':_0x2ebcfb,'options':_0xd004('0x63')})['then'](function(_0x2fdb4f){var _0x318a81=_[_0xd004('0x5b')](_0x858974[_0xd004('0x64')],{'filename':_0xd004('0x65')+_0x2ebcfb[_0xd004('0x66')]()});if(_[_0xd004('0x67')](_0x318a81)){_0x858974[_0xd004('0x64')]['push']({'filename':_0xd004('0x65')+_0x2ebcfb['toLowerCase'](),'createdAt':moment()[_0xd004('0x5e')](_0xd004('0x68')),'mixmonitorid':_0x2fdb4f['mixmonitorid'],'status':_0xd004('0x69')});}else{_0x318a81[_0xd004('0x6a')]=_0x2fdb4f['mixmonitorid'];_0x318a81[_0xd004('0x6b')]='rec';}_0x103f0d({'code':0xc8,'message':[_0x54cfaa['uniqueid'],_0xd004('0x6c'),_0x2fdb4f['mixmonitorid']]['join']('\x20'),'mixmonitorid':_0x2fdb4f[_0xd004('0x6a')]});})[_0xd004('0x19')](function(_0x411da4){_0x532d6d(_0x1277f4['error'](0x1f5,[_0x54cfaa['uniqueid'],_0x411da4[_0xd004('0x18')][_0xd004('0x66')]()][_0xd004('0x11')]('\x20')));});}else{return _0x532d6d(_0x1277f4['error'](0x1f5,_0xd004('0x6d')));}});},'VoiceChannelStopMixMonitor':function(_0x196a3e){var _0x497298=this;return new Promise(function(_0x441fd2,_0x3bde5f){if(ami['isConnected']()==![]){return _0x3bde5f(_0x497298[_0xd004('0x1a')](0x1f4,[config[_0xd004('0xf')]['ip'],config[_0xd004('0xf')][_0xd004('0x10')],_0xd004('0x1c')][_0xd004('0x11')]('\x20')));}var _0x270e01=schema(properties[_0xd004('0x59')])[_0xd004('0x6e')](_0x196a3e);if(_0x270e01[_0xd004('0x56')]>0x0){return _0x3bde5f(_0x497298[_0xd004('0x1a')](0x1f4,_[_0xd004('0x5a')](_0x270e01,_0xd004('0x18'))[_0xd004('0x11')](',\x20')));}var _0x30d466=_[_0xd004('0x5b')](_0x2392aa['channels'],{'uniqueid':_0x196a3e[_0xd004('0x5c')]});if(_0x30d466){return BPromise[_0xd004('0x6f')]()['then'](function(){if(_0x30d466[_0xd004('0x5d')]){return ami[_0xd004('0x16')]({'action':_0xd004('0x70'),'channel':_0x30d466[_0xd004('0x5d')],'mixmonitorid':_0x196a3e[_0xd004('0x6a')]})['catch'](function(_0xda957d){});}})[_0xd004('0x17')](function(){if(_0x30d466[_0xd004('0x71')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x30d466[_0xd004('0x71')],'mixmonitorid':_0x196a3e[_0xd004('0x6a')]})[_0xd004('0x19')](function(_0xcf203a){});}})['then'](function(_0x2d5b2b){var _0x29fabf=_['find'](_0x30d466['monitors'],{'mixmonitorid':_0x196a3e[_0xd004('0x6a')]});if(_0x29fabf){_0x29fabf[_0xd004('0x6b')]=_0xd004('0x72');}})[_0xd004('0x17')](function(){var _0xbdf40f=util[_0xd004('0x5e')](_0xd004('0x5f'),_0x196a3e[_0xd004('0x60')]||_0x196a3e[_0xd004('0x5c')],_0x196a3e[_0xd004('0x5e')]||_0xd004('0x61'));var _0x1a6459=_['find'](_0x30d466[_0xd004('0x64')],{'filename':'/var/spool/asterisk/monitor/'+_0xbdf40f[_0xd004('0x66')]()});if(_0x1a6459){_0x1a6459[_0xd004('0x6b')]=_0xd004('0x72');}})[_0xd004('0x17')](function(){_0x441fd2({'code':0xc8,'message':[_0x196a3e['uniqueid'],_0xd004('0x73')][_0xd004('0x11')]('\x20')});})['catch'](function(_0x5e2bfc){_0x3bde5f(_0x497298[_0xd004('0x1a')](0x1f5,[_0x196a3e[_0xd004('0x5c')],_0x5e2bfc[_0xd004('0x18')][_0xd004('0x66')]()][_0xd004('0x11')]('\x20')));});}else{return _0x3bde5f(_0x497298['error'](0x1f5,_0xd004('0x6d')));}});},'VoiceQueuesChannels':function(_0x14fb8b){return new Promise(function(_0x554fa3,_0x5a760d){var _0x53cd84=_['values'](_0x2392aa[_0xd004('0x74')]);_0x554fa3({'count':_0x53cd84['length'],'rows':_0x53cd84});});},'VoiceQueuesChannel':function(_0x4d7662){var _0x3bbbb8=this;return new Promise(function(_0x4e44cb,_0xb50ea4){var _0x5964ed=schema(properties[_0xd004('0x75')])[_0xd004('0x6e')](_0x4d7662);if(_0x5964ed['length']>0x0){return _0xb50ea4(_0x3bbbb8['error'](0x1f4,_['map'](_0x5964ed,'message')['join'](',\x20')));}var _0x1fac56=_[_0xd004('0x5b')](_0x2392aa[_0xd004('0x74')],{'uniqueid':_0x4d7662[_0xd004('0x5c')]});if(_0x1fac56){_0x4e44cb(_0x1fac56);}else{return _0xb50ea4(_0x3bbbb8['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x540862){var _0x37df78=this;return new Promise(function(_0x3e1f18,_0x5b15e5){if(ami[_0xd004('0x1b')]()==![]){return _0x5b15e5(_0x37df78[_0xd004('0x1a')](0x1f4,[config[_0xd004('0xf')]['ip'],config[_0xd004('0xf')][_0xd004('0x10')],_0xd004('0x1c')][_0xd004('0x11')]('\x20')));}var _0x6db25d=schema(properties[_0xd004('0x76')])[_0xd004('0x6e')](_0x540862);if(_0x6db25d[_0xd004('0x56')]>0x0){return _0x5b15e5(_0x37df78[_0xd004('0x1a')](0x1f4,_['map'](_0x6db25d,'message')[_0xd004('0x11')](',\x20')));}var _0x207772=_[_0xd004('0x5b')](_0x2392aa[_0xd004('0x74')],{'uniqueid':_0x540862['uniqueid']});if(_0x207772&&_0x207772[_0xd004('0x5d')]){return ami[_0xd004('0x16')]({'action':_0xd004('0x77'),'channel':_0x207772[_0xd004('0x5d')]})[_0xd004('0x17')](function(_0x31ed47){_0x3e1f18({'code':0xc8,'message':[_0x540862[_0xd004('0x5c')],_0x31ed47[_0xd004('0x18')][_0xd004('0x66')]()]['join']('\x20')});})[_0xd004('0x19')](function(_0x5a61fd){_0x5b15e5(_0x37df78['error'](0x1f5,[_0x540862['uniqueid'],_0x5a61fd[_0xd004('0x18')][_0xd004('0x66')]()][_0xd004('0x11')]('\x20')));});}else{return _0x5b15e5(_0x37df78['error'](0x1f5,_0xd004('0x6d')));}});},'VoiceQueuesChannelRedirect':function(_0x2111e0){var _0x52dece=this;return new Promise(function(_0x448267,_0x16ef2f){if(ami['isConnected']()==![]){return _0x16ef2f(_0x52dece[_0xd004('0x1a')](0x1f4,[config[_0xd004('0xf')]['ip'],config[_0xd004('0xf')][_0xd004('0x10')],_0xd004('0x1c')][_0xd004('0x11')]('\x20')));}var _0x2cdfca=schema(properties[_0xd004('0x78')])[_0xd004('0x6e')](_0x2111e0);if(_0x2cdfca['length']>0x0){return _0x16ef2f(_0x52dece[_0xd004('0x1a')](0x1f4,_['map'](_0x2cdfca,_0xd004('0x18'))[_0xd004('0x11')](',\x20')));}var _0x2845b6=_[_0xd004('0x5b')](_0x2392aa['queueChannels'],{'uniqueid':_0x2111e0[_0xd004('0x5c')]});if(_0x2845b6&&_0x2845b6[_0xd004('0x5d')]){return ami[_0xd004('0x16')]({'action':_0xd004('0x79'),'channel':_0x2845b6[_0xd004('0x5d')],'exten':_0x2111e0['exten'],'context':_0x2111e0['context']||_0x2845b6[_0xd004('0x7a')],'priority':0x1})[_0xd004('0x17')](function(_0x3a6220){_0x448267({'code':0xc8,'message':[_0x2111e0[_0xd004('0x5c')],_0x3a6220[_0xd004('0x18')]['toLowerCase']()][_0xd004('0x11')]('\x20')});})[_0xd004('0x19')](function(_0x440e56){_0x16ef2f(_0x52dece[_0xd004('0x1a')](0x1f5,[_0x2111e0[_0xd004('0x5c')],_0x440e56['message'][_0xd004('0x66')]()]['join']('\x20')));});}else{return _0x16ef2f(_0x52dece[_0xd004('0x1a')](0x1f5,_0xd004('0x6d')));}});},'Agents':function(_0xce1586){return new Promise(function(_0x340e12,_0x4deb12){var _0x155cc4=_[_0xd004('0x57')](_0x2392aa[_0xd004('0xd')]);_0x340e12({'count':_0x155cc4[_0xd004('0x56')],'rows':_0x155cc4});});},'Telephones':function(_0xd081c3){return new Promise(function(_0x565a2a,_0x251842){var _0x41f27e=_['values'](_0x2392aa['telephones']);_0x565a2a({'count':_0x41f27e['length'],'rows':_0x41f27e});});},'Trunks':function(_0x3a9092){return new Promise(function(_0x502689,_0x669116){var _0x179b44=_[_0xd004('0x57')](_0x2392aa[_0xd004('0x7b')]);_0x502689({'count':_0x179b44[_0xd004('0x56')],'rows':_0x179b44});});},'OutboundChannels':function(_0x518b15){return new Promise(function(_0x1c03f5,_0x49ad23){var _0x20ef52=_[_0xd004('0x57')](_0x2392aa['outboundChannels']);_0x1c03f5({'count':_0x20ef52[_0xd004('0x56')],'rows':_0x20ef52});});},'Outbound':function(_0xf1896b){return new Promise(function(_0x5dd76d,_0x24f0be){_0x5dd76d(_0x2392aa[_0xd004('0x7c')]);});},'Campaigns':function(_0x1d6cb5){return new Promise(function(_0x33f8bf,_0x3b0770){var _0x575453=_[_0xd004('0x57')](_0x2392aa['campaigns']);_0x33f8bf({'count':_0x575453['length'],'rows':_0x575453});});},'VoiceQueuesPreview':function(_0x25fe01){var _0x235800=this;return new Promise(function(_0x37975a,_0x52e73f){_0x15ba36[_0xd004('0x7d')](_0x25fe01['id'])[_0xd004('0x17')](function(_0x9cccfa){_0x37975a({'code':0xc8,'message':_0x9cccfa['message']});})[_0xd004('0x19')](function(_0x334024){_0x52e73f(_0x235800[_0xd004('0x1a')](0x1f4,_0x334024['message']));});});},'EventManager':function(_0x235307){var _0x5b03dd=this;return new Promise(function(_0x328daa,_0x199d1f){if(!_0x235307[_0xd004('0x7e')]){return _0x199d1f(_0x5b03dd['error'](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xd004('0x7f')](_0xd004('0x80')+_0x235307[_0xd004('0x7e')],_0x235307[_0xd004('0x18')]);_0x328daa({'code':0xc8,'message':_0x235307});});},'FaxAccounts':function(_0x431ec0){return new Promise(function(_0x1cc64f,_0x328f12){var _0x1c5478=_[_0xd004('0x57')](_0x2392aa[_0xd004('0x81')]);_0x1cc64f({'count':_0x1c5478[_0xd004('0x56')],'rows':_0x1c5478});});},'SendFax':function(_0x1d2769){var _0x370f64=this;return new Promise(function(_0x5516a1,_0x33f305){_0x16889f['send'](_0x1d2769)[_0xd004('0x17')](function(_0x267cd4){_0x5516a1({'code':0xc8,'message':_0x267cd4[_0xd004('0x18')]});})['catch'](function(_0x2b555d){_0x33f305(_0x370f64[_0xd004('0x1a')](0x1f4,_0x2b555d[_0xd004('0x18')]));});});},'CheckAfterSend':function(_0x114739){var _0x3ef293=this;return new Promise(function(_0x5e900d,_0x9ca988){_0x16889f['checkAfterSend'](_0x114739)[_0xd004('0x17')](function(_0x463fac){_0x5e900d({'code':0xc8,'message':_0x463fac[_0xd004('0x18')]});})[_0xd004('0x19')](function(_0x4d7348){_0x9ca988(_0x3ef293[_0xd004('0x1a')](0x1f4,_0x4d7348[_0xd004('0x18')]));});});}};var _0x345066=jayson[_0xd004('0x82')](_0x1a82d7)[_0xd004('0x83')]();_0x345066['on']('error',function(_0x2c6861){return _0x3de0b5(_0x2c6861);});_0x345066[_0xd004('0x7')](0x232a,_0xd004('0x84'),function(){console[_0xd004('0x85')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x37af7b(_0xd004('0x86')+0x232a);});});};
\ No newline at end of file
+var _0xb0d4=['monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','voicechannel','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','outbound','campaigns','run','Event\x20name\x20mandatory','emit','event','checkAfterSend','server','http','listen','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','validate','bluebird','moment','../../../config/environment','../properties','../ami','format','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','ami\x20disconnected','join','keys','module','action','Reload','Action','then','message','error','username','pick','command','Command','catch','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumHoldTime','talking','unmanaged','abandoned','waiting','type','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','push','values','channels','length','map','find','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)'];(function(_0x48f1db,_0x554c57){var _0x27de48=function(_0x3cd347){while(--_0x3cd347){_0x48f1db['push'](_0x48f1db['shift']());}};_0x27de48(++_0x554c57);}(_0xb0d4,0x1ba));var _0x4b0d=function(_0x2d48a2,_0x34ffa6){_0x2d48a2=_0x2d48a2-0x0;var _0x2ba1cb=_0xb0d4[_0x2d48a2];return _0x2ba1cb;};'use strict';var _=require(_0x4b0d('0x0'));var util=require(_0x4b0d('0x1'));var jayson=require('jayson/promise');var schema=require(_0x4b0d('0x2'));var BPromise=require(_0x4b0d('0x3'));var moment=require(_0x4b0d('0x4'));var config=require(_0x4b0d('0x5'));var properties=require(_0x4b0d('0x6'));var ami=require(_0x4b0d('0x7'));exports['listen']=function(_0xd9e767,_0x49eb9f,_0x49ab42){return new BPromise(function(_0x57186c,_0x368fb5){var _0x10977e={'QueuePause':function(_0x15a0ea){return new Promise(function(_0x4efef1,_0xbc67f7){var _0x6ba00=util[_0x4b0d('0x8')]('%s/%s','SIP',_0x15a0ea[_0x4b0d('0x9')]);if(_0xd9e767[_0x4b0d('0xa')]&&_0xd9e767[_0x4b0d('0xa')][_0x6ba00]&&_0xd9e767[_0x4b0d('0xa')][_0x6ba00][_0x4b0d('0xb')]){_0xd9e767[_0x4b0d('0xa')][_0x6ba00][_0x4b0d('0xc')]();}if(_0xd9e767[_0x4b0d('0xd')][_0x6ba00]){_0xd9e767[_0x4b0d('0xd')][_0x6ba00][_0x4b0d('0xe')]({'statePause':_0x15a0ea[_0x4b0d('0xf')]?!![]:![]});}_0x4efef1({'code':0xc8,'message':_0x4b0d('0x10')});});},'Reload':function(_0x4314c0){var _0x31044c=this;return new Promise(function(_0xf60338,_0x355595){if(ami[_0x4b0d('0x11')]()==![]){return _0x355595(_0x31044c['error'](0x1f4,[config[_0x4b0d('0x12')]['ip'],config[_0x4b0d('0x12')]['username'],_0x4b0d('0x13')][_0x4b0d('0x14')]('\x20')));}_0x4314c0=_['pick'](_0x4314c0,_[_0x4b0d('0x15')](properties[_0x4b0d('0x16')]));_0x4314c0[_0x4b0d('0x17')]=_0x4b0d('0x18');return ami[_0x4b0d('0x19')](_0x4314c0)[_0x4b0d('0x1a')](function(_0x293238){_0xf60338({'code':0xc8,'message':_0x293238[_0x4b0d('0x1b')]});})['catch'](function(_0x48deff){_0x355595(_0x31044c[_0x4b0d('0x1c')](0x1f5,_0x48deff[_0x4b0d('0x1b')]));});});},'Command':function(_0x370811){var _0xd35d20=this;return new Promise(function(_0x58d803,_0x4e5ae8){if(ami[_0x4b0d('0x11')]()==![]){return _0x4e5ae8(_0xd35d20[_0x4b0d('0x1c')](0x1f4,[config[_0x4b0d('0x12')]['ip'],config[_0x4b0d('0x12')][_0x4b0d('0x1d')],_0x4b0d('0x13')]['join']('\x20')));}_0x370811=_[_0x4b0d('0x1e')](_0x370811,_0x4b0d('0x1f'));_0x370811['action']=_0x4b0d('0x20');return ami[_0x4b0d('0x19')](_0x370811)[_0x4b0d('0x1a')](function(_0x2513d4){_0x58d803({'code':0xc8,'message':_0x2513d4['content']});})[_0x4b0d('0x21')](function(_0x5f18c6){_0x4e5ae8(_0xd35d20[_0x4b0d('0x1c')](0x1f5,_0x5f18c6[_0x4b0d('0x1b')]));});});},'VoiceQueues':function(_0x100b6d){return new Promise(function(_0x9bc6b0,_0x2d9a08){var _0x9a9415=[];for(var _0x4ebaf2 in _0xd9e767[_0x4b0d('0x22')]){if(_0xd9e767[_0x4b0d('0x22')][_0x4b0d('0x23')](_0x4ebaf2)){var _0xe4059d=_0xd9e767[_0x4b0d('0x22')][_0x4ebaf2];var _0x2b8b66={'id':_0xe4059d['id'],'name':_0xe4059d['name'],'strategy':_0xe4059d[_0x4b0d('0x24')],'answered':_0xe4059d[_0x4b0d('0x25')],'available':_0xe4059d[_0x4b0d('0x26')],'loggedIn':_0xe4059d[_0x4b0d('0x27')],'pTalking':_0xe4059d[_0x4b0d('0x28')],'sumBillable':_0xe4059d['sumBillable'],'sumDuration':_0xe4059d['sumDuration'],'sumHoldTime':_0xe4059d[_0x4b0d('0x29')]||0x0,'talking':_0xe4059d[_0x4b0d('0x2a')],'total':_0xe4059d['total'],'type':_0xe4059d['type'],'unmanaged':_0xe4059d[_0x4b0d('0x2b')],'abandoned':_0xe4059d[_0x4b0d('0x2c')],'waiting':_0xe4059d[_0x4b0d('0x2d')],'loggedInDb':_0xe4059d['loggedInDb']};if(_0xe4059d[_0x4b0d('0x2e')]==='outbound'){_0x2b8b66[_0x4b0d('0x2f')]=_0xe4059d[_0x4b0d('0x2f')];_0x2b8b66[_0x4b0d('0x30')]=_0xe4059d['dialMethod'];_0x2b8b66[_0x4b0d('0x31')]=_0xe4059d['dialOriginateCallerIdName'];_0x2b8b66[_0x4b0d('0x32')]=_0xe4059d[_0x4b0d('0x32')];_0x2b8b66[_0x4b0d('0x33')]=_0xe4059d[_0x4b0d('0x33')];_0x2b8b66[_0x4b0d('0x34')]=_0xe4059d[_0x4b0d('0x34')];_0x2b8b66[_0x4b0d('0x35')]=_0xe4059d[_0x4b0d('0x35')];_0x2b8b66[_0x4b0d('0x36')]=_0xe4059d[_0x4b0d('0x36')];_0x2b8b66[_0x4b0d('0x37')]=_0xe4059d[_0x4b0d('0x37')];_0x2b8b66[_0x4b0d('0x38')]=_0xe4059d['outboundBusyCallsDay'];_0x2b8b66['outboundCongestionCallsDay']=_0xe4059d[_0x4b0d('0x39')];_0x2b8b66[_0x4b0d('0x3a')]=_0xe4059d['outboundDropCallsDayACS'];_0x2b8b66[_0x4b0d('0x3b')]=_0xe4059d['outboundDropCallsDayCallersExit'];_0x2b8b66['outboundDropCallsDayTimeout']=_0xe4059d[_0x4b0d('0x3c')];_0x2b8b66[_0x4b0d('0x3d')]=_0xe4059d[_0x4b0d('0x3d')];_0x2b8b66[_0x4b0d('0x3e')]=_0xe4059d[_0x4b0d('0x3e')];_0x2b8b66[_0x4b0d('0x3f')]=_0xe4059d[_0x4b0d('0x3f')];_0x2b8b66[_0x4b0d('0x40')]=_0xe4059d[_0x4b0d('0x40')];_0x2b8b66[_0x4b0d('0x41')]=_0xe4059d['outboundRejectCallsDay'];_0x2b8b66['outboundUnknownCallsDay']=_0xe4059d[_0x4b0d('0x42')];_0x2b8b66['predictiveIntervalAnsweredCalls']=_0xe4059d[_0x4b0d('0x43')];_0x2b8b66['predictiveIntervalAvgHoldtime']=_0xe4059d[_0x4b0d('0x44')];_0x2b8b66[_0x4b0d('0x45')]=_0xe4059d[_0x4b0d('0x45')];_0x2b8b66[_0x4b0d('0x46')]=_0xe4059d['predictiveIntervalDroppedCallsCallersExit'];_0x2b8b66['predictiveIntervalDroppedCallsTimeout']=_0xe4059d[_0x4b0d('0x47')];_0x2b8b66[_0x4b0d('0x48')]=_0xe4059d[_0x4b0d('0x48')];_0x2b8b66[_0x4b0d('0x49')]=_0xe4059d['predictiveIntervalErlangCallsDroppedCalls'];_0x2b8b66[_0x4b0d('0x4a')]=_0xe4059d[_0x4b0d('0x4a')];_0x2b8b66[_0x4b0d('0x4b')]=_0xe4059d[_0x4b0d('0x4b')];_0x2b8b66[_0x4b0d('0x4c')]=_0xe4059d[_0x4b0d('0x4c')];_0x2b8b66[_0x4b0d('0x4d')]=_0xe4059d[_0x4b0d('0x4d')];_0x2b8b66['predictiveIntervalTotalCalls']=_0xe4059d[_0x4b0d('0x4e')];_0x2b8b66[_0x4b0d('0x1b')]=_0xe4059d[_0x4b0d('0x1b')];_0x2b8b66[_0x4b0d('0x4f')]=_0xe4059d[_0x4b0d('0x4f')];_0x2b8b66[_0x4b0d('0x50')]=_0xe4059d[_0x4b0d('0x50')];_0x2b8b66[_0x4b0d('0x51')]=_0xe4059d[_0x4b0d('0x51')];_0x2b8b66[_0x4b0d('0x52')]=_0xe4059d[_0x4b0d('0x52')];_0x2b8b66[_0x4b0d('0x53')]=_0xe4059d[_0x4b0d('0x53')];_0x2b8b66[_0x4b0d('0x54')]=_0xe4059d['startPredictive'];_0x2b8b66['startProgressive']=_0xe4059d['startProgressive'];}if(_0xe4059d['Trunk']){_0x2b8b66[_0x4b0d('0x55')]={'id':_0xe4059d['Trunk']['id'],'name':_0xe4059d[_0x4b0d('0x55')][_0x4b0d('0x9')],'active':_0xe4059d[_0x4b0d('0x55')][_0x4b0d('0x56')],'callerid':_0xe4059d[_0x4b0d('0x55')][_0x4b0d('0x57')]};}if(_0xe4059d[_0x4b0d('0x58')]){_0x2b8b66[_0x4b0d('0x58')]={'id':_0xe4059d['Interval']['id'],'name':_0xe4059d[_0x4b0d('0x58')][_0x4b0d('0x9')]};}_0x9a9415[_0x4b0d('0x59')](_0x2b8b66);}}_0x9bc6b0({'count':_0x9a9415['length'],'rows':_0x9a9415});});},'VoiceChannels':function(_0x186b7e){return new Promise(function(_0x2e71b9,_0x50f422){var _0x2b8e15=_[_0x4b0d('0x5a')](_0xd9e767[_0x4b0d('0x5b')]);_0x2e71b9({'count':_0x2b8e15[_0x4b0d('0x5c')],'rows':_0x2b8e15});});},'VoiceChannelMixMonitor':function(_0x6f4ab4){var _0x46cec1=this;return new Promise(function(_0x53e4c1,_0x353e98){if(ami['isConnected']()==![]){return _0x353e98(_0x46cec1['error'](0x1f4,[config['asterisk']['ip'],config[_0x4b0d('0x12')][_0x4b0d('0x1d')],'ami\x20disconnected'][_0x4b0d('0x14')]('\x20')));}var _0x424870=schema(properties['voicechannel'])['validate'](_0x6f4ab4);if(_0x424870[_0x4b0d('0x5c')]>0x0){return _0x353e98(_0x46cec1['error'](0x1f4,_[_0x4b0d('0x5d')](_0x424870,_0x4b0d('0x1b'))[_0x4b0d('0x14')](',\x20')));}var _0x2be2bb=_[_0x4b0d('0x5e')](_0xd9e767[_0x4b0d('0x5b')],{'uniqueid':_0x6f4ab4[_0x4b0d('0x5f')]});if(_0x2be2bb&&_0x2be2bb[_0x4b0d('0x60')]){var _0x437f3d=util[_0x4b0d('0x8')](_0x4b0d('0x61'),_0x6f4ab4[_0x4b0d('0x62')]||_0x6f4ab4[_0x4b0d('0x5f')],_0x6f4ab4[_0x4b0d('0x8')]||_0x4b0d('0x63'));return ami[_0x4b0d('0x19')]({'action':_0x4b0d('0x64'),'channel':_0x2be2bb[_0x4b0d('0x60')],'file':_0x437f3d,'options':_0x4b0d('0x65')})[_0x4b0d('0x1a')](function(_0x170fc5){var _0x5d24d0=_[_0x4b0d('0x5e')](_0x2be2bb[_0x4b0d('0x66')],{'filename':_0x4b0d('0x67')+_0x437f3d[_0x4b0d('0x68')]()});if(_[_0x4b0d('0x69')](_0x5d24d0)){_0x2be2bb[_0x4b0d('0x66')][_0x4b0d('0x59')]({'filename':'/var/spool/asterisk/monitor/'+_0x437f3d[_0x4b0d('0x68')](),'createdAt':moment()[_0x4b0d('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x170fc5[_0x4b0d('0x6a')],'status':_0x4b0d('0x6b')});}else{_0x5d24d0[_0x4b0d('0x6a')]=_0x170fc5['mixmonitorid'];_0x5d24d0[_0x4b0d('0x6c')]=_0x4b0d('0x6b');}_0x53e4c1({'code':0xc8,'message':[_0x6f4ab4['uniqueid'],'MixMonitor\x20Success',_0x170fc5['mixmonitorid']][_0x4b0d('0x14')]('\x20'),'mixmonitorid':_0x170fc5[_0x4b0d('0x6a')]});})[_0x4b0d('0x21')](function(_0x405718){_0x353e98(_0x46cec1['error'](0x1f5,[_0x6f4ab4[_0x4b0d('0x5f')],_0x405718['message'][_0x4b0d('0x68')]()][_0x4b0d('0x14')]('\x20')));});}else{return _0x353e98(_0x46cec1[_0x4b0d('0x1c')](0x1f5,_0x4b0d('0x6d')));}});},'VoiceChannelStopMixMonitor':function(_0x189ccb){var _0x3d9b43=this;return new Promise(function(_0x5a6301,_0x308afe){if(ami[_0x4b0d('0x11')]()==![]){return _0x308afe(_0x3d9b43[_0x4b0d('0x1c')](0x1f4,[config['asterisk']['ip'],config[_0x4b0d('0x12')][_0x4b0d('0x1d')],'ami\x20disconnected']['join']('\x20')));}var _0x451213=schema(properties[_0x4b0d('0x6e')])[_0x4b0d('0x2')](_0x189ccb);if(_0x451213[_0x4b0d('0x5c')]>0x0){return _0x308afe(_0x3d9b43[_0x4b0d('0x1c')](0x1f4,_[_0x4b0d('0x5d')](_0x451213,_0x4b0d('0x1b'))[_0x4b0d('0x14')](',\x20')));}var _0x3af08a=_['find'](_0xd9e767['channels'],{'uniqueid':_0x189ccb[_0x4b0d('0x5f')]});if(_0x3af08a){return BPromise['resolve']()['then'](function(){if(_0x3af08a[_0x4b0d('0x60')]){return ami[_0x4b0d('0x19')]({'action':_0x4b0d('0x6f'),'channel':_0x3af08a[_0x4b0d('0x60')],'mixmonitorid':_0x189ccb['mixmonitorid']})[_0x4b0d('0x21')](function(_0x3037e8){});}})[_0x4b0d('0x1a')](function(){if(_0x3af08a[_0x4b0d('0x70')]){return ami[_0x4b0d('0x19')]({'action':_0x4b0d('0x6f'),'channel':_0x3af08a[_0x4b0d('0x70')],'mixmonitorid':_0x189ccb[_0x4b0d('0x6a')]})[_0x4b0d('0x21')](function(_0x19bf35){});}})['then'](function(_0x56d501){var _0x1ece7d=_[_0x4b0d('0x5e')](_0x3af08a[_0x4b0d('0x66')],{'mixmonitorid':_0x189ccb['mixmonitorid']});if(_0x1ece7d){_0x1ece7d[_0x4b0d('0x6c')]=_0x4b0d('0x71');}})[_0x4b0d('0x1a')](function(){var _0x5e00f5=util[_0x4b0d('0x8')](_0x4b0d('0x61'),_0x189ccb['filename']||_0x189ccb['uniqueid'],_0x189ccb[_0x4b0d('0x8')]||_0x4b0d('0x63'));var _0x464172=_[_0x4b0d('0x5e')](_0x3af08a[_0x4b0d('0x66')],{'filename':_0x4b0d('0x67')+_0x5e00f5[_0x4b0d('0x68')]()});if(_0x464172){_0x464172[_0x4b0d('0x6c')]='stop';}})[_0x4b0d('0x1a')](function(){_0x5a6301({'code':0xc8,'message':[_0x189ccb['uniqueid'],_0x4b0d('0x72')][_0x4b0d('0x14')]('\x20')});})[_0x4b0d('0x21')](function(_0x4c2901){_0x308afe(_0x3d9b43[_0x4b0d('0x1c')](0x1f5,[_0x189ccb[_0x4b0d('0x5f')],_0x4c2901[_0x4b0d('0x1b')][_0x4b0d('0x68')]()]['join']('\x20')));});}else{return _0x308afe(_0x3d9b43[_0x4b0d('0x1c')](0x1f5,_0x4b0d('0x6d')));}});},'VoiceQueuesChannels':function(_0x318cca){return new Promise(function(_0xc1a052,_0x4f18c2){var _0x5e31c8=_[_0x4b0d('0x5a')](_0xd9e767[_0x4b0d('0x73')]);_0xc1a052({'count':_0x5e31c8[_0x4b0d('0x5c')],'rows':_0x5e31c8});});},'VoiceQueuesChannel':function(_0x2916a8){var _0x317886=this;return new Promise(function(_0x4917fd,_0x58c9a6){var _0x3e7615=schema(properties['voicequeuechannel'])['validate'](_0x2916a8);if(_0x3e7615[_0x4b0d('0x5c')]>0x0){return _0x58c9a6(_0x317886['error'](0x1f4,_[_0x4b0d('0x5d')](_0x3e7615,_0x4b0d('0x1b'))['join'](',\x20')));}var _0x4be489=_['find'](_0xd9e767[_0x4b0d('0x73')],{'uniqueid':_0x2916a8[_0x4b0d('0x5f')]});if(_0x4be489){_0x4917fd(_0x4be489);}else{return _0x58c9a6(_0x317886['error'](0x1f5,_0x4b0d('0x6d')));}});},'VoiceQueuesChannelHangup':function(_0xf795b1){var _0x4ec1a2=this;return new Promise(function(_0x29f562,_0x5c142e){if(ami[_0x4b0d('0x11')]()==![]){return _0x5c142e(_0x4ec1a2[_0x4b0d('0x1c')](0x1f4,[config['asterisk']['ip'],config[_0x4b0d('0x12')][_0x4b0d('0x1d')],_0x4b0d('0x13')][_0x4b0d('0x14')]('\x20')));}var _0x515d6b=schema(properties['voicequeuechannelhangup'])['validate'](_0xf795b1);if(_0x515d6b[_0x4b0d('0x5c')]>0x0){return _0x5c142e(_0x4ec1a2[_0x4b0d('0x1c')](0x1f4,_[_0x4b0d('0x5d')](_0x515d6b,'message')[_0x4b0d('0x14')](',\x20')));}var _0x15c58d=_[_0x4b0d('0x5e')](_0xd9e767[_0x4b0d('0x73')],{'uniqueid':_0xf795b1[_0x4b0d('0x5f')]});if(_0x15c58d&&_0x15c58d[_0x4b0d('0x60')]){return ami[_0x4b0d('0x19')]({'action':'Hangup','channel':_0x15c58d['channel']})['then'](function(_0x4a271c){_0x29f562({'code':0xc8,'message':[_0xf795b1['uniqueid'],_0x4a271c['message'][_0x4b0d('0x68')]()][_0x4b0d('0x14')]('\x20')});})[_0x4b0d('0x21')](function(_0x3affe3){_0x5c142e(_0x4ec1a2[_0x4b0d('0x1c')](0x1f5,[_0xf795b1[_0x4b0d('0x5f')],_0x3affe3[_0x4b0d('0x1b')][_0x4b0d('0x68')]()][_0x4b0d('0x14')]('\x20')));});}else{return _0x5c142e(_0x4ec1a2[_0x4b0d('0x1c')](0x1f5,_0x4b0d('0x6d')));}});},'VoiceQueuesChannelRedirect':function(_0x2c18f6){var _0x7fc769=this;return new Promise(function(_0x5689dc,_0x39a6e8){if(ami['isConnected']()==![]){return _0x39a6e8(_0x7fc769[_0x4b0d('0x1c')](0x1f4,[config['asterisk']['ip'],config[_0x4b0d('0x12')][_0x4b0d('0x1d')],_0x4b0d('0x13')][_0x4b0d('0x14')]('\x20')));}var _0x3c6d29=schema(properties[_0x4b0d('0x74')])[_0x4b0d('0x2')](_0x2c18f6);if(_0x3c6d29[_0x4b0d('0x5c')]>0x0){return _0x39a6e8(_0x7fc769[_0x4b0d('0x1c')](0x1f4,_[_0x4b0d('0x5d')](_0x3c6d29,_0x4b0d('0x1b'))[_0x4b0d('0x14')](',\x20')));}var _0x5f53b4=_[_0x4b0d('0x5e')](_0xd9e767['queueChannels'],{'uniqueid':_0x2c18f6[_0x4b0d('0x5f')]});if(_0x5f53b4&&_0x5f53b4[_0x4b0d('0x60')]){return ami[_0x4b0d('0x19')]({'action':_0x4b0d('0x75'),'channel':_0x5f53b4[_0x4b0d('0x60')],'exten':_0x2c18f6[_0x4b0d('0x76')],'context':_0x2c18f6[_0x4b0d('0x77')]||_0x5f53b4[_0x4b0d('0x77')],'priority':0x1})[_0x4b0d('0x1a')](function(_0x26d11e){_0x5689dc({'code':0xc8,'message':[_0x2c18f6[_0x4b0d('0x5f')],_0x26d11e[_0x4b0d('0x1b')]['toLowerCase']()][_0x4b0d('0x14')]('\x20')});})['catch'](function(_0x25032e){_0x39a6e8(_0x7fc769[_0x4b0d('0x1c')](0x1f5,[_0x2c18f6[_0x4b0d('0x5f')],_0x25032e['message'][_0x4b0d('0x68')]()][_0x4b0d('0x14')]('\x20')));});}else{return _0x39a6e8(_0x7fc769[_0x4b0d('0x1c')](0x1f5,_0x4b0d('0x6d')));}});},'Agents':function(_0x14d9fa){return new Promise(function(_0x1a7307,_0x55a516){var _0x8ad47d=_[_0x4b0d('0x5a')](_0xd9e767[_0x4b0d('0xd')]);_0x1a7307({'count':_0x8ad47d[_0x4b0d('0x5c')],'rows':_0x8ad47d});});},'Telephones':function(_0x18651f){return new Promise(function(_0x4f16b0,_0x45b14e){var _0x5dcd58=_[_0x4b0d('0x5a')](_0xd9e767[_0x4b0d('0x78')]);_0x4f16b0({'count':_0x5dcd58['length'],'rows':_0x5dcd58});});},'Trunks':function(_0x50bc6a){return new Promise(function(_0x1fcf5d,_0xab49e0){var _0x183fdd=_[_0x4b0d('0x5a')](_0xd9e767[_0x4b0d('0x79')]);_0x1fcf5d({'count':_0x183fdd['length'],'rows':_0x183fdd});});},'OutboundChannels':function(_0x3407e8){return new Promise(function(_0x50f76a,_0x5d9be3){var _0x2d3a45=_[_0x4b0d('0x5a')](_0xd9e767[_0x4b0d('0x7a')]);_0x50f76a({'count':_0x2d3a45[_0x4b0d('0x5c')],'rows':_0x2d3a45});});},'Outbound':function(_0x59eca3){return new Promise(function(_0x43f333,_0x1f1882){_0x43f333(_0xd9e767[_0x4b0d('0x7b')]);});},'Campaigns':function(_0x27ccc4){return new Promise(function(_0x64debc,_0x32a806){var _0x5a5ef0=_[_0x4b0d('0x5a')](_0xd9e767[_0x4b0d('0x7c')]);_0x64debc({'count':_0x5a5ef0[_0x4b0d('0x5c')],'rows':_0x5a5ef0});});},'VoiceQueuesPreview':function(_0x58d2bf){var _0x3173f6=this;return new Promise(function(_0x4d0b47,_0x33b520){_0x49eb9f[_0x4b0d('0x7d')](_0x58d2bf['id'])[_0x4b0d('0x1a')](function(_0x4069fe){_0x4d0b47({'code':0xc8,'message':_0x4069fe[_0x4b0d('0x1b')]});})[_0x4b0d('0x21')](function(_0x1eb660){_0x33b520(_0x3173f6[_0x4b0d('0x1c')](0x1f4,_0x1eb660[_0x4b0d('0x1b')]));});});},'EventManager':function(_0x5d89e4){var _0x7adb0e=this;return new Promise(function(_0x34d76f,_0x1310d9){if(!_0x5d89e4['event']){return _0x1310d9(_0x7adb0e[_0x4b0d('0x1c')](0x1f4,_0x4b0d('0x7e')));}ami[_0x4b0d('0x7f')]('custom:'+_0x5d89e4[_0x4b0d('0x80')],_0x5d89e4['message']);_0x34d76f({'code':0xc8,'message':_0x5d89e4});});},'FaxAccounts':function(_0x5484a6){return new Promise(function(_0x8d98c4,_0x4456fb){var _0x2b45c6=_[_0x4b0d('0x5a')](_0xd9e767['faxAccounts']);_0x8d98c4({'count':_0x2b45c6[_0x4b0d('0x5c')],'rows':_0x2b45c6});});},'SendFax':function(_0x57a8a5){var _0x5a7711=this;return new Promise(function(_0x4478fc,_0x3ab5f0){_0x49ab42['send'](_0x57a8a5)[_0x4b0d('0x1a')](function(_0x2a0051){_0x4478fc({'code':0xc8,'message':_0x2a0051[_0x4b0d('0x1b')]});})[_0x4b0d('0x21')](function(_0x4b5494){_0x3ab5f0(_0x5a7711['error'](0x1f4,_0x4b5494[_0x4b0d('0x1b')]));});});},'CheckAfterSend':function(_0x185624){var _0x3af5d9=this;return new Promise(function(_0x3396f8,_0xb8614e){_0x49ab42[_0x4b0d('0x81')](_0x185624)[_0x4b0d('0x1a')](function(_0x5add17){_0x3396f8({'code':0xc8,'message':_0x5add17['message']});})[_0x4b0d('0x21')](function(_0x1285c6){_0xb8614e(_0x3af5d9['error'](0x1f4,_0x1285c6[_0x4b0d('0x1b')]));});});}};var _0x314f36=jayson[_0x4b0d('0x82')](_0x10977e)[_0x4b0d('0x83')]();_0x314f36['on'](_0x4b0d('0x1c'),function(_0xda7a28){return _0x368fb5(_0xda7a28);});_0x314f36[_0x4b0d('0x84')](0x232a,_0x4b0d('0x85'),function(){console[_0x4b0d('0x86')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x57186c(_0x4b0d('0x87')+0x232a);});});};
\ No newline at end of file