Built motion from commit 8356fca3.|2.6.19
[motion2.git] / server / services / ami / report / voiceQueueReport.js
index c8cd5dd..697bea7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1c23=['[%s][voiceQueueReport][checkChannel]','inspect','queueReports','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','emit','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','queue','voice_queue_presence:save','debug',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','ATTENDEDTRANSFER','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','isUndefined','clearZombieChannels','Action','queues','isRunning','then','actionid','queuestatus','[voiceQueueReport][queuesummary]','createQueueSummaryReport','name','summaryEvent','createReport','realtime','compareToInboundQueue','assign','handleInboundQueueSummaryReport','outbound','custom:queuesummary','statusRequests','completeEvent','push','isNotNull','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','routealias','info','pick','keys','emitVoiceQueueChannelSave','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','queuecallerleaveAt','connectedlinenum','connectedlinename','[%s][voiceQueueReport][queuecallerleave]','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','local/','linkedid','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','variable','value','CONTINUE','TIMEOUT','lastevent','timeout','custom:timeout','queueposition','EXITWITHKEY','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','handleHangup','length','sumHoldTime','sumDuration','milliseconds','total','answered','sumBillable','diff','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][hangup]','cause-txt','cause','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','[%s][voiceQueueReport][attendedtransfer]','secondtransfererexten','secondtransfereruniqueid','transfereeuniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','ATTENDED','origtransfereruniqueid','syncBlindTransfer','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohstarttime','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','set','applicationdata','appdata','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceQueueReport][newexten]','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','../model/voiceQueueSummary','redis','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','agents','channels','queueChannels','voiceQueues','campaigns','summary','variables','queuesummary','syncQueueSummary','bind','syncQueueSummaryComplete','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','pTalking','queueStatusComplete','queuecallerexit','queuecallercomplete','switch','isNil','channel','catch','message','No\x20such\x20channel','error'];(function(_0x15180b,_0x23dac3){var _0x4f02fe=function(_0x39f0b3){while(--_0x39f0b3){_0x15180b['push'](_0x15180b['shift']());}};_0x4f02fe(++_0x23dac3);}(_0x1c23,0x1b6));var _0x31c2=function(_0x2071d8,_0xb92a7b){_0x2071d8=_0x2071d8-0x0;var _0x1e43da=_0x1c23[_0x2071d8];return _0x1e43da;};'use strict';var _=require(_0x31c2('0x0'));var moment=require('moment');var util=require(_0x31c2('0x1'));var Redis=require(_0x31c2('0x2'));var config=require(_0x31c2('0x3'));var logger=require(_0x31c2('0x4'))(_0x31c2('0x5'));var ami=require(_0x31c2('0x6'));var QueueReport=require(_0x31c2('0x7'));var VoiceQueueSummary=require(_0x31c2('0x8'));config[_0x31c2('0x9')]=_['defaults'](config[_0x31c2('0x9')],{'host':_0x31c2('0xa'),'port':0x18eb});var io=require(_0x31c2('0xb'))(new Redis(config[_0x31c2('0x9')]));var Sequence=function(){};Sequence[_0x31c2('0xc')][_0x31c2('0xd')]=function(_0x4c92af){this['tail']=this['tail']?this[_0x31c2('0xe')]['finally'](_0x4c92af):_0x4c92af();};function VoiceQueueReport(_0x324531){this[_0x31c2('0xf')]=new Sequence();this['queueReports']={};this['realtime']=_0x324531;this['agents']=_0x324531[_0x31c2('0x10')];this[_0x31c2('0x11')]=_0x324531[_0x31c2('0x12')];this[_0x31c2('0x13')]=_0x324531[_0x31c2('0x13')];this[_0x31c2('0x14')]=_0x324531[_0x31c2('0x14')];this[_0x31c2('0x15')]=initializeSummary();this[_0x31c2('0x16')]={};ami['on'](_0x31c2('0x17'),this[_0x31c2('0x18')][_0x31c2('0x19')](this));ami['on']('queuesummarycomplete',this[_0x31c2('0x1a')]['bind'](this));ami['on'](_0x31c2('0x1b'),this[_0x31c2('0x1c')][_0x31c2('0x19')](this));ami['on'](_0x31c2('0x1d'),this[_0x31c2('0x1e')][_0x31c2('0x19')](this));ami['on'](_0x31c2('0x1f'),this[_0x31c2('0x20')]['bind'](this));ami['on'](_0x31c2('0x21'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x31c2('0x22'),this[_0x31c2('0x23')][_0x31c2('0x19')](this));ami['on'](_0x31c2('0x24'),this[_0x31c2('0x25')]['bind'](this));ami['on'](_0x31c2('0x26'),this[_0x31c2('0x27')][_0x31c2('0x19')](this));ami['on'](_0x31c2('0x28'),this[_0x31c2('0x29')][_0x31c2('0x19')](this));ami['on'](_0x31c2('0x2a'),this[_0x31c2('0x2b')]['bind'](this));ami['on']('fullybooted',this[_0x31c2('0x2c')][_0x31c2('0x19')](this));ami['on'](_0x31c2('0x2d'),this[_0x31c2('0x2e')][_0x31c2('0x19')](this));ami['on']('musiconholdstop',this[_0x31c2('0x2f')][_0x31c2('0x19')](this));ami['on'](_0x31c2('0x30'),this[_0x31c2('0x31')][_0x31c2('0x19')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x31c2('0x19')](this));this[_0x31c2('0x32')]();this[_0x31c2('0x33')]();}function clearChannels(_0x3ac94d){if(!_[_0x31c2('0x34')](_0x3ac94d)){for(var _0x488224 in _0x3ac94d){if(_0x3ac94d[_0x31c2('0x35')](_0x488224)){delete _0x3ac94d[_0x488224];}}}}function clearCampaigns(_0x418163){if(!_[_0x31c2('0x34')](_0x418163)){for(var _0x1a8e0e in _0x418163){if(_0x418163['hasOwnProperty'](_0x1a8e0e)){_0x418163[_0x1a8e0e][_0x31c2('0x36')]=0x0;}}}}function clearVoiceQueues(_0x1bc554){if(!_['isEmpty'](_0x1bc554)){for(var _0x8cd928 in _0x1bc554){if(_0x1bc554[_0x31c2('0x35')](_0x8cd928)){_0x1bc554[_0x8cd928][_0x31c2('0x36')]=0x0;_0x1bc554[_0x8cd928]['talking']=0x0;_0x1bc554[_0x8cd928][_0x31c2('0x37')]=0x0;_0x1bc554[_0x8cd928]['waiting']=0x0;_0x1bc554[_0x8cd928][_0x31c2('0x38')]=!![];}}}}function clearAgentBooked(_0x49c16c){if(!_[_0x31c2('0x34')](_0x49c16c)){for(var _0x130572 in _0x49c16c){if(_0x49c16c['hasOwnProperty'](_0x130572)){_0x49c16c[_0x130572]['unlockRR']=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x6a575f){return _0x6a575f[_0x31c2('0x39')]||_0x6a575f['queuecallerabandon']||_0x6a575f[_0x31c2('0x3a')];}VoiceQueueReport[_0x31c2('0xc')]['clearZombieChannels']=function(){var _0x30a49a=this;for(var _0x362e6a in this[_0x31c2('0x11')]){if(this[_0x31c2('0x11')][_0x31c2('0x35')](_0x362e6a)&&!this[_0x31c2('0x11')][_0x362e6a][_0x31c2('0x3b')]){this[_0x31c2('0xf')][_0x31c2('0xd')](function(){if(!_[_0x31c2('0x3c')](_0x30a49a[_0x31c2('0x11')][_0x362e6a])){return ami['Action']({'action':'status','channel':_0x30a49a[_0x31c2('0x11')][_0x362e6a][_0x31c2('0x3d')]})[_0x31c2('0x3e')](function(_0x487f0c){if(_0x487f0c[_0x31c2('0x3f')]===_0x31c2('0x40')){setTimeout(function(){if(_0x30a49a['channels'][_0x362e6a]){delete _0x30a49a[_0x31c2('0x11')][_0x362e6a];logger[_0x31c2('0x41')](_0x31c2('0x42'),_0x362e6a,util[_0x31c2('0x43')](_0x487f0c,{'showHidden':![],'depth':null}));}if(_0x30a49a['queueReports'][_0x362e6a]){delete _0x30a49a[_0x31c2('0x44')][_0x362e6a];logger[_0x31c2('0x41')](_0x31c2('0x45'),_0x362e6a,util[_0x31c2('0x43')](_0x487f0c,{'showHidden':![],'depth':null}));}if(_0x30a49a[_0x31c2('0x16')][_0x362e6a]){delete _0x30a49a[_0x31c2('0x16')][_0x362e6a];logger[_0x31c2('0x41')](_0x31c2('0x46'),_0x362e6a,util[_0x31c2('0x43')](_0x487f0c,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x31c2('0xc')][_0x31c2('0x2c')]=function(){logger[_0x31c2('0x41')](_0x31c2('0x47'));clearChannels(this[_0x31c2('0x11')]);this[_0x31c2('0x48')](this[_0x31c2('0x44')]);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0x31c2('0x13')]);clearCampaigns(this[_0x31c2('0x14')]);this[_0x31c2('0x15')]=initializeSummary();};VoiceQueueReport[_0x31c2('0xc')][_0x31c2('0x48')]=function(_0x21c671){var _0x611222=this;if(!_['isEmpty'](_0x21c671)){for(var _0x4125f5 in _0x21c671){if(_0x21c671[_0x31c2('0x35')](_0x4125f5)){_0x611222[_0x31c2('0x49')](_0x21c671[_0x4125f5],'clearqueuereport');delete _0x21c671[_0x4125f5];}}}};VoiceQueueReport[_0x31c2('0xc')][_0x31c2('0x4a')]=function(_0x2d6c5f,_0x153f52,_0x3e98f1){io['to'](_0x2d6c5f)[_0x31c2('0x4a')](_0x153f52,_0x3e98f1);};VoiceQueueReport[_0x31c2('0xc')]['emitVoiceQueueChannelSave']=function(_0x5df481,_0x41752d){logger['debug'](_0x31c2('0x4b')+_0x41752d+_0x31c2('0x4c'),_0x5df481[_0x31c2('0x4d')],util['inspect'](_0x5df481,{'showHidden':![],'depth':null}));this[_0x31c2('0x4a')](util[_0x31c2('0x4e')]('voice:queue:%s',_0x5df481[_0x31c2('0x4f')]),'voice_queue_channel:save',_0x5df481);io[_0x31c2('0x4a')](_0x31c2('0x50'),_0x5df481);};VoiceQueueReport[_0x31c2('0xc')][_0x31c2('0x49')]=function(_0x46187f,_0x44d932){logger[_0x31c2('0x51')](_0x31c2('0x4b')+_0x44d932+_0x31c2('0x52'),_0x46187f[_0x31c2('0x4d')],util[_0x31c2('0x43')](_0x46187f,{'showHidden':![],'depth':null}));if(_0x46187f[_0x31c2('0x53')]===_0x31c2('0x54')){return;}this[_0x31c2('0x4a')](util[_0x31c2('0x4e')](_0x31c2('0x55'),_0x46187f[_0x31c2('0x4f')]),_0x31c2('0x56'),_0x46187f);io[_0x31c2('0x4a')](_0x31c2('0x57'),_0x46187f);};VoiceQueueReport[_0x31c2('0xc')][_0x31c2('0x58')]=function(_0x310aec){if(_0x310aec[_0x31c2('0x59')]===_0x31c2('0x5a')){logger['debug'](_0x31c2('0x5b'),util[_0x31c2('0x43')](_0x310aec,{'showHidden':![],'depth':null}));this[_0x31c2('0x4a')](util[_0x31c2('0x4e')](_0x31c2('0x55'),_0x310aec['name']),'voice_queue:save',_0x310aec);}};VoiceQueueReport[_0x31c2('0xc')]['isNotNull']=function(_0x2fd501){return _0x2fd501!==null&&!_[_0x31c2('0x5c')](_0x2fd501);};VoiceQueueReport[_0x31c2('0xc')][_0x31c2('0x33')]=function(){var _0x207e63=this;setInterval(function(){_0x207e63[_0x31c2('0x5d')]();ami[_0x31c2('0x5e')]({'action':_0x31c2('0x5f')})[_0x31c2('0x3e')](function(_0x2c0479){logger[_0x31c2('0x41')]('[voiceQueueReport][queues]',util[_0x31c2('0x43')](_0x2c0479,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x31c2('0xc')][_0x31c2('0x32')]=function(){var _0x1434a4=this;setInterval(function(){if(!_0x1434a4[_0x31c2('0x15')][_0x31c2('0x60')]){return ami[_0x31c2('0x5e')]({'action':_0x31c2('0x17')})[_0x31c2('0x61')](function(_0x16f652){_0x1434a4[_0x31c2('0x15')]['id']=_0x16f652[_0x31c2('0x62')];_0x1434a4[_0x31c2('0x15')][_0x31c2('0x60')]=!![];_0x1434a4[_0x31c2('0x15')][_0x31c2('0x63')][_0x16f652[_0x31c2('0x62')]]={};})[_0x31c2('0x3e')](function(_0x3b3d98){logger['error'](_0x31c2('0x64'),util[_0x31c2('0x43')](_0x3b3d98,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x31c2('0xc')][_0x31c2('0x65')]=function(_0x7634af,_0x4a756f){var _0x3e202b;if(this[_0x31c2('0x15')]&&this[_0x31c2('0x15')][_0x31c2('0x5f')]&&this[_0x31c2('0x15')][_0x31c2('0x5f')][_0x7634af[_0x31c2('0x66')]]){_0x3e202b=this['summary'][_0x31c2('0x5f')][_0x7634af[_0x31c2('0x66')]][_0x31c2('0x67')];}var _0x48b503=new VoiceQueueSummary(_0x7634af);return _0x48b503[_0x31c2('0x68')](_0x4a756f['agents'],this[_0x31c2('0x10')],_0x3e202b,this[_0x31c2('0x69')][_0x31c2('0x11')]);};VoiceQueueReport[_0x31c2('0xc')]['handleInboundQueueSummaryReport']=function(_0x353874,_0x4b8208){var _0x2c17be=this['createQueueSummaryReport'](_0x353874,_0x4b8208);var _0x77fd4a=![];_0x77fd4a=_0x2c17be[_0x31c2('0x6a')](_0x353874);if(_0x77fd4a){Object[_0x31c2('0x6b')](_0x353874,_0x2c17be);this['realtime'][_0x31c2('0x13')][_0x353874['name']]=_0x353874;this[_0x31c2('0x58')](_0x2c17be);}};VoiceQueueReport[_0x31c2('0xc')][_0x31c2('0x1e')]=function(_0x2f84b4){var _0x3a0549=null;var _0x20a27f=this[_0x31c2('0x15')]['id'];if(this[_0x31c2('0x15')][_0x31c2('0x63')][_0x20a27f]){_0x3a0549=this[_0x31c2('0x15')]['queuestatus'][_0x20a27f][_0x2f84b4['actionid']];}if(!_0x3a0549){this['summary']=initializeSummary();return;}var _0x48c200=this['voiceQueues'][_0x3a0549[_0x31c2('0x4f')]];if(_0x48c200['type']==='inbound'){this[_0x31c2('0x6c')](_0x48c200,_0x3a0549);}else if(_0x48c200[_0x31c2('0x59')]===_0x31c2('0x6d')){var _0x103684=this[_0x31c2('0x65')](_0x48c200,_0x3a0549);ami['emit'](_0x31c2('0x6e'),_0x103684);}this[_0x31c2('0x15')][_0x31c2('0x6f')]-=0x1;var _0x2eca46=this[_0x31c2('0x15')][_0x31c2('0x6f')]>0x0?!![]:![];if(!_0x2eca46){return this[_0x31c2('0x1a')](this[_0x31c2('0x15')][_0x31c2('0x70')]);}};VoiceQueueReport[_0x31c2('0xc')][_0x31c2('0x1c')]=function(_0x3fbda3){var _0x18abab=this[_0x31c2('0x15')]['id'];if(this[_0x31c2('0x15')][_0x31c2('0x63')][_0x18abab]&&this[_0x31c2('0x15')][_0x31c2('0x63')][_0x18abab][_0x3fbda3[_0x31c2('0x62')]]){this[_0x31c2('0x15')]['queuestatus'][_0x18abab][_0x3fbda3[_0x31c2('0x62')]]['agents'][_0x31c2('0x71')](_0x3fbda3);}};VoiceQueueReport[_0x31c2('0xc')]['syncQueueSummary']=function(_0x4b52db){var _0xb701af=this;try{if(this[_0x31c2('0x72')](_0x4b52db)&&this[_0x31c2('0x72')](_0x4b52db[_0x31c2('0x4f')])){logger[_0x31c2('0x51')](_0x31c2('0x73'),util[_0x31c2('0x43')](_0x4b52db,{'showHidden':![],'depth':null}));var _0x49f486=this[_0x31c2('0x13')][_0x4b52db[_0x31c2('0x4f')]];if(_0x49f486){logger[_0x31c2('0x51')](_0x31c2('0x74'),_0x49f486['name']);this[_0x31c2('0x15')][_0x31c2('0x5f')][_0x49f486[_0x31c2('0x66')]]={'summaryEvent':_0x4b52db};this['summary'][_0x31c2('0x6f')]+=0x1;return ami['Action']({'action':_0x31c2('0x63'),'queue':_0x49f486[_0x31c2('0x66')]})[_0x31c2('0x61')](function(_0x37d55d){if(!_0xb701af[_0x31c2('0x15')]['queuestatus'][_0x4b52db[_0x31c2('0x62')]]){_0xb701af['summary']['queuestatus'][_0x4b52db[_0x31c2('0x62')]]={};}_0xb701af[_0x31c2('0x15')]['queuestatus'][_0x4b52db[_0x31c2('0x62')]][_0x37d55d[_0x31c2('0x62')]]={'queue':_0x49f486['name'],'agents':[]};})[_0x31c2('0x3e')](function(_0x121dc2){throw _0x121dc2;});}}}catch(_0x514136){logger['error'](_0x31c2('0x64'),util[_0x31c2('0x43')](_0x514136,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x31c2('0xc')][_0x31c2('0x1a')]=function(_0x47d6cb){if(this[_0x31c2('0x15')][_0x31c2('0x6f')]>0x0){this[_0x31c2('0x15')][_0x31c2('0x70')]=_0x47d6cb;return;}logger[_0x31c2('0x51')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x31c2('0x43')](_0x47d6cb,{'showHidden':![],'depth':null}));this[_0x31c2('0x15')]=initializeSummary();ami['emit']('custom:queuesummarycomplete',{});};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x2beaa8){try{if(this[_0x31c2('0x72')](_0x2beaa8)){logger[_0x31c2('0x51')](_0x31c2('0x75'),_0x2beaa8['uniqueid'],util['inspect'](_0x2beaa8,{'showHidden':![],'depth':null}));if(_[_0x31c2('0x5c')](this['queueReports'][_0x2beaa8[_0x31c2('0x4d')]])){this[_0x31c2('0x44')][_0x2beaa8[_0x31c2('0x4d')]]=[];}if(_['isUndefined'](this[_0x31c2('0x11')][_0x2beaa8['uniqueid']])){this[_0x31c2('0x11')][_0x2beaa8[_0x31c2('0x4d')]]={};}var _0x268542=new QueueReport();_0x268542[_0x31c2('0x4f')]=_0x2beaa8[_0x31c2('0x4f')];_0x268542[_0x31c2('0x59')]=this[_0x31c2('0x13')][_0x268542[_0x31c2('0x4f')]]&&this['voiceQueues'][_0x268542[_0x31c2('0x4f')]][_0x31c2('0x59')]?this[_0x31c2('0x13')][_0x268542[_0x31c2('0x4f')]][_0x31c2('0x59')]||'inbound':_0x31c2('0x5a');_0x268542[_0x31c2('0x76')]=moment()['format'](_0x31c2('0x77'));_0x268542[_0x31c2('0x78')]=_0x2beaa8['position'];_0x268542['count']=_0x2beaa8[_0x31c2('0x79')];_0x268542[_0x31c2('0x4d')]=_0x2beaa8[_0x31c2('0x4d')];_0x268542['routealias']=this[_0x31c2('0x11')][_0x2beaa8[_0x31c2('0x4d')]][_0x31c2('0x7a')];logger[_0x31c2('0x7b')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x268542[_0x31c2('0x4f')],_0x268542[_0x31c2('0x59')]);Object[_0x31c2('0x6b')](_0x268542,_[_0x31c2('0x7c')](_0x2beaa8,_[_0x31c2('0x7d')](_0x268542)));this['queueReports'][_0x2beaa8[_0x31c2('0x4d')]][_0x31c2('0x71')](_0x268542);this['channels'][_0x2beaa8[_0x31c2('0x4d')]]=_0x268542;this[_0x31c2('0x7e')](_0x268542,_0x31c2('0x1f'));}}catch(_0x279bc6){logger[_0x31c2('0x41')](_0x31c2('0x75'),_0x2beaa8[_0x31c2('0x4d')],util['inspect'](_0x279bc6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x31c2('0xc')]['syncQueueCallerAbandon']=function(_0x67daf4){try{if(this[_0x31c2('0x72')](_0x67daf4)){logger['debug'](_0x31c2('0x7f'),_0x67daf4['uniqueid'],util[_0x31c2('0x43')](_0x67daf4,{'showHidden':![],'depth':null}));if(this[_0x31c2('0x44')][_0x67daf4[_0x31c2('0x4d')]]){var _0x4a99c6=_[_0x31c2('0x80')](this[_0x31c2('0x44')][_0x67daf4['uniqueid']]);_0x4a99c6[_0x31c2('0x3a')]=![];_0x4a99c6[_0x31c2('0x81')]=null;_0x4a99c6[_0x31c2('0x82')]=_0x67daf4[_0x31c2('0x82')];_0x4a99c6[_0x31c2('0x83')]=_0x67daf4[_0x31c2('0x83')];_0x4a99c6[_0x31c2('0x21')]=!![];_0x4a99c6[_0x31c2('0x84')]=moment()[_0x31c2('0x4e')](_0x31c2('0x77'));_0x4a99c6['queuecallerexitreason']=_0x31c2('0x85');_0x4a99c6[_0x31c2('0x86')]=null;logger[_0x31c2('0x7b')](_0x31c2('0x87'),_0x4a99c6[_0x31c2('0x4f')],_0x4a99c6[_0x31c2('0x59')]);this[_0x31c2('0x11')][_0x67daf4[_0x31c2('0x4d')]]=_0x4a99c6;this[_0x31c2('0x49')](_0x4a99c6,_0x31c2('0x21'));}}}catch(_0x49f0d9){logger['error'](_0x31c2('0x7f'),_0x67daf4[_0x31c2('0x4d')],util['inspect'](_0x49f0d9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x31c2('0xc')][_0x31c2('0x23')]=function(_0x438818){try{if(this[_0x31c2('0x72')](_0x438818)){logger[_0x31c2('0x51')]('[%s][voiceQueueReport][queuecallerleave]',_0x438818[_0x31c2('0x4d')],util['inspect'](_0x438818,{'showHidden':![],'depth':null}));if(this[_0x31c2('0x44')][_0x438818['uniqueid']]){var _0xdccd99=_[_0x31c2('0x80')](this['queueReports'][_0x438818['uniqueid']]);_0xdccd99[_0x31c2('0x88')]=moment()[_0x31c2('0x4e')](_0x31c2('0x77'));_0xdccd99[_0x31c2('0x89')]=_0x438818['connectedlinenum'];_0xdccd99[_0x31c2('0x8a')]=_0x438818[_0x31c2('0x8a')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0xdccd99[_0x31c2('0x4f')],_0xdccd99[_0x31c2('0x59')],_0x438818[_0x31c2('0x89')],_0x438818[_0x31c2('0x8a')]);this[_0x31c2('0x11')][_0x438818[_0x31c2('0x4d')]]=_0xdccd99;this[_0x31c2('0x7e')](_0xdccd99,'queuecallerleave');}}}catch(_0xbc1b97){logger[_0x31c2('0x41')](_0x31c2('0x8b'),_0x438818[_0x31c2('0x4d')],util[_0x31c2('0x43')](_0xbc1b97,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x31c2('0xc')][_0x31c2('0x27')]=function(_0x236ea2){try{if(this[_0x31c2('0x72')](_0x236ea2)){logger['debug'](_0x31c2('0x8c'),_0x236ea2[_0x31c2('0x4d')],util[_0x31c2('0x43')](_0x236ea2,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x236ea2[_0x31c2('0x4d')]]){var _0x4d5428=_[_0x31c2('0x80')](this[_0x31c2('0x44')][_0x236ea2[_0x31c2('0x4d')]]);_0x4d5428[_0x31c2('0x3a')]=!![];_0x4d5428[_0x31c2('0x53')]=_0x31c2('0x8d');logger['info'](_0x31c2('0x8e'),_0x4d5428[_0x31c2('0x4f')],_0x4d5428[_0x31c2('0x59')]);}}}catch(_0x4b8676){logger[_0x31c2('0x41')](_0x31c2('0x8c'),_0x236ea2[_0x31c2('0x4d')],util[_0x31c2('0x43')](_0x4b8676,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x21b2df){try{if(this[_0x31c2('0x72')](_0x21b2df)){logger[_0x31c2('0x51')](_0x31c2('0x8f'),_0x21b2df[_0x31c2('0x4d')],util[_0x31c2('0x43')](_0x21b2df,{'showHidden':![],'depth':null}));if(this[_0x31c2('0x44')][_0x21b2df[_0x31c2('0x4d')]]){var _0x3edeb3=_[_0x31c2('0x80')](this[_0x31c2('0x44')][_0x21b2df[_0x31c2('0x4d')]]);_0x3edeb3[_0x31c2('0x21')]=![];_0x3edeb3['queuecallerabandonAt']=null;_0x3edeb3[_0x31c2('0x90')]=!![];_0x3edeb3[_0x31c2('0x86')]=_0x21b2df[_0x31c2('0x91')];_0x3edeb3[_0x31c2('0x82')]=_0x21b2df[_0x31c2('0x82')];_0x3edeb3[_0x31c2('0x3a')]=!![];_0x3edeb3[_0x31c2('0x39')]=![];_0x3edeb3[_0x31c2('0x92')]=null;if(!_0x3edeb3[_0x31c2('0x93')]){if(_0x21b2df[_0x31c2('0x94')]==_0x31c2('0x93')){_0x3edeb3['queuecallerexitreason']=_0x31c2('0x95');logger[_0x31c2('0x7b')](_0x31c2('0x96'),_0x3edeb3[_0x31c2('0x4f')],_0x3edeb3[_0x31c2('0x59')]);}else{if(_[_0x31c2('0x97')](_0x21b2df[_0x31c2('0x3d')][_0x31c2('0x98')](),_0x31c2('0x99'))){if(this[_0x31c2('0x44')][_0x21b2df['linkedid']]){var _0x334953=_[_0x31c2('0x80')](this[_0x31c2('0x44')][_0x21b2df[_0x31c2('0x9a')]]);_0x334953[_0x31c2('0x3a')]=![];_0x334953[_0x31c2('0x39')]=!![];_0x334953['queuecallerexitAt']=moment(_0x3edeb3[_0x31c2('0x76')])['add'](_0x21b2df[_0x31c2('0x82')],_0x31c2('0x9b'))[_0x31c2('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x334953[_0x31c2('0x53')]=_0x31c2('0x9c');_0x334953[_0x31c2('0x93')]=!![];_0x334953[_0x31c2('0x9d')]=_0x31c2('0x9e');_0x334953[_0x31c2('0x9f')]=_0x21b2df[_0x31c2('0xa0')];_0x334953[_0x31c2('0xa1')]=_0x21b2df[_0x31c2('0x4d')];logger[_0x31c2('0x7b')](_0x31c2('0xa2'),_0x334953[_0x31c2('0x4f')],_0x334953['type']);var _0x410aca=this['queueReports'][_0x21b2df['linkedid']];this['queueReports'][_0x21b2df[_0x31c2('0x9a')]]=this['queueReports'][_0x21b2df[_0x31c2('0x4d')]];this[_0x31c2('0x44')][_0x21b2df[_0x31c2('0x4d')]]=_0x410aca;}}else{_0x3edeb3[_0x31c2('0x53')]=_0x31c2('0xa3')+_0x21b2df['reason'][_0x31c2('0xa4')]();logger['info'](_0x31c2('0xa5'),_0x3edeb3['queue'],_0x3edeb3[_0x31c2('0x59')],_0x3edeb3['queuecallerexitreason']);}}}this[_0x31c2('0x11')][_0x21b2df[_0x31c2('0x4d')]]=_0x3edeb3;}}}catch(_0x4875e1){logger[_0x31c2('0x41')](_0x31c2('0x8f'),_0x21b2df[_0x31c2('0x4d')],util[_0x31c2('0x43')](_0x4875e1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x31c2('0xc')]['syncVarSet']=function(_0x1074c8){try{if(this[_0x31c2('0x72')](_0x1074c8)){logger[_0x31c2('0x51')](_0x31c2('0xa6'),_0x1074c8[_0x31c2('0x4d')],util[_0x31c2('0x43')](_0x1074c8,{'showHidden':![],'depth':null}));this[_0x31c2('0xa7')](_0x1074c8[_0x31c2('0x4d')],_[_0x31c2('0x7d')](_0x1074c8[_0x31c2('0xa8')])[0x0],_0x1074c8['value']);if(this[_0x31c2('0x44')][_0x1074c8['uniqueid']]){var _0x162ab7=_[_0x31c2('0x80')](this[_0x31c2('0x44')][_0x1074c8['uniqueid']]);if(_0x162ab7){if(this[_0x31c2('0x72')](_0x1074c8[_0x31c2('0xa8')])&&this[_0x31c2('0x72')](_0x1074c8[_0x31c2('0xa8')][_0x31c2('0x63')])){switch(_0x1074c8[_0x31c2('0xa9')]){case _0x31c2('0xaa'):_0x162ab7[_0x31c2('0x39')]=![];_0x162ab7[_0x31c2('0x92')]=null;break;case _0x31c2('0xab'):_0x162ab7[_0x31c2('0xac')]=_0x31c2('0xad');_0x162ab7[_0x31c2('0x39')]=!![];_0x162ab7[_0x31c2('0x92')]=moment()[_0x31c2('0x4e')](_0x31c2('0x77'));_0x162ab7['queuecallerleaveAt']=moment()[_0x31c2('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');logger['debug']('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x1074c8['uniqueid'],util[_0x31c2('0x43')](_0x162ab7,{'showHidden':![],'depth':null}));ami[_0x31c2('0x4a')](_0x31c2('0xae'),_0x162ab7);break;default:_0x162ab7['queuecallerexit']=!![];_0x162ab7[_0x31c2('0x92')]=moment()[_0x31c2('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x162ab7[_0x31c2('0x88')]=moment()[_0x31c2('0x4e')](_0x31c2('0x77'));}_0x162ab7['queuecallerabandon']=![];_0x162ab7[_0x31c2('0x84')]=null;_0x162ab7['queuecallerexitreason']=_0x1074c8[_0x31c2('0xa9')];this[_0x31c2('0x11')][_0x1074c8[_0x31c2('0x4d')]]=_0x162ab7;this['emitVoiceQueueChannelRemove'](_0x162ab7,_0x31c2('0x28'));}else if(this[_0x31c2('0x72')](_0x1074c8['variable'])&&this[_0x31c2('0x72')](_0x1074c8[_0x31c2('0xa8')][_0x31c2('0xaf')])){if(!_0x162ab7[_0x31c2('0x21')]){_0x162ab7['queuecallerexit']=!![];_0x162ab7['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x162ab7[_0x31c2('0x53')]=_0x31c2('0xb0');_0x162ab7[_0x31c2('0x88')]=moment()[_0x31c2('0x4e')](_0x31c2('0x77'));this[_0x31c2('0x11')][_0x1074c8[_0x31c2('0x4d')]]=_0x162ab7;}}logger[_0x31c2('0x7b')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x1074c8[_0x31c2('0x4d')],_0x162ab7[_0x31c2('0x4f')],_0x162ab7['type'],_[_0x31c2('0x7d')](_0x1074c8['variable'])[0x0],_0x1074c8[_0x31c2('0xa9')]);_0x162ab7['variables']=this[_0x31c2('0x16')][_0x1074c8['uniqueid']];}}}}catch(_0x48e21c){logger[_0x31c2('0x41')]('[%s][voiceQueueReport][varset]',_0x1074c8[_0x31c2('0x4d')],util[_0x31c2('0x43')](_0x48e21c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x31c2('0xc')]['addVariable']=function(_0x4e332a,_0x4ca8d7,_0x387d5){var _0x53fdde=[_0x31c2('0xb1'),_0x31c2('0xb2'),_0x31c2('0xb3'),_0x31c2('0xb4'),_0x31c2('0xb5'),_0x31c2('0xb6'),_0x31c2('0xb7'),_0x31c2('0xb8'),_0x31c2('0xb9'),_0x31c2('0xba'),_0x31c2('0xbb'),_0x31c2('0xbc'),_0x31c2('0xbd'),_0x31c2('0xbe'),_0x31c2('0xbf'),_0x31c2('0xc0'),_0x31c2('0x91'),_0x31c2('0xc1'),_0x31c2('0xc2')];if(!_['isNil'](_0x4ca8d7)&&!_[_0x31c2('0xc3')](_0x53fdde,_0x4ca8d7)){if(_['isUndefined'](this[_0x31c2('0x16')][_0x4e332a])){this['variables'][_0x4e332a]={};}this[_0x31c2('0x16')][_0x4e332a][_0x4ca8d7]=_0x387d5;}};VoiceQueueReport['prototype'][_0x31c2('0xc4')]=function(_0x155818,_0x2238da,_0x590354){try{var _0x5f2871={};if(this['queueReports'][_0x155818]){for(var _0x10f76b=0x0;_0x10f76b<this[_0x31c2('0x44')][_0x155818][_0x31c2('0xc5')];_0x10f76b+=0x1){_0x5f2871=this[_0x31c2('0x44')][_0x155818][_0x10f76b];var _0x54d469=this['voiceQueues'][_0x5f2871[_0x31c2('0x4f')]];if(_0x54d469){_0x54d469[_0x31c2('0xc6')]+=moment(_0x5f2871[_0x31c2('0x88')])['diff'](_0x5f2871[_0x31c2('0x76')],_0x31c2('0x9b'))||0x0;if(_0x590354&&_0x5f2871[_0x31c2('0x53')]==='ATTENDEDTRANSFER'){_0x5f2871[_0x31c2('0x53')]=_0x31c2('0x8d');}if(_0x10f76b===this[_0x31c2('0x44')][_0x155818][_0x31c2('0xc5')]-0x1){_0x54d469[_0x31c2('0xc7')]+=moment()[_0x31c2('0xc8')](0x0)['diff'](_0x5f2871[_0x31c2('0x76')],_0x31c2('0x9b'));if(hasCallerLeftTheQueue(_0x5f2871)&&_0x5f2871[_0x31c2('0x53')]!==_0x31c2('0x54')){_0x54d469[_0x31c2('0xc9')]+=0x1;}if(_0x5f2871[_0x31c2('0x3a')]){_0x54d469[_0x31c2('0xca')]+=0x1;_0x54d469[_0x31c2('0xcb')]+=moment()['milliseconds'](0x0)[_0x31c2('0xcc')](_0x5f2871[_0x31c2('0x88')],_0x31c2('0x9b'));_0x5f2871[_0x31c2('0x81')]=moment()['format'](_0x31c2('0x77'));_0x5f2871[_0x31c2('0x39')]=![];_0x5f2871['queuecallerexitAt']=null;}if(_0x5f2871[_0x31c2('0x39')]&&_0x5f2871[_0x31c2('0x93')]!=!![]){_0x54d469[_0x31c2('0xcd')]+=0x1;_0x5f2871[_0x31c2('0xac')]=_0x31c2('0xcd');logger[_0x31c2('0x51')](_0x31c2('0xce'),_0x155818,util[_0x31c2('0x43')](_0x5f2871,{'showHidden':![],'depth':null}));ami[_0x31c2('0x4a')]('custom:queuecallerunmanaged',_0x5f2871);}if(_0x5f2871['queuecallerabandon']){_0x54d469[_0x31c2('0xcf')]+=0x1;_0x5f2871[_0x31c2('0xac')]='abandoned';logger[_0x31c2('0x51')](_0x31c2('0xd0'),_0x155818,util[_0x31c2('0x43')](_0x5f2871,{'showHidden':![],'depth':null}));ami[_0x31c2('0x4a')](_0x31c2('0xd1'),_0x5f2871);}}else{_0x54d469[_0x31c2('0xc7')]+=_0x54d469['sumHoldTime'];}logger[_0x31c2('0x7b')]('[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s',_0x155818,_0x5f2871[_0x31c2('0x4f')],_0x5f2871[_0x31c2('0x59')],_0x2238da);this[_0x31c2('0x11')][_0x155818]=_0x5f2871;Object[_0x31c2('0x6b')](this[_0x31c2('0x13')][_0x5f2871[_0x31c2('0x4f')]],_0x54d469);if(_0x5f2871['queuecallerleaveAt']){this[_0x31c2('0x49')](_0x5f2871,_0x31c2('0x2a'));}}}logger['debug'](_0x31c2('0xd2'),_0x155818,util['inspect'](this[_0x31c2('0x44')][_0x155818],{'showHidden':![],'depth':null}));if(hasCallerLeftTheQueue(_0x5f2871)&&_0x5f2871['queuecallerexitreason']!==_0x31c2('0x54')){ami[_0x31c2('0x4a')](_0x31c2('0xd3'),this[_0x31c2('0x44')][_0x155818]);if(this[_0x31c2('0x44')][_0x155818]){delete this[_0x31c2('0x44')][_0x155818];}if(this['channels'][_0x155818]){delete this['channels'][_0x155818];}if(this[_0x31c2('0x16')][_0x155818]){delete this[_0x31c2('0x16')][_0x155818];}}}}catch(_0x51be61){logger['error']('[%s][voiceQueueReport][handleHangup]',_0x155818,util['inspect'](_0x51be61,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x31c2('0xc')]['syncHangup']=function(_0x40be6e){try{if(this[_0x31c2('0x72')](_0x40be6e)){logger[_0x31c2('0x51')](_0x31c2('0xd4'),_0x40be6e[_0x31c2('0x4d')],util[_0x31c2('0x43')](_0x40be6e,{'showHidden':![],'depth':null}));if(this[_0x31c2('0x44')][_0x40be6e[_0x31c2('0x4d')]]){return this[_0x31c2('0xc4')](_0x40be6e[_0x31c2('0x4d')],_0x40be6e[_0x31c2('0xd5')],![]);}if(this[_0x31c2('0x44')][_0x40be6e[_0x31c2('0x9a')]]){if(_0x40be6e[_0x31c2('0xd6')]==='21'){return;}return this['handleHangup'](_0x40be6e[_0x31c2('0x9a')],_0x40be6e['cause-txt'],!![]);}var _0x172c3e=Object[_0x31c2('0x7d')](this['queueReports']);for(var _0x578933=0x0;_0x578933<_0x172c3e[_0x31c2('0xc5')];_0x578933++){var _0xea1f67=_['last'](this[_0x31c2('0x44')][_0x172c3e[_0x578933]]);if(_0xea1f67&&_0xea1f67[_0x31c2('0xd7')]===_0x40be6e[_0x31c2('0x4d')]){return this[_0x31c2('0xc4')](_0xea1f67['uniqueid'],_0x40be6e['cause-txt'],!![]);}}if(!this[_0x31c2('0x44')][_0x40be6e[_0x31c2('0x4d')]]){logger[_0x31c2('0x51')](_0x31c2('0xd8'),_0x40be6e[_0x31c2('0x4d')]);if(this[_0x31c2('0x11')][_0x40be6e[_0x31c2('0x4d')]]){delete this['channels'][_0x40be6e[_0x31c2('0x4d')]];}if(this[_0x31c2('0x16')][_0x40be6e[_0x31c2('0x4d')]]){delete this['variables'][_0x40be6e[_0x31c2('0x4d')]];}}}}catch(_0x10af82){logger['error']('[%s][voiceQueueReport][hangup]',_0x40be6e[_0x31c2('0x4d')],util[_0x31c2('0x43')](_0x10af82,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x31c2('0xc')][_0x31c2('0x31')]=function(_0x477741){try{if(this[_0x31c2('0x72')](_0x477741)){logger['debug'](_0x31c2('0xd9'),_0x477741[_0x31c2('0x4d')],util[_0x31c2('0x43')](_0x477741,{'showHidden':![],'depth':null}));var _0x3117f2;var _0x27a160;var _0x55178b;if(this[_0x31c2('0x44')][_0x477741['transfereeuniqueid']]){_0x3117f2=_[_0x31c2('0x80')](this[_0x31c2('0x44')][_0x477741['transfereeuniqueid']]);_0x3117f2[_0x31c2('0x9f')]=_0x477741[_0x31c2('0xda')];_0x3117f2['transferuniqueid']=_0x477741[_0x31c2('0xdb')];_0x3117f2[_0x31c2('0x53')]=_0x31c2('0x54');_0x3117f2['transfer']=!![];_0x3117f2[_0x31c2('0x9d')]='ATTENDED';if(this[_0x31c2('0x44')][_0x477741[_0x31c2('0xdb')]]){_0x55178b=this['queueReports'][_0x477741[_0x31c2('0xdb')]];this[_0x31c2('0x44')][_0x477741['secondtransfereruniqueid']]=this[_0x31c2('0x44')][_0x477741[_0x31c2('0xdc')]];this[_0x31c2('0x44')][_0x477741['transfereeuniqueid']]=_0x55178b;_0x27a160=_['last'](this[_0x31c2('0x44')][_0x477741[_0x31c2('0xdc')]]);_0x27a160[_0x31c2('0x3b')]=!![];}logger['info'](_0x31c2('0xdd'),_0x477741['uniqueid'],_0x3117f2[_0x31c2('0x4f')],_0x3117f2[_0x31c2('0x59')],_0x3117f2[_0x31c2('0x9f')],_0x3117f2['transferuniqueid']);}else if(this[_0x31c2('0x44')][_0x477741['transfertargetuniqueid']]){_0x3117f2=_[_0x31c2('0x80')](this[_0x31c2('0x44')][_0x477741[_0x31c2('0xde')]]);_0x3117f2['transferexten']=_0x477741[_0x31c2('0xdf')];_0x3117f2['transferuniqueid']=_0x477741['origtransfereruniqueid'];_0x3117f2[_0x31c2('0x53')]=_0x31c2('0x54');_0x3117f2['transfer']=!![];_0x3117f2[_0x31c2('0x9d')]=_0x31c2('0xe0');if(this[_0x31c2('0x44')][_0x477741['origtransfereruniqueid']]){_0x55178b=this['queueReports'][_0x477741[_0x31c2('0xe1')]];this[_0x31c2('0x44')][_0x477741[_0x31c2('0xe1')]]=this[_0x31c2('0x44')][_0x477741[_0x31c2('0xde')]];this['queueReports'][_0x477741[_0x31c2('0xde')]]=_0x55178b;_0x27a160=_[_0x31c2('0x80')](this['queueReports'][_0x477741[_0x31c2('0xde')]]);_0x27a160[_0x31c2('0x3b')]=!![];}logger[_0x31c2('0x7b')]('[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s',_0x477741['uniqueid'],_0x3117f2[_0x31c2('0x4f')],_0x3117f2[_0x31c2('0x59')],_0x3117f2[_0x31c2('0x9f')],_0x3117f2['transferuniqueid']);}else if(this[_0x31c2('0x44')][_0x477741['origtransfereruniqueid']]){_0x3117f2=_['last'](this[_0x31c2('0x44')][_0x477741[_0x31c2('0xe1')]]);_0x3117f2[_0x31c2('0x9f')]=_0x477741[_0x31c2('0xdf')];_0x3117f2['transferuniqueid']=_0x477741[_0x31c2('0xe1')];_0x3117f2[_0x31c2('0x53')]=_0x31c2('0x54');_0x3117f2[_0x31c2('0x93')]=!![];_0x3117f2[_0x31c2('0x9d')]=_0x31c2('0xe0');_0x3117f2[_0x31c2('0x3b')]=!![];_0x3117f2[_0x31c2('0xd7')]=_0x477741[_0x31c2('0xdc')];}else if(this[_0x31c2('0x44')][_0x477741[_0x31c2('0xdb')]]){_0x3117f2=_[_0x31c2('0x80')](this['queueReports'][_0x477741[_0x31c2('0xdb')]]);_0x3117f2[_0x31c2('0x9f')]=_0x477741[_0x31c2('0xda')];_0x3117f2[_0x31c2('0xa1')]=_0x477741['secondtransfereruniqueid'];_0x3117f2[_0x31c2('0x53')]=_0x31c2('0x54');_0x3117f2['transfer']=!![];_0x3117f2[_0x31c2('0x9d')]=_0x31c2('0xe0');_0x3117f2[_0x31c2('0x3b')]=!![];_0x3117f2[_0x31c2('0xd7')]=_0x477741[_0x31c2('0xde')];}}}catch(_0x4fb04e){logger[_0x31c2('0x41')](_0x31c2('0xd9'),_0x477741['uniqueid'],util['inspect'](_0x4fb04e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x31c2('0xc')][_0x31c2('0xe2')]=function(_0x46d79c){try{if(this[_0x31c2('0x72')](_0x46d79c)){logger[_0x31c2('0x51')](_0x31c2('0xe3'),_0x46d79c[_0x31c2('0x4d')],util[_0x31c2('0x43')](_0x46d79c,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x46d79c['transfereeuniqueid']]){var _0x19f604=_[_0x31c2('0x80')](this[_0x31c2('0x44')][_0x46d79c[_0x31c2('0xdc')]]);_0x19f604['queuecallerexitreason']=_0x31c2('0xe4');_0x19f604[_0x31c2('0x93')]=!![];_0x19f604[_0x31c2('0x9d')]=_0x31c2('0xe5');_0x19f604[_0x31c2('0x9f')]=_0x46d79c[_0x31c2('0xe6')];_0x19f604['transferuniqueid']=_0x46d79c[_0x31c2('0xdc')];logger[_0x31c2('0x7b')](_0x31c2('0xe7'),_0x46d79c[_0x31c2('0x4d')],_0x19f604['queue'],_0x19f604['type'],_0x19f604['transferexten'],_0x19f604[_0x31c2('0xa1')]);this[_0x31c2('0x2b')]({'event':_0x31c2('0xe8'),'uniqueid':_0x46d79c[_0x31c2('0xdc')],'context':_0x46d79c[_0x31c2('0xe9')],'channel':_0x46d79c[_0x31c2('0xea')]});}}}catch(_0xcfc2a1){logger[_0x31c2('0x41')](_0x31c2('0xe3'),_0x46d79c[_0x31c2('0x4d')],util[_0x31c2('0x43')](_0xcfc2a1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x31c2('0xc')][_0x31c2('0x2e')]=function(_0x434b75){try{if(this[_0x31c2('0x72')](_0x434b75)){logger[_0x31c2('0x51')](_0x31c2('0xeb'),_0x434b75[_0x31c2('0x4d')],util['inspect'](_0x434b75,{'showHidden':![],'depth':null}));if(this[_0x31c2('0x44')][_0x434b75[_0x31c2('0x4d')]]){var _0x381df1=_['last'](this[_0x31c2('0x44')][_0x434b75[_0x31c2('0x4d')]]);if(!_[_0x31c2('0x3c')](_0x381df1[_0x31c2('0x88')])){_0x381df1['mohstarttime']=moment()[_0x31c2('0x4e')](_0x31c2('0x77'));logger['info'](_0x31c2('0xec'),_0x434b75[_0x31c2('0x4d')],_0x381df1['mohstarttime']);}}}}catch(_0x3bbf14){logger['error'](_0x31c2('0xeb'),_0x434b75[_0x31c2('0x4d')],util['inspect'](_0x3bbf14,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncMusicOnHoldStop']=function(_0x435dfa){try{if(this[_0x31c2('0x72')](_0x435dfa)){logger[_0x31c2('0x51')](_0x31c2('0xed'),_0x435dfa[_0x31c2('0x4d')],util[_0x31c2('0x43')](_0x435dfa,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x435dfa[_0x31c2('0x4d')]]){var _0x3720a9=_['last'](this['queueReports'][_0x435dfa[_0x31c2('0x4d')]]);if(!_[_0x31c2('0x3c')](_0x3720a9[_0x31c2('0xee')])){_0x3720a9[_0x31c2('0xef')]+=moment()[_0x31c2('0xc8')](0x0)[_0x31c2('0xcc')](_0x3720a9[_0x31c2('0xee')],_0x31c2('0x9b'));logger[_0x31c2('0x7b')](_0x31c2('0xf0'),_0x435dfa[_0x31c2('0x4d')],_0x3720a9[_0x31c2('0xef')]);delete _0x3720a9[_0x31c2('0xee')];}}}}catch(_0x5411ba){logger[_0x31c2('0x41')](_0x31c2('0xed'),_0x435dfa[_0x31c2('0x4d')],util[_0x31c2('0x43')](_0x5411ba,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x31c2('0xc')][_0x31c2('0xf1')]=function(_0x2dd7a3){try{if(this[_0x31c2('0x72')](_0x2dd7a3)){logger[_0x31c2('0x51')](_0x31c2('0xf2'),_0x2dd7a3[_0x31c2('0x4d')],util[_0x31c2('0x43')](_0x2dd7a3,{'showHidden':![],'depth':null}));if(_0x2dd7a3[_0x31c2('0xf3')]['toLowerCase']()===_0x31c2('0xf4')){_0x2dd7a3[_0x31c2('0xf5')]=_0x2dd7a3[_0x31c2('0xf6')]&&_0x2dd7a3[_0x31c2('0xf6')][_0x31c2('0x97')]('CDR(routeAlias)')?_0x2dd7a3['appdata']:(_0x2dd7a3[_0x31c2('0xf6')]||_0x2dd7a3[_0x31c2('0xf5')])[_0x31c2('0x98')]();if(_[_0x31c2('0x97')](_0x2dd7a3[_0x31c2('0xf5')][_0x31c2('0x98')](),'cdr(')){logger[_0x31c2('0x7b')](_0x31c2('0xf7'),_0x2dd7a3[_0x31c2('0x4d')],_0x2dd7a3[_0x31c2('0xf3')],_0x2dd7a3[_0x31c2('0xf5')]);if(_[_0x31c2('0x5c')](this[_0x31c2('0x11')][_0x2dd7a3[_0x31c2('0x4d')]]))this[_0x31c2('0x11')][_0x2dd7a3[_0x31c2('0x4d')]]={};var _0x24d590=_0x2dd7a3[_0x31c2('0xf5')][_0x31c2('0xf8')]('=');var _0x12bf3e=_0x24d590[0x0][_0x31c2('0x98')]()[_0x31c2('0xf9')](/cdr\((.*)\)/);if(_0x12bf3e)this[_0x31c2('0x11')][_0x2dd7a3[_0x31c2('0x4d')]][_0x12bf3e[0x1]]=_0x24d590[0x1];}}}}catch(_0x4a3001){logger[_0x31c2('0x41')](_0x31c2('0xfa'),_0x2dd7a3['uniqueid'],util['inspect'](_0x4a3001,{'showHidden':![],'depth':null}));}};module[_0x31c2('0xfb')]=VoiceQueueReport;
\ No newline at end of file
+var _0xa718=['channel','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','emit','format','voice:queue:%s',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','isNotNull','queues','[voiceQueueReport][queues]','then','isRunning','queuestatus','actionid','[voiceQueueReport][queuesummary]','createQueueSummaryReport','summaryEvent','createReport','assign','voiceQueues','queue','inbound','outbound','custom:queuesummary','statusRequests','completeEvent','push','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','isUndefined','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','routealias','keys','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','info','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','membername','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','toLowerCase','linkedid','add','seconds','FORWARDTRANSFER','transfertype','transferexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','value','variable','CONTINUE','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','addVariable','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','includes','handleHangup','sumHoldTime','diff','milliseconds','ATTENDEDTRANSFER','total','sumBillable','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumDuration','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][handleHangup]','[%s][voiceQueueReport][hangup]','cause-txt','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','transferuniqueid','ATTENDED','secondtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfereruniqueid','origtransfererexten','secondtransfererexten','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfererchannel','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','syncMusicOnHoldStop','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','application','set','applicationdata','appdata','startsWith','CDR(routeAlias)','cdr(','split','[%s][voiceQueueReport][newexten]','exports','lodash','util','ioredis','../../../config/environment','ami','../ami','../model/queueReport','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','queueReports','realtime','agents','channels','queueChannels','campaigns','summary','variables','queuesummary','syncQueueSummary','bind','syncQueueSummaryComplete','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','syncFullyBooted','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','queuecallerexit','queuecallercomplete','clearZombieChannels','switch','sequence','isNil','Action','status'];(function(_0x1646fa,_0x4e5bd7){var _0x5a47a5=function(_0x2db820){while(--_0x2db820){_0x1646fa['push'](_0x1646fa['shift']());}};_0x5a47a5(++_0x4e5bd7);}(_0xa718,0x19f));var _0x8a71=function(_0x23bb24,_0x12162c){_0x23bb24=_0x23bb24-0x0;var _0x329778=_0xa718[_0x23bb24];return _0x329778;};'use strict';var _=require(_0x8a71('0x0'));var moment=require('moment');var util=require(_0x8a71('0x1'));var Redis=require(_0x8a71('0x2'));var config=require(_0x8a71('0x3'));var logger=require('../../../config/logger')(_0x8a71('0x4'));var ami=require(_0x8a71('0x5'));var QueueReport=require(_0x8a71('0x6'));var VoiceQueueSummary=require('../model/voiceQueueSummary');config['redis']=_[_0x8a71('0x7')](config[_0x8a71('0x8')],{'host':_0x8a71('0x9'),'port':0x18eb});var io=require(_0x8a71('0xa'))(new Redis(config[_0x8a71('0x8')]));var Sequence=function(){};Sequence[_0x8a71('0xb')][_0x8a71('0xc')]=function(_0x288caa){this[_0x8a71('0xd')]=this[_0x8a71('0xd')]?this[_0x8a71('0xd')][_0x8a71('0xe')](_0x288caa):_0x288caa();};function VoiceQueueReport(_0x3255ce){this['sequence']=new Sequence();this[_0x8a71('0xf')]={};this[_0x8a71('0x10')]=_0x3255ce;this['agents']=_0x3255ce[_0x8a71('0x11')];this[_0x8a71('0x12')]=_0x3255ce[_0x8a71('0x13')];this['voiceQueues']=_0x3255ce['voiceQueues'];this['campaigns']=_0x3255ce[_0x8a71('0x14')];this[_0x8a71('0x15')]=initializeSummary();this[_0x8a71('0x16')]={};ami['on'](_0x8a71('0x17'),this[_0x8a71('0x18')][_0x8a71('0x19')](this));ami['on']('queuesummarycomplete',this[_0x8a71('0x1a')][_0x8a71('0x19')](this));ami['on'](_0x8a71('0x1b'),this[_0x8a71('0x1c')][_0x8a71('0x19')](this));ami['on'](_0x8a71('0x1d'),this[_0x8a71('0x1e')][_0x8a71('0x19')](this));ami['on'](_0x8a71('0x1f'),this[_0x8a71('0x20')][_0x8a71('0x19')](this));ami['on'](_0x8a71('0x21'),this[_0x8a71('0x22')][_0x8a71('0x19')](this));ami['on'](_0x8a71('0x23'),this[_0x8a71('0x24')][_0x8a71('0x19')](this));ami['on'](_0x8a71('0x25'),this['syncAgentComplete'][_0x8a71('0x19')](this));ami['on'](_0x8a71('0x26'),this[_0x8a71('0x27')][_0x8a71('0x19')](this));ami['on'](_0x8a71('0x28'),this[_0x8a71('0x29')][_0x8a71('0x19')](this));ami['on'](_0x8a71('0x2a'),this[_0x8a71('0x2b')][_0x8a71('0x19')](this));ami['on']('fullybooted',this[_0x8a71('0x2c')][_0x8a71('0x19')](this));ami['on']('musiconholdstart',this[_0x8a71('0x2d')][_0x8a71('0x19')](this));ami['on'](_0x8a71('0x2e'),this['syncMusicOnHoldStop'][_0x8a71('0x19')](this));ami['on'](_0x8a71('0x2f'),this[_0x8a71('0x30')][_0x8a71('0x19')](this));ami['on'](_0x8a71('0x31'),this[_0x8a71('0x32')][_0x8a71('0x19')](this));this[_0x8a71('0x33')]();this[_0x8a71('0x34')]();}function clearChannels(_0x12ba58){if(!_[_0x8a71('0x35')](_0x12ba58)){for(var _0x1d8b5c in _0x12ba58){if(_0x12ba58[_0x8a71('0x36')](_0x1d8b5c)){delete _0x12ba58[_0x1d8b5c];}}}}function clearCampaigns(_0x38f76c){if(!_[_0x8a71('0x35')](_0x38f76c)){for(var _0x261b1c in _0x38f76c){if(_0x38f76c[_0x8a71('0x36')](_0x261b1c)){_0x38f76c[_0x261b1c][_0x8a71('0x37')]=0x0;}}}}function clearVoiceQueues(_0x3b6d46){if(!_[_0x8a71('0x35')](_0x3b6d46)){for(var _0x41dc63 in _0x3b6d46){if(_0x3b6d46['hasOwnProperty'](_0x41dc63)){_0x3b6d46[_0x41dc63][_0x8a71('0x37')]=0x0;_0x3b6d46[_0x41dc63][_0x8a71('0x38')]=0x0;_0x3b6d46[_0x41dc63][_0x8a71('0x39')]=0x0;_0x3b6d46[_0x41dc63][_0x8a71('0x3a')]=0x0;_0x3b6d46[_0x41dc63][_0x8a71('0x3b')]=!![];}}}}function clearAgentBooked(_0x3a95e9){if(!_[_0x8a71('0x35')](_0x3a95e9)){for(var _0x343194 in _0x3a95e9){if(_0x3a95e9[_0x8a71('0x36')](_0x343194)){_0x3a95e9[_0x343194][_0x8a71('0x3c')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x1676ca){return _0x1676ca[_0x8a71('0x3d')]||_0x1676ca[_0x8a71('0x21')]||_0x1676ca[_0x8a71('0x3e')];}VoiceQueueReport[_0x8a71('0xb')][_0x8a71('0x3f')]=function(){var _0x13ba9a=this;for(var _0x48610a in this[_0x8a71('0x12')]){if(this['channels'][_0x8a71('0x36')](_0x48610a)&&!this[_0x8a71('0x12')][_0x48610a][_0x8a71('0x40')]){this[_0x8a71('0x41')][_0x8a71('0xc')](function(){if(!_[_0x8a71('0x42')](_0x13ba9a['channels'][_0x48610a])){return ami[_0x8a71('0x43')]({'action':_0x8a71('0x44'),'channel':_0x13ba9a[_0x8a71('0x12')][_0x48610a][_0x8a71('0x45')]})[_0x8a71('0x46')](function(_0x199be7){if(_0x199be7[_0x8a71('0x47')]===_0x8a71('0x48')){setTimeout(function(){if(_0x13ba9a[_0x8a71('0x12')][_0x48610a]){delete _0x13ba9a[_0x8a71('0x12')][_0x48610a];logger[_0x8a71('0x49')](_0x8a71('0x4a'),_0x48610a,util[_0x8a71('0x4b')](_0x199be7,{'showHidden':![],'depth':null}));}if(_0x13ba9a['queueReports'][_0x48610a]){delete _0x13ba9a['queueReports'][_0x48610a];logger[_0x8a71('0x49')]('[%s][voiceQueueReport][checkQueueReport]',_0x48610a,util['inspect'](_0x199be7,{'showHidden':![],'depth':null}));}if(_0x13ba9a[_0x8a71('0x16')][_0x48610a]){delete _0x13ba9a['variables'][_0x48610a];logger['error'](_0x8a71('0x4c'),_0x48610a,util['inspect'](_0x199be7,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x8a71('0xb')][_0x8a71('0x2c')]=function(){logger[_0x8a71('0x49')](_0x8a71('0x4d'));clearChannels(this[_0x8a71('0x12')]);this['clearQueueReport'](this[_0x8a71('0xf')]);clearAgentBooked(this['agents']);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this['campaigns']);this[_0x8a71('0x15')]=initializeSummary();};VoiceQueueReport[_0x8a71('0xb')][_0x8a71('0x4e')]=function(_0x50a37f){var _0x4904b3=this;if(!_['isEmpty'](_0x50a37f)){for(var _0x139ec2 in _0x50a37f){if(_0x50a37f['hasOwnProperty'](_0x139ec2)){_0x4904b3[_0x8a71('0x4f')](_0x50a37f[_0x139ec2],_0x8a71('0x50'));delete _0x50a37f[_0x139ec2];}}}};VoiceQueueReport[_0x8a71('0xb')]['emit']=function(_0x3a5efc,_0x5ced6e,_0x504ab4){io['to'](_0x3a5efc)['emit'](_0x5ced6e,_0x504ab4);};VoiceQueueReport[_0x8a71('0xb')][_0x8a71('0x51')]=function(_0x2037b6,_0x45ce79){logger[_0x8a71('0x52')](_0x8a71('0x53')+_0x45ce79+_0x8a71('0x54'),_0x2037b6[_0x8a71('0x55')],util[_0x8a71('0x4b')](_0x2037b6,{'showHidden':![],'depth':null}));this[_0x8a71('0x56')](util[_0x8a71('0x57')](_0x8a71('0x58'),_0x2037b6['queue']),'voice_queue_channel:save',_0x2037b6);io[_0x8a71('0x56')]('voice_queue_presence:save',_0x2037b6);};VoiceQueueReport['prototype'][_0x8a71('0x4f')]=function(_0x5373d6,_0x1f4534){logger[_0x8a71('0x52')](_0x8a71('0x53')+_0x1f4534+_0x8a71('0x59'),_0x5373d6[_0x8a71('0x55')],util[_0x8a71('0x4b')](_0x5373d6,{'showHidden':![],'depth':null}));if(_0x5373d6[_0x8a71('0x5a')]==='ATTENDEDTRANSFER'){return;}this[_0x8a71('0x56')](util[_0x8a71('0x57')]('voice:queue:%s',_0x5373d6['queue']),'voice_queue_channel:remove',_0x5373d6);io[_0x8a71('0x56')](_0x8a71('0x5b'),_0x5373d6);};VoiceQueueReport[_0x8a71('0xb')][_0x8a71('0x5c')]=function(_0xad4bd8){if(_0xad4bd8[_0x8a71('0x5d')]==='inbound'){logger['debug'](_0x8a71('0x5e'),util[_0x8a71('0x4b')](_0xad4bd8,{'showHidden':![],'depth':null}));this[_0x8a71('0x56')](util[_0x8a71('0x57')]('voice:queue:%s',_0xad4bd8[_0x8a71('0x5f')]),_0x8a71('0x60'),_0xad4bd8);}};VoiceQueueReport[_0x8a71('0xb')][_0x8a71('0x61')]=function(_0x108eb4){return _0x108eb4!==null&&!_['isUndefined'](_0x108eb4);};VoiceQueueReport[_0x8a71('0xb')][_0x8a71('0x34')]=function(){var _0x3fe7ea=this;setInterval(function(){_0x3fe7ea[_0x8a71('0x3f')]();ami[_0x8a71('0x43')]({'action':_0x8a71('0x62')})[_0x8a71('0x46')](function(_0x46ff01){logger[_0x8a71('0x49')](_0x8a71('0x63'),util['inspect'](_0x46ff01,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport['prototype'][_0x8a71('0x33')]=function(){var _0x1206ee=this;setInterval(function(){if(!_0x1206ee[_0x8a71('0x15')]['isRunning']){return ami['Action']({'action':_0x8a71('0x17')})[_0x8a71('0x64')](function(_0x58b784){_0x1206ee[_0x8a71('0x15')]['id']=_0x58b784['actionid'];_0x1206ee['summary'][_0x8a71('0x65')]=!![];_0x1206ee['summary'][_0x8a71('0x66')][_0x58b784[_0x8a71('0x67')]]={};})[_0x8a71('0x46')](function(_0x43d512){logger[_0x8a71('0x49')](_0x8a71('0x68'),util[_0x8a71('0x4b')](_0x43d512,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x8a71('0xb')][_0x8a71('0x69')]=function(_0x437dd5,_0x543918){var _0x3249b4;if(this[_0x8a71('0x15')]&&this[_0x8a71('0x15')][_0x8a71('0x62')]&&this[_0x8a71('0x15')][_0x8a71('0x62')][_0x437dd5[_0x8a71('0x5f')]]){_0x3249b4=this[_0x8a71('0x15')][_0x8a71('0x62')][_0x437dd5[_0x8a71('0x5f')]][_0x8a71('0x6a')];}var _0x18df60=new VoiceQueueSummary(_0x437dd5);return _0x18df60[_0x8a71('0x6b')](_0x543918[_0x8a71('0x11')],this[_0x8a71('0x11')],_0x3249b4,this[_0x8a71('0x10')][_0x8a71('0x12')]);};VoiceQueueReport[_0x8a71('0xb')]['handleInboundQueueSummaryReport']=function(_0x5f28f8,_0x6cf943){var _0x1fbde0=this[_0x8a71('0x69')](_0x5f28f8,_0x6cf943);var _0x3116ca=![];_0x3116ca=_0x1fbde0['compareToInboundQueue'](_0x5f28f8);if(_0x3116ca){Object[_0x8a71('0x6c')](_0x5f28f8,_0x1fbde0);this[_0x8a71('0x10')][_0x8a71('0x6d')][_0x5f28f8[_0x8a71('0x5f')]]=_0x5f28f8;this[_0x8a71('0x5c')](_0x1fbde0);}};VoiceQueueReport[_0x8a71('0xb')][_0x8a71('0x1e')]=function(_0x38b8b2){var _0x4d987c=null;var _0x7f6f27=this[_0x8a71('0x15')]['id'];if(this[_0x8a71('0x15')][_0x8a71('0x66')][_0x7f6f27]){_0x4d987c=this['summary'][_0x8a71('0x66')][_0x7f6f27][_0x38b8b2[_0x8a71('0x67')]];}if(!_0x4d987c){this[_0x8a71('0x15')]=initializeSummary();return;}var _0x5670e7=this[_0x8a71('0x6d')][_0x4d987c[_0x8a71('0x6e')]];if(_0x5670e7[_0x8a71('0x5d')]===_0x8a71('0x6f')){this['handleInboundQueueSummaryReport'](_0x5670e7,_0x4d987c);}else if(_0x5670e7['type']===_0x8a71('0x70')){var _0x4ebc90=this['createQueueSummaryReport'](_0x5670e7,_0x4d987c);ami[_0x8a71('0x56')](_0x8a71('0x71'),_0x4ebc90);}this[_0x8a71('0x15')][_0x8a71('0x72')]-=0x1;var _0x12fc52=this[_0x8a71('0x15')][_0x8a71('0x72')]>0x0?!![]:![];if(!_0x12fc52){return this[_0x8a71('0x1a')](this[_0x8a71('0x15')][_0x8a71('0x73')]);}};VoiceQueueReport[_0x8a71('0xb')][_0x8a71('0x1c')]=function(_0x90ce01){var _0xd962ce=this[_0x8a71('0x15')]['id'];if(this[_0x8a71('0x15')]['queuestatus'][_0xd962ce]&&this[_0x8a71('0x15')][_0x8a71('0x66')][_0xd962ce][_0x90ce01[_0x8a71('0x67')]]){this[_0x8a71('0x15')][_0x8a71('0x66')][_0xd962ce][_0x90ce01['actionid']]['agents'][_0x8a71('0x74')](_0x90ce01);}};VoiceQueueReport[_0x8a71('0xb')][_0x8a71('0x18')]=function(_0x3d22c5){var _0xd12f55=this;try{if(this['isNotNull'](_0x3d22c5)&&this['isNotNull'](_0x3d22c5[_0x8a71('0x6e')])){logger[_0x8a71('0x52')](_0x8a71('0x75'),util[_0x8a71('0x4b')](_0x3d22c5,{'showHidden':![],'depth':null}));var _0x13a0e1=this['voiceQueues'][_0x3d22c5['queue']];if(_0x13a0e1){logger[_0x8a71('0x52')](_0x8a71('0x76'),_0x13a0e1[_0x8a71('0x5f')]);this[_0x8a71('0x15')]['queues'][_0x13a0e1[_0x8a71('0x5f')]]={'summaryEvent':_0x3d22c5};this[_0x8a71('0x15')][_0x8a71('0x72')]+=0x1;return ami[_0x8a71('0x43')]({'action':_0x8a71('0x66'),'queue':_0x13a0e1['name']})[_0x8a71('0x64')](function(_0x98abbc){if(!_0xd12f55[_0x8a71('0x15')][_0x8a71('0x66')][_0x3d22c5[_0x8a71('0x67')]]){_0xd12f55[_0x8a71('0x15')]['queuestatus'][_0x3d22c5[_0x8a71('0x67')]]={};}_0xd12f55['summary'][_0x8a71('0x66')][_0x3d22c5[_0x8a71('0x67')]][_0x98abbc[_0x8a71('0x67')]]={'queue':_0x13a0e1['name'],'agents':[]};})[_0x8a71('0x46')](function(_0x47739d){throw _0x47739d;});}}}catch(_0x5850f9){logger[_0x8a71('0x49')]('[voiceQueueReport][queuesummary]',util[_0x8a71('0x4b')](_0x5850f9,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x28238a){if(this[_0x8a71('0x15')]['statusRequests']>0x0){this[_0x8a71('0x15')][_0x8a71('0x73')]=_0x28238a;return;}logger['debug'](_0x8a71('0x77'),util[_0x8a71('0x4b')](_0x28238a,{'showHidden':![],'depth':null}));this[_0x8a71('0x15')]=initializeSummary();ami['emit'](_0x8a71('0x78'),{});};VoiceQueueReport[_0x8a71('0xb')]['syncQueueCallerJoin']=function(_0x30424f){try{if(this[_0x8a71('0x61')](_0x30424f)){logger[_0x8a71('0x52')](_0x8a71('0x79'),_0x30424f['uniqueid'],util[_0x8a71('0x4b')](_0x30424f,{'showHidden':![],'depth':null}));if(_[_0x8a71('0x7a')](this[_0x8a71('0xf')][_0x30424f['uniqueid']])){this['queueReports'][_0x30424f[_0x8a71('0x55')]]=[];}if(_[_0x8a71('0x7a')](this['channels'][_0x30424f['uniqueid']])){this[_0x8a71('0x12')][_0x30424f[_0x8a71('0x55')]]={};}var _0x55a1e8=new QueueReport();_0x55a1e8[_0x8a71('0x6e')]=_0x30424f[_0x8a71('0x6e')];_0x55a1e8['type']=this[_0x8a71('0x6d')][_0x55a1e8['queue']]&&this[_0x8a71('0x6d')][_0x55a1e8[_0x8a71('0x6e')]][_0x8a71('0x5d')]?this[_0x8a71('0x6d')][_0x55a1e8[_0x8a71('0x6e')]][_0x8a71('0x5d')]||_0x8a71('0x6f'):_0x8a71('0x6f');_0x55a1e8[_0x8a71('0x7b')]=moment()[_0x8a71('0x57')](_0x8a71('0x7c'));_0x55a1e8[_0x8a71('0x7d')]=_0x30424f['position'];_0x55a1e8[_0x8a71('0x7e')]=_0x30424f['count'];_0x55a1e8['uniqueid']=_0x30424f[_0x8a71('0x55')];_0x55a1e8[_0x8a71('0x7f')]=this[_0x8a71('0x12')][_0x30424f['uniqueid']]['routealias'];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x55a1e8[_0x8a71('0x6e')],_0x55a1e8[_0x8a71('0x5d')]);Object[_0x8a71('0x6c')](_0x55a1e8,_['pick'](_0x30424f,_[_0x8a71('0x80')](_0x55a1e8)));this[_0x8a71('0xf')][_0x30424f['uniqueid']][_0x8a71('0x74')](_0x55a1e8);this['channels'][_0x30424f[_0x8a71('0x55')]]=_0x55a1e8;this[_0x8a71('0x51')](_0x55a1e8,'queuecallerjoin');}}catch(_0x3c42e8){logger[_0x8a71('0x49')](_0x8a71('0x79'),_0x30424f[_0x8a71('0x55')],util[_0x8a71('0x4b')](_0x3c42e8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8a71('0xb')]['syncQueueCallerAbandon']=function(_0x5be44e){try{if(this[_0x8a71('0x61')](_0x5be44e)){logger['debug'](_0x8a71('0x81'),_0x5be44e[_0x8a71('0x55')],util['inspect'](_0x5be44e,{'showHidden':![],'depth':null}));if(this[_0x8a71('0xf')][_0x5be44e['uniqueid']]){var _0x1e0cf6=_[_0x8a71('0x82')](this[_0x8a71('0xf')][_0x5be44e[_0x8a71('0x55')]]);_0x1e0cf6[_0x8a71('0x3e')]=![];_0x1e0cf6[_0x8a71('0x83')]=null;_0x1e0cf6['holdtime']=_0x5be44e[_0x8a71('0x84')];_0x1e0cf6[_0x8a71('0x85')]=_0x5be44e[_0x8a71('0x85')];_0x1e0cf6[_0x8a71('0x21')]=!![];_0x1e0cf6[_0x8a71('0x86')]=moment()['format'](_0x8a71('0x7c'));_0x1e0cf6[_0x8a71('0x5a')]=_0x8a71('0x87');_0x1e0cf6[_0x8a71('0x88')]=null;logger[_0x8a71('0x89')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x1e0cf6['queue'],_0x1e0cf6[_0x8a71('0x5d')]);this['channels'][_0x5be44e['uniqueid']]=_0x1e0cf6;this[_0x8a71('0x4f')](_0x1e0cf6,_0x8a71('0x21'));}}}catch(_0x125901){logger['error'](_0x8a71('0x81'),_0x5be44e['uniqueid'],util[_0x8a71('0x4b')](_0x125901,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x32ffaf){try{if(this[_0x8a71('0x61')](_0x32ffaf)){logger[_0x8a71('0x52')](_0x8a71('0x8a'),_0x32ffaf[_0x8a71('0x55')],util[_0x8a71('0x4b')](_0x32ffaf,{'showHidden':![],'depth':null}));if(this[_0x8a71('0xf')][_0x32ffaf[_0x8a71('0x55')]]){var _0x29a887=_[_0x8a71('0x82')](this['queueReports'][_0x32ffaf[_0x8a71('0x55')]]);_0x29a887[_0x8a71('0x8b')]=moment()['format'](_0x8a71('0x7c'));_0x29a887[_0x8a71('0x8c')]=_0x32ffaf[_0x8a71('0x8c')];_0x29a887[_0x8a71('0x8d')]=_0x32ffaf[_0x8a71('0x8d')];logger[_0x8a71('0x89')](_0x8a71('0x8e'),_0x29a887[_0x8a71('0x6e')],_0x29a887[_0x8a71('0x5d')],_0x32ffaf[_0x8a71('0x8c')],_0x32ffaf['connectedlinename']);this[_0x8a71('0x12')][_0x32ffaf['uniqueid']]=_0x29a887;this[_0x8a71('0x51')](_0x29a887,_0x8a71('0x23'));}}}catch(_0x2ab6ba){logger[_0x8a71('0x49')](_0x8a71('0x8a'),_0x32ffaf[_0x8a71('0x55')],util[_0x8a71('0x4b')](_0x2ab6ba,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8a71('0xb')]['syncAgentConnect']=function(_0x2abf32){try{if(this['isNotNull'](_0x2abf32)){logger[_0x8a71('0x52')](_0x8a71('0x8f'),_0x2abf32['uniqueid'],util[_0x8a71('0x4b')](_0x2abf32,{'showHidden':![],'depth':null}));if(this[_0x8a71('0xf')][_0x2abf32[_0x8a71('0x55')]]){var _0x297b2f=_[_0x8a71('0x82')](this[_0x8a71('0xf')][_0x2abf32[_0x8a71('0x55')]]);_0x297b2f['queuecallercomplete']=!![];_0x297b2f[_0x8a71('0x5a')]=_0x8a71('0x90');logger[_0x8a71('0x89')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x297b2f[_0x8a71('0x6e')],_0x297b2f[_0x8a71('0x5d')]);}}}catch(_0x149f39){logger[_0x8a71('0x49')]('[%s][voiceQueueReport][agentconnect]',_0x2abf32[_0x8a71('0x55')],util['inspect'](_0x149f39,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8a71('0xb')]['syncAgentComplete']=function(_0x56bb24){try{if(this[_0x8a71('0x61')](_0x56bb24)){logger[_0x8a71('0x52')](_0x8a71('0x91'),_0x56bb24[_0x8a71('0x55')],util[_0x8a71('0x4b')](_0x56bb24,{'showHidden':![],'depth':null}));if(this[_0x8a71('0xf')][_0x56bb24['uniqueid']]){var _0x5d1ecb=_[_0x8a71('0x82')](this[_0x8a71('0xf')][_0x56bb24[_0x8a71('0x55')]]);_0x5d1ecb[_0x8a71('0x21')]=![];_0x5d1ecb[_0x8a71('0x86')]=null;_0x5d1ecb['assigned']=!![];_0x5d1ecb[_0x8a71('0x88')]=_0x56bb24[_0x8a71('0x92')];_0x5d1ecb['holdtime']=_0x56bb24[_0x8a71('0x84')];_0x5d1ecb[_0x8a71('0x3e')]=!![];_0x5d1ecb[_0x8a71('0x3d')]=![];_0x5d1ecb[_0x8a71('0x93')]=null;if(!_0x5d1ecb[_0x8a71('0x94')]){if(_0x56bb24[_0x8a71('0x95')]==_0x8a71('0x94')){_0x5d1ecb[_0x8a71('0x5a')]=_0x8a71('0x96');logger[_0x8a71('0x89')](_0x8a71('0x97'),_0x5d1ecb[_0x8a71('0x6e')],_0x5d1ecb[_0x8a71('0x5d')]);}else{if(_['startsWith'](_0x56bb24['channel'][_0x8a71('0x98')](),'local/')){if(this[_0x8a71('0xf')][_0x56bb24[_0x8a71('0x99')]]){var _0xf1b047=_[_0x8a71('0x82')](this[_0x8a71('0xf')][_0x56bb24['linkedid']]);_0xf1b047[_0x8a71('0x3e')]=![];_0xf1b047[_0x8a71('0x3d')]=!![];_0xf1b047[_0x8a71('0x93')]=moment(_0x5d1ecb['queuecallerjoinAt'])[_0x8a71('0x9a')](_0x56bb24[_0x8a71('0x84')],_0x8a71('0x9b'))[_0x8a71('0x57')](_0x8a71('0x7c'));_0xf1b047[_0x8a71('0x5a')]=_0x8a71('0x9c');_0xf1b047[_0x8a71('0x94')]=!![];_0xf1b047[_0x8a71('0x9d')]='FORWARD';_0xf1b047[_0x8a71('0x9e')]=_0x56bb24['destexten'];_0xf1b047['transferuniqueid']=_0x56bb24[_0x8a71('0x55')];logger[_0x8a71('0x89')](_0x8a71('0x9f'),_0xf1b047['queue'],_0xf1b047[_0x8a71('0x5d')]);var _0x5ae501=this[_0x8a71('0xf')][_0x56bb24[_0x8a71('0x99')]];this[_0x8a71('0xf')][_0x56bb24['linkedid']]=this[_0x8a71('0xf')][_0x56bb24[_0x8a71('0x55')]];this[_0x8a71('0xf')][_0x56bb24['uniqueid']]=_0x5ae501;}}else{_0x5d1ecb[_0x8a71('0x5a')]=_0x8a71('0xa0')+_0x56bb24[_0x8a71('0x95')][_0x8a71('0xa1')]();logger[_0x8a71('0x89')](_0x8a71('0xa2'),_0x5d1ecb[_0x8a71('0x6e')],_0x5d1ecb['type'],_0x5d1ecb[_0x8a71('0x5a')]);}}}this['channels'][_0x56bb24['uniqueid']]=_0x5d1ecb;}}}catch(_0x58e1e1){logger[_0x8a71('0x49')](_0x8a71('0x91'),_0x56bb24[_0x8a71('0x55')],util[_0x8a71('0x4b')](_0x58e1e1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8a71('0xb')][_0x8a71('0x29')]=function(_0x4b3a10){try{if(this[_0x8a71('0x61')](_0x4b3a10)){logger['debug'](_0x8a71('0xa3'),_0x4b3a10[_0x8a71('0x55')],util[_0x8a71('0x4b')](_0x4b3a10,{'showHidden':![],'depth':null}));this['addVariable'](_0x4b3a10[_0x8a71('0x55')],_[_0x8a71('0x80')](_0x4b3a10['variable'])[0x0],_0x4b3a10[_0x8a71('0xa4')]);if(this[_0x8a71('0xf')][_0x4b3a10[_0x8a71('0x55')]]){var _0x356060=_[_0x8a71('0x82')](this[_0x8a71('0xf')][_0x4b3a10[_0x8a71('0x55')]]);if(_0x356060){if(this[_0x8a71('0x61')](_0x4b3a10[_0x8a71('0xa5')])&&this['isNotNull'](_0x4b3a10[_0x8a71('0xa5')][_0x8a71('0x66')])){switch(_0x4b3a10['value']){case _0x8a71('0xa6'):_0x356060['queuecallerexit']=![];_0x356060['queuecallerexitAt']=null;break;case _0x8a71('0xa7'):_0x356060[_0x8a71('0xa8')]=_0x8a71('0xa9');_0x356060[_0x8a71('0x3d')]=!![];_0x356060[_0x8a71('0x93')]=moment()['format'](_0x8a71('0x7c'));_0x356060['queuecallerleaveAt']=moment()[_0x8a71('0x57')](_0x8a71('0x7c'));logger[_0x8a71('0x52')](_0x8a71('0xaa'),_0x4b3a10['uniqueid'],util[_0x8a71('0x4b')](_0x356060,{'showHidden':![],'depth':null}));ami[_0x8a71('0x56')](_0x8a71('0xab'),_0x356060);break;default:_0x356060[_0x8a71('0x3d')]=!![];_0x356060[_0x8a71('0x93')]=moment()['format'](_0x8a71('0x7c'));_0x356060['queuecallerleaveAt']=moment()['format'](_0x8a71('0x7c'));}_0x356060['queuecallerabandon']=![];_0x356060[_0x8a71('0x86')]=null;_0x356060[_0x8a71('0x5a')]=_0x4b3a10['value'];this['channels'][_0x4b3a10['uniqueid']]=_0x356060;this[_0x8a71('0x4f')](_0x356060,'varset');}else if(this['isNotNull'](_0x4b3a10[_0x8a71('0xa5')])&&this['isNotNull'](_0x4b3a10[_0x8a71('0xa5')][_0x8a71('0xac')])){if(!_0x356060[_0x8a71('0x21')]){_0x356060[_0x8a71('0x3d')]=!![];_0x356060[_0x8a71('0x93')]=moment()['format'](_0x8a71('0x7c'));_0x356060[_0x8a71('0x5a')]=_0x8a71('0xad');_0x356060[_0x8a71('0x8b')]=moment()[_0x8a71('0x57')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8a71('0x12')][_0x4b3a10[_0x8a71('0x55')]]=_0x356060;}}logger['info'](_0x8a71('0xae'),_0x4b3a10[_0x8a71('0x55')],_0x356060[_0x8a71('0x6e')],_0x356060[_0x8a71('0x5d')],_['keys'](_0x4b3a10[_0x8a71('0xa5')])[0x0],_0x4b3a10[_0x8a71('0xa4')]);_0x356060['variables']=this[_0x8a71('0x16')][_0x4b3a10[_0x8a71('0x55')]];}}}}catch(_0xd3f68d){logger[_0x8a71('0x49')](_0x8a71('0xa3'),_0x4b3a10['uniqueid'],util[_0x8a71('0x4b')](_0xd3f68d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8a71('0xb')][_0x8a71('0xaf')]=function(_0x23d442,_0x165f82,_0x2fd9f9){var _0x2f02c0=[_0x8a71('0xb0'),'rtpaudioqosbridged',_0x8a71('0xb1'),'rtpaudioqosjitterbridged',_0x8a71('0xb2'),_0x8a71('0xb3'),_0x8a71('0xb4'),'rtpaudioqosrttbridged',_0x8a71('0xb5'),_0x8a71('0xb6'),_0x8a71('0xb7'),'bridgepvtcallid',_0x8a71('0xb8'),_0x8a71('0xb9'),_0x8a71('0xba'),_0x8a71('0xbb'),_0x8a71('0x92'),'memberpenalty',_0x8a71('0xbc')];if(!_[_0x8a71('0x42')](_0x165f82)&&!_[_0x8a71('0xbd')](_0x2f02c0,_0x165f82)){if(_[_0x8a71('0x7a')](this[_0x8a71('0x16')][_0x23d442])){this[_0x8a71('0x16')][_0x23d442]={};}this[_0x8a71('0x16')][_0x23d442][_0x165f82]=_0x2fd9f9;}};VoiceQueueReport[_0x8a71('0xb')][_0x8a71('0xbe')]=function(_0x573191,_0x276f0e,_0x4e1200){try{var _0xaefae5={};if(this['queueReports'][_0x573191]){for(var _0x3b7448=0x0;_0x3b7448<this['queueReports'][_0x573191]['length'];_0x3b7448+=0x1){_0xaefae5=this[_0x8a71('0xf')][_0x573191][_0x3b7448];var _0x4fa19c=this[_0x8a71('0x6d')][_0xaefae5[_0x8a71('0x6e')]];if(_0x4fa19c){_0x4fa19c[_0x8a71('0xbf')]+=moment(_0xaefae5[_0x8a71('0x8b')])[_0x8a71('0xc0')](_0xaefae5['queuecallerjoinAt'],_0x8a71('0x9b'))||0x0;if(_0x4e1200&&_0xaefae5[_0x8a71('0x5a')]==='ATTENDEDTRANSFER'){_0xaefae5[_0x8a71('0x5a')]=_0x8a71('0x90');}if(_0x3b7448===this[_0x8a71('0xf')][_0x573191]['length']-0x1){_0x4fa19c['sumDuration']+=moment()[_0x8a71('0xc1')](0x0)['diff'](_0xaefae5[_0x8a71('0x7b')],'seconds');if(hasCallerLeftTheQueue(_0xaefae5)&&_0xaefae5[_0x8a71('0x5a')]!==_0x8a71('0xc2')){_0x4fa19c[_0x8a71('0xc3')]+=0x1;}if(_0xaefae5['queuecallercomplete']){_0x4fa19c['answered']+=0x1;_0x4fa19c[_0x8a71('0xc4')]+=moment()[_0x8a71('0xc1')](0x0)[_0x8a71('0xc0')](_0xaefae5['queuecallerleaveAt'],'seconds');_0xaefae5[_0x8a71('0x83')]=moment()['format'](_0x8a71('0x7c'));_0xaefae5[_0x8a71('0x3d')]=![];_0xaefae5[_0x8a71('0x93')]=null;}if(_0xaefae5['queuecallerexit']&&_0xaefae5[_0x8a71('0x94')]!=!![]){_0x4fa19c[_0x8a71('0xc5')]+=0x1;_0xaefae5[_0x8a71('0xa8')]=_0x8a71('0xc5');logger['debug'](_0x8a71('0xc6'),_0x573191,util[_0x8a71('0x4b')](_0xaefae5,{'showHidden':![],'depth':null}));ami[_0x8a71('0x56')]('custom:queuecallerunmanaged',_0xaefae5);}if(_0xaefae5[_0x8a71('0x21')]){_0x4fa19c[_0x8a71('0xc7')]+=0x1;_0xaefae5['lastevent']=_0x8a71('0xc7');logger[_0x8a71('0x52')](_0x8a71('0xc8'),_0x573191,util[_0x8a71('0x4b')](_0xaefae5,{'showHidden':![],'depth':null}));ami[_0x8a71('0x56')](_0x8a71('0xc9'),_0xaefae5);}}else{_0x4fa19c[_0x8a71('0xca')]+=_0x4fa19c[_0x8a71('0xbf')];}logger['info']('[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s',_0x573191,_0xaefae5['queue'],_0xaefae5[_0x8a71('0x5d')],_0x276f0e);this[_0x8a71('0x12')][_0x573191]=_0xaefae5;Object[_0x8a71('0x6c')](this[_0x8a71('0x6d')][_0xaefae5['queue']],_0x4fa19c);if(_0xaefae5[_0x8a71('0x8b')]){this[_0x8a71('0x4f')](_0xaefae5,'hangup');}}}logger['debug'](_0x8a71('0xcb'),_0x573191,util['inspect'](this[_0x8a71('0xf')][_0x573191],{'showHidden':![],'depth':null}));if(hasCallerLeftTheQueue(_0xaefae5)&&_0xaefae5['queuecallerexitreason']!==_0x8a71('0xc2')){ami['emit'](_0x8a71('0xcc'),this[_0x8a71('0xf')][_0x573191]);if(this[_0x8a71('0xf')][_0x573191]){delete this['queueReports'][_0x573191];}if(this[_0x8a71('0x12')][_0x573191]){delete this[_0x8a71('0x12')][_0x573191];}if(this[_0x8a71('0x16')][_0x573191]){delete this[_0x8a71('0x16')][_0x573191];}}}}catch(_0x146788){logger[_0x8a71('0x49')](_0x8a71('0xcd'),_0x573191,util[_0x8a71('0x4b')](_0x146788,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8a71('0xb')][_0x8a71('0x2b')]=function(_0x42bce6){try{if(this[_0x8a71('0x61')](_0x42bce6)){logger[_0x8a71('0x52')](_0x8a71('0xce'),_0x42bce6[_0x8a71('0x55')],util[_0x8a71('0x4b')](_0x42bce6,{'showHidden':![],'depth':null}));if(this[_0x8a71('0xf')][_0x42bce6[_0x8a71('0x55')]]){return this['handleHangup'](_0x42bce6[_0x8a71('0x55')],_0x42bce6[_0x8a71('0xcf')],![]);}if(this['queueReports'][_0x42bce6['linkedid']]){if(_0x42bce6['cause']==='21'){return;}return this[_0x8a71('0xbe')](_0x42bce6[_0x8a71('0x99')],_0x42bce6[_0x8a71('0xcf')],!![]);}var _0x202bc4=Object[_0x8a71('0x80')](this[_0x8a71('0xf')]);for(var _0x3ba528=0x0;_0x3ba528<_0x202bc4['length'];_0x3ba528++){var _0x4be860=_[_0x8a71('0x82')](this[_0x8a71('0xf')][_0x202bc4[_0x3ba528]]);if(_0x4be860&&_0x4be860[_0x8a71('0xd0')]===_0x42bce6['uniqueid']){return this[_0x8a71('0xbe')](_0x4be860[_0x8a71('0x55')],_0x42bce6['cause-txt'],!![]);}}if(!this[_0x8a71('0xf')][_0x42bce6[_0x8a71('0x55')]]){logger[_0x8a71('0x52')](_0x8a71('0xd1'),_0x42bce6[_0x8a71('0x55')]);if(this[_0x8a71('0x12')][_0x42bce6['uniqueid']]){delete this[_0x8a71('0x12')][_0x42bce6[_0x8a71('0x55')]];}if(this['variables'][_0x42bce6[_0x8a71('0x55')]]){delete this[_0x8a71('0x16')][_0x42bce6[_0x8a71('0x55')]];}}}}catch(_0x2b444b){logger[_0x8a71('0x49')](_0x8a71('0xce'),_0x42bce6[_0x8a71('0x55')],util[_0x8a71('0x4b')](_0x2b444b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8a71('0xb')]['syncAttendedTransfer']=function(_0x21f3ac){try{if(this[_0x8a71('0x61')](_0x21f3ac)){logger[_0x8a71('0x52')](_0x8a71('0xd2'),_0x21f3ac[_0x8a71('0x55')],util['inspect'](_0x21f3ac,{'showHidden':![],'depth':null}));var _0x4fc4b2;var _0x3cfd36;var _0x5c3188;if(this[_0x8a71('0xf')][_0x21f3ac[_0x8a71('0xd3')]]){_0x4fc4b2=_[_0x8a71('0x82')](this[_0x8a71('0xf')][_0x21f3ac['transfereeuniqueid']]);_0x4fc4b2[_0x8a71('0x9e')]=_0x21f3ac['secondtransfererexten'];_0x4fc4b2[_0x8a71('0xd4')]=_0x21f3ac['secondtransfereruniqueid'];_0x4fc4b2[_0x8a71('0x5a')]='ATTENDEDTRANSFER';_0x4fc4b2[_0x8a71('0x94')]=!![];_0x4fc4b2[_0x8a71('0x9d')]=_0x8a71('0xd5');if(this[_0x8a71('0xf')][_0x21f3ac[_0x8a71('0xd6')]]){_0x5c3188=this[_0x8a71('0xf')][_0x21f3ac[_0x8a71('0xd6')]];this[_0x8a71('0xf')][_0x21f3ac[_0x8a71('0xd6')]]=this[_0x8a71('0xf')][_0x21f3ac[_0x8a71('0xd3')]];this[_0x8a71('0xf')][_0x21f3ac[_0x8a71('0xd3')]]=_0x5c3188;_0x3cfd36=_[_0x8a71('0x82')](this[_0x8a71('0xf')][_0x21f3ac[_0x8a71('0xd3')]]);_0x3cfd36[_0x8a71('0x40')]=!![];}logger[_0x8a71('0x89')](_0x8a71('0xd7'),_0x21f3ac[_0x8a71('0x55')],_0x4fc4b2[_0x8a71('0x6e')],_0x4fc4b2['type'],_0x4fc4b2[_0x8a71('0x9e')],_0x4fc4b2[_0x8a71('0xd4')]);}else if(this[_0x8a71('0xf')][_0x21f3ac[_0x8a71('0xd8')]]){_0x4fc4b2=_['last'](this[_0x8a71('0xf')][_0x21f3ac[_0x8a71('0xd8')]]);_0x4fc4b2['transferexten']=_0x21f3ac['origtransfererexten'];_0x4fc4b2['transferuniqueid']=_0x21f3ac['origtransfereruniqueid'];_0x4fc4b2[_0x8a71('0x5a')]=_0x8a71('0xc2');_0x4fc4b2[_0x8a71('0x94')]=!![];_0x4fc4b2[_0x8a71('0x9d')]='ATTENDED';if(this[_0x8a71('0xf')][_0x21f3ac[_0x8a71('0xd9')]]){_0x5c3188=this[_0x8a71('0xf')][_0x21f3ac[_0x8a71('0xd9')]];this['queueReports'][_0x21f3ac['origtransfereruniqueid']]=this['queueReports'][_0x21f3ac[_0x8a71('0xd8')]];this[_0x8a71('0xf')][_0x21f3ac[_0x8a71('0xd8')]]=_0x5c3188;_0x3cfd36=_[_0x8a71('0x82')](this[_0x8a71('0xf')][_0x21f3ac[_0x8a71('0xd8')]]);_0x3cfd36[_0x8a71('0x40')]=!![];}logger[_0x8a71('0x89')](_0x8a71('0xd7'),_0x21f3ac['uniqueid'],_0x4fc4b2[_0x8a71('0x6e')],_0x4fc4b2[_0x8a71('0x5d')],_0x4fc4b2[_0x8a71('0x9e')],_0x4fc4b2[_0x8a71('0xd4')]);}else if(this[_0x8a71('0xf')][_0x21f3ac['origtransfereruniqueid']]){_0x4fc4b2=_[_0x8a71('0x82')](this[_0x8a71('0xf')][_0x21f3ac[_0x8a71('0xd9')]]);_0x4fc4b2[_0x8a71('0x9e')]=_0x21f3ac[_0x8a71('0xda')];_0x4fc4b2[_0x8a71('0xd4')]=_0x21f3ac[_0x8a71('0xd9')];_0x4fc4b2[_0x8a71('0x5a')]='ATTENDEDTRANSFER';_0x4fc4b2[_0x8a71('0x94')]=!![];_0x4fc4b2['transfertype']='ATTENDED';_0x4fc4b2[_0x8a71('0x40')]=!![];_0x4fc4b2[_0x8a71('0xd0')]=_0x21f3ac[_0x8a71('0xd3')];}else if(this[_0x8a71('0xf')][_0x21f3ac[_0x8a71('0xd6')]]){_0x4fc4b2=_[_0x8a71('0x82')](this[_0x8a71('0xf')][_0x21f3ac[_0x8a71('0xd6')]]);_0x4fc4b2[_0x8a71('0x9e')]=_0x21f3ac[_0x8a71('0xdb')];_0x4fc4b2['transferuniqueid']=_0x21f3ac[_0x8a71('0xd6')];_0x4fc4b2['queuecallerexitreason']=_0x8a71('0xc2');_0x4fc4b2['transfer']=!![];_0x4fc4b2[_0x8a71('0x9d')]=_0x8a71('0xd5');_0x4fc4b2[_0x8a71('0x40')]=!![];_0x4fc4b2['transferid']=_0x21f3ac['transfertargetuniqueid'];}}}catch(_0x3356df){logger[_0x8a71('0x49')]('[%s][voiceQueueReport][attendedtransfer]',_0x21f3ac[_0x8a71('0x55')],util[_0x8a71('0x4b')](_0x3356df,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8a71('0xb')][_0x8a71('0x32')]=function(_0x2a3c14){try{if(this['isNotNull'](_0x2a3c14)){logger['debug'](_0x8a71('0xdc'),_0x2a3c14['uniqueid'],util['inspect'](_0x2a3c14,{'showHidden':![],'depth':null}));if(this[_0x8a71('0xf')][_0x2a3c14[_0x8a71('0xd3')]]){var _0x19be58=_[_0x8a71('0x82')](this[_0x8a71('0xf')][_0x2a3c14[_0x8a71('0xd3')]]);_0x19be58[_0x8a71('0x5a')]=_0x8a71('0xdd');_0x19be58[_0x8a71('0x94')]=!![];_0x19be58['transfertype']=_0x8a71('0xde');_0x19be58['transferexten']=_0x2a3c14[_0x8a71('0xdf')];_0x19be58[_0x8a71('0xd4')]=_0x2a3c14[_0x8a71('0xd3')];logger[_0x8a71('0x89')](_0x8a71('0xe0'),_0x2a3c14[_0x8a71('0x55')],_0x19be58[_0x8a71('0x6e')],_0x19be58[_0x8a71('0x5d')],_0x19be58[_0x8a71('0x9e')],_0x19be58[_0x8a71('0xd4')]);this[_0x8a71('0x2b')]({'event':'BlindTransfer','uniqueid':_0x2a3c14[_0x8a71('0xd3')],'context':_0x2a3c14['context'],'channel':_0x2a3c14[_0x8a71('0xe1')]});}}}catch(_0xd1ff28){logger[_0x8a71('0x49')](_0x8a71('0xdc'),_0x2a3c14[_0x8a71('0x55')],util[_0x8a71('0x4b')](_0xd1ff28,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8a71('0xb')][_0x8a71('0x2d')]=function(_0x53dd8d){try{if(this[_0x8a71('0x61')](_0x53dd8d)){logger[_0x8a71('0x52')]('[%s][voiceQueueReport][musiconholdstart]',_0x53dd8d[_0x8a71('0x55')],util[_0x8a71('0x4b')](_0x53dd8d,{'showHidden':![],'depth':null}));if(this[_0x8a71('0xf')][_0x53dd8d['uniqueid']]){var _0x25e416=_[_0x8a71('0x82')](this[_0x8a71('0xf')][_0x53dd8d['uniqueid']]);if(!_[_0x8a71('0x42')](_0x25e416[_0x8a71('0x8b')])){_0x25e416['mohstarttime']=moment()[_0x8a71('0x57')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x8a71('0x89')](_0x8a71('0xe2'),_0x53dd8d['uniqueid'],_0x25e416[_0x8a71('0xe3')]);}}}}catch(_0x1a542c){logger[_0x8a71('0x49')]('[%s][voiceQueueReport][musiconholdstart]',_0x53dd8d['uniqueid'],util[_0x8a71('0x4b')](_0x1a542c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8a71('0xb')][_0x8a71('0xe4')]=function(_0x221b35){try{if(this['isNotNull'](_0x221b35)){logger[_0x8a71('0x52')](_0x8a71('0xe5'),_0x221b35[_0x8a71('0x55')],util['inspect'](_0x221b35,{'showHidden':![],'depth':null}));if(this[_0x8a71('0xf')][_0x221b35[_0x8a71('0x55')]]){var _0x42a556=_['last'](this[_0x8a71('0xf')][_0x221b35[_0x8a71('0x55')]]);if(!_[_0x8a71('0x42')](_0x42a556[_0x8a71('0xe3')])){_0x42a556[_0x8a71('0xe6')]+=moment()[_0x8a71('0xc1')](0x0)[_0x8a71('0xc0')](_0x42a556['mohstarttime'],'seconds');logger[_0x8a71('0x89')](_0x8a71('0xe7'),_0x221b35[_0x8a71('0x55')],_0x42a556[_0x8a71('0xe6')]);delete _0x42a556[_0x8a71('0xe3')];}}}}catch(_0x874cf4){logger[_0x8a71('0x49')](_0x8a71('0xe5'),_0x221b35[_0x8a71('0x55')],util[_0x8a71('0x4b')](_0x874cf4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8a71('0xb')]['syncNewExten']=function(_0xd9763d){try{if(this[_0x8a71('0x61')](_0xd9763d)){logger[_0x8a71('0x52')]('[%s][voiceQueueReport][newexten]\x20event:',_0xd9763d[_0x8a71('0x55')],util[_0x8a71('0x4b')](_0xd9763d,{'showHidden':![],'depth':null}));if(_0xd9763d[_0x8a71('0xe8')][_0x8a71('0x98')]()===_0x8a71('0xe9')){_0xd9763d[_0x8a71('0xea')]=_0xd9763d[_0x8a71('0xeb')]&&_0xd9763d[_0x8a71('0xeb')][_0x8a71('0xec')](_0x8a71('0xed'))?_0xd9763d['appdata']:(_0xd9763d[_0x8a71('0xeb')]||_0xd9763d['applicationdata'])['toLowerCase']();if(_[_0x8a71('0xec')](_0xd9763d[_0x8a71('0xea')][_0x8a71('0x98')](),_0x8a71('0xee'))){logger[_0x8a71('0x89')]('[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s',_0xd9763d[_0x8a71('0x55')],_0xd9763d[_0x8a71('0xe8')],_0xd9763d['applicationdata']);if(_[_0x8a71('0x7a')](this[_0x8a71('0x12')][_0xd9763d['uniqueid']]))this[_0x8a71('0x12')][_0xd9763d[_0x8a71('0x55')]]={};var _0x471443=_0xd9763d[_0x8a71('0xea')][_0x8a71('0xef')]('=');var _0x199d18=_0x471443[0x0]['toLowerCase']()['match'](/cdr\((.*)\)/);if(_0x199d18)this[_0x8a71('0x12')][_0xd9763d[_0x8a71('0x55')]][_0x199d18[0x1]]=_0x471443[0x1];}}}}catch(_0x5510c8){logger['error'](_0x8a71('0xf0'),_0xd9763d[_0x8a71('0x55')],util[_0x8a71('0x4b')](_0x5510c8,{'showHidden':![],'depth':null}));}};module[_0x8a71('0xf1')]=VoiceQueueReport;
\ No newline at end of file