Built motion from commit cf5ff673.|2.5.41
[motion2.git] / server / services / ami / server / index.js
index bdb62df..cf9407c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7b84=['QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Action','catch','command','Command','then','message','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','sumBillable','sumHoldTime','talking','total','type','abandoned','waiting','loggedInDb','outbound','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','values','channels','voicechannel','map','uniqueid','%s.%s','wav','channel','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','status','stop','filename','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','context','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../ami','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause'];(function(_0x4855e3,_0x215372){var _0x28e3c0=function(_0x1bf819){while(--_0x1bf819){_0x4855e3['push'](_0x4855e3['shift']());}};_0x28e3c0(++_0x215372);}(_0x7b84,0x17c));var _0x47b8=function(_0x5c54ba,_0x3670ad){_0x5c54ba=_0x5c54ba-0x0;var _0x3c5355=_0x7b84[_0x5c54ba];return _0x3c5355;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var jayson=require(_0x47b8('0x2'));var schema=require(_0x47b8('0x3'));var BPromise=require(_0x47b8('0x4'));var moment=require(_0x47b8('0x5'));var config=require(_0x47b8('0x6'));var properties=require('../properties');var ami=require(_0x47b8('0x7'));exports[_0x47b8('0x8')]=function(_0x2279ea,_0x7013d7,_0x2e6853){return new BPromise(function(_0xafe88a,_0x53e656){var _0x3867ca={'QueuePause':function(_0x3ce846){return new Promise(function(_0x46245a,_0xb845c9){var _0x2289d5=util[_0x47b8('0x9')](_0x47b8('0xa'),_0x47b8('0xb'),_0x3ce846[_0x47b8('0xc')]);if(_0x2279ea[_0x47b8('0xd')]&&_0x2279ea[_0x47b8('0xd')][_0x2289d5]&&_0x2279ea[_0x47b8('0xd')][_0x2289d5][_0x47b8('0xe')]){_0x2279ea[_0x47b8('0xd')][_0x2289d5][_0x47b8('0xf')]();}if(_0x2279ea[_0x47b8('0x10')][_0x2289d5]){_0x2279ea[_0x47b8('0x10')][_0x2289d5][_0x47b8('0x11')]({'statePause':_0x3ce846[_0x47b8('0x12')]?!![]:![]});}_0x46245a({'code':0xc8,'message':_0x47b8('0x13')});});},'Reload':function(_0x1edb4b){var _0x127d42=this;return new Promise(function(_0x2d1aaf,_0x268440){if(ami[_0x47b8('0x14')]()==![]){return _0x268440(_0x127d42[_0x47b8('0x15')](0x1f4,[config[_0x47b8('0x16')]['ip'],config['asterisk'][_0x47b8('0x17')],_0x47b8('0x18')][_0x47b8('0x19')]('\x20')));}_0x1edb4b=_[_0x47b8('0x1a')](_0x1edb4b,_[_0x47b8('0x1b')](properties[_0x47b8('0x1c')]));_0x1edb4b[_0x47b8('0x1d')]='Reload';return ami[_0x47b8('0x1e')](_0x1edb4b)['then'](function(_0x525fd6){_0x2d1aaf({'code':0xc8,'message':_0x525fd6['message']});})[_0x47b8('0x1f')](function(_0x36faf1){_0x268440(_0x127d42[_0x47b8('0x15')](0x1f5,_0x36faf1['message']));});});},'Command':function(_0x502a23){var _0x4f6716=this;return new Promise(function(_0x1c5bfd,_0x5531a2){if(ami[_0x47b8('0x14')]()==![]){return _0x5531a2(_0x4f6716[_0x47b8('0x15')](0x1f4,[config[_0x47b8('0x16')]['ip'],config[_0x47b8('0x16')]['username'],_0x47b8('0x18')][_0x47b8('0x19')]('\x20')));}_0x502a23=_[_0x47b8('0x1a')](_0x502a23,_0x47b8('0x20'));_0x502a23[_0x47b8('0x1d')]=_0x47b8('0x21');return ami['Action'](_0x502a23)[_0x47b8('0x22')](function(_0x2a22e3){_0x1c5bfd({'code':0xc8,'message':_0x2a22e3['content']});})[_0x47b8('0x1f')](function(_0x247429){_0x5531a2(_0x4f6716[_0x47b8('0x15')](0x1f5,_0x247429[_0x47b8('0x23')]));});});},'VoiceQueues':function(_0x5604c9){return new Promise(function(_0x35b327,_0x332c23){var _0x319d17=[];for(var _0x3e3de0 in _0x2279ea[_0x47b8('0x24')]){if(_0x2279ea[_0x47b8('0x24')][_0x47b8('0x25')](_0x3e3de0)){var _0x568c1e=_0x2279ea[_0x47b8('0x24')][_0x3e3de0];var _0x1f719a={'id':_0x568c1e['id'],'name':_0x568c1e['name'],'strategy':_0x568c1e[_0x47b8('0x26')],'answered':_0x568c1e[_0x47b8('0x27')],'available':_0x568c1e[_0x47b8('0x28')],'loggedIn':_0x568c1e[_0x47b8('0x29')],'pTalking':_0x568c1e['pTalking'],'sumBillable':_0x568c1e[_0x47b8('0x2a')],'sumDuration':_0x568c1e['sumDuration'],'sumHoldTime':_0x568c1e[_0x47b8('0x2b')]||0x0,'talking':_0x568c1e[_0x47b8('0x2c')],'total':_0x568c1e[_0x47b8('0x2d')],'type':_0x568c1e[_0x47b8('0x2e')],'unmanaged':_0x568c1e['unmanaged'],'abandoned':_0x568c1e[_0x47b8('0x2f')],'waiting':_0x568c1e[_0x47b8('0x30')],'loggedInDb':_0x568c1e[_0x47b8('0x31')]};if(_0x568c1e[_0x47b8('0x2e')]===_0x47b8('0x32')){_0x1f719a[_0x47b8('0x33')]=_0x568c1e['dialActive'];_0x1f719a['dialMethod']=_0x568c1e['dialMethod'];_0x1f719a[_0x47b8('0x34')]=_0x568c1e[_0x47b8('0x34')];_0x1f719a[_0x47b8('0x35')]=_0x568c1e['dialOriginateCallerIdNumber'];_0x1f719a['dialOriginateTimeout']=_0x568c1e['dialOriginateTimeout'];_0x1f719a['dialPrefix']=_0x568c1e[_0x47b8('0x36')];_0x1f719a[_0x47b8('0x37')]=_0x568c1e[_0x47b8('0x37')];_0x1f719a[_0x47b8('0x38')]=_0x568c1e[_0x47b8('0x38')];_0x1f719a[_0x47b8('0x39')]=_0x568c1e[_0x47b8('0x39')];_0x1f719a[_0x47b8('0x3a')]=_0x568c1e[_0x47b8('0x3a')];_0x1f719a['outboundBusyCallsDay']=_0x568c1e['outboundBusyCallsDay'];_0x1f719a[_0x47b8('0x3b')]=_0x568c1e[_0x47b8('0x3b')];_0x1f719a['outboundDropCallsDayACS']=_0x568c1e['outboundDropCallsDayACS'];_0x1f719a[_0x47b8('0x3c')]=_0x568c1e[_0x47b8('0x3c')];_0x1f719a[_0x47b8('0x3d')]=_0x568c1e['outboundDropCallsDayTimeout'];_0x1f719a[_0x47b8('0x3e')]=_0x568c1e[_0x47b8('0x3e')];_0x1f719a['outboundNoSuchCallsDay']=_0x568c1e['outboundNoSuchCallsDay'];_0x1f719a['outboundOriginateFailureCallsDay']=_0x568c1e['outboundOriginateFailureCallsDay'];_0x1f719a[_0x47b8('0x3f')]=_0x568c1e[_0x47b8('0x3f')];_0x1f719a[_0x47b8('0x40')]=_0x568c1e[_0x47b8('0x40')];_0x1f719a[_0x47b8('0x41')]=_0x568c1e[_0x47b8('0x41')];_0x1f719a['predictiveIntervalAnsweredCalls']=_0x568c1e['predictiveIntervalAnsweredCalls'];_0x1f719a[_0x47b8('0x42')]=_0x568c1e[_0x47b8('0x42')];_0x1f719a[_0x47b8('0x43')]=_0x568c1e['predictiveIntervalAvgTalktime'];_0x1f719a['predictiveIntervalDroppedCallsCallersExit']=_0x568c1e[_0x47b8('0x44')];_0x1f719a[_0x47b8('0x45')]=_0x568c1e['predictiveIntervalDroppedCallsTimeout'];_0x1f719a[_0x47b8('0x46')]=_0x568c1e[_0x47b8('0x46')];_0x1f719a['predictiveIntervalErlangCallsDroppedCalls']=_0x568c1e['predictiveIntervalErlangCallsDroppedCalls'];_0x1f719a['predictiveIntervalHitRate']=_0x568c1e['predictiveIntervalHitRate'];_0x1f719a[_0x47b8('0x47')]=_0x568c1e[_0x47b8('0x47')];_0x1f719a[_0x47b8('0x48')]=_0x568c1e[_0x47b8('0x48')];_0x1f719a[_0x47b8('0x49')]=_0x568c1e['predictiveIntervalAvailable'];_0x1f719a[_0x47b8('0x4a')]=_0x568c1e['predictiveIntervalTotalCalls'];_0x1f719a[_0x47b8('0x23')]=_0x568c1e[_0x47b8('0x23')];_0x1f719a[_0x47b8('0x4b')]=_0x568c1e['originated'];_0x1f719a[_0x47b8('0x4c')]=_0x568c1e[_0x47b8('0x4c')];_0x1f719a[_0x47b8('0x4d')]=_0x568c1e[_0x47b8('0x4d')];_0x1f719a[_0x47b8('0x4e')]=_0x568c1e[_0x47b8('0x4e')];_0x1f719a[_0x47b8('0x4f')]=_0x568c1e['erlangBusyFactor'];_0x1f719a[_0x47b8('0x50')]=_0x568c1e['startPredictive'];_0x1f719a[_0x47b8('0x51')]=_0x568c1e[_0x47b8('0x51')];}if(_0x568c1e[_0x47b8('0x52')]){_0x1f719a[_0x47b8('0x52')]={'id':_0x568c1e[_0x47b8('0x52')]['id'],'name':_0x568c1e[_0x47b8('0x52')]['name'],'active':_0x568c1e['Trunk'][_0x47b8('0x53')],'callerid':_0x568c1e[_0x47b8('0x52')][_0x47b8('0x54')]};}if(_0x568c1e['Interval']){_0x1f719a[_0x47b8('0x55')]={'id':_0x568c1e['Interval']['id'],'name':_0x568c1e[_0x47b8('0x55')][_0x47b8('0xc')]};}_0x319d17[_0x47b8('0x56')](_0x1f719a);}}_0x35b327({'count':_0x319d17[_0x47b8('0x57')],'rows':_0x319d17});});},'UpdateVoiceQueue':function(_0x3f13ae){return new Promise(function(_0x5c26c7,_0x40ff24){var _0xfb8041=_[_0x47b8('0x58')](_0x2279ea[_0x47b8('0x24')],{'id':parseInt(_0x3f13ae['id'])});var _0x1dce38=_[_0x47b8('0x59')](_0x3f13ae,['id']);if(_0xfb8041){for(var _0x46e648 in _0x1dce38){if(typeof _0x1dce38[_0x46e648]!=='undefined'&&typeof _0xfb8041[_0x46e648]!==_0x47b8('0x5a')){_0xfb8041[_0x46e648]=_0x1dce38[_0x46e648];}}_0x5c26c7(_0xfb8041);}else{_0x40ff24();}});},'VoiceChannels':function(_0x4bc93d){return new Promise(function(_0x4020f2,_0x2b46da){var _0x4a46eb=_[_0x47b8('0x5b')](_0x2279ea[_0x47b8('0x5c')]);_0x4020f2({'count':_0x4a46eb[_0x47b8('0x57')],'rows':_0x4a46eb});});},'VoiceChannelMixMonitor':function(_0x33ae87){var _0x223443=this;return new Promise(function(_0x167f24,_0x1b1733){if(ami[_0x47b8('0x14')]()==![]){return _0x1b1733(_0x223443['error'](0x1f4,[config[_0x47b8('0x16')]['ip'],config[_0x47b8('0x16')][_0x47b8('0x17')],'ami\x20disconnected'][_0x47b8('0x19')]('\x20')));}var _0x5645e6=schema(properties[_0x47b8('0x5d')])[_0x47b8('0x3')](_0x33ae87);if(_0x5645e6['length']>0x0){return _0x1b1733(_0x223443[_0x47b8('0x15')](0x1f4,_[_0x47b8('0x5e')](_0x5645e6,'message')[_0x47b8('0x19')](',\x20')));}var _0x263698=_[_0x47b8('0x58')](_0x2279ea['channels'],{'uniqueid':_0x33ae87[_0x47b8('0x5f')]});if(_0x263698&&_0x263698['channel']){var _0x178427=util['format'](_0x47b8('0x60'),_0x33ae87['filename']||_0x33ae87[_0x47b8('0x5f')],_0x33ae87[_0x47b8('0x9')]||_0x47b8('0x61'));return ami[_0x47b8('0x1e')]({'action':'MixMonitor','channel':_0x263698[_0x47b8('0x62')],'file':_0x178427,'options':_0x47b8('0x63')})[_0x47b8('0x22')](function(_0x115da1){var _0x586cf6=_[_0x47b8('0x58')](_0x263698[_0x47b8('0x64')],{'filename':_0x47b8('0x65')+_0x178427['toLowerCase']()});if(_['isNil'](_0x586cf6)){_0x263698[_0x47b8('0x64')]['push']({'filename':_0x47b8('0x65')+_0x178427[_0x47b8('0x66')](),'createdAt':moment()[_0x47b8('0x9')](_0x47b8('0x67')),'mixmonitorid':_0x115da1['mixmonitorid'],'status':_0x47b8('0x68')});}else{_0x586cf6[_0x47b8('0x69')]=_0x115da1[_0x47b8('0x69')];_0x586cf6['status']='rec';}_0x167f24({'code':0xc8,'message':[_0x33ae87[_0x47b8('0x5f')],_0x47b8('0x6a'),_0x115da1[_0x47b8('0x69')]]['join']('\x20'),'mixmonitorid':_0x115da1[_0x47b8('0x69')]});})[_0x47b8('0x1f')](function(_0x23a759){_0x1b1733(_0x223443[_0x47b8('0x15')](0x1f5,[_0x33ae87['uniqueid'],_0x23a759[_0x47b8('0x23')][_0x47b8('0x66')]()][_0x47b8('0x19')]('\x20')));});}else{return _0x1b1733(_0x223443['error'](0x1f5,_0x47b8('0x6b')));}});},'VoiceChannelStopMixMonitor':function(_0x480d8c){var _0x1311aa=this;return new Promise(function(_0x4fc8ac,_0x447ff7){if(ami[_0x47b8('0x14')]()==![]){return _0x447ff7(_0x1311aa[_0x47b8('0x15')](0x1f4,[config['asterisk']['ip'],config[_0x47b8('0x16')][_0x47b8('0x17')],'ami\x20disconnected'][_0x47b8('0x19')]('\x20')));}var _0x4e1aa7=schema(properties['voicechannel'])['validate'](_0x480d8c);if(_0x4e1aa7[_0x47b8('0x57')]>0x0){return _0x447ff7(_0x1311aa['error'](0x1f4,_[_0x47b8('0x5e')](_0x4e1aa7,'message')[_0x47b8('0x19')](',\x20')));}var _0x4be9dc=_[_0x47b8('0x58')](_0x2279ea[_0x47b8('0x5c')],{'uniqueid':_0x480d8c[_0x47b8('0x5f')]});if(_0x4be9dc){return BPromise[_0x47b8('0x6c')]()[_0x47b8('0x22')](function(){if(_0x4be9dc['channel']){return ami[_0x47b8('0x1e')]({'action':_0x47b8('0x6d'),'channel':_0x4be9dc[_0x47b8('0x62')],'mixmonitorid':_0x480d8c[_0x47b8('0x69')]})[_0x47b8('0x1f')](function(_0x4ada28){});}})[_0x47b8('0x22')](function(){if(_0x4be9dc[_0x47b8('0x6e')]){return ami['Action']({'action':_0x47b8('0x6d'),'channel':_0x4be9dc[_0x47b8('0x6e')],'mixmonitorid':_0x480d8c[_0x47b8('0x69')]})[_0x47b8('0x1f')](function(_0x5f3771){});}})[_0x47b8('0x22')](function(_0x226d29){var _0x44b461=_[_0x47b8('0x58')](_0x4be9dc[_0x47b8('0x64')],{'mixmonitorid':_0x480d8c[_0x47b8('0x69')]});if(_0x44b461){_0x44b461[_0x47b8('0x6f')]=_0x47b8('0x70');}})[_0x47b8('0x22')](function(){var _0xd55e85=util[_0x47b8('0x9')](_0x47b8('0x60'),_0x480d8c[_0x47b8('0x71')]||_0x480d8c[_0x47b8('0x5f')],_0x480d8c[_0x47b8('0x9')]||_0x47b8('0x61'));var _0x5e4b95=_[_0x47b8('0x58')](_0x4be9dc['monitors'],{'filename':_0x47b8('0x65')+_0xd55e85['toLowerCase']()});if(_0x5e4b95){_0x5e4b95[_0x47b8('0x6f')]=_0x47b8('0x70');}})[_0x47b8('0x22')](function(){_0x4fc8ac({'code':0xc8,'message':[_0x480d8c[_0x47b8('0x5f')],'StopMixMonitor\x20Success'][_0x47b8('0x19')]('\x20')});})[_0x47b8('0x1f')](function(_0x5a7cbe){_0x447ff7(_0x1311aa[_0x47b8('0x15')](0x1f5,[_0x480d8c[_0x47b8('0x5f')],_0x5a7cbe[_0x47b8('0x23')][_0x47b8('0x66')]()][_0x47b8('0x19')]('\x20')));});}else{return _0x447ff7(_0x1311aa[_0x47b8('0x15')](0x1f5,_0x47b8('0x6b')));}});},'VoiceQueuesChannels':function(_0x1a38fe){return new Promise(function(_0x56545b,_0x355d01){var _0x1246f9=_[_0x47b8('0x5b')](_0x2279ea[_0x47b8('0x72')]);_0x56545b({'count':_0x1246f9[_0x47b8('0x57')],'rows':_0x1246f9});});},'VoiceQueuesChannel':function(_0x3cf1b6){var _0x547df3=this;return new Promise(function(_0x578a3e,_0x1829f8){var _0xe2c20c=schema(properties[_0x47b8('0x73')])['validate'](_0x3cf1b6);if(_0xe2c20c['length']>0x0){return _0x1829f8(_0x547df3[_0x47b8('0x15')](0x1f4,_[_0x47b8('0x5e')](_0xe2c20c,_0x47b8('0x23'))['join'](',\x20')));}var _0x6ed009=_[_0x47b8('0x58')](_0x2279ea[_0x47b8('0x72')],{'uniqueid':_0x3cf1b6[_0x47b8('0x5f')]});if(_0x6ed009){_0x578a3e(_0x6ed009);}else{return _0x1829f8(_0x547df3[_0x47b8('0x15')](0x1f5,_0x47b8('0x6b')));}});},'VoiceQueuesChannelHangup':function(_0xbac225){var _0x4ad83a=this;return new Promise(function(_0xde73a6,_0x2930cc){if(ami['isConnected']()==![]){return _0x2930cc(_0x4ad83a[_0x47b8('0x15')](0x1f4,[config[_0x47b8('0x16')]['ip'],config['asterisk'][_0x47b8('0x17')],_0x47b8('0x18')]['join']('\x20')));}var _0xdf662d=schema(properties[_0x47b8('0x74')])['validate'](_0xbac225);if(_0xdf662d[_0x47b8('0x57')]>0x0){return _0x2930cc(_0x4ad83a['error'](0x1f4,_['map'](_0xdf662d,_0x47b8('0x23'))[_0x47b8('0x19')](',\x20')));}var _0x2ded9a=_[_0x47b8('0x58')](_0x2279ea[_0x47b8('0x72')],{'uniqueid':_0xbac225[_0x47b8('0x5f')]});if(_0x2ded9a&&_0x2ded9a[_0x47b8('0x62')]){return ami[_0x47b8('0x1e')]({'action':_0x47b8('0x75'),'channel':_0x2ded9a['channel']})['then'](function(_0x341bf5){_0xde73a6({'code':0xc8,'message':[_0xbac225[_0x47b8('0x5f')],_0x341bf5['message'][_0x47b8('0x66')]()]['join']('\x20')});})[_0x47b8('0x1f')](function(_0x116691){_0x2930cc(_0x4ad83a[_0x47b8('0x15')](0x1f5,[_0xbac225[_0x47b8('0x5f')],_0x116691[_0x47b8('0x23')][_0x47b8('0x66')]()][_0x47b8('0x19')]('\x20')));});}else{return _0x2930cc(_0x4ad83a[_0x47b8('0x15')](0x1f5,_0x47b8('0x6b')));}});},'VoiceQueuesChannelRedirect':function(_0x5e4b92){var _0x437cc5=this;return new Promise(function(_0x590577,_0x22f163){if(ami[_0x47b8('0x14')]()==![]){return _0x22f163(_0x437cc5['error'](0x1f4,[config[_0x47b8('0x16')]['ip'],config[_0x47b8('0x16')][_0x47b8('0x17')],_0x47b8('0x18')][_0x47b8('0x19')]('\x20')));}var _0x1dc765=schema(properties['voicequeuechannelredirect'])[_0x47b8('0x3')](_0x5e4b92);if(_0x1dc765[_0x47b8('0x57')]>0x0){return _0x22f163(_0x437cc5[_0x47b8('0x15')](0x1f4,_[_0x47b8('0x5e')](_0x1dc765,_0x47b8('0x23'))[_0x47b8('0x19')](',\x20')));}var _0x398d44=_['find'](_0x2279ea['queueChannels'],{'uniqueid':_0x5e4b92[_0x47b8('0x5f')]});if(_0x398d44&&_0x398d44[_0x47b8('0x62')]){return ami['Action']({'action':'Redirect','channel':_0x398d44[_0x47b8('0x62')],'exten':_0x5e4b92['exten'],'context':_0x5e4b92[_0x47b8('0x76')]||_0x398d44['context'],'priority':0x1})['then'](function(_0x438fc1){_0x590577({'code':0xc8,'message':[_0x5e4b92['uniqueid'],_0x438fc1['message'][_0x47b8('0x66')]()][_0x47b8('0x19')]('\x20')});})['catch'](function(_0x83c650){_0x22f163(_0x437cc5[_0x47b8('0x15')](0x1f5,[_0x5e4b92[_0x47b8('0x5f')],_0x83c650['message']['toLowerCase']()][_0x47b8('0x19')]('\x20')));});}else{return _0x22f163(_0x437cc5[_0x47b8('0x15')](0x1f5,_0x47b8('0x6b')));}});},'Agents':function(_0x19354e){return new Promise(function(_0x23bf13,_0x5237c3){var _0x41e4a7=_[_0x47b8('0x5b')](_0x2279ea[_0x47b8('0x10')]);_0x23bf13({'count':_0x41e4a7['length'],'rows':_0x41e4a7});});},'Telephones':function(_0x50cd3d){return new Promise(function(_0x2dab51,_0x182d57){var _0x37effe=_['values'](_0x2279ea['telephones']);_0x2dab51({'count':_0x37effe[_0x47b8('0x57')],'rows':_0x37effe});});},'Trunks':function(_0x5baf1a){return new Promise(function(_0x9d58bc,_0x45c6e0){var _0x5ab3be=_[_0x47b8('0x5b')](_0x2279ea[_0x47b8('0x77')]);_0x9d58bc({'count':_0x5ab3be['length'],'rows':_0x5ab3be});});},'OutboundChannels':function(_0x57e1f8){return new Promise(function(_0x398685,_0x4ef77b){var _0x4aa570=_[_0x47b8('0x5b')](_0x2279ea[_0x47b8('0x78')]);_0x398685({'count':_0x4aa570[_0x47b8('0x57')],'rows':_0x4aa570});});},'Outbound':function(_0x5703e3){return new Promise(function(_0x3559f4,_0x36e455){_0x3559f4(_0x2279ea[_0x47b8('0x32')]);});},'Campaigns':function(_0xe6cc93){return new Promise(function(_0x2faf37,_0x43c5ce){var _0x34e2cb=_['values'](_0x2279ea[_0x47b8('0x79')]);_0x2faf37({'count':_0x34e2cb[_0x47b8('0x57')],'rows':_0x34e2cb});});},'VoiceQueuesPreview':function(_0x347240){var _0x3c784e=this;return new Promise(function(_0x4281be,_0x289fa7){_0x7013d7[_0x47b8('0x7a')](_0x347240['id'])[_0x47b8('0x22')](function(_0x2136d0){_0x4281be({'code':0xc8,'message':_0x2136d0[_0x47b8('0x23')]});})[_0x47b8('0x1f')](function(_0x1b646e){_0x289fa7(_0x3c784e[_0x47b8('0x15')](0x1f4,_0x1b646e[_0x47b8('0x23')]));});});},'EventManager':function(_0x3df892){var _0x199933=this;return new Promise(function(_0x1524e6,_0x4690a5){if(!_0x3df892[_0x47b8('0x7b')]){return _0x4690a5(_0x199933[_0x47b8('0x15')](0x1f4,_0x47b8('0x7c')));}ami['emit'](_0x47b8('0x7d')+_0x3df892[_0x47b8('0x7b')],_0x3df892['message']);_0x1524e6({'code':0xc8,'message':_0x3df892});});},'FaxAccounts':function(_0xc2596d){return new Promise(function(_0xca5d3d,_0x349cc4){var _0x4dbf55=_[_0x47b8('0x5b')](_0x2279ea[_0x47b8('0x7e')]);_0xca5d3d({'count':_0x4dbf55[_0x47b8('0x57')],'rows':_0x4dbf55});});},'SendFax':function(_0xe0e869){var _0x3565ec=this;return new Promise(function(_0xd0a81a,_0xa7efe3){_0x2e6853[_0x47b8('0x7f')](_0xe0e869)[_0x47b8('0x22')](function(_0x37aa38){_0xd0a81a({'code':0xc8,'message':_0x37aa38[_0x47b8('0x23')]});})['catch'](function(_0x2ce472){_0xa7efe3(_0x3565ec[_0x47b8('0x15')](0x1f4,_0x2ce472[_0x47b8('0x23')]));});});},'CheckAfterSend':function(_0x3ed98e){var _0x3e1971=this;return new Promise(function(_0xc10a53,_0x579df5){_0x2e6853[_0x47b8('0x80')](_0x3ed98e)[_0x47b8('0x22')](function(_0x2db02c){_0xc10a53({'code':0xc8,'message':_0x2db02c['message']});})[_0x47b8('0x1f')](function(_0x542c38){_0x579df5(_0x3e1971[_0x47b8('0x15')](0x1f4,_0x542c38[_0x47b8('0x23')]));});});}};var _0x258f13=jayson[_0x47b8('0x81')](_0x3867ca)[_0x47b8('0x82')]();_0x258f13['on'](_0x47b8('0x15'),function(_0x74851f){return _0x53e656(_0x74851f);});_0x258f13['listen'](0x232a,_0x47b8('0x83'),function(){console[_0x47b8('0x84')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0xafe88a('RPC\x20listening\x20on\x20port:'+0x232a);});});};
\ No newline at end of file
+var _0xbd51=['Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','listen','127.0.0.1','log','lodash','jayson/promise','validate','bluebird','moment','format','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','error','asterisk','username','pick','keys','module','action','Reload','Action','then','message','isConnected','ami\x20disconnected','join','command','Command','catch','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','type','outbound','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','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','omit','undefined','values','channels','length','voicechannel','map','find','channel','%s.%s','filename','uniqueid','MixMonitor','ai(mixmonitorid)','monitors','toLowerCase','isNil','/var/spool/asterisk/monitor/','mixmonitorid','status','MixMonitor\x20Success','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','context','telephones','trunks','campaigns','run'];(function(_0x10f68e,_0xf198ea){var _0x4c8372=function(_0x38517){while(--_0x38517){_0x10f68e['push'](_0x10f68e['shift']());}};_0x4c8372(++_0xf198ea);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x4eabd7,_0x2ab488){_0x4eabd7=_0x4eabd7-0x0;var _0x3491e4=_0xbd51[_0x4eabd7];return _0x3491e4;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var jayson=require(_0x1bd5('0x1'));var schema=require(_0x1bd5('0x2'));var BPromise=require(_0x1bd5('0x3'));var moment=require(_0x1bd5('0x4'));var config=require('../../../config/environment');var properties=require('../properties');var ami=require('../ami');exports['listen']=function(_0x3bce00,_0x362b24,_0x43e6b6){return new BPromise(function(_0x59ddfb,_0x29abea){var _0x30a385={'QueuePause':function(_0x19077c){return new Promise(function(_0x27d58f,_0xd8418f){var _0x4a7f90=util[_0x1bd5('0x5')]('%s/%s',_0x1bd5('0x6'),_0x19077c[_0x1bd5('0x7')]);if(_0x3bce00[_0x1bd5('0x8')]&&_0x3bce00[_0x1bd5('0x8')][_0x4a7f90]&&_0x3bce00[_0x1bd5('0x8')][_0x4a7f90][_0x1bd5('0x9')]){_0x3bce00['timers'][_0x4a7f90][_0x1bd5('0xa')]();}if(_0x3bce00['agents'][_0x4a7f90]){_0x3bce00[_0x1bd5('0xb')][_0x4a7f90][_0x1bd5('0xc')]({'statePause':_0x19077c[_0x1bd5('0xd')]?!![]:![]});}_0x27d58f({'code':0xc8,'message':_0x1bd5('0xe')});});},'Reload':function(_0x177be0){var _0x81f02c=this;return new Promise(function(_0x1527c1,_0x4942df){if(ami['isConnected']()==![]){return _0x4942df(_0x81f02c[_0x1bd5('0xf')](0x1f4,[config[_0x1bd5('0x10')]['ip'],config[_0x1bd5('0x10')][_0x1bd5('0x11')],'ami\x20disconnected']['join']('\x20')));}_0x177be0=_[_0x1bd5('0x12')](_0x177be0,_[_0x1bd5('0x13')](properties[_0x1bd5('0x14')]));_0x177be0[_0x1bd5('0x15')]=_0x1bd5('0x16');return ami[_0x1bd5('0x17')](_0x177be0)[_0x1bd5('0x18')](function(_0x3afc4a){_0x1527c1({'code':0xc8,'message':_0x3afc4a[_0x1bd5('0x19')]});})['catch'](function(_0x53ad5e){_0x4942df(_0x81f02c[_0x1bd5('0xf')](0x1f5,_0x53ad5e[_0x1bd5('0x19')]));});});},'Command':function(_0x476bd1){var _0xb95d4e=this;return new Promise(function(_0x459649,_0x2ff39a){if(ami[_0x1bd5('0x1a')]()==![]){return _0x2ff39a(_0xb95d4e[_0x1bd5('0xf')](0x1f4,[config[_0x1bd5('0x10')]['ip'],config[_0x1bd5('0x10')][_0x1bd5('0x11')],_0x1bd5('0x1b')][_0x1bd5('0x1c')]('\x20')));}_0x476bd1=_[_0x1bd5('0x12')](_0x476bd1,_0x1bd5('0x1d'));_0x476bd1[_0x1bd5('0x15')]=_0x1bd5('0x1e');return ami[_0x1bd5('0x17')](_0x476bd1)['then'](function(_0x42c43d){_0x459649({'code':0xc8,'message':_0x42c43d['content']});})[_0x1bd5('0x1f')](function(_0x1e534e){_0x2ff39a(_0xb95d4e[_0x1bd5('0xf')](0x1f5,_0x1e534e['message']));});});},'VoiceQueues':function(_0x3f4156){return new Promise(function(_0x4fa37c,_0x2ed551){var _0x30676d=[];for(var _0x3dba4f in _0x3bce00[_0x1bd5('0x20')]){if(_0x3bce00['voiceQueues'][_0x1bd5('0x21')](_0x3dba4f)){var _0x69bb17=_0x3bce00[_0x1bd5('0x20')][_0x3dba4f];var _0x3b1090={'id':_0x69bb17['id'],'name':_0x69bb17['name'],'strategy':_0x69bb17[_0x1bd5('0x22')],'answered':_0x69bb17[_0x1bd5('0x23')],'available':_0x69bb17[_0x1bd5('0x24')],'loggedIn':_0x69bb17[_0x1bd5('0x25')],'pTalking':_0x69bb17[_0x1bd5('0x26')],'sumBillable':_0x69bb17[_0x1bd5('0x27')],'sumDuration':_0x69bb17['sumDuration'],'sumHoldTime':_0x69bb17[_0x1bd5('0x28')]||0x0,'talking':_0x69bb17[_0x1bd5('0x29')],'total':_0x69bb17[_0x1bd5('0x2a')],'type':_0x69bb17['type'],'unmanaged':_0x69bb17[_0x1bd5('0x2b')],'abandoned':_0x69bb17[_0x1bd5('0x2c')],'waiting':_0x69bb17[_0x1bd5('0x2d')],'loggedInDb':_0x69bb17[_0x1bd5('0x2e')]};if(_0x69bb17[_0x1bd5('0x2f')]===_0x1bd5('0x30')){_0x3b1090['dialActive']=_0x69bb17['dialActive'];_0x3b1090[_0x1bd5('0x31')]=_0x69bb17[_0x1bd5('0x31')];_0x3b1090['dialOriginateCallerIdName']=_0x69bb17[_0x1bd5('0x32')];_0x3b1090[_0x1bd5('0x33')]=_0x69bb17[_0x1bd5('0x33')];_0x3b1090[_0x1bd5('0x34')]=_0x69bb17['dialOriginateTimeout'];_0x3b1090[_0x1bd5('0x35')]=_0x69bb17[_0x1bd5('0x35')];_0x3b1090[_0x1bd5('0x36')]=_0x69bb17[_0x1bd5('0x36')];_0x3b1090[_0x1bd5('0x37')]=_0x69bb17[_0x1bd5('0x37')];_0x3b1090[_0x1bd5('0x38')]=_0x69bb17[_0x1bd5('0x38')];_0x3b1090['outboundBlacklistCallsDay']=_0x69bb17[_0x1bd5('0x39')];_0x3b1090[_0x1bd5('0x3a')]=_0x69bb17[_0x1bd5('0x3a')];_0x3b1090[_0x1bd5('0x3b')]=_0x69bb17[_0x1bd5('0x3b')];_0x3b1090[_0x1bd5('0x3c')]=_0x69bb17[_0x1bd5('0x3c')];_0x3b1090['outboundDropCallsDayCallersExit']=_0x69bb17[_0x1bd5('0x3d')];_0x3b1090[_0x1bd5('0x3e')]=_0x69bb17[_0x1bd5('0x3e')];_0x3b1090[_0x1bd5('0x3f')]=_0x69bb17[_0x1bd5('0x3f')];_0x3b1090[_0x1bd5('0x40')]=_0x69bb17[_0x1bd5('0x40')];_0x3b1090['outboundOriginateFailureCallsDay']=_0x69bb17['outboundOriginateFailureCallsDay'];_0x3b1090[_0x1bd5('0x41')]=_0x69bb17[_0x1bd5('0x41')];_0x3b1090[_0x1bd5('0x42')]=_0x69bb17['outboundRejectCallsDay'];_0x3b1090[_0x1bd5('0x43')]=_0x69bb17['outboundUnknownCallsDay'];_0x3b1090[_0x1bd5('0x44')]=_0x69bb17[_0x1bd5('0x44')];_0x3b1090[_0x1bd5('0x45')]=_0x69bb17[_0x1bd5('0x45')];_0x3b1090[_0x1bd5('0x46')]=_0x69bb17[_0x1bd5('0x46')];_0x3b1090[_0x1bd5('0x47')]=_0x69bb17[_0x1bd5('0x47')];_0x3b1090['predictiveIntervalDroppedCallsTimeout']=_0x69bb17[_0x1bd5('0x48')];_0x3b1090[_0x1bd5('0x49')]=_0x69bb17['predictiveIntervalErlangCalls'];_0x3b1090[_0x1bd5('0x4a')]=_0x69bb17[_0x1bd5('0x4a')];_0x3b1090[_0x1bd5('0x4b')]=_0x69bb17['predictiveIntervalHitRate'];_0x3b1090[_0x1bd5('0x4c')]=_0x69bb17[_0x1bd5('0x4c')];_0x3b1090[_0x1bd5('0x4d')]=_0x69bb17[_0x1bd5('0x4d')];_0x3b1090['predictiveIntervalAvailable']=_0x69bb17[_0x1bd5('0x4e')];_0x3b1090[_0x1bd5('0x4f')]=_0x69bb17[_0x1bd5('0x4f')];_0x3b1090[_0x1bd5('0x19')]=_0x69bb17['message'];_0x3b1090['originated']=_0x69bb17[_0x1bd5('0x50')];_0x3b1090[_0x1bd5('0x51')]=_0x69bb17[_0x1bd5('0x51')];_0x3b1090['erlangCallToSecond']=_0x69bb17[_0x1bd5('0x52')];_0x3b1090[_0x1bd5('0x53')]=_0x69bb17['erlangAbandonmentRate'];_0x3b1090[_0x1bd5('0x54')]=_0x69bb17['erlangBusyFactor'];_0x3b1090[_0x1bd5('0x55')]=_0x69bb17[_0x1bd5('0x55')];_0x3b1090['startProgressive']=_0x69bb17[_0x1bd5('0x56')];}if(_0x69bb17[_0x1bd5('0x57')]){_0x3b1090[_0x1bd5('0x57')]={'id':_0x69bb17[_0x1bd5('0x57')]['id'],'name':_0x69bb17[_0x1bd5('0x57')][_0x1bd5('0x7')],'active':_0x69bb17[_0x1bd5('0x57')][_0x1bd5('0x58')],'callerid':_0x69bb17[_0x1bd5('0x57')][_0x1bd5('0x59')]};}if(_0x69bb17[_0x1bd5('0x5a')]){_0x3b1090[_0x1bd5('0x5a')]={'id':_0x69bb17['Interval']['id'],'name':_0x69bb17[_0x1bd5('0x5a')][_0x1bd5('0x7')]};}_0x30676d[_0x1bd5('0x5b')](_0x3b1090);}}_0x4fa37c({'count':_0x30676d['length'],'rows':_0x30676d});});},'UpdateVoiceQueue':function(_0x1caa90){return new Promise(function(_0x12e616,_0x5bb8a6){var _0x1dbde9=_['find'](_0x3bce00[_0x1bd5('0x20')],{'id':parseInt(_0x1caa90['id'])});var _0x558fec=_[_0x1bd5('0x5c')](_0x1caa90,['id']);if(_0x1dbde9){for(var _0xdd6c1a in _0x558fec){if(typeof _0x558fec[_0xdd6c1a]!=='undefined'&&typeof _0x1dbde9[_0xdd6c1a]!==_0x1bd5('0x5d')){_0x1dbde9[_0xdd6c1a]=_0x558fec[_0xdd6c1a];}}_0x12e616(_0x1dbde9);}else{_0x5bb8a6();}});},'VoiceChannels':function(_0x546657){return new Promise(function(_0x293fc3,_0x38dced){var _0x1a29f3=_[_0x1bd5('0x5e')](_0x3bce00[_0x1bd5('0x5f')]);_0x293fc3({'count':_0x1a29f3[_0x1bd5('0x60')],'rows':_0x1a29f3});});},'VoiceChannelMixMonitor':function(_0x25da00){var _0x308de2=this;return new Promise(function(_0x53070e,_0x13985e){if(ami[_0x1bd5('0x1a')]()==![]){return _0x13985e(_0x308de2[_0x1bd5('0xf')](0x1f4,[config[_0x1bd5('0x10')]['ip'],config[_0x1bd5('0x10')][_0x1bd5('0x11')],'ami\x20disconnected'][_0x1bd5('0x1c')]('\x20')));}var _0x121bfb=schema(properties[_0x1bd5('0x61')])[_0x1bd5('0x2')](_0x25da00);if(_0x121bfb[_0x1bd5('0x60')]>0x0){return _0x13985e(_0x308de2[_0x1bd5('0xf')](0x1f4,_[_0x1bd5('0x62')](_0x121bfb,'message')['join'](',\x20')));}var _0x126221=_[_0x1bd5('0x63')](_0x3bce00[_0x1bd5('0x5f')],{'uniqueid':_0x25da00['uniqueid']});if(_0x126221&&_0x126221[_0x1bd5('0x64')]){var _0x1bb55b=util[_0x1bd5('0x5')](_0x1bd5('0x65'),_0x25da00[_0x1bd5('0x66')]||_0x25da00[_0x1bd5('0x67')],_0x25da00[_0x1bd5('0x5')]||'wav');return ami[_0x1bd5('0x17')]({'action':_0x1bd5('0x68'),'channel':_0x126221['channel'],'file':_0x1bb55b,'options':_0x1bd5('0x69')})['then'](function(_0x29f5c2){var _0x4daea9=_[_0x1bd5('0x63')](_0x126221[_0x1bd5('0x6a')],{'filename':'/var/spool/asterisk/monitor/'+_0x1bb55b[_0x1bd5('0x6b')]()});if(_[_0x1bd5('0x6c')](_0x4daea9)){_0x126221[_0x1bd5('0x6a')][_0x1bd5('0x5b')]({'filename':_0x1bd5('0x6d')+_0x1bb55b[_0x1bd5('0x6b')](),'createdAt':moment()[_0x1bd5('0x5')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x29f5c2[_0x1bd5('0x6e')],'status':'rec'});}else{_0x4daea9[_0x1bd5('0x6e')]=_0x29f5c2[_0x1bd5('0x6e')];_0x4daea9[_0x1bd5('0x6f')]='rec';}_0x53070e({'code':0xc8,'message':[_0x25da00['uniqueid'],_0x1bd5('0x70'),_0x29f5c2[_0x1bd5('0x6e')]][_0x1bd5('0x1c')]('\x20'),'mixmonitorid':_0x29f5c2[_0x1bd5('0x6e')]});})[_0x1bd5('0x1f')](function(_0x62c890){_0x13985e(_0x308de2[_0x1bd5('0xf')](0x1f5,[_0x25da00[_0x1bd5('0x67')],_0x62c890[_0x1bd5('0x19')][_0x1bd5('0x6b')]()]['join']('\x20')));});}else{return _0x13985e(_0x308de2[_0x1bd5('0xf')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x2fe8f4){var _0x34d93b=this;return new Promise(function(_0x179d1e,_0x513b85){if(ami[_0x1bd5('0x1a')]()==![]){return _0x513b85(_0x34d93b[_0x1bd5('0xf')](0x1f4,[config[_0x1bd5('0x10')]['ip'],config['asterisk'][_0x1bd5('0x11')],_0x1bd5('0x1b')][_0x1bd5('0x1c')]('\x20')));}var _0x197e74=schema(properties['voicechannel'])['validate'](_0x2fe8f4);if(_0x197e74[_0x1bd5('0x60')]>0x0){return _0x513b85(_0x34d93b[_0x1bd5('0xf')](0x1f4,_[_0x1bd5('0x62')](_0x197e74,'message')['join'](',\x20')));}var _0x2bc0dc=_['find'](_0x3bce00[_0x1bd5('0x5f')],{'uniqueid':_0x2fe8f4[_0x1bd5('0x67')]});if(_0x2bc0dc){return BPromise['resolve']()[_0x1bd5('0x18')](function(){if(_0x2bc0dc['channel']){return ami[_0x1bd5('0x17')]({'action':'StopMixMonitor','channel':_0x2bc0dc[_0x1bd5('0x64')],'mixmonitorid':_0x2fe8f4[_0x1bd5('0x6e')]})['catch'](function(_0x2d1b1e){});}})[_0x1bd5('0x18')](function(){if(_0x2bc0dc['destinationchannel']){return ami['Action']({'action':_0x1bd5('0x71'),'channel':_0x2bc0dc[_0x1bd5('0x72')],'mixmonitorid':_0x2fe8f4['mixmonitorid']})[_0x1bd5('0x1f')](function(_0x40b508){});}})['then'](function(_0x551f22){var _0x14dd41=_[_0x1bd5('0x63')](_0x2bc0dc[_0x1bd5('0x6a')],{'mixmonitorid':_0x2fe8f4['mixmonitorid']});if(_0x14dd41){_0x14dd41[_0x1bd5('0x6f')]=_0x1bd5('0x73');}})['then'](function(){var _0x4b317d=util[_0x1bd5('0x5')](_0x1bd5('0x65'),_0x2fe8f4[_0x1bd5('0x66')]||_0x2fe8f4[_0x1bd5('0x67')],_0x2fe8f4[_0x1bd5('0x5')]||'wav');var _0x3827d7=_['find'](_0x2bc0dc[_0x1bd5('0x6a')],{'filename':_0x1bd5('0x6d')+_0x4b317d[_0x1bd5('0x6b')]()});if(_0x3827d7){_0x3827d7[_0x1bd5('0x6f')]='stop';}})['then'](function(){_0x179d1e({'code':0xc8,'message':[_0x2fe8f4[_0x1bd5('0x67')],_0x1bd5('0x74')][_0x1bd5('0x1c')]('\x20')});})[_0x1bd5('0x1f')](function(_0xae8acf){_0x513b85(_0x34d93b[_0x1bd5('0xf')](0x1f5,[_0x2fe8f4[_0x1bd5('0x67')],_0xae8acf[_0x1bd5('0x19')][_0x1bd5('0x6b')]()][_0x1bd5('0x1c')]('\x20')));});}else{return _0x513b85(_0x34d93b[_0x1bd5('0xf')](0x1f5,_0x1bd5('0x75')));}});},'VoiceQueuesChannels':function(_0x437bd5){return new Promise(function(_0x27be44,_0x3f9518){var _0x154bf5=_[_0x1bd5('0x5e')](_0x3bce00[_0x1bd5('0x76')]);_0x27be44({'count':_0x154bf5[_0x1bd5('0x60')],'rows':_0x154bf5});});},'VoiceQueuesChannel':function(_0x1ffbab){var _0x1f536d=this;return new Promise(function(_0x4ba749,_0x1fa551){var _0x3ddf27=schema(properties['voicequeuechannel'])[_0x1bd5('0x2')](_0x1ffbab);if(_0x3ddf27[_0x1bd5('0x60')]>0x0){return _0x1fa551(_0x1f536d[_0x1bd5('0xf')](0x1f4,_[_0x1bd5('0x62')](_0x3ddf27,_0x1bd5('0x19'))[_0x1bd5('0x1c')](',\x20')));}var _0x1e282c=_['find'](_0x3bce00[_0x1bd5('0x76')],{'uniqueid':_0x1ffbab[_0x1bd5('0x67')]});if(_0x1e282c){_0x4ba749(_0x1e282c);}else{return _0x1fa551(_0x1f536d[_0x1bd5('0xf')](0x1f5,_0x1bd5('0x75')));}});},'VoiceQueuesChannelHangup':function(_0x590b3d){var _0x2ed59d=this;return new Promise(function(_0x31effa,_0x173fd2){if(ami[_0x1bd5('0x1a')]()==![]){return _0x173fd2(_0x2ed59d[_0x1bd5('0xf')](0x1f4,[config[_0x1bd5('0x10')]['ip'],config[_0x1bd5('0x10')]['username'],_0x1bd5('0x1b')]['join']('\x20')));}var _0x4fe10a=schema(properties[_0x1bd5('0x77')])['validate'](_0x590b3d);if(_0x4fe10a[_0x1bd5('0x60')]>0x0){return _0x173fd2(_0x2ed59d[_0x1bd5('0xf')](0x1f4,_['map'](_0x4fe10a,_0x1bd5('0x19'))[_0x1bd5('0x1c')](',\x20')));}var _0xe5a36d=_[_0x1bd5('0x63')](_0x3bce00[_0x1bd5('0x76')],{'uniqueid':_0x590b3d[_0x1bd5('0x67')]});if(_0xe5a36d&&_0xe5a36d['channel']){return ami[_0x1bd5('0x17')]({'action':_0x1bd5('0x78'),'channel':_0xe5a36d[_0x1bd5('0x64')]})[_0x1bd5('0x18')](function(_0x4e6258){_0x31effa({'code':0xc8,'message':[_0x590b3d['uniqueid'],_0x4e6258[_0x1bd5('0x19')][_0x1bd5('0x6b')]()][_0x1bd5('0x1c')]('\x20')});})[_0x1bd5('0x1f')](function(_0x502942){_0x173fd2(_0x2ed59d[_0x1bd5('0xf')](0x1f5,[_0x590b3d['uniqueid'],_0x502942['message'][_0x1bd5('0x6b')]()]['join']('\x20')));});}else{return _0x173fd2(_0x2ed59d[_0x1bd5('0xf')](0x1f5,_0x1bd5('0x75')));}});},'VoiceQueuesChannelRedirect':function(_0x231556){var _0x2a474a=this;return new Promise(function(_0xaa3282,_0xab4ed6){if(ami[_0x1bd5('0x1a')]()==![]){return _0xab4ed6(_0x2a474a[_0x1bd5('0xf')](0x1f4,[config[_0x1bd5('0x10')]['ip'],config['asterisk'][_0x1bd5('0x11')],'ami\x20disconnected']['join']('\x20')));}var _0x59b491=schema(properties[_0x1bd5('0x79')])['validate'](_0x231556);if(_0x59b491[_0x1bd5('0x60')]>0x0){return _0xab4ed6(_0x2a474a[_0x1bd5('0xf')](0x1f4,_[_0x1bd5('0x62')](_0x59b491,_0x1bd5('0x19'))[_0x1bd5('0x1c')](',\x20')));}var _0x91bcf8=_[_0x1bd5('0x63')](_0x3bce00['queueChannels'],{'uniqueid':_0x231556[_0x1bd5('0x67')]});if(_0x91bcf8&&_0x91bcf8['channel']){return ami[_0x1bd5('0x17')]({'action':_0x1bd5('0x7a'),'channel':_0x91bcf8[_0x1bd5('0x64')],'exten':_0x231556['exten'],'context':_0x231556['context']||_0x91bcf8[_0x1bd5('0x7b')],'priority':0x1})['then'](function(_0x3bec89){_0xaa3282({'code':0xc8,'message':[_0x231556['uniqueid'],_0x3bec89[_0x1bd5('0x19')][_0x1bd5('0x6b')]()][_0x1bd5('0x1c')]('\x20')});})[_0x1bd5('0x1f')](function(_0x38f9e3){_0xab4ed6(_0x2a474a[_0x1bd5('0xf')](0x1f5,[_0x231556[_0x1bd5('0x67')],_0x38f9e3[_0x1bd5('0x19')][_0x1bd5('0x6b')]()][_0x1bd5('0x1c')]('\x20')));});}else{return _0xab4ed6(_0x2a474a[_0x1bd5('0xf')](0x1f5,_0x1bd5('0x75')));}});},'Agents':function(_0x3bf3bf){return new Promise(function(_0x3882db,_0x541f2d){var _0x2a1b4a=_[_0x1bd5('0x5e')](_0x3bce00[_0x1bd5('0xb')]);_0x3882db({'count':_0x2a1b4a['length'],'rows':_0x2a1b4a});});},'Telephones':function(_0x84b186){return new Promise(function(_0x3055b3,_0x4fd2d1){var _0x3a9d0b=_[_0x1bd5('0x5e')](_0x3bce00[_0x1bd5('0x7c')]);_0x3055b3({'count':_0x3a9d0b['length'],'rows':_0x3a9d0b});});},'Trunks':function(_0x2db6da){return new Promise(function(_0x24ff69,_0x2279ae){var _0x2629b6=_['values'](_0x3bce00[_0x1bd5('0x7d')]);_0x24ff69({'count':_0x2629b6[_0x1bd5('0x60')],'rows':_0x2629b6});});},'OutboundChannels':function(_0x1c05a4){return new Promise(function(_0x4916c7,_0x1645b6){var _0x323db1=_['values'](_0x3bce00['outboundChannels']);_0x4916c7({'count':_0x323db1[_0x1bd5('0x60')],'rows':_0x323db1});});},'Outbound':function(_0x182d75){return new Promise(function(_0x5c9098,_0x5d6b17){_0x5c9098(_0x3bce00[_0x1bd5('0x30')]);});},'Campaigns':function(_0x5ce94f){return new Promise(function(_0x56bb24,_0x112844){var _0x5cb13d=_[_0x1bd5('0x5e')](_0x3bce00[_0x1bd5('0x7e')]);_0x56bb24({'count':_0x5cb13d['length'],'rows':_0x5cb13d});});},'VoiceQueuesPreview':function(_0x66914f){var _0x254c8d=this;return new Promise(function(_0x319fbf,_0x5f38c7){_0x362b24[_0x1bd5('0x7f')](_0x66914f['id'])['then'](function(_0x2d7025){_0x319fbf({'code':0xc8,'message':_0x2d7025[_0x1bd5('0x19')]});})[_0x1bd5('0x1f')](function(_0x24e013){_0x5f38c7(_0x254c8d[_0x1bd5('0xf')](0x1f4,_0x24e013['message']));});});},'EventManager':function(_0x22f8cd){var _0x4a8e67=this;return new Promise(function(_0x298c7c,_0x4f40c7){if(!_0x22f8cd['event']){return _0x4f40c7(_0x4a8e67[_0x1bd5('0xf')](0x1f4,_0x1bd5('0x80')));}ami[_0x1bd5('0x81')](_0x1bd5('0x82')+_0x22f8cd['event'],_0x22f8cd[_0x1bd5('0x19')]);_0x298c7c({'code':0xc8,'message':_0x22f8cd});});},'FaxAccounts':function(_0x3ec572){return new Promise(function(_0x2ede9d,_0x374f89){var _0x15e584=_[_0x1bd5('0x5e')](_0x3bce00[_0x1bd5('0x83')]);_0x2ede9d({'count':_0x15e584[_0x1bd5('0x60')],'rows':_0x15e584});});},'SendFax':function(_0x22e1f4){var _0x347d06=this;return new Promise(function(_0x3cf023,_0x33b46d){_0x43e6b6[_0x1bd5('0x84')](_0x22e1f4)[_0x1bd5('0x18')](function(_0x4789ad){_0x3cf023({'code':0xc8,'message':_0x4789ad[_0x1bd5('0x19')]});})[_0x1bd5('0x1f')](function(_0x1391ac){_0x33b46d(_0x347d06[_0x1bd5('0xf')](0x1f4,_0x1391ac[_0x1bd5('0x19')]));});});},'CheckAfterSend':function(_0x26f9ad){var _0x28f567=this;return new Promise(function(_0x2a7a91,_0xf61654){_0x43e6b6[_0x1bd5('0x85')](_0x26f9ad)[_0x1bd5('0x18')](function(_0x56fb4b){_0x2a7a91({'code':0xc8,'message':_0x56fb4b[_0x1bd5('0x19')]});})[_0x1bd5('0x1f')](function(_0x2268db){_0xf61654(_0x28f567[_0x1bd5('0xf')](0x1f4,_0x2268db['message']));});});}};var _0x105e91=jayson[_0x1bd5('0x86')](_0x30a385)['http']();_0x105e91['on']('error',function(_0x57ca48){return _0x29abea(_0x57ca48);});_0x105e91[_0x1bd5('0x87')](0x232a,_0x1bd5('0x88'),function(){console[_0x1bd5('0x89')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x59ddfb('RPC\x20listening\x20on\x20port:'+0x232a);});});};
\ No newline at end of file