4c643183d91da094a4d603f8887ec67cee5a76bf
[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 _0xa2c6=['COMPLETEDBYAGENT','total','sumBillable','milliseconds','queuecallercompleteAt','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','abandoned','custom:queuecallerabandon','sumDuration','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','[%s][voiceQueueReport][handleHangup]','syncHangup','[%s][voiceQueueReport][hangup]','cause-txt','cause','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','transfereeuniqueid','transferexten','secondtransfereruniqueid','transfertype','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','secondtransfererexten','[%s][voiceQueueReport][attendedtransfer]','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','context','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','application','toLowerCase','applicationdata','appdata','CDR(routeAlias)','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','match','[%s][voiceQueueReport][newexten]','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','realtime','agents','channels','queueChannels','voiceQueues','campaigns','variables','queuesummary','syncQueueSummary','bind','syncQueueSummaryComplete','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','fullybooted','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','isEmpty','hasOwnProperty','originated','talking','pTalking','queueStatusComplete','unlockRR','clearZombieChannels','switch','status','catch','error','[%s][voiceQueueReport][checkChannel]','[%s][voiceQueueReport][checkQueueReport]','inspect','[%s][voiceQueueReport][checkVariables]','syncFullyBooted','[FullyBooted]\x20clear\x20realtime','clearQueueReport','summary','emitVoiceQueueChannelRemove','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','voice_queue_channel:save','voice_queue_presence:save','queue','emitInboundVoiceQueueSummary','type','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','isNotNull','loopQueueShow','Action','queues','[voiceQueueReport][queues]','isRunning','actionid','[voiceQueueReport][queuesummary]','createQueueSummaryReport','summaryEvent','createReport','handleInboundQueueSummaryReport','compareToInboundQueue','assign','queuestatus','custom:queuesummary','statusRequests','completeEvent','push','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','then','custom:queuesummarycomplete','isUndefined','inbound','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','routealias','info','pick','keys','[%s][voiceQueueReport][queuecallerjoin]','[%s][voiceQueueReport][queuecallerabandon]','queuecallercomplete','holdtime','originalposition','queuecallerexitreason','[%s][voiceQueueReport][queuecallerleave]','last','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','assigned','lastAssignedTo','queuecallerexit','queuecallerexitAt','reason','transfer','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','linkedid','seconds','FORWARDTRANSFER','FORWARD','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[%s][voiceQueueReport][agentcomplete]','variable','value','lastevent','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queuecallerabandonAt','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','[%s][voiceQueueReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','membername','memberpenalty','memberrealtime','isNil','includes','handleHangup','length','sumHoldTime','diff','ATTENDEDTRANSFER'];(function(_0x3dea7d,_0x2cd4ea){var _0x53919a=function(_0x1554e2){while(--_0x1554e2){_0x3dea7d['push'](_0x3dea7d['shift']());}};_0x53919a(++_0x2cd4ea);}(_0xa2c6,0x11f));var _0x6a2c=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0xa2c6[_0x4ed4d2];return _0x15ae2e;};'use strict';var _=require(_0x6a2c('0x0'));var moment=require('moment');var util=require(_0x6a2c('0x1'));var Redis=require(_0x6a2c('0x2'));var config=require(_0x6a2c('0x3'));var logger=require(_0x6a2c('0x4'))(_0x6a2c('0x5'));var ami=require(_0x6a2c('0x6'));var QueueReport=require(_0x6a2c('0x7'));var VoiceQueueSummary=require('../model/voiceQueueSummary');config['redis']=_[_0x6a2c('0x8')](config[_0x6a2c('0x9')],{'host':_0x6a2c('0xa'),'port':0x18eb});var io=require(_0x6a2c('0xb'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x6a2c('0xc')][_0x6a2c('0xd')]=function(_0x719be0){this['tail']=this[_0x6a2c('0xe')]?this[_0x6a2c('0xe')][_0x6a2c('0xf')](_0x719be0):_0x719be0();};function VoiceQueueReport(_0xc8b1ce){this[_0x6a2c('0x10')]=new Sequence();this[_0x6a2c('0x11')]={};this[_0x6a2c('0x12')]=_0xc8b1ce;this['agents']=_0xc8b1ce[_0x6a2c('0x13')];this[_0x6a2c('0x14')]=_0xc8b1ce[_0x6a2c('0x15')];this[_0x6a2c('0x16')]=_0xc8b1ce[_0x6a2c('0x16')];this[_0x6a2c('0x17')]=_0xc8b1ce[_0x6a2c('0x17')];this['summary']=initializeSummary();this[_0x6a2c('0x18')]={};ami['on'](_0x6a2c('0x19'),this[_0x6a2c('0x1a')][_0x6a2c('0x1b')](this));ami['on']('queuesummarycomplete',this[_0x6a2c('0x1c')][_0x6a2c('0x1b')](this));ami['on'](_0x6a2c('0x1d'),this[_0x6a2c('0x1e')][_0x6a2c('0x1b')](this));ami['on'](_0x6a2c('0x1f'),this[_0x6a2c('0x20')][_0x6a2c('0x1b')](this));ami['on'](_0x6a2c('0x21'),this[_0x6a2c('0x22')][_0x6a2c('0x1b')](this));ami['on'](_0x6a2c('0x23'),this[_0x6a2c('0x24')][_0x6a2c('0x1b')](this));ami['on'](_0x6a2c('0x25'),this[_0x6a2c('0x26')]['bind'](this));ami['on']('agentcomplete',this[_0x6a2c('0x27')][_0x6a2c('0x1b')](this));ami['on'](_0x6a2c('0x28'),this[_0x6a2c('0x29')][_0x6a2c('0x1b')](this));ami['on'](_0x6a2c('0x2a'),this[_0x6a2c('0x2b')][_0x6a2c('0x1b')](this));ami['on'](_0x6a2c('0x2c'),this['syncHangup'][_0x6a2c('0x1b')](this));ami['on'](_0x6a2c('0x2d'),this['syncFullyBooted'][_0x6a2c('0x1b')](this));ami['on'](_0x6a2c('0x2e'),this['syncMusicOnHoldStart'][_0x6a2c('0x1b')](this));ami['on'](_0x6a2c('0x2f'),this[_0x6a2c('0x30')]['bind'](this));ami['on'](_0x6a2c('0x31'),this[_0x6a2c('0x32')]['bind'](this));ami['on'](_0x6a2c('0x33'),this[_0x6a2c('0x34')]['bind'](this));this[_0x6a2c('0x35')]();this['loopQueueShow']();}function clearChannels(_0x560f94){if(!_[_0x6a2c('0x36')](_0x560f94)){for(var _0x13f7d6 in _0x560f94){if(_0x560f94[_0x6a2c('0x37')](_0x13f7d6)){delete _0x560f94[_0x13f7d6];}}}}function clearCampaigns(_0x5201f2){if(!_[_0x6a2c('0x36')](_0x5201f2)){for(var _0x51a50e in _0x5201f2){if(_0x5201f2[_0x6a2c('0x37')](_0x51a50e)){_0x5201f2[_0x51a50e]['originated']=0x0;}}}}function clearVoiceQueues(_0x35fa1b){if(!_[_0x6a2c('0x36')](_0x35fa1b)){for(var _0x3700c2 in _0x35fa1b){if(_0x35fa1b['hasOwnProperty'](_0x3700c2)){_0x35fa1b[_0x3700c2][_0x6a2c('0x38')]=0x0;_0x35fa1b[_0x3700c2][_0x6a2c('0x39')]=0x0;_0x35fa1b[_0x3700c2][_0x6a2c('0x3a')]=0x0;_0x35fa1b[_0x3700c2]['waiting']=0x0;_0x35fa1b[_0x3700c2][_0x6a2c('0x3b')]=!![];}}}}function clearAgentBooked(_0xca29a1){if(!_[_0x6a2c('0x36')](_0xca29a1)){for(var _0x19267f in _0xca29a1){if(_0xca29a1['hasOwnProperty'](_0x19267f)){_0xca29a1[_0x19267f][_0x6a2c('0x3c')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0xa43fdc){return _0xa43fdc['queuecallerexit']||_0xa43fdc[_0x6a2c('0x23')]||_0xa43fdc['queuecallercomplete'];}VoiceQueueReport['prototype'][_0x6a2c('0x3d')]=function(){var _0x49af6d=this;for(var _0x53a8e9 in this['channels']){if(this[_0x6a2c('0x14')][_0x6a2c('0x37')](_0x53a8e9)&&!this[_0x6a2c('0x14')][_0x53a8e9][_0x6a2c('0x3e')]){this[_0x6a2c('0x10')][_0x6a2c('0xd')](function(){if(!_['isNil'](_0x49af6d[_0x6a2c('0x14')][_0x53a8e9])){return ami['Action']({'action':_0x6a2c('0x3f'),'channel':_0x49af6d[_0x6a2c('0x14')][_0x53a8e9]['channel']})[_0x6a2c('0x40')](function(_0x4cb75b){if(_0x4cb75b['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x49af6d['channels'][_0x53a8e9]){delete _0x49af6d[_0x6a2c('0x14')][_0x53a8e9];logger[_0x6a2c('0x41')](_0x6a2c('0x42'),_0x53a8e9,util['inspect'](_0x4cb75b,{'showHidden':![],'depth':null}));}if(_0x49af6d['queueReports'][_0x53a8e9]){delete _0x49af6d[_0x6a2c('0x11')][_0x53a8e9];logger['error'](_0x6a2c('0x43'),_0x53a8e9,util[_0x6a2c('0x44')](_0x4cb75b,{'showHidden':![],'depth':null}));}if(_0x49af6d[_0x6a2c('0x18')][_0x53a8e9]){delete _0x49af6d[_0x6a2c('0x18')][_0x53a8e9];logger['error'](_0x6a2c('0x45'),_0x53a8e9,util['inspect'](_0x4cb75b,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0x46')]=function(){logger[_0x6a2c('0x41')](_0x6a2c('0x47'));clearChannels(this[_0x6a2c('0x14')]);this[_0x6a2c('0x48')](this[_0x6a2c('0x11')]);clearAgentBooked(this[_0x6a2c('0x13')]);clearVoiceQueues(this[_0x6a2c('0x16')]);clearCampaigns(this[_0x6a2c('0x17')]);this[_0x6a2c('0x49')]=initializeSummary();};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0x48')]=function(_0x25a3e6){var _0x1a019d=this;if(!_['isEmpty'](_0x25a3e6)){for(var _0x468535 in _0x25a3e6){if(_0x25a3e6[_0x6a2c('0x37')](_0x468535)){_0x1a019d[_0x6a2c('0x4a')](_0x25a3e6[_0x468535],'clearqueuereport');delete _0x25a3e6[_0x468535];}}}};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0x4b')]=function(_0x577688,_0x290a35,_0x2f50ae){io['to'](_0x577688)[_0x6a2c('0x4b')](_0x290a35,_0x2f50ae);};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0x4c')]=function(_0x46871f,_0xc7f02e){logger[_0x6a2c('0x4d')](_0x6a2c('0x4e')+_0xc7f02e+_0x6a2c('0x4f'),_0x46871f[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x46871f,{'showHidden':![],'depth':null}));this[_0x6a2c('0x4b')](util[_0x6a2c('0x51')](_0x6a2c('0x52'),_0x46871f['queue']),_0x6a2c('0x53'),_0x46871f);io[_0x6a2c('0x4b')](_0x6a2c('0x54'),_0x46871f);};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0x4a')]=function(_0x18f6ab,_0x43f06f){logger['debug'](_0x6a2c('0x4e')+_0x43f06f+']\x20sending\x20voice_queue_channel:remove\x20event:',_0x18f6ab[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x18f6ab,{'showHidden':![],'depth':null}));if(_0x18f6ab['queuecallerexitreason']==='ATTENDEDTRANSFER'){return;}this[_0x6a2c('0x4b')](util[_0x6a2c('0x51')](_0x6a2c('0x52'),_0x18f6ab[_0x6a2c('0x55')]),'voice_queue_channel:remove',_0x18f6ab);io['emit']('voice_queue_presence:remove',_0x18f6ab);};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0x56')]=function(_0x40d96c){if(_0x40d96c[_0x6a2c('0x57')]==='inbound'){logger[_0x6a2c('0x4d')](_0x6a2c('0x58'),util['inspect'](_0x40d96c,{'showHidden':![],'depth':null}));this[_0x6a2c('0x4b')](util['format'](_0x6a2c('0x52'),_0x40d96c[_0x6a2c('0x59')]),'voice_queue:save',_0x40d96c);}};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0x5a')]=function(_0x5e5117){return _0x5e5117!==null&&!_['isUndefined'](_0x5e5117);};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0x5b')]=function(){var _0x26d13f=this;setInterval(function(){_0x26d13f[_0x6a2c('0x3d')]();ami[_0x6a2c('0x5c')]({'action':_0x6a2c('0x5d')})[_0x6a2c('0x40')](function(_0x454e07){logger[_0x6a2c('0x41')](_0x6a2c('0x5e'),util[_0x6a2c('0x44')](_0x454e07,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x6a2c('0xc')]['loopQueueSummary']=function(){var _0x165459=this;setInterval(function(){if(!_0x165459[_0x6a2c('0x49')][_0x6a2c('0x5f')]){return ami[_0x6a2c('0x5c')]({'action':_0x6a2c('0x19')})['then'](function(_0x4f404f){_0x165459[_0x6a2c('0x49')]['id']=_0x4f404f[_0x6a2c('0x60')];_0x165459[_0x6a2c('0x49')][_0x6a2c('0x5f')]=!![];_0x165459['summary']['queuestatus'][_0x4f404f[_0x6a2c('0x60')]]={};})['catch'](function(_0x41007b){logger[_0x6a2c('0x41')](_0x6a2c('0x61'),util[_0x6a2c('0x44')](_0x41007b,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0x62')]=function(_0x95db0f,_0x3fba77){var _0x2d6c24=this[_0x6a2c('0x49')]['queues'][_0x95db0f[_0x6a2c('0x59')]][_0x6a2c('0x63')];var _0x2fb0ad=new VoiceQueueSummary(_0x95db0f);return _0x2fb0ad[_0x6a2c('0x64')](_0x3fba77[_0x6a2c('0x13')],this[_0x6a2c('0x13')],_0x2d6c24,this[_0x6a2c('0x12')][_0x6a2c('0x14')]);};VoiceQueueReport['prototype'][_0x6a2c('0x65')]=function(_0x31601b,_0x2b102f){var _0x226179=this[_0x6a2c('0x62')](_0x31601b,_0x2b102f);var _0x1df202=![];_0x1df202=_0x226179[_0x6a2c('0x66')](_0x31601b);if(_0x1df202){Object[_0x6a2c('0x67')](_0x31601b,_0x226179);this['realtime'][_0x6a2c('0x16')][_0x31601b[_0x6a2c('0x59')]]=_0x31601b;this[_0x6a2c('0x56')](_0x226179);}};VoiceQueueReport['prototype'][_0x6a2c('0x20')]=function(_0x2488b5){var _0x2f508e=null;var _0x1722fd=this[_0x6a2c('0x49')]['id'];if(this[_0x6a2c('0x49')]['queuestatus'][_0x1722fd]){_0x2f508e=this['summary'][_0x6a2c('0x68')][_0x1722fd][_0x2488b5[_0x6a2c('0x60')]];}if(!_0x2f508e){this[_0x6a2c('0x49')]=initializeSummary();return;}var _0x1b971b=this['voiceQueues'][_0x2f508e['queue']];if(_0x1b971b[_0x6a2c('0x57')]==='inbound'){this['handleInboundQueueSummaryReport'](_0x1b971b,_0x2f508e);}else if(_0x1b971b['type']==='outbound'){var _0x2c8e3d=this[_0x6a2c('0x62')](_0x1b971b,_0x2f508e);ami[_0x6a2c('0x4b')](_0x6a2c('0x69'),_0x2c8e3d);}this[_0x6a2c('0x49')][_0x6a2c('0x6a')]-=0x1;var _0x2b6396=this['summary'][_0x6a2c('0x6a')]>0x0?!![]:![];if(!_0x2b6396){return this['syncQueueSummaryComplete'](this[_0x6a2c('0x49')][_0x6a2c('0x6b')]);}};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0x1e')]=function(_0x4db820){var _0x41c764=this['summary']['id'];if(this['summary'][_0x6a2c('0x68')][_0x41c764]&&this[_0x6a2c('0x49')][_0x6a2c('0x68')][_0x41c764][_0x4db820[_0x6a2c('0x60')]]){this['summary'][_0x6a2c('0x68')][_0x41c764][_0x4db820[_0x6a2c('0x60')]][_0x6a2c('0x13')][_0x6a2c('0x6c')](_0x4db820);}};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0x1a')]=function(_0x231327){var _0x22a1c3=this;try{if(this[_0x6a2c('0x5a')](_0x231327)&&this['isNotNull'](_0x231327[_0x6a2c('0x55')])){logger['debug'](_0x6a2c('0x6d'),util[_0x6a2c('0x44')](_0x231327,{'showHidden':![],'depth':null}));var _0x139b67=this[_0x6a2c('0x16')][_0x231327[_0x6a2c('0x55')]];if(_0x139b67){logger[_0x6a2c('0x4d')](_0x6a2c('0x6e'),_0x139b67[_0x6a2c('0x59')]);this[_0x6a2c('0x49')][_0x6a2c('0x5d')][_0x139b67[_0x6a2c('0x59')]]={'summaryEvent':_0x231327};this[_0x6a2c('0x49')][_0x6a2c('0x6a')]+=0x1;return ami[_0x6a2c('0x5c')]({'action':'queuestatus','queue':_0x139b67[_0x6a2c('0x59')]})[_0x6a2c('0x6f')](function(_0xc4930b){if(!_0x22a1c3['summary'][_0x6a2c('0x68')][_0x231327[_0x6a2c('0x60')]]){_0x22a1c3[_0x6a2c('0x49')]['queuestatus'][_0x231327['actionid']]={};}_0x22a1c3[_0x6a2c('0x49')][_0x6a2c('0x68')][_0x231327[_0x6a2c('0x60')]][_0xc4930b[_0x6a2c('0x60')]]={'queue':_0x139b67[_0x6a2c('0x59')],'agents':[]};})[_0x6a2c('0x40')](function(_0x29ead8){throw _0x29ead8;});}}}catch(_0x11ca53){logger[_0x6a2c('0x41')]('[voiceQueueReport][queuesummary]',util[_0x6a2c('0x44')](_0x11ca53,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0x1c')]=function(_0x6931af){if(this['summary'][_0x6a2c('0x6a')]>0x0){this['summary']['completeEvent']=_0x6931af;return;}logger[_0x6a2c('0x4d')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x6a2c('0x44')](_0x6931af,{'showHidden':![],'depth':null}));this[_0x6a2c('0x49')]=initializeSummary();ami[_0x6a2c('0x4b')](_0x6a2c('0x70'),{});};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0x22')]=function(_0x259172){try{if(this['isNotNull'](_0x259172)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x259172[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x259172,{'showHidden':![],'depth':null}));if(_[_0x6a2c('0x71')](this[_0x6a2c('0x11')][_0x259172[_0x6a2c('0x50')]])){this[_0x6a2c('0x11')][_0x259172['uniqueid']]=[];}if(_[_0x6a2c('0x71')](this[_0x6a2c('0x14')][_0x259172[_0x6a2c('0x50')]])){this[_0x6a2c('0x14')][_0x259172['uniqueid']]={};}var _0x22b32c=new QueueReport();_0x22b32c['queue']=_0x259172['queue'];_0x22b32c['type']=this[_0x6a2c('0x16')][_0x22b32c[_0x6a2c('0x55')]]&&this[_0x6a2c('0x16')][_0x22b32c['queue']][_0x6a2c('0x57')]?this['voiceQueues'][_0x22b32c[_0x6a2c('0x55')]][_0x6a2c('0x57')]||'inbound':_0x6a2c('0x72');_0x22b32c[_0x6a2c('0x73')]=moment()[_0x6a2c('0x51')](_0x6a2c('0x74'));_0x22b32c[_0x6a2c('0x75')]=_0x259172[_0x6a2c('0x75')];_0x22b32c['count']=_0x259172[_0x6a2c('0x76')];_0x22b32c[_0x6a2c('0x50')]=_0x259172['uniqueid'];_0x22b32c[_0x6a2c('0x77')]=this[_0x6a2c('0x14')][_0x259172[_0x6a2c('0x50')]][_0x6a2c('0x77')];logger[_0x6a2c('0x78')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x22b32c[_0x6a2c('0x55')],_0x22b32c[_0x6a2c('0x57')]);Object[_0x6a2c('0x67')](_0x22b32c,_[_0x6a2c('0x79')](_0x259172,_[_0x6a2c('0x7a')](_0x22b32c)));this['queueReports'][_0x259172[_0x6a2c('0x50')]][_0x6a2c('0x6c')](_0x22b32c);this[_0x6a2c('0x14')][_0x259172[_0x6a2c('0x50')]]=_0x22b32c;this[_0x6a2c('0x4c')](_0x22b32c,_0x6a2c('0x21'));}}catch(_0xdd61d9){logger[_0x6a2c('0x41')](_0x6a2c('0x7b'),_0x259172[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0xdd61d9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0x24')]=function(_0x5bf5fb){try{if(this['isNotNull'](_0x5bf5fb)){logger[_0x6a2c('0x4d')](_0x6a2c('0x7c'),_0x5bf5fb[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x5bf5fb,{'showHidden':![],'depth':null}));if(this[_0x6a2c('0x11')][_0x5bf5fb[_0x6a2c('0x50')]]){var _0x467f19=_['last'](this[_0x6a2c('0x11')][_0x5bf5fb[_0x6a2c('0x50')]]);_0x467f19[_0x6a2c('0x7d')]=![];_0x467f19['queuecallercompleteAt']=null;_0x467f19[_0x6a2c('0x7e')]=_0x5bf5fb['holdtime'];_0x467f19[_0x6a2c('0x7f')]=_0x5bf5fb[_0x6a2c('0x7f')];_0x467f19[_0x6a2c('0x23')]=!![];_0x467f19['queuecallerabandonAt']=moment()[_0x6a2c('0x51')](_0x6a2c('0x74'));_0x467f19[_0x6a2c('0x80')]='ABANDONED';_0x467f19['lastAssignedTo']=null;logger[_0x6a2c('0x78')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x467f19[_0x6a2c('0x55')],_0x467f19[_0x6a2c('0x57')]);this[_0x6a2c('0x14')][_0x5bf5fb[_0x6a2c('0x50')]]=_0x467f19;this[_0x6a2c('0x4a')](_0x467f19,_0x6a2c('0x23'));}}}catch(_0x2e4194){logger['error'](_0x6a2c('0x7c'),_0x5bf5fb[_0x6a2c('0x50')],util['inspect'](_0x2e4194,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0x26')]=function(_0x19770c){try{if(this[_0x6a2c('0x5a')](_0x19770c)){logger[_0x6a2c('0x4d')](_0x6a2c('0x81'),_0x19770c[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x19770c,{'showHidden':![],'depth':null}));if(this[_0x6a2c('0x11')][_0x19770c['uniqueid']]){var _0x3278e8=_[_0x6a2c('0x82')](this[_0x6a2c('0x11')][_0x19770c[_0x6a2c('0x50')]]);_0x3278e8[_0x6a2c('0x83')]=moment()['format'](_0x6a2c('0x74'));_0x3278e8[_0x6a2c('0x84')]=_0x19770c['connectedlinenum'];_0x3278e8['connectedlinename']=_0x19770c[_0x6a2c('0x85')];logger[_0x6a2c('0x78')](_0x6a2c('0x86'),_0x3278e8['queue'],_0x3278e8['type'],_0x19770c[_0x6a2c('0x84')],_0x19770c[_0x6a2c('0x85')]);this[_0x6a2c('0x14')][_0x19770c['uniqueid']]=_0x3278e8;this['emitVoiceQueueChannelSave'](_0x3278e8,_0x6a2c('0x25'));}}}catch(_0x33f08d){logger[_0x6a2c('0x41')](_0x6a2c('0x81'),_0x19770c['uniqueid'],util[_0x6a2c('0x44')](_0x33f08d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6a2c('0x29')]=function(_0x486525){try{if(this[_0x6a2c('0x5a')](_0x486525)){logger['debug']('[%s][voiceQueueReport][agentconnect]',_0x486525[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x486525,{'showHidden':![],'depth':null}));if(this[_0x6a2c('0x11')][_0x486525['uniqueid']]){var _0xe6bc68=_[_0x6a2c('0x82')](this[_0x6a2c('0x11')][_0x486525[_0x6a2c('0x50')]]);_0xe6bc68[_0x6a2c('0x7d')]=!![];_0xe6bc68[_0x6a2c('0x80')]='COMPLETEDBYAGENT';logger['info']('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0xe6bc68['queue'],_0xe6bc68['type']);}}}catch(_0x28ad1d){logger[_0x6a2c('0x41')](_0x6a2c('0x87'),_0x486525[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x28ad1d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0x27')]=function(_0x3ce8ee){try{if(this['isNotNull'](_0x3ce8ee)){logger[_0x6a2c('0x4d')]('[%s][voiceQueueReport][agentcomplete]',_0x3ce8ee[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x3ce8ee,{'showHidden':![],'depth':null}));if(this[_0x6a2c('0x11')][_0x3ce8ee['uniqueid']]){var _0x1961e1=_['last'](this[_0x6a2c('0x11')][_0x3ce8ee[_0x6a2c('0x50')]]);_0x1961e1[_0x6a2c('0x23')]=![];_0x1961e1['queuecallerabandonAt']=null;_0x1961e1[_0x6a2c('0x88')]=!![];_0x1961e1[_0x6a2c('0x89')]=_0x3ce8ee['membername'];_0x1961e1[_0x6a2c('0x7e')]=_0x3ce8ee['holdtime'];_0x1961e1[_0x6a2c('0x7d')]=!![];_0x1961e1[_0x6a2c('0x8a')]=![];_0x1961e1[_0x6a2c('0x8b')]=null;if(!_0x1961e1['transfer']){if(_0x3ce8ee[_0x6a2c('0x8c')]==_0x6a2c('0x8d')){_0x1961e1[_0x6a2c('0x80')]=_0x6a2c('0x8e');logger[_0x6a2c('0x78')](_0x6a2c('0x8f'),_0x1961e1[_0x6a2c('0x55')],_0x1961e1[_0x6a2c('0x57')]);}else{if(_[_0x6a2c('0x90')](_0x3ce8ee['channel']['toLowerCase'](),'local/')){if(this[_0x6a2c('0x11')][_0x3ce8ee[_0x6a2c('0x91')]]){var _0xa871bb=_[_0x6a2c('0x82')](this[_0x6a2c('0x11')][_0x3ce8ee[_0x6a2c('0x91')]]);_0xa871bb[_0x6a2c('0x7d')]=![];_0xa871bb[_0x6a2c('0x8a')]=!![];_0xa871bb[_0x6a2c('0x8b')]=moment(_0x1961e1[_0x6a2c('0x73')])['add'](_0x3ce8ee[_0x6a2c('0x7e')],_0x6a2c('0x92'))['format'](_0x6a2c('0x74'));_0xa871bb[_0x6a2c('0x80')]=_0x6a2c('0x93');_0xa871bb[_0x6a2c('0x8d')]=!![];_0xa871bb['transfertype']=_0x6a2c('0x94');_0xa871bb['transferexten']=_0x3ce8ee['destexten'];_0xa871bb[_0x6a2c('0x95')]=_0x3ce8ee['uniqueid'];logger[_0x6a2c('0x78')](_0x6a2c('0x96'),_0xa871bb[_0x6a2c('0x55')],_0xa871bb['type']);var _0x1e1374=this[_0x6a2c('0x11')][_0x3ce8ee[_0x6a2c('0x91')]];this['queueReports'][_0x3ce8ee[_0x6a2c('0x91')]]=this[_0x6a2c('0x11')][_0x3ce8ee[_0x6a2c('0x50')]];this[_0x6a2c('0x11')][_0x3ce8ee[_0x6a2c('0x50')]]=_0x1e1374;}}else{_0x1961e1[_0x6a2c('0x80')]=_0x6a2c('0x97')+_0x3ce8ee[_0x6a2c('0x8c')][_0x6a2c('0x98')]();logger[_0x6a2c('0x78')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x1961e1['queue'],_0x1961e1[_0x6a2c('0x57')],_0x1961e1[_0x6a2c('0x80')]);}}}this[_0x6a2c('0x14')][_0x3ce8ee['uniqueid']]=_0x1961e1;}}}catch(_0x29294c){logger[_0x6a2c('0x41')](_0x6a2c('0x99'),_0x3ce8ee[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x29294c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0x2b')]=function(_0x312c3f){try{if(this[_0x6a2c('0x5a')](_0x312c3f)){logger[_0x6a2c('0x4d')]('[%s][voiceQueueReport][varset]',_0x312c3f[_0x6a2c('0x50')],util['inspect'](_0x312c3f,{'showHidden':![],'depth':null}));this['addVariable'](_0x312c3f[_0x6a2c('0x50')],_[_0x6a2c('0x7a')](_0x312c3f[_0x6a2c('0x9a')])[0x0],_0x312c3f[_0x6a2c('0x9b')]);if(this['queueReports'][_0x312c3f[_0x6a2c('0x50')]]){var _0x16da05=_[_0x6a2c('0x82')](this['queueReports'][_0x312c3f['uniqueid']]);if(_0x16da05){if(this['isNotNull'](_0x312c3f[_0x6a2c('0x9a')])&&this[_0x6a2c('0x5a')](_0x312c3f[_0x6a2c('0x9a')][_0x6a2c('0x68')])){switch(_0x312c3f['value']){case'CONTINUE':_0x16da05['queuecallerexit']=![];_0x16da05[_0x6a2c('0x8b')]=null;break;case'TIMEOUT':_0x16da05[_0x6a2c('0x9c')]='timeout';_0x16da05[_0x6a2c('0x8a')]=!![];_0x16da05[_0x6a2c('0x8b')]=moment()[_0x6a2c('0x51')](_0x6a2c('0x74'));_0x16da05[_0x6a2c('0x83')]=moment()[_0x6a2c('0x51')](_0x6a2c('0x74'));logger[_0x6a2c('0x4d')](_0x6a2c('0x9d'),_0x312c3f[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x16da05,{'showHidden':![],'depth':null}));ami[_0x6a2c('0x4b')](_0x6a2c('0x9e'),_0x16da05);break;default:_0x16da05['queuecallerexit']=!![];_0x16da05[_0x6a2c('0x8b')]=moment()[_0x6a2c('0x51')](_0x6a2c('0x74'));_0x16da05[_0x6a2c('0x83')]=moment()[_0x6a2c('0x51')](_0x6a2c('0x74'));}_0x16da05[_0x6a2c('0x23')]=![];_0x16da05[_0x6a2c('0x9f')]=null;_0x16da05[_0x6a2c('0x80')]=_0x312c3f[_0x6a2c('0x9b')];this[_0x6a2c('0x14')][_0x312c3f[_0x6a2c('0x50')]]=_0x16da05;this[_0x6a2c('0x4a')](_0x16da05,_0x6a2c('0x2a'));}else if(this['isNotNull'](_0x312c3f['variable'])&&this[_0x6a2c('0x5a')](_0x312c3f[_0x6a2c('0x9a')]['queueposition'])){if(!_0x16da05[_0x6a2c('0x23')]){_0x16da05['queuecallerexit']=!![];_0x16da05[_0x6a2c('0x8b')]=moment()[_0x6a2c('0x51')](_0x6a2c('0x74'));_0x16da05[_0x6a2c('0x80')]=_0x6a2c('0xa0');_0x16da05['queuecallerleaveAt']=moment()[_0x6a2c('0x51')](_0x6a2c('0x74'));this['channels'][_0x312c3f[_0x6a2c('0x50')]]=_0x16da05;}}logger['info'](_0x6a2c('0xa1'),_0x312c3f['uniqueid'],_0x16da05['queue'],_0x16da05['type'],_[_0x6a2c('0x7a')](_0x312c3f[_0x6a2c('0x9a')])[0x0],_0x312c3f['value']);_0x16da05['variables']=this[_0x6a2c('0x18')][_0x312c3f[_0x6a2c('0x50')]];}}}}catch(_0x421fbd){logger[_0x6a2c('0x41')](_0x6a2c('0xa2'),_0x312c3f[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x421fbd,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x572f0d,_0x1dd7c7,_0x1fba0a){var _0x5ce9e5=['rtpaudioqos',_0x6a2c('0xa3'),_0x6a2c('0xa4'),_0x6a2c('0xa5'),_0x6a2c('0xa6'),'rtpaudioqoslossbridged',_0x6a2c('0xa7'),'rtpaudioqosrttbridged',_0x6a2c('0xa8'),_0x6a2c('0xa9'),'bridgepeer',_0x6a2c('0xaa'),_0x6a2c('0xab'),_0x6a2c('0xac'),'memberinterface','memberlastcall',_0x6a2c('0xad'),_0x6a2c('0xae'),_0x6a2c('0xaf')];if(!_[_0x6a2c('0xb0')](_0x1dd7c7)&&!_[_0x6a2c('0xb1')](_0x5ce9e5,_0x1dd7c7)){if(_[_0x6a2c('0x71')](this[_0x6a2c('0x18')][_0x572f0d])){this[_0x6a2c('0x18')][_0x572f0d]={};}this['variables'][_0x572f0d][_0x1dd7c7]=_0x1fba0a;}};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0xb2')]=function(_0x5a12d5,_0x2e1764,_0x2178e3){try{var _0x1e592d={};if(this[_0x6a2c('0x11')][_0x5a12d5]){for(var _0x37ca86=0x0;_0x37ca86<this[_0x6a2c('0x11')][_0x5a12d5][_0x6a2c('0xb3')];_0x37ca86+=0x1){_0x1e592d=this[_0x6a2c('0x11')][_0x5a12d5][_0x37ca86];var _0x12d7e6=this[_0x6a2c('0x16')][_0x1e592d[_0x6a2c('0x55')]];if(_0x12d7e6){_0x12d7e6[_0x6a2c('0xb4')]+=moment(_0x1e592d[_0x6a2c('0x83')])[_0x6a2c('0xb5')](_0x1e592d[_0x6a2c('0x73')],_0x6a2c('0x92'))||0x0;if(_0x2178e3&&_0x1e592d['queuecallerexitreason']===_0x6a2c('0xb6')){_0x1e592d['queuecallerexitreason']=_0x6a2c('0xb7');}if(_0x37ca86===this[_0x6a2c('0x11')][_0x5a12d5][_0x6a2c('0xb3')]-0x1){_0x12d7e6['sumDuration']+=moment()['milliseconds'](0x0)[_0x6a2c('0xb5')](_0x1e592d[_0x6a2c('0x73')],'seconds');if(hasCallerLeftTheQueue(_0x1e592d)&&_0x1e592d[_0x6a2c('0x80')]!==_0x6a2c('0xb6')){_0x12d7e6[_0x6a2c('0xb8')]+=0x1;}if(_0x1e592d['queuecallercomplete']){_0x12d7e6['answered']+=0x1;_0x12d7e6[_0x6a2c('0xb9')]+=moment()[_0x6a2c('0xba')](0x0)[_0x6a2c('0xb5')](_0x1e592d[_0x6a2c('0x83')],'seconds');_0x1e592d[_0x6a2c('0xbb')]=moment()['format'](_0x6a2c('0x74'));_0x1e592d[_0x6a2c('0x8a')]=![];_0x1e592d[_0x6a2c('0x8b')]=null;}if(_0x1e592d[_0x6a2c('0x8a')]&&_0x1e592d[_0x6a2c('0x8d')]!=!![]){_0x12d7e6[_0x6a2c('0xbc')]+=0x1;_0x1e592d[_0x6a2c('0x9c')]='unmanaged';logger['debug'](_0x6a2c('0xbd'),_0x5a12d5,util[_0x6a2c('0x44')](_0x1e592d,{'showHidden':![],'depth':null}));ami['emit'](_0x6a2c('0xbe'),_0x1e592d);}if(_0x1e592d['queuecallerabandon']){_0x12d7e6[_0x6a2c('0xbf')]+=0x1;_0x1e592d[_0x6a2c('0x9c')]='abandoned';logger[_0x6a2c('0x4d')]('[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:',_0x5a12d5,util[_0x6a2c('0x44')](_0x1e592d,{'showHidden':![],'depth':null}));ami[_0x6a2c('0x4b')](_0x6a2c('0xc0'),_0x1e592d);}}else{_0x12d7e6[_0x6a2c('0xc1')]+=_0x12d7e6['sumHoldTime'];}logger[_0x6a2c('0x78')]('[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s',_0x5a12d5,_0x1e592d[_0x6a2c('0x55')],_0x1e592d[_0x6a2c('0x57')],_0x2e1764);this[_0x6a2c('0x14')][_0x5a12d5]=_0x1e592d;Object['assign'](this[_0x6a2c('0x16')][_0x1e592d[_0x6a2c('0x55')]],_0x12d7e6);if(_0x1e592d[_0x6a2c('0x83')]){this['emitVoiceQueueChannelRemove'](_0x1e592d,_0x6a2c('0x2c'));}}}logger[_0x6a2c('0x4d')](_0x6a2c('0xc2'),_0x5a12d5,util[_0x6a2c('0x44')](this['queueReports'][_0x5a12d5],{'showHidden':![],'depth':null}));if(hasCallerLeftTheQueue(_0x1e592d)&&_0x1e592d[_0x6a2c('0x80')]!==_0x6a2c('0xb6')){ami[_0x6a2c('0x4b')]('custom:voiceQueueReport',this[_0x6a2c('0x11')][_0x5a12d5]);if(this[_0x6a2c('0x11')][_0x5a12d5]){delete this[_0x6a2c('0x11')][_0x5a12d5];}if(this['channels'][_0x5a12d5]){delete this['channels'][_0x5a12d5];}if(this[_0x6a2c('0x18')][_0x5a12d5]){delete this['variables'][_0x5a12d5];}}}}catch(_0x4b3af2){logger[_0x6a2c('0x41')](_0x6a2c('0xc3'),_0x5a12d5,util[_0x6a2c('0x44')](_0x4b3af2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0xc4')]=function(_0xd481c){try{if(this[_0x6a2c('0x5a')](_0xd481c)){logger[_0x6a2c('0x4d')](_0x6a2c('0xc5'),_0xd481c[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0xd481c,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xd481c[_0x6a2c('0x50')]]){return this[_0x6a2c('0xb2')](_0xd481c[_0x6a2c('0x50')],_0xd481c[_0x6a2c('0xc6')],![]);}if(this[_0x6a2c('0x11')][_0xd481c[_0x6a2c('0x91')]]){if(_0xd481c[_0x6a2c('0xc7')]==='21'){return;}return this[_0x6a2c('0xb2')](_0xd481c[_0x6a2c('0x91')],_0xd481c[_0x6a2c('0xc6')],!![]);}var _0x3354d3=Object[_0x6a2c('0x7a')](this[_0x6a2c('0x11')]);for(var _0x24ab19=0x0;_0x24ab19<_0x3354d3[_0x6a2c('0xb3')];_0x24ab19++){var _0x2a5811=_[_0x6a2c('0x82')](this[_0x6a2c('0x11')][_0x3354d3[_0x24ab19]]);if(_0x2a5811&&_0x2a5811[_0x6a2c('0xc8')]===_0xd481c[_0x6a2c('0x50')]){return this[_0x6a2c('0xb2')](_0x2a5811[_0x6a2c('0x50')],_0xd481c[_0x6a2c('0xc6')],!![]);}}if(!this[_0x6a2c('0x11')][_0xd481c[_0x6a2c('0x50')]]){logger[_0x6a2c('0x4d')](_0x6a2c('0xc9'),_0xd481c[_0x6a2c('0x50')]);if(this[_0x6a2c('0x14')][_0xd481c[_0x6a2c('0x50')]]){delete this[_0x6a2c('0x14')][_0xd481c[_0x6a2c('0x50')]];}if(this[_0x6a2c('0x18')][_0xd481c[_0x6a2c('0x50')]]){delete this[_0x6a2c('0x18')][_0xd481c[_0x6a2c('0x50')]];}}}}catch(_0x20b437){logger[_0x6a2c('0x41')](_0x6a2c('0xc5'),_0xd481c[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x20b437,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0x32')]=function(_0x4e39d9){try{if(this[_0x6a2c('0x5a')](_0x4e39d9)){logger[_0x6a2c('0x4d')]('[%s][voiceQueueReport][attendedtransfer]',_0x4e39d9[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x4e39d9,{'showHidden':![],'depth':null}));var _0x330bfe;var _0x56d7d1;var _0x48dbf7;if(this[_0x6a2c('0x11')][_0x4e39d9[_0x6a2c('0xca')]]){_0x330bfe=_['last'](this['queueReports'][_0x4e39d9[_0x6a2c('0xca')]]);_0x330bfe[_0x6a2c('0xcb')]=_0x4e39d9['secondtransfererexten'];_0x330bfe[_0x6a2c('0x95')]=_0x4e39d9[_0x6a2c('0xcc')];_0x330bfe['queuecallerexitreason']='ATTENDEDTRANSFER';_0x330bfe[_0x6a2c('0x8d')]=!![];_0x330bfe[_0x6a2c('0xcd')]=_0x6a2c('0xce');if(this[_0x6a2c('0x11')][_0x4e39d9['secondtransfereruniqueid']]){_0x48dbf7=this[_0x6a2c('0x11')][_0x4e39d9['secondtransfereruniqueid']];this[_0x6a2c('0x11')][_0x4e39d9[_0x6a2c('0xcc')]]=this[_0x6a2c('0x11')][_0x4e39d9[_0x6a2c('0xca')]];this[_0x6a2c('0x11')][_0x4e39d9[_0x6a2c('0xca')]]=_0x48dbf7;_0x56d7d1=_[_0x6a2c('0x82')](this['queueReports'][_0x4e39d9[_0x6a2c('0xca')]]);_0x56d7d1[_0x6a2c('0x3e')]=!![];}logger[_0x6a2c('0x78')](_0x6a2c('0xcf'),_0x4e39d9[_0x6a2c('0x50')],_0x330bfe[_0x6a2c('0x55')],_0x330bfe[_0x6a2c('0x57')],_0x330bfe[_0x6a2c('0xcb')],_0x330bfe[_0x6a2c('0x95')]);}else if(this['queueReports'][_0x4e39d9[_0x6a2c('0xd0')]]){_0x330bfe=_[_0x6a2c('0x82')](this[_0x6a2c('0x11')][_0x4e39d9[_0x6a2c('0xd0')]]);_0x330bfe['transferexten']=_0x4e39d9[_0x6a2c('0xd1')];_0x330bfe[_0x6a2c('0x95')]=_0x4e39d9['origtransfereruniqueid'];_0x330bfe['queuecallerexitreason']='ATTENDEDTRANSFER';_0x330bfe[_0x6a2c('0x8d')]=!![];_0x330bfe['transfertype']=_0x6a2c('0xce');if(this[_0x6a2c('0x11')][_0x4e39d9[_0x6a2c('0xd2')]]){_0x48dbf7=this[_0x6a2c('0x11')][_0x4e39d9[_0x6a2c('0xd2')]];this[_0x6a2c('0x11')][_0x4e39d9[_0x6a2c('0xd2')]]=this['queueReports'][_0x4e39d9[_0x6a2c('0xd0')]];this[_0x6a2c('0x11')][_0x4e39d9[_0x6a2c('0xd0')]]=_0x48dbf7;_0x56d7d1=_[_0x6a2c('0x82')](this[_0x6a2c('0x11')][_0x4e39d9[_0x6a2c('0xd0')]]);_0x56d7d1[_0x6a2c('0x3e')]=!![];}logger[_0x6a2c('0x78')](_0x6a2c('0xcf'),_0x4e39d9[_0x6a2c('0x50')],_0x330bfe['queue'],_0x330bfe[_0x6a2c('0x57')],_0x330bfe[_0x6a2c('0xcb')],_0x330bfe[_0x6a2c('0x95')]);}else if(this[_0x6a2c('0x11')][_0x4e39d9[_0x6a2c('0xd2')]]){_0x330bfe=_[_0x6a2c('0x82')](this['queueReports'][_0x4e39d9[_0x6a2c('0xd2')]]);_0x330bfe[_0x6a2c('0xcb')]=_0x4e39d9[_0x6a2c('0xd1')];_0x330bfe[_0x6a2c('0x95')]=_0x4e39d9[_0x6a2c('0xd2')];_0x330bfe[_0x6a2c('0x80')]='ATTENDEDTRANSFER';_0x330bfe['transfer']=!![];_0x330bfe[_0x6a2c('0xcd')]=_0x6a2c('0xce');_0x330bfe[_0x6a2c('0x3e')]=!![];_0x330bfe[_0x6a2c('0xc8')]=_0x4e39d9[_0x6a2c('0xca')];}else if(this[_0x6a2c('0x11')][_0x4e39d9['secondtransfereruniqueid']]){_0x330bfe=_[_0x6a2c('0x82')](this[_0x6a2c('0x11')][_0x4e39d9[_0x6a2c('0xcc')]]);_0x330bfe[_0x6a2c('0xcb')]=_0x4e39d9[_0x6a2c('0xd3')];_0x330bfe['transferuniqueid']=_0x4e39d9[_0x6a2c('0xcc')];_0x330bfe['queuecallerexitreason']=_0x6a2c('0xb6');_0x330bfe[_0x6a2c('0x8d')]=!![];_0x330bfe[_0x6a2c('0xcd')]=_0x6a2c('0xce');_0x330bfe[_0x6a2c('0x3e')]=!![];_0x330bfe[_0x6a2c('0xc8')]=_0x4e39d9[_0x6a2c('0xd0')];}}}catch(_0x3bd0cb){logger[_0x6a2c('0x41')](_0x6a2c('0xd4'),_0x4e39d9['uniqueid'],util[_0x6a2c('0x44')](_0x3bd0cb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0x34')]=function(_0x3c2961){try{if(this['isNotNull'](_0x3c2961)){logger[_0x6a2c('0x4d')](_0x6a2c('0xd5'),_0x3c2961[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x3c2961,{'showHidden':![],'depth':null}));if(this[_0x6a2c('0x11')][_0x3c2961[_0x6a2c('0xca')]]){var _0x38f259=_[_0x6a2c('0x82')](this[_0x6a2c('0x11')][_0x3c2961['transfereeuniqueid']]);_0x38f259[_0x6a2c('0x80')]=_0x6a2c('0xd6');_0x38f259[_0x6a2c('0x8d')]=!![];_0x38f259['transfertype']=_0x6a2c('0xd7');_0x38f259['transferexten']=_0x3c2961[_0x6a2c('0xd8')];_0x38f259[_0x6a2c('0x95')]=_0x3c2961['transfereeuniqueid'];logger[_0x6a2c('0x78')](_0x6a2c('0xd9'),_0x3c2961['uniqueid'],_0x38f259[_0x6a2c('0x55')],_0x38f259['type'],_0x38f259[_0x6a2c('0xcb')],_0x38f259[_0x6a2c('0x95')]);this[_0x6a2c('0xc4')]({'event':'BlindTransfer','uniqueid':_0x3c2961[_0x6a2c('0xca')],'context':_0x3c2961[_0x6a2c('0xda')],'channel':_0x3c2961['transfererchannel']});}}}catch(_0x3ac697){logger[_0x6a2c('0x41')]('[%s][voiceQueueReport][blindtransfer]',_0x3c2961[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x3ac697,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncMusicOnHoldStart']=function(_0x4d5de1){try{if(this[_0x6a2c('0x5a')](_0x4d5de1)){logger[_0x6a2c('0x4d')](_0x6a2c('0xdb'),_0x4d5de1[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x4d5de1,{'showHidden':![],'depth':null}));if(this[_0x6a2c('0x11')][_0x4d5de1[_0x6a2c('0x50')]]){var _0x31c781=_[_0x6a2c('0x82')](this[_0x6a2c('0x11')][_0x4d5de1[_0x6a2c('0x50')]]);if(!_[_0x6a2c('0xb0')](_0x31c781[_0x6a2c('0x83')])){_0x31c781[_0x6a2c('0xdc')]=moment()[_0x6a2c('0x51')](_0x6a2c('0x74'));logger[_0x6a2c('0x78')](_0x6a2c('0xdd'),_0x4d5de1[_0x6a2c('0x50')],_0x31c781[_0x6a2c('0xdc')]);}}}}catch(_0x498ea8){logger['error'](_0x6a2c('0xdb'),_0x4d5de1[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x498ea8,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6a2c('0x30')]=function(_0x1fd21f){try{if(this['isNotNull'](_0x1fd21f)){logger[_0x6a2c('0x4d')]('[%s][voiceQueueReport][musiconholdstop]',_0x1fd21f[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x1fd21f,{'showHidden':![],'depth':null}));if(this[_0x6a2c('0x11')][_0x1fd21f[_0x6a2c('0x50')]]){var _0x559fe1=_[_0x6a2c('0x82')](this[_0x6a2c('0x11')][_0x1fd21f[_0x6a2c('0x50')]]);if(!_['isNil'](_0x559fe1[_0x6a2c('0xdc')])){_0x559fe1[_0x6a2c('0xde')]+=moment()[_0x6a2c('0xba')](0x0)[_0x6a2c('0xb5')](_0x559fe1[_0x6a2c('0xdc')],_0x6a2c('0x92'));logger[_0x6a2c('0x78')](_0x6a2c('0xdf'),_0x1fd21f[_0x6a2c('0x50')],_0x559fe1['mohtime']);delete _0x559fe1[_0x6a2c('0xdc')];}}}}catch(_0x522147){logger['error']('[%s][voiceQueueReport][musiconholdstop]',_0x1fd21f[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x522147,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0xe0')]=function(_0x38fd5f){try{if(this[_0x6a2c('0x5a')](_0x38fd5f)){logger[_0x6a2c('0x4d')]('[%s][voiceQueueReport][newexten]\x20event:',_0x38fd5f[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x38fd5f,{'showHidden':![],'depth':null}));if(_0x38fd5f[_0x6a2c('0xe1')][_0x6a2c('0xe2')]()==='set'){_0x38fd5f[_0x6a2c('0xe3')]=_0x38fd5f[_0x6a2c('0xe4')]&&_0x38fd5f[_0x6a2c('0xe4')][_0x6a2c('0x90')](_0x6a2c('0xe5'))?_0x38fd5f[_0x6a2c('0xe4')]:(_0x38fd5f[_0x6a2c('0xe4')]||_0x38fd5f['applicationdata'])[_0x6a2c('0xe2')]();if(_[_0x6a2c('0x90')](_0x38fd5f[_0x6a2c('0xe3')][_0x6a2c('0xe2')](),_0x6a2c('0xe6'))){logger[_0x6a2c('0x78')](_0x6a2c('0xe7'),_0x38fd5f[_0x6a2c('0x50')],_0x38fd5f[_0x6a2c('0xe1')],_0x38fd5f['applicationdata']);if(_[_0x6a2c('0x71')](this[_0x6a2c('0x14')][_0x38fd5f[_0x6a2c('0x50')]]))this['channels'][_0x38fd5f[_0x6a2c('0x50')]]={};var _0x52d09d=_0x38fd5f['applicationdata']['split']('=');var _0x8b4d48=_0x52d09d[0x0][_0x6a2c('0xe2')]()[_0x6a2c('0xe8')](/cdr\((.*)\)/);if(_0x8b4d48)this[_0x6a2c('0x14')][_0x38fd5f[_0x6a2c('0x50')]][_0x8b4d48[0x1]]=_0x52d09d[0x1];}}}}catch(_0x24d4a9){logger[_0x6a2c('0x41')](_0x6a2c('0xe9'),_0x38fd5f['uniqueid'],util[_0x6a2c('0x44')](_0x24d4a9,{'showHidden':![],'depth':null}));}};module[_0x6a2c('0xea')]=VoiceQueueReport;