Built motion from commit 3c2ce842.|2.6.31
[motion2.git] / server / services / ami / report / voiceQueueReport.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x46a4=['queueChannels','voiceQueues','campaigns','summary','variables','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','syncQueueMember','queuestatuscomplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','syncQueueCallerLeave','agentcomplete','syncAgentConnect','varset','hangup','syncHangup','syncFullyBooted','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','queuecallerexit','clearZombieChannels','isNil','status','channel','catch','message','No\x20such\x20channel','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','error','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','format','voice:queue:%s','queue','voice_queue_channel:save','voice_queue_presence:save','debug',']\x20sending\x20voice_queue_channel:remove\x20event:','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','isNotNull','isUndefined','loopQueueShow','queues','[voiceQueueReport][queues]','loopQueueSummary','isRunning','Action','queuesummary','then','queuestatus','actionid','[voiceQueueReport][queuesummary]','createQueueSummaryReport','summaryEvent','createReport','handleInboundQueueSummaryReport','compareToInboundQueue','assign','syncQueueStatusComplete','custom:queuesummary','statusRequests','completeEvent','push','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','uniqueid','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','keys','emitVoiceQueueChannelSave','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleave','[%s][voiceQueueReport][queuecallerleave]','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','syncAgentComplete','[%s][voiceQueueReport][agentcomplete]','assigned','lastAssignedTo','membername','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','local/','linkedid','add','FORWARD','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','syncVarSet','[%s][voiceQueueReport][varset]','addVariable','variable','value','CONTINUE','lastevent','timeout','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','membercalls','memberdynamic','memberpenalty','memberrealtime','includes','handleHangup','sumHoldTime','seconds','ATTENDEDTRANSFER','length','milliseconds','diff','total','answered','queuecallercompleteAt','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','abandoned','custom:queuecallerabandon','sumDuration','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%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','deleteChannelAfterTimeout','syncAttendedTransfer','transfereeuniqueid','transferexten','secondtransfererexten','secondtransfereruniqueid','transfertype','switch','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDED','BLINDTRANSFER','BLIND','extension','BlindTransfer','context','[%s][voiceQueueReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','syncNewExten','set','applicationdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','match','[%s][voiceQueueReport][newexten]','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','../model/voiceQueueSummary','defaults','localhost','socket.io-emitter','redis','prototype','enqueue','tail','finally','sequence','queueReports','realtime','agents','channels'];(function(_0x12c3d7,_0xc116fd){var _0x14ba8b=function(_0x184608){while(--_0x184608){_0x12c3d7['push'](_0x12c3d7['shift']());}};_0x14ba8b(++_0xc116fd);}(_0x46a4,0xe2));var _0x446a=function(_0x2bb9cd,_0x13c6eb){_0x2bb9cd=_0x2bb9cd-0x0;var _0x150406=_0x46a4[_0x2bb9cd];return _0x150406;};'use strict';var _=require('lodash');var moment=require(_0x446a('0x0'));var util=require(_0x446a('0x1'));var Redis=require(_0x446a('0x2'));var config=require(_0x446a('0x3'));var logger=require(_0x446a('0x4'))(_0x446a('0x5'));var ami=require(_0x446a('0x6'));var QueueReport=require(_0x446a('0x7'));var VoiceQueueSummary=require(_0x446a('0x8'));config['redis']=_[_0x446a('0x9')](config['redis'],{'host':_0x446a('0xa'),'port':0x18eb});var io=require(_0x446a('0xb'))(new Redis(config[_0x446a('0xc')]));var Sequence=function(){};Sequence[_0x446a('0xd')][_0x446a('0xe')]=function(_0x1892f3){this[_0x446a('0xf')]=this[_0x446a('0xf')]?this['tail'][_0x446a('0x10')](_0x1892f3):_0x1892f3();};function VoiceQueueReport(_0x1446f9){this[_0x446a('0x11')]=new Sequence();this[_0x446a('0x12')]={};this[_0x446a('0x13')]=_0x1446f9;this['agents']=_0x1446f9[_0x446a('0x14')];this[_0x446a('0x15')]=_0x1446f9[_0x446a('0x16')];this['voiceQueues']=_0x1446f9[_0x446a('0x17')];this[_0x446a('0x18')]=_0x1446f9[_0x446a('0x18')];this[_0x446a('0x19')]=initializeSummary();this[_0x446a('0x1a')]={};ami['on']('queuesummary',this[_0x446a('0x1b')][_0x446a('0x1c')](this));ami['on'](_0x446a('0x1d'),this[_0x446a('0x1e')][_0x446a('0x1c')](this));ami['on']('queuemember',this[_0x446a('0x1f')][_0x446a('0x1c')](this));ami['on'](_0x446a('0x20'),this['syncQueueStatusComplete'][_0x446a('0x1c')](this));ami['on'](_0x446a('0x21'),this[_0x446a('0x22')][_0x446a('0x1c')](this));ami['on'](_0x446a('0x23'),this[_0x446a('0x24')][_0x446a('0x1c')](this));ami['on']('queuecallerleave',this[_0x446a('0x25')][_0x446a('0x1c')](this));ami['on'](_0x446a('0x26'),this['syncAgentComplete']['bind'](this));ami['on']('agentconnect',this[_0x446a('0x27')][_0x446a('0x1c')](this));ami['on'](_0x446a('0x28'),this['syncVarSet'][_0x446a('0x1c')](this));ami['on'](_0x446a('0x29'),this[_0x446a('0x2a')][_0x446a('0x1c')](this));ami['on']('fullybooted',this[_0x446a('0x2b')][_0x446a('0x1c')](this));ami['on'](_0x446a('0x2c'),this['syncMusicOnHoldStart'][_0x446a('0x1c')](this));ami['on'](_0x446a('0x2d'),this[_0x446a('0x2e')][_0x446a('0x1c')](this));ami['on'](_0x446a('0x2f'),this['syncAttendedTransfer'][_0x446a('0x1c')](this));ami['on'](_0x446a('0x30'),this[_0x446a('0x31')][_0x446a('0x1c')](this));this['loopQueueSummary']();this['loopQueueShow']();}function clearChannels(_0x4e289b){if(!_[_0x446a('0x32')](_0x4e289b)){for(var _0x4351b7 in _0x4e289b){if(_0x4e289b['hasOwnProperty'](_0x4351b7)){delete _0x4e289b[_0x4351b7];}}}}function clearCampaigns(_0x1cb541){if(!_[_0x446a('0x32')](_0x1cb541)){for(var _0x1cfcc3 in _0x1cb541){if(_0x1cb541[_0x446a('0x33')](_0x1cfcc3)){_0x1cb541[_0x1cfcc3]['originated']=0x0;}}}}function clearVoiceQueues(_0x121cd5){if(!_[_0x446a('0x32')](_0x121cd5)){for(var _0x5b1f0f in _0x121cd5){if(_0x121cd5[_0x446a('0x33')](_0x5b1f0f)){_0x121cd5[_0x5b1f0f][_0x446a('0x34')]=0x0;_0x121cd5[_0x5b1f0f][_0x446a('0x35')]=0x0;_0x121cd5[_0x5b1f0f][_0x446a('0x36')]=0x0;_0x121cd5[_0x5b1f0f][_0x446a('0x37')]=0x0;_0x121cd5[_0x5b1f0f][_0x446a('0x38')]=!![];}}}}function clearAgentBooked(_0x934c7a){if(!_['isEmpty'](_0x934c7a)){for(var _0x58cc7e in _0x934c7a){if(_0x934c7a[_0x446a('0x33')](_0x58cc7e)){_0x934c7a[_0x58cc7e][_0x446a('0x39')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x59e99f){return _0x59e99f[_0x446a('0x3a')]||_0x59e99f[_0x446a('0x23')]||_0x59e99f['queuecallercomplete'];}VoiceQueueReport[_0x446a('0xd')][_0x446a('0x3b')]=function(){var _0x88e5dc=this;for(var _0xc8df4d in this['channels']){if(this[_0x446a('0x15')][_0x446a('0x33')](_0xc8df4d)&&!this[_0x446a('0x15')][_0xc8df4d]['switch']){this[_0x446a('0x11')]['enqueue'](function(){if(!_[_0x446a('0x3c')](_0x88e5dc[_0x446a('0x15')][_0xc8df4d])){return ami['Action']({'action':_0x446a('0x3d'),'channel':_0x88e5dc[_0x446a('0x15')][_0xc8df4d][_0x446a('0x3e')]})[_0x446a('0x3f')](function(_0xf8f4e7){if(_0xf8f4e7[_0x446a('0x40')]===_0x446a('0x41')){setTimeout(function(){if(_0x88e5dc[_0x446a('0x15')][_0xc8df4d]){delete _0x88e5dc[_0x446a('0x15')][_0xc8df4d];logger['error'](_0x446a('0x42'),_0xc8df4d,util[_0x446a('0x43')](_0xf8f4e7,{'showHidden':![],'depth':null}));}if(_0x88e5dc[_0x446a('0x12')][_0xc8df4d]){delete _0x88e5dc[_0x446a('0x12')][_0xc8df4d];logger['error'](_0x446a('0x44'),_0xc8df4d,util[_0x446a('0x43')](_0xf8f4e7,{'showHidden':![],'depth':null}));}if(_0x88e5dc[_0x446a('0x1a')][_0xc8df4d]){delete _0x88e5dc[_0x446a('0x1a')][_0xc8df4d];logger[_0x446a('0x45')]('[%s][voiceQueueReport][checkVariables]',_0xc8df4d,util[_0x446a('0x43')](_0xf8f4e7,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x446a('0xd')][_0x446a('0x2b')]=function(){logger[_0x446a('0x45')](_0x446a('0x46'));clearChannels(this[_0x446a('0x15')]);this[_0x446a('0x47')](this[_0x446a('0x12')]);clearAgentBooked(this[_0x446a('0x14')]);clearVoiceQueues(this[_0x446a('0x17')]);clearCampaigns(this[_0x446a('0x18')]);this[_0x446a('0x19')]=initializeSummary();};VoiceQueueReport['prototype'][_0x446a('0x47')]=function(_0x4c7361){var _0x5dbe5d=this;if(!_[_0x446a('0x32')](_0x4c7361)){for(var _0x567031 in _0x4c7361){if(_0x4c7361['hasOwnProperty'](_0x567031)){_0x5dbe5d[_0x446a('0x48')](_0x4c7361[_0x567031],_0x446a('0x49'));delete _0x4c7361[_0x567031];}}}};VoiceQueueReport[_0x446a('0xd')][_0x446a('0x4a')]=function(_0x56d512,_0x42887f,_0x395020){io['to'](_0x56d512)[_0x446a('0x4a')](_0x42887f,_0x395020);};VoiceQueueReport['prototype']['emitVoiceQueueChannelSave']=function(_0x270ded,_0x18e824){logger['debug'](_0x446a('0x4b')+_0x18e824+_0x446a('0x4c'),_0x270ded['uniqueid'],util[_0x446a('0x43')](_0x270ded,{'showHidden':![],'depth':null}));this[_0x446a('0x4a')](util[_0x446a('0x4d')](_0x446a('0x4e'),_0x270ded[_0x446a('0x4f')]),_0x446a('0x50'),_0x270ded);io['emit'](_0x446a('0x51'),_0x270ded);};VoiceQueueReport['prototype']['emitVoiceQueueChannelRemove']=function(_0x3735cd,_0x59bb90){logger[_0x446a('0x52')](_0x446a('0x4b')+_0x59bb90+_0x446a('0x53'),_0x3735cd['uniqueid'],util[_0x446a('0x43')](_0x3735cd,{'showHidden':![],'depth':null}));if(_0x3735cd['queuecallerexitreason']==='ATTENDEDTRANSFER'){return;}this[_0x446a('0x4a')](util[_0x446a('0x4d')](_0x446a('0x4e'),_0x3735cd[_0x446a('0x4f')]),_0x446a('0x54'),_0x3735cd);io[_0x446a('0x4a')](_0x446a('0x55'),_0x3735cd);};VoiceQueueReport[_0x446a('0xd')][_0x446a('0x56')]=function(_0x5df907){if(_0x5df907[_0x446a('0x57')]===_0x446a('0x58')){logger['debug'](_0x446a('0x59'),util['inspect'](_0x5df907,{'showHidden':![],'depth':null}));this[_0x446a('0x4a')](util['format']('voice:queue:%s',_0x5df907[_0x446a('0x5a')]),'voice_queue:save',_0x5df907);}};VoiceQueueReport['prototype'][_0x446a('0x5b')]=function(_0x3ff5aa){return _0x3ff5aa!==null&&!_[_0x446a('0x5c')](_0x3ff5aa);};VoiceQueueReport[_0x446a('0xd')][_0x446a('0x5d')]=function(){var _0x450325=this;setInterval(function(){_0x450325[_0x446a('0x3b')]();ami['Action']({'action':_0x446a('0x5e')})[_0x446a('0x3f')](function(_0x412d1f){logger[_0x446a('0x45')](_0x446a('0x5f'),util[_0x446a('0x43')](_0x412d1f,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x446a('0xd')][_0x446a('0x60')]=function(){var _0x32d46c=this;setInterval(function(){if(!_0x32d46c[_0x446a('0x19')][_0x446a('0x61')]){return ami[_0x446a('0x62')]({'action':_0x446a('0x63')})[_0x446a('0x64')](function(_0x138b96){_0x32d46c['summary']['id']=_0x138b96['actionid'];_0x32d46c['summary'][_0x446a('0x61')]=!![];_0x32d46c['summary'][_0x446a('0x65')][_0x138b96[_0x446a('0x66')]]={};})[_0x446a('0x3f')](function(_0x9ed435){logger[_0x446a('0x45')](_0x446a('0x67'),util[_0x446a('0x43')](_0x9ed435,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x446a('0xd')][_0x446a('0x68')]=function(_0x750c88,_0x46be37){var _0x2c3abd;if(this[_0x446a('0x19')]&&this[_0x446a('0x19')][_0x446a('0x5e')]&&this[_0x446a('0x19')][_0x446a('0x5e')][_0x750c88['name']]){_0x2c3abd=this[_0x446a('0x19')]['queues'][_0x750c88[_0x446a('0x5a')]][_0x446a('0x69')];}var _0x500c6f=new VoiceQueueSummary(_0x750c88);return _0x500c6f[_0x446a('0x6a')](_0x46be37['agents'],this[_0x446a('0x14')],_0x2c3abd,this['realtime'][_0x446a('0x15')]);};VoiceQueueReport['prototype'][_0x446a('0x6b')]=function(_0x5ee367,_0x16e7f6){var _0x1a8812=this[_0x446a('0x68')](_0x5ee367,_0x16e7f6);var _0x585462=![];_0x585462=_0x1a8812[_0x446a('0x6c')](_0x5ee367);if(_0x585462){Object[_0x446a('0x6d')](_0x5ee367,_0x1a8812);this[_0x446a('0x13')][_0x446a('0x17')][_0x5ee367[_0x446a('0x5a')]]=_0x5ee367;this[_0x446a('0x56')](_0x1a8812);}};VoiceQueueReport[_0x446a('0xd')][_0x446a('0x6e')]=function(_0x14e4d0){var _0x30b7ca=null;var _0x1b6c2b=this[_0x446a('0x19')]['id'];if(this[_0x446a('0x19')]['queuestatus'][_0x1b6c2b]){_0x30b7ca=this[_0x446a('0x19')]['queuestatus'][_0x1b6c2b][_0x14e4d0['actionid']];}if(!_0x30b7ca){this[_0x446a('0x19')]=initializeSummary();return;}var _0x18c7bb=this[_0x446a('0x17')][_0x30b7ca[_0x446a('0x4f')]];if(_0x18c7bb[_0x446a('0x57')]===_0x446a('0x58')){this[_0x446a('0x6b')](_0x18c7bb,_0x30b7ca);}else if(_0x18c7bb[_0x446a('0x57')]==='outbound'){var _0x2557f3=this[_0x446a('0x68')](_0x18c7bb,_0x30b7ca);ami[_0x446a('0x4a')](_0x446a('0x6f'),_0x2557f3);}this[_0x446a('0x19')]['statusRequests']-=0x1;var _0x10b520=this['summary'][_0x446a('0x70')]>0x0?!![]:![];if(!_0x10b520){return this[_0x446a('0x1e')](this[_0x446a('0x19')][_0x446a('0x71')]);}};VoiceQueueReport[_0x446a('0xd')][_0x446a('0x1f')]=function(_0x182cae){var _0x220919=this[_0x446a('0x19')]['id'];if(this[_0x446a('0x19')][_0x446a('0x65')][_0x220919]&&this[_0x446a('0x19')]['queuestatus'][_0x220919][_0x182cae[_0x446a('0x66')]]){this['summary'][_0x446a('0x65')][_0x220919][_0x182cae[_0x446a('0x66')]][_0x446a('0x14')][_0x446a('0x72')](_0x182cae);}};VoiceQueueReport[_0x446a('0xd')][_0x446a('0x1b')]=function(_0x172390){var _0x677325=this;try{if(this[_0x446a('0x5b')](_0x172390)&&this[_0x446a('0x5b')](_0x172390[_0x446a('0x4f')])){logger['debug']('[voiceQueueReport][queuesummary]\x20event:',util[_0x446a('0x43')](_0x172390,{'showHidden':![],'depth':null}));var _0x5146a5=this[_0x446a('0x17')][_0x172390[_0x446a('0x4f')]];if(_0x5146a5){logger['debug'](_0x446a('0x73'),_0x5146a5['name']);this[_0x446a('0x19')][_0x446a('0x5e')][_0x5146a5[_0x446a('0x5a')]]={'summaryEvent':_0x172390};this[_0x446a('0x19')][_0x446a('0x70')]+=0x1;return ami['Action']({'action':_0x446a('0x65'),'queue':_0x5146a5['name']})[_0x446a('0x64')](function(_0x4c48a6){if(!_0x677325[_0x446a('0x19')][_0x446a('0x65')][_0x172390[_0x446a('0x66')]]){_0x677325[_0x446a('0x19')]['queuestatus'][_0x172390[_0x446a('0x66')]]={};}_0x677325['summary']['queuestatus'][_0x172390[_0x446a('0x66')]][_0x4c48a6[_0x446a('0x66')]]={'queue':_0x5146a5['name'],'agents':[]};})[_0x446a('0x3f')](function(_0x42028e){throw _0x42028e;});}}}catch(_0x3af18f){logger[_0x446a('0x45')]('[voiceQueueReport][queuesummary]',util[_0x446a('0x43')](_0x3af18f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x446a('0xd')]['syncQueueSummaryComplete']=function(_0x461b65){if(this[_0x446a('0x19')]['statusRequests']>0x0){this[_0x446a('0x19')]['completeEvent']=_0x461b65;return;}logger[_0x446a('0x52')](_0x446a('0x74'),util['inspect'](_0x461b65,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0x446a('0x4a')](_0x446a('0x75'),{});};VoiceQueueReport[_0x446a('0xd')][_0x446a('0x22')]=function(_0x287324){try{if(this[_0x446a('0x5b')](_0x287324)){logger[_0x446a('0x52')](_0x446a('0x76'),_0x287324[_0x446a('0x77')],util['inspect'](_0x287324,{'showHidden':![],'depth':null}));if(_[_0x446a('0x5c')](this[_0x446a('0x12')][_0x287324[_0x446a('0x77')]])){this[_0x446a('0x12')][_0x287324['uniqueid']]=[];}if(_[_0x446a('0x5c')](this['channels'][_0x287324[_0x446a('0x77')]])){this['channels'][_0x287324[_0x446a('0x77')]]={};}var _0x5ad2f1=new QueueReport();_0x5ad2f1[_0x446a('0x4f')]=_0x287324[_0x446a('0x4f')];_0x5ad2f1[_0x446a('0x57')]=this[_0x446a('0x17')][_0x5ad2f1[_0x446a('0x4f')]]&&this['voiceQueues'][_0x5ad2f1['queue']][_0x446a('0x57')]?this[_0x446a('0x17')][_0x5ad2f1['queue']]['type']||_0x446a('0x58'):_0x446a('0x58');_0x5ad2f1[_0x446a('0x78')]=moment()[_0x446a('0x4d')](_0x446a('0x79'));_0x5ad2f1['position']=_0x287324['position'];_0x5ad2f1['count']=_0x287324[_0x446a('0x7a')];_0x5ad2f1[_0x446a('0x77')]=_0x287324[_0x446a('0x77')];logger[_0x446a('0x7b')](_0x446a('0x7c'),_0x5ad2f1[_0x446a('0x4f')],_0x5ad2f1[_0x446a('0x57')]);Object['assign'](_0x5ad2f1,_[_0x446a('0x7d')](_0x287324,_[_0x446a('0x7e')](_0x5ad2f1)));this[_0x446a('0x12')][_0x287324[_0x446a('0x77')]]['push'](_0x5ad2f1);this[_0x446a('0x15')][_0x287324[_0x446a('0x77')]]=_0x5ad2f1;this[_0x446a('0x7f')](_0x5ad2f1,_0x446a('0x21'));}}catch(_0x36d831){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x287324[_0x446a('0x77')],util[_0x446a('0x43')](_0x36d831,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x446a('0xd')]['syncQueueCallerAbandon']=function(_0x160c63){try{if(this['isNotNull'](_0x160c63)){logger[_0x446a('0x52')](_0x446a('0x80'),_0x160c63['uniqueid'],util['inspect'](_0x160c63,{'showHidden':![],'depth':null}));if(this[_0x446a('0x12')][_0x160c63[_0x446a('0x77')]]){var _0x2a9620=_[_0x446a('0x81')](this[_0x446a('0x12')][_0x160c63[_0x446a('0x77')]]);_0x2a9620[_0x446a('0x82')]=![];_0x2a9620['queuecallercompleteAt']=null;_0x2a9620[_0x446a('0x83')]=_0x160c63[_0x446a('0x83')];_0x2a9620['originalposition']=_0x160c63[_0x446a('0x84')];_0x2a9620[_0x446a('0x23')]=!![];_0x2a9620[_0x446a('0x85')]=moment()[_0x446a('0x4d')](_0x446a('0x79'));_0x2a9620[_0x446a('0x86')]=_0x446a('0x87');_0x2a9620['lastAssignedTo']=null;logger[_0x446a('0x7b')](_0x446a('0x88'),_0x2a9620['queue'],_0x2a9620[_0x446a('0x57')]);this[_0x446a('0x15')][_0x160c63[_0x446a('0x77')]]=_0x2a9620;this[_0x446a('0x48')](_0x2a9620,_0x446a('0x23'));}}}catch(_0xbc3645){logger[_0x446a('0x45')](_0x446a('0x80'),_0x160c63[_0x446a('0x77')],util['inspect'](_0xbc3645,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x446a('0xd')]['syncQueueCallerLeave']=function(_0x353dbf){try{if(this[_0x446a('0x5b')](_0x353dbf)){logger[_0x446a('0x52')]('[%s][voiceQueueReport][queuecallerleave]',_0x353dbf[_0x446a('0x77')],util[_0x446a('0x43')](_0x353dbf,{'showHidden':![],'depth':null}));if(this[_0x446a('0x12')][_0x353dbf[_0x446a('0x77')]]){var _0xf58d01=_['last'](this[_0x446a('0x12')][_0x353dbf[_0x446a('0x77')]]);_0xf58d01[_0x446a('0x89')]=moment()[_0x446a('0x4d')](_0x446a('0x79'));_0xf58d01[_0x446a('0x8a')]=_0x353dbf[_0x446a('0x8a')];_0xf58d01[_0x446a('0x8b')]=_0x353dbf['connectedlinename'];logger[_0x446a('0x7b')](_0x446a('0x8c'),_0xf58d01[_0x446a('0x4f')],_0xf58d01[_0x446a('0x57')],_0x353dbf[_0x446a('0x8a')],_0x353dbf[_0x446a('0x8b')]);this[_0x446a('0x15')][_0x353dbf[_0x446a('0x77')]]=_0xf58d01;this['emitVoiceQueueChannelSave'](_0xf58d01,_0x446a('0x8d'));}}}catch(_0x122d2c){logger['error'](_0x446a('0x8e'),_0x353dbf[_0x446a('0x77')],util[_0x446a('0x43')](_0x122d2c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x446a('0x27')]=function(_0x4c4fa9){try{if(this['isNotNull'](_0x4c4fa9)){logger[_0x446a('0x52')](_0x446a('0x8f'),_0x4c4fa9[_0x446a('0x77')],util[_0x446a('0x43')](_0x4c4fa9,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4c4fa9[_0x446a('0x77')]]){var _0x31350b=_['last'](this['queueReports'][_0x4c4fa9[_0x446a('0x77')]]);_0x31350b[_0x446a('0x82')]=!![];_0x31350b[_0x446a('0x86')]=_0x446a('0x90');logger[_0x446a('0x7b')](_0x446a('0x91'),_0x31350b['queue'],_0x31350b[_0x446a('0x57')]);}}}catch(_0x5f0002){logger['error'](_0x446a('0x8f'),_0x4c4fa9['uniqueid'],util[_0x446a('0x43')](_0x5f0002,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x446a('0xd')][_0x446a('0x92')]=function(_0x7f0531){try{if(this[_0x446a('0x5b')](_0x7f0531)){logger[_0x446a('0x52')](_0x446a('0x93'),_0x7f0531[_0x446a('0x77')],util[_0x446a('0x43')](_0x7f0531,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x7f0531[_0x446a('0x77')]]){var _0x5ef545=_[_0x446a('0x81')](this['queueReports'][_0x7f0531['uniqueid']]);_0x5ef545[_0x446a('0x23')]=![];_0x5ef545['queuecallerabandonAt']=null;_0x5ef545[_0x446a('0x94')]=!![];_0x5ef545[_0x446a('0x95')]=_0x7f0531[_0x446a('0x96')];_0x5ef545[_0x446a('0x83')]=_0x7f0531['holdtime'];_0x5ef545['queuecallercomplete']=!![];_0x5ef545[_0x446a('0x3a')]=![];_0x5ef545[_0x446a('0x97')]=null;if(!_0x5ef545[_0x446a('0x98')]){if(_0x7f0531[_0x446a('0x99')]==_0x446a('0x98')){_0x5ef545[_0x446a('0x86')]=_0x446a('0x9a');logger[_0x446a('0x7b')](_0x446a('0x9b'),_0x5ef545[_0x446a('0x4f')],_0x5ef545[_0x446a('0x57')]);}else{if(_[_0x446a('0x9c')](_0x7f0531[_0x446a('0x3e')][_0x446a('0x9d')](),_0x446a('0x9e'))){if(this[_0x446a('0x12')][_0x7f0531[_0x446a('0x9f')]]){var _0x2dc2e9=_['last'](this['queueReports'][_0x7f0531[_0x446a('0x9f')]]);_0x2dc2e9['queuecallercomplete']=![];_0x2dc2e9[_0x446a('0x3a')]=!![];_0x2dc2e9[_0x446a('0x97')]=moment(_0x5ef545[_0x446a('0x78')])[_0x446a('0xa0')](_0x7f0531['holdtime'],'seconds')[_0x446a('0x4d')](_0x446a('0x79'));_0x2dc2e9['queuecallerexitreason']='FORWARDTRANSFER';_0x2dc2e9[_0x446a('0x98')]=!![];_0x2dc2e9['transfertype']=_0x446a('0xa1');_0x2dc2e9['transferexten']=_0x7f0531['destexten'];_0x2dc2e9[_0x446a('0xa2')]=_0x7f0531[_0x446a('0x77')];logger[_0x446a('0x7b')](_0x446a('0xa3'),_0x2dc2e9['queue'],_0x2dc2e9[_0x446a('0x57')]);var _0x25d670=this[_0x446a('0x12')][_0x7f0531[_0x446a('0x9f')]];this[_0x446a('0x12')][_0x7f0531[_0x446a('0x9f')]]=this[_0x446a('0x12')][_0x7f0531['uniqueid']];this[_0x446a('0x12')][_0x7f0531[_0x446a('0x77')]]=_0x25d670;}}else{_0x5ef545[_0x446a('0x86')]=_0x446a('0xa4')+_0x7f0531[_0x446a('0x99')][_0x446a('0xa5')]();logger[_0x446a('0x7b')](_0x446a('0xa6'),_0x5ef545['queue'],_0x5ef545[_0x446a('0x57')],_0x5ef545['queuecallerexitreason']);}}}this[_0x446a('0x15')][_0x7f0531[_0x446a('0x77')]]=_0x5ef545;}}}catch(_0x247a4d){logger[_0x446a('0x45')](_0x446a('0x93'),_0x7f0531[_0x446a('0x77')],util[_0x446a('0x43')](_0x247a4d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x446a('0xd')][_0x446a('0xa7')]=function(_0x48a1e0){try{if(this['isNotNull'](_0x48a1e0)){logger['debug'](_0x446a('0xa8'),_0x48a1e0['uniqueid'],util[_0x446a('0x43')](_0x48a1e0,{'showHidden':![],'depth':null}));this[_0x446a('0xa9')](_0x48a1e0[_0x446a('0x77')],_['keys'](_0x48a1e0[_0x446a('0xaa')])[0x0],_0x48a1e0[_0x446a('0xab')]);if(this['queueReports'][_0x48a1e0[_0x446a('0x77')]]){var _0x55a008=_['last'](this[_0x446a('0x12')][_0x48a1e0[_0x446a('0x77')]]);if(_0x55a008){if(this[_0x446a('0x5b')](_0x48a1e0['variable'])&&this[_0x446a('0x5b')](_0x48a1e0[_0x446a('0xaa')][_0x446a('0x65')])){switch(_0x48a1e0['value']){case _0x446a('0xac'):_0x55a008['queuecallerexit']=![];_0x55a008[_0x446a('0x97')]=null;break;case'TIMEOUT':_0x55a008[_0x446a('0xad')]=_0x446a('0xae');_0x55a008[_0x446a('0x3a')]=!![];_0x55a008['queuecallerexitAt']=moment()[_0x446a('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x55a008[_0x446a('0x89')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0x446a('0x52')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x48a1e0[_0x446a('0x77')],util['inspect'](_0x55a008,{'showHidden':![],'depth':null}));ami['emit'](_0x446a('0xaf'),_0x55a008);break;default:_0x55a008[_0x446a('0x3a')]=!![];_0x55a008[_0x446a('0x97')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x55a008[_0x446a('0x89')]=moment()[_0x446a('0x4d')](_0x446a('0x79'));}_0x55a008[_0x446a('0x23')]=![];_0x55a008['queuecallerabandonAt']=null;_0x55a008[_0x446a('0x86')]=_0x48a1e0['value'];this[_0x446a('0x15')][_0x48a1e0['uniqueid']]=_0x55a008;this['emitVoiceQueueChannelRemove'](_0x55a008,_0x446a('0x28'));}else if(this[_0x446a('0x5b')](_0x48a1e0[_0x446a('0xaa')])&&this[_0x446a('0x5b')](_0x48a1e0[_0x446a('0xaa')][_0x446a('0xb0')])){if(!_0x55a008[_0x446a('0x23')]){_0x55a008[_0x446a('0x3a')]=!![];_0x55a008[_0x446a('0x97')]=moment()[_0x446a('0x4d')](_0x446a('0x79'));_0x55a008['queuecallerexitreason']=_0x446a('0xb1');_0x55a008[_0x446a('0x89')]=moment()[_0x446a('0x4d')](_0x446a('0x79'));this[_0x446a('0x15')][_0x48a1e0[_0x446a('0x77')]]=_0x55a008;}}logger[_0x446a('0x7b')](_0x446a('0xb2'),_0x48a1e0[_0x446a('0x77')],_0x55a008['queue'],_0x55a008[_0x446a('0x57')],_[_0x446a('0x7e')](_0x48a1e0[_0x446a('0xaa')])[0x0],_0x48a1e0[_0x446a('0xab')]);_0x55a008[_0x446a('0x1a')]=this['variables'][_0x48a1e0[_0x446a('0x77')]];}}}}catch(_0x32989e){logger[_0x446a('0x45')](_0x446a('0xa8'),_0x48a1e0[_0x446a('0x77')],util['inspect'](_0x32989e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x446a('0xd')][_0x446a('0xa9')]=function(_0x9d5b74,_0x511c60,_0x16efc9){var _0x316da6=['rtpaudioqos',_0x446a('0xb3'),'rtpaudioqosjitter',_0x446a('0xb4'),_0x446a('0xb5'),_0x446a('0xb6'),_0x446a('0xb7'),_0x446a('0xb8'),'sipcallid','sipuri','bridgepeer',_0x446a('0xb9'),_0x446a('0xba'),_0x446a('0xbb'),'memberinterface','memberlastcall',_0x446a('0x96'),_0x446a('0xbc'),_0x446a('0xbd')];if(!_['isNil'](_0x511c60)&&!_[_0x446a('0xbe')](_0x316da6,_0x511c60)){if(_[_0x446a('0x5c')](this[_0x446a('0x1a')][_0x9d5b74])){this[_0x446a('0x1a')][_0x9d5b74]={};}this[_0x446a('0x1a')][_0x9d5b74][_0x511c60]=_0x16efc9;}};VoiceQueueReport[_0x446a('0xd')][_0x446a('0xbf')]=function(_0x489b3e,_0x5da324,_0x1c23f0){try{var _0x977afd={};if(this[_0x446a('0x12')][_0x489b3e]){for(var _0x1fa53f=0x0;_0x1fa53f<this['queueReports'][_0x489b3e]['length'];_0x1fa53f+=0x1){_0x977afd=this[_0x446a('0x12')][_0x489b3e][_0x1fa53f];var _0x1188fd=this[_0x446a('0x17')][_0x977afd[_0x446a('0x4f')]];if(_0x1188fd){_0x1188fd[_0x446a('0xc0')]+=moment(_0x977afd[_0x446a('0x89')])['diff'](_0x977afd[_0x446a('0x78')],_0x446a('0xc1'))||0x0;if(_0x1c23f0&&_0x977afd[_0x446a('0x86')]===_0x446a('0xc2')){_0x977afd[_0x446a('0x86')]=_0x446a('0x90');}if(_0x1fa53f===this[_0x446a('0x12')][_0x489b3e][_0x446a('0xc3')]-0x1){_0x1188fd['sumDuration']+=moment()[_0x446a('0xc4')](0x0)[_0x446a('0xc5')](_0x977afd[_0x446a('0x78')],_0x446a('0xc1'));if(hasCallerLeftTheQueue(_0x977afd)&&_0x977afd[_0x446a('0x86')]!=='ATTENDEDTRANSFER'){_0x1188fd[_0x446a('0xc6')]+=0x1;}if(_0x977afd['queuecallercomplete']){_0x1188fd[_0x446a('0xc7')]+=0x1;_0x1188fd['sumBillable']+=moment()[_0x446a('0xc4')](0x0)[_0x446a('0xc5')](_0x977afd[_0x446a('0x89')],_0x446a('0xc1'));_0x977afd[_0x446a('0xc8')]=moment()[_0x446a('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x977afd[_0x446a('0x3a')]=![];_0x977afd['queuecallerexitAt']=null;}if(_0x977afd[_0x446a('0x3a')]&&_0x977afd[_0x446a('0x98')]!=!![]){_0x1188fd[_0x446a('0xc9')]+=0x1;_0x977afd[_0x446a('0xad')]='unmanaged';logger[_0x446a('0x52')](_0x446a('0xca'),_0x489b3e,util[_0x446a('0x43')](_0x977afd,{'showHidden':![],'depth':null}));ami[_0x446a('0x4a')](_0x446a('0xcb'),_0x977afd);}if(_0x977afd[_0x446a('0x23')]){_0x1188fd[_0x446a('0xcc')]+=0x1;_0x977afd[_0x446a('0xad')]=_0x446a('0xcc');logger[_0x446a('0x52')]('[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:',_0x489b3e,util[_0x446a('0x43')](_0x977afd,{'showHidden':![],'depth':null}));ami[_0x446a('0x4a')](_0x446a('0xcd'),_0x977afd);}}else{_0x1188fd[_0x446a('0xce')]+=_0x1188fd[_0x446a('0xc0')];}logger[_0x446a('0x7b')](_0x446a('0xcf'),_0x489b3e,_0x977afd[_0x446a('0x4f')],_0x977afd[_0x446a('0x57')],_0x5da324);this[_0x446a('0x15')][_0x489b3e]=_0x977afd;Object['assign'](this[_0x446a('0x17')][_0x977afd[_0x446a('0x4f')]],_0x1188fd);if(_0x977afd[_0x446a('0x89')]){this[_0x446a('0x48')](_0x977afd,_0x446a('0x29'));}}}logger[_0x446a('0x52')](_0x446a('0xd0'),_0x489b3e,util[_0x446a('0x43')](this[_0x446a('0x12')][_0x489b3e],{'showHidden':![],'depth':null}));if(hasCallerLeftTheQueue(_0x977afd)&&_0x977afd['queuecallerexitreason']!==_0x446a('0xc2')){ami['emit'](_0x446a('0xd1'),this[_0x446a('0x12')][_0x489b3e]);if(this[_0x446a('0x12')][_0x489b3e]){delete this['queueReports'][_0x489b3e];}if(this[_0x446a('0x15')][_0x489b3e]){this['deleteChannelAfterTimeout'](_0x489b3e);}if(this[_0x446a('0x1a')][_0x489b3e]){delete this[_0x446a('0x1a')][_0x489b3e];}}}}catch(_0x3b6c84){logger[_0x446a('0x45')](_0x446a('0xd2'),_0x489b3e,util[_0x446a('0x43')](_0x3b6c84,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x446a('0x2a')]=function(_0x3372b9){try{if(this['isNotNull'](_0x3372b9)){logger[_0x446a('0x52')](_0x446a('0xd3'),_0x3372b9[_0x446a('0x77')],util[_0x446a('0x43')](_0x3372b9,{'showHidden':![],'depth':null}));if(this[_0x446a('0x12')][_0x3372b9['uniqueid']]){return this['handleHangup'](_0x3372b9[_0x446a('0x77')],_0x3372b9[_0x446a('0xd4')],![]);}if(this[_0x446a('0x12')][_0x3372b9[_0x446a('0x9f')]]){if(_0x3372b9['cause']==='21'){return;}return this['handleHangup'](_0x3372b9[_0x446a('0x9f')],_0x3372b9[_0x446a('0xd4')],!![]);}var _0x30c687=Object[_0x446a('0x7e')](this['queueReports']);for(var _0xc5ff=0x0;_0xc5ff<_0x30c687[_0x446a('0xc3')];_0xc5ff++){var _0x4a30ff=_[_0x446a('0x81')](this[_0x446a('0x12')][_0x30c687[_0xc5ff]]);if(_0x4a30ff&&_0x4a30ff[_0x446a('0xd5')]===_0x3372b9[_0x446a('0x77')]){return this['handleHangup'](_0x4a30ff[_0x446a('0x77')],_0x3372b9[_0x446a('0xd4')],!![]);}}if(!this[_0x446a('0x12')][_0x3372b9[_0x446a('0x77')]]){logger[_0x446a('0x52')](_0x446a('0xd6'),_0x3372b9['uniqueid']);if(this[_0x446a('0x15')][_0x3372b9[_0x446a('0x77')]]){this[_0x446a('0xd7')](_0x3372b9[_0x446a('0x77')]);}if(this['variables'][_0x3372b9[_0x446a('0x77')]]){delete this['variables'][_0x3372b9[_0x446a('0x77')]];}}}}catch(_0x1d894c){logger[_0x446a('0x45')](_0x446a('0xd3'),_0x3372b9['uniqueid'],util[_0x446a('0x43')](_0x1d894c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x446a('0xd')][_0x446a('0xd8')]=function(_0x5c17bc){try{if(this[_0x446a('0x5b')](_0x5c17bc)){logger[_0x446a('0x52')]('[%s][voiceQueueReport][attendedtransfer]',_0x5c17bc[_0x446a('0x77')],util['inspect'](_0x5c17bc,{'showHidden':![],'depth':null}));var _0x3eeaa4;var _0x1e5cf5;var _0x2018c7;if(this[_0x446a('0x12')][_0x5c17bc[_0x446a('0xd9')]]){_0x3eeaa4=_[_0x446a('0x81')](this[_0x446a('0x12')][_0x5c17bc[_0x446a('0xd9')]]);_0x3eeaa4[_0x446a('0xda')]=_0x5c17bc[_0x446a('0xdb')];_0x3eeaa4[_0x446a('0xa2')]=_0x5c17bc[_0x446a('0xdc')];_0x3eeaa4[_0x446a('0x86')]=_0x446a('0xc2');_0x3eeaa4[_0x446a('0x98')]=!![];_0x3eeaa4[_0x446a('0xdd')]='ATTENDED';if(this[_0x446a('0x12')][_0x5c17bc[_0x446a('0xdc')]]){_0x2018c7=this[_0x446a('0x12')][_0x5c17bc[_0x446a('0xdc')]];this[_0x446a('0x12')][_0x5c17bc['secondtransfereruniqueid']]=this[_0x446a('0x12')][_0x5c17bc[_0x446a('0xd9')]];this[_0x446a('0x12')][_0x5c17bc[_0x446a('0xd9')]]=_0x2018c7;_0x1e5cf5=_['last'](this[_0x446a('0x12')][_0x5c17bc[_0x446a('0xd9')]]);_0x1e5cf5[_0x446a('0xde')]=!![];}logger['info'](_0x446a('0xdf'),_0x5c17bc[_0x446a('0x77')],_0x3eeaa4[_0x446a('0x4f')],_0x3eeaa4['type'],_0x3eeaa4[_0x446a('0xda')],_0x3eeaa4[_0x446a('0xa2')]);}else if(this['queueReports'][_0x5c17bc[_0x446a('0xe0')]]){_0x3eeaa4=_[_0x446a('0x81')](this['queueReports'][_0x5c17bc[_0x446a('0xe0')]]);_0x3eeaa4['transferexten']=_0x5c17bc[_0x446a('0xe1')];_0x3eeaa4[_0x446a('0xa2')]=_0x5c17bc[_0x446a('0xe2')];_0x3eeaa4['queuecallerexitreason']=_0x446a('0xc2');_0x3eeaa4[_0x446a('0x98')]=!![];_0x3eeaa4[_0x446a('0xdd')]=_0x446a('0xe3');if(this['queueReports'][_0x5c17bc[_0x446a('0xe2')]]){_0x2018c7=this[_0x446a('0x12')][_0x5c17bc[_0x446a('0xe2')]];this[_0x446a('0x12')][_0x5c17bc[_0x446a('0xe2')]]=this[_0x446a('0x12')][_0x5c17bc[_0x446a('0xe0')]];this['queueReports'][_0x5c17bc[_0x446a('0xe0')]]=_0x2018c7;_0x1e5cf5=_[_0x446a('0x81')](this[_0x446a('0x12')][_0x5c17bc[_0x446a('0xe0')]]);_0x1e5cf5[_0x446a('0xde')]=!![];}logger[_0x446a('0x7b')](_0x446a('0xdf'),_0x5c17bc[_0x446a('0x77')],_0x3eeaa4['queue'],_0x3eeaa4[_0x446a('0x57')],_0x3eeaa4[_0x446a('0xda')],_0x3eeaa4['transferuniqueid']);}else if(this['queueReports'][_0x5c17bc[_0x446a('0xe2')]]){_0x3eeaa4=_['last'](this[_0x446a('0x12')][_0x5c17bc[_0x446a('0xe2')]]);_0x3eeaa4[_0x446a('0xda')]=_0x5c17bc[_0x446a('0xe1')];_0x3eeaa4[_0x446a('0xa2')]=_0x5c17bc['origtransfereruniqueid'];_0x3eeaa4[_0x446a('0x86')]=_0x446a('0xc2');_0x3eeaa4[_0x446a('0x98')]=!![];_0x3eeaa4[_0x446a('0xdd')]=_0x446a('0xe3');_0x3eeaa4[_0x446a('0xde')]=!![];_0x3eeaa4[_0x446a('0xd5')]=_0x5c17bc[_0x446a('0xd9')];}else if(this[_0x446a('0x12')][_0x5c17bc['secondtransfereruniqueid']]){_0x3eeaa4=_['last'](this[_0x446a('0x12')][_0x5c17bc[_0x446a('0xdc')]]);_0x3eeaa4[_0x446a('0xda')]=_0x5c17bc[_0x446a('0xdb')];_0x3eeaa4[_0x446a('0xa2')]=_0x5c17bc[_0x446a('0xdc')];_0x3eeaa4[_0x446a('0x86')]=_0x446a('0xc2');_0x3eeaa4[_0x446a('0x98')]=!![];_0x3eeaa4['transfertype']='ATTENDED';_0x3eeaa4[_0x446a('0xde')]=!![];_0x3eeaa4['transferid']=_0x5c17bc['transfertargetuniqueid'];}}}catch(_0x4dec7a){logger[_0x446a('0x45')]('[%s][voiceQueueReport][attendedtransfer]',_0x5c17bc[_0x446a('0x77')],util[_0x446a('0x43')](_0x4dec7a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x446a('0xd')]['syncBlindTransfer']=function(_0x52735a){try{if(this['isNotNull'](_0x52735a)){logger[_0x446a('0x52')]('[%s][voiceQueueReport][blindtransfer]',_0x52735a[_0x446a('0x77')],util[_0x446a('0x43')](_0x52735a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x52735a[_0x446a('0xd9')]]){var _0x3fe2f5=_[_0x446a('0x81')](this[_0x446a('0x12')][_0x52735a[_0x446a('0xd9')]]);_0x3fe2f5[_0x446a('0x86')]=_0x446a('0xe4');_0x3fe2f5['transfer']=!![];_0x3fe2f5[_0x446a('0xdd')]=_0x446a('0xe5');_0x3fe2f5[_0x446a('0xda')]=_0x52735a[_0x446a('0xe6')];_0x3fe2f5[_0x446a('0xa2')]=_0x52735a[_0x446a('0xd9')];logger['info']('[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s',_0x52735a[_0x446a('0x77')],_0x3fe2f5[_0x446a('0x4f')],_0x3fe2f5['type'],_0x3fe2f5['transferexten'],_0x3fe2f5[_0x446a('0xa2')]);this[_0x446a('0x2a')]({'event':_0x446a('0xe7'),'uniqueid':_0x52735a[_0x446a('0xd9')],'context':_0x52735a[_0x446a('0xe8')],'channel':_0x52735a['transfererchannel']});}}}catch(_0x5e3f2b){logger[_0x446a('0x45')](_0x446a('0xe9'),_0x52735a[_0x446a('0x77')],util[_0x446a('0x43')](_0x5e3f2b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x446a('0xd')][_0x446a('0xea')]=function(_0x21601b){try{if(this['isNotNull'](_0x21601b)){logger['debug'](_0x446a('0xeb'),_0x21601b[_0x446a('0x77')],util['inspect'](_0x21601b,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x21601b[_0x446a('0x77')]]){var _0x4f009f=_[_0x446a('0x81')](this[_0x446a('0x12')][_0x21601b['uniqueid']]);if(!_[_0x446a('0x3c')](_0x4f009f['queuecallerleaveAt'])){_0x4f009f[_0x446a('0xec')]=moment()[_0x446a('0x4d')](_0x446a('0x79'));logger[_0x446a('0x7b')](_0x446a('0xed'),_0x21601b[_0x446a('0x77')],_0x4f009f['mohstarttime']);}}}}catch(_0x51fb13){logger[_0x446a('0x45')](_0x446a('0xeb'),_0x21601b[_0x446a('0x77')],util[_0x446a('0x43')](_0x51fb13,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x446a('0xd')][_0x446a('0x2e')]=function(_0x188206){try{if(this['isNotNull'](_0x188206)){logger[_0x446a('0x52')](_0x446a('0xee'),_0x188206['uniqueid'],util['inspect'](_0x188206,{'showHidden':![],'depth':null}));if(this[_0x446a('0x12')][_0x188206[_0x446a('0x77')]]){var _0x43b383=_[_0x446a('0x81')](this[_0x446a('0x12')][_0x188206[_0x446a('0x77')]]);if(!_[_0x446a('0x3c')](_0x43b383['mohstarttime'])){_0x43b383[_0x446a('0xef')]+=moment()['milliseconds'](0x0)[_0x446a('0xc5')](_0x43b383['mohstarttime'],_0x446a('0xc1'));logger[_0x446a('0x7b')]('[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s',_0x188206[_0x446a('0x77')],_0x43b383[_0x446a('0xef')]);delete _0x43b383[_0x446a('0xec')];}}}}catch(_0x4cef0b){logger[_0x446a('0x45')]('[%s][voiceQueueReport][musiconholdstop]',_0x188206[_0x446a('0x77')],util[_0x446a('0x43')](_0x4cef0b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x446a('0xf0')]=function(_0x697daa){try{if(this[_0x446a('0x5b')](_0x697daa)){logger[_0x446a('0x52')]('[%s][voiceQueueReport][newexten]\x20event:',_0x697daa['uniqueid'],util[_0x446a('0x43')](_0x697daa,{'showHidden':![],'depth':null}));if(_0x697daa['application'][_0x446a('0x9d')]()===_0x446a('0xf1')){_0x697daa['applicationdata']=(_0x697daa['appdata']||_0x697daa[_0x446a('0xf2')])[_0x446a('0x9d')]();if(_['startsWith'](_0x697daa[_0x446a('0xf2')][_0x446a('0x9d')](),_0x446a('0xf3'))){logger[_0x446a('0x7b')](_0x446a('0xf4'),_0x697daa[_0x446a('0x77')],_0x697daa['application'],_0x697daa['applicationdata']);if(_[_0x446a('0x5c')](this[_0x446a('0x15')][_0x697daa[_0x446a('0x77')]]))this['channels'][_0x697daa[_0x446a('0x77')]]={};var _0x309ba8=_0x697daa[_0x446a('0xf2')]['split']('=');var _0x68bcf0=_0x309ba8[0x0][_0x446a('0x9d')]()[_0x446a('0xf5')](/cdr\((.*)\)/);if(_0x68bcf0)this[_0x446a('0x15')][_0x697daa[_0x446a('0x77')]][_0x68bcf0[0x1]]=_0x309ba8[0x1];}}}}catch(_0x36b9fa){logger[_0x446a('0x45')](_0x446a('0xf6'),_0x697daa[_0x446a('0x77')],util[_0x446a('0x43')](_0x36b9fa,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x446a('0xd')][_0x446a('0xd7')]=function(_0x43edf0,_0x3766fd=0x2710){if(this['channels'][_0x43edf0]){setTimeout(()=>{delete this[_0x446a('0x15')][_0x43edf0];},_0x3766fd);}};module[_0x446a('0xf7')]=VoiceQueueReport;