Built motion from commit 9d0783e6.|2.6.13
[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 _0x9e72=['syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','loopQueueShow','hasOwnProperty','isEmpty','originated','talking','pTalking','queueStatusComplete','switch','isNil','Action','status','catch','message','No\x20such\x20channel','error','inspect','[%s][voiceQueueReport][checkQueueReport]','variables','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','debug','[%s][voiceQueueReport][','uniqueid','emit','format','voice_queue_channel:save','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','queue','voice_queue_channel:remove','emitInboundVoiceQueueSummary','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','voice:queue:%s','voice_queue:save','isUndefined','clearZombieChannels','queues','[voiceQueueReport][queues]','isRunning','then','actionid','queuestatus','[voiceQueueReport][queuesummary]','createQueueSummaryReport','name','summaryEvent','createReport','assign','type','inbound','handleInboundQueueSummaryReport','outbound','custom:queuesummary','statusRequests','completeEvent','isNotNull','[voiceQueueReport][queuesummary]\x20event:','info','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','position','count','routealias','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','keys','push','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','queuecallerleave','[%s][voiceQueueReport][agentconnect]','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','lastAssignedTo','membername','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','channel','toLowerCase','local/','linkedid','queuecallercomplete','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','destexten','transferuniqueid','COMPLETEDBY','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','addVariable','value','variable','CONTINUE','TIMEOUT','lastevent','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','[%s][voiceQueueReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','handleHangup','length','unmanaged','abandoned','sumHoldTime','diff','sumDuration','milliseconds','total','sumBillable','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','ATTENDEDTRANSFER','COMPLETEDBYAGENT','cause-txt','cause','transferid','[%s][voiceQueueReport][hangup]','syncAttendedTransfer','transfereeuniqueid','transferexten','secondtransfererexten','secondtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfereruniqueid','origtransfererexten','[%s][voiceQueueReport][attendedtransfer]','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','syncMusicOnHoldStart','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','set','applicationdata','appdata','CDR(routeAlias)','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceQueueReport][newexten]','lodash','moment','ioredis','../../../config/logger','ami','../ami','../model/voiceQueueSummary','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','realtime','agents','channels','queueChannels','voiceQueues','campaigns','summary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','syncQueueCallerLeave','syncAgentComplete','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart'];(function(_0x218b6f,_0x2a67cc){var _0x45c373=function(_0x3de60c){while(--_0x3de60c){_0x218b6f['push'](_0x218b6f['shift']());}};_0x45c373(++_0x2a67cc);}(_0x9e72,0xc7));var _0x29e7=function(_0x11de08,_0x43b2bf){_0x11de08=_0x11de08-0x0;var _0x5c5c32=_0x9e72[_0x11de08];return _0x5c5c32;};'use strict';var _=require(_0x29e7('0x0'));var moment=require(_0x29e7('0x1'));var util=require('util');var Redis=require(_0x29e7('0x2'));var config=require('../../../config/environment');var logger=require(_0x29e7('0x3'))(_0x29e7('0x4'));var ami=require(_0x29e7('0x5'));var QueueReport=require('../model/queueReport');var VoiceQueueSummary=require(_0x29e7('0x6'));config[_0x29e7('0x7')]=_[_0x29e7('0x8')](config['redis'],{'host':_0x29e7('0x9'),'port':0x18eb});var io=require(_0x29e7('0xa'))(new Redis(config[_0x29e7('0x7')]));var Sequence=function(){};Sequence[_0x29e7('0xb')][_0x29e7('0xc')]=function(_0x4cca44){this[_0x29e7('0xd')]=this[_0x29e7('0xd')]?this[_0x29e7('0xd')][_0x29e7('0xe')](_0x4cca44):_0x4cca44();};function VoiceQueueReport(_0x38fc00){this[_0x29e7('0xf')]=new Sequence();this[_0x29e7('0x10')]={};this[_0x29e7('0x11')]=_0x38fc00;this[_0x29e7('0x12')]=_0x38fc00[_0x29e7('0x12')];this[_0x29e7('0x13')]=_0x38fc00[_0x29e7('0x14')];this[_0x29e7('0x15')]=_0x38fc00['voiceQueues'];this['campaigns']=_0x38fc00[_0x29e7('0x16')];this[_0x29e7('0x17')]=initializeSummary();this['variables']={};ami['on']('queuesummary',this[_0x29e7('0x18')][_0x29e7('0x19')](this));ami['on'](_0x29e7('0x1a'),this[_0x29e7('0x1b')][_0x29e7('0x19')](this));ami['on']('queuemember',this[_0x29e7('0x1c')][_0x29e7('0x19')](this));ami['on'](_0x29e7('0x1d'),this[_0x29e7('0x1e')][_0x29e7('0x19')](this));ami['on'](_0x29e7('0x1f'),this[_0x29e7('0x20')][_0x29e7('0x19')](this));ami['on'](_0x29e7('0x21'),this[_0x29e7('0x22')]['bind'](this));ami['on']('queuecallerleave',this[_0x29e7('0x23')][_0x29e7('0x19')](this));ami['on']('agentcomplete',this[_0x29e7('0x24')][_0x29e7('0x19')](this));ami['on']('agentconnect',this[_0x29e7('0x25')][_0x29e7('0x19')](this));ami['on'](_0x29e7('0x26'),this[_0x29e7('0x27')]['bind'](this));ami['on'](_0x29e7('0x28'),this[_0x29e7('0x29')]['bind'](this));ami['on'](_0x29e7('0x2a'),this[_0x29e7('0x2b')]['bind'](this));ami['on'](_0x29e7('0x2c'),this['syncMusicOnHoldStart'][_0x29e7('0x19')](this));ami['on']('musiconholdstop',this[_0x29e7('0x2d')]['bind'](this));ami['on'](_0x29e7('0x2e'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0x29e7('0x2f'),this[_0x29e7('0x30')]['bind'](this));this['loopQueueSummary']();this[_0x29e7('0x31')]();}function clearChannels(_0x37e4f8){if(!_['isEmpty'](_0x37e4f8)){for(var _0x35b174 in _0x37e4f8){if(_0x37e4f8[_0x29e7('0x32')](_0x35b174)){delete _0x37e4f8[_0x35b174];}}}}function clearCampaigns(_0x523f11){if(!_[_0x29e7('0x33')](_0x523f11)){for(var _0x316302 in _0x523f11){if(_0x523f11[_0x29e7('0x32')](_0x316302)){_0x523f11[_0x316302][_0x29e7('0x34')]=0x0;}}}}function clearVoiceQueues(_0x293ead){if(!_['isEmpty'](_0x293ead)){for(var _0x5b1ad0 in _0x293ead){if(_0x293ead['hasOwnProperty'](_0x5b1ad0)){_0x293ead[_0x5b1ad0][_0x29e7('0x34')]=0x0;_0x293ead[_0x5b1ad0][_0x29e7('0x35')]=0x0;_0x293ead[_0x5b1ad0][_0x29e7('0x36')]=0x0;_0x293ead[_0x5b1ad0]['waiting']=0x0;_0x293ead[_0x5b1ad0][_0x29e7('0x37')]=!![];}}}}function clearAgentBooked(_0x39976d){if(!_[_0x29e7('0x33')](_0x39976d)){for(var _0x393a9 in _0x39976d){if(_0x39976d[_0x29e7('0x32')](_0x393a9)){_0x39976d[_0x393a9]['unlockRR']=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}VoiceQueueReport[_0x29e7('0xb')]['clearZombieChannels']=function(){var _0x3c2ec4=this;for(var _0x240691 in this['channels']){if(this[_0x29e7('0x13')]['hasOwnProperty'](_0x240691)&&!this[_0x29e7('0x13')][_0x240691][_0x29e7('0x38')]){this[_0x29e7('0xf')][_0x29e7('0xc')](function(){if(!_[_0x29e7('0x39')](_0x3c2ec4[_0x29e7('0x13')][_0x240691])){return ami[_0x29e7('0x3a')]({'action':_0x29e7('0x3b'),'channel':_0x3c2ec4[_0x29e7('0x13')][_0x240691]['channel']})[_0x29e7('0x3c')](function(_0x47f08e){if(_0x47f08e[_0x29e7('0x3d')]===_0x29e7('0x3e')){setTimeout(function(){if(_0x3c2ec4[_0x29e7('0x13')][_0x240691]){delete _0x3c2ec4[_0x29e7('0x13')][_0x240691];logger[_0x29e7('0x3f')]('[%s][voiceQueueReport][checkChannel]',_0x240691,util[_0x29e7('0x40')](_0x47f08e,{'showHidden':![],'depth':null}));}if(_0x3c2ec4[_0x29e7('0x10')][_0x240691]){delete _0x3c2ec4[_0x29e7('0x10')][_0x240691];logger[_0x29e7('0x3f')](_0x29e7('0x41'),_0x240691,util[_0x29e7('0x40')](_0x47f08e,{'showHidden':![],'depth':null}));}if(_0x3c2ec4[_0x29e7('0x42')][_0x240691]){delete _0x3c2ec4[_0x29e7('0x42')][_0x240691];logger[_0x29e7('0x3f')](_0x29e7('0x43'),_0x240691,util[_0x29e7('0x40')](_0x47f08e,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x29e7('0xb')]['syncFullyBooted']=function(){logger['error'](_0x29e7('0x44'));clearChannels(this[_0x29e7('0x13')]);this['clearQueueReport'](this[_0x29e7('0x10')]);clearAgentBooked(this[_0x29e7('0x12')]);clearVoiceQueues(this[_0x29e7('0x15')]);clearCampaigns(this[_0x29e7('0x16')]);this[_0x29e7('0x17')]=initializeSummary();};VoiceQueueReport[_0x29e7('0xb')][_0x29e7('0x45')]=function(_0x43b81c){var _0x5158d6=this;if(!_[_0x29e7('0x33')](_0x43b81c)){for(var _0x21e3ed in _0x43b81c){if(_0x43b81c[_0x29e7('0x32')](_0x21e3ed)){_0x5158d6[_0x29e7('0x46')](_0x43b81c[_0x21e3ed],'clearqueuereport');delete _0x43b81c[_0x21e3ed];}}}};VoiceQueueReport[_0x29e7('0xb')]['emit']=function(_0x3d9c4d,_0x45935b,_0x2ed4e8){io['to'](_0x3d9c4d)['emit'](_0x45935b,_0x2ed4e8);};VoiceQueueReport[_0x29e7('0xb')]['emitVoiceQueueChannelSave']=function(_0x22d50e,_0x2c823f){logger[_0x29e7('0x47')](_0x29e7('0x48')+_0x2c823f+']\x20sending\x20voice_queue_channel:save\x20event:',_0x22d50e[_0x29e7('0x49')],util[_0x29e7('0x40')](_0x22d50e,{'showHidden':![],'depth':null}));this[_0x29e7('0x4a')](util[_0x29e7('0x4b')]('voice:queue:%s',_0x22d50e['queue']),_0x29e7('0x4c'),_0x22d50e);io['emit'](_0x29e7('0x4d'),_0x22d50e);};VoiceQueueReport[_0x29e7('0xb')][_0x29e7('0x46')]=function(_0x249859,_0x261f45){logger[_0x29e7('0x47')](_0x29e7('0x48')+_0x261f45+_0x29e7('0x4e'),_0x249859['uniqueid'],util[_0x29e7('0x40')](_0x249859,{'showHidden':![],'depth':null}));if(_0x249859[_0x29e7('0x4f')]==='ATTENDEDTRANSFER'){return;}this[_0x29e7('0x4a')](util[_0x29e7('0x4b')]('voice:queue:%s',_0x249859[_0x29e7('0x50')]),_0x29e7('0x51'),_0x249859);io[_0x29e7('0x4a')]('voice_queue_presence:remove',_0x249859);};VoiceQueueReport[_0x29e7('0xb')][_0x29e7('0x52')]=function(_0x11c146){if(_0x11c146['type']==='inbound'){logger['debug'](_0x29e7('0x53'),util[_0x29e7('0x40')](_0x11c146,{'showHidden':![],'depth':null}));this[_0x29e7('0x4a')](util[_0x29e7('0x4b')](_0x29e7('0x54'),_0x11c146['name']),_0x29e7('0x55'),_0x11c146);}};VoiceQueueReport[_0x29e7('0xb')]['isNotNull']=function(_0x29f0c9){return _0x29f0c9!==null&&!_[_0x29e7('0x56')](_0x29f0c9);};VoiceQueueReport[_0x29e7('0xb')][_0x29e7('0x31')]=function(){var _0x314bf4=this;setInterval(function(){_0x314bf4[_0x29e7('0x57')]();ami[_0x29e7('0x3a')]({'action':_0x29e7('0x58')})[_0x29e7('0x3c')](function(_0x18647a){logger[_0x29e7('0x3f')](_0x29e7('0x59'),util[_0x29e7('0x40')](_0x18647a,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x29e7('0xb')]['loopQueueSummary']=function(){var _0x11b9cf=this;setInterval(function(){if(!_0x11b9cf['summary'][_0x29e7('0x5a')]){return ami[_0x29e7('0x3a')]({'action':'queuesummary'})[_0x29e7('0x5b')](function(_0x1c7cf1){_0x11b9cf[_0x29e7('0x17')]['id']=_0x1c7cf1[_0x29e7('0x5c')];_0x11b9cf['summary'][_0x29e7('0x5a')]=!![];_0x11b9cf[_0x29e7('0x17')][_0x29e7('0x5d')][_0x1c7cf1[_0x29e7('0x5c')]]={};})[_0x29e7('0x3c')](function(_0x4c48aa){logger[_0x29e7('0x3f')](_0x29e7('0x5e'),util['inspect'](_0x4c48aa,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x29e7('0xb')][_0x29e7('0x5f')]=function(_0x1ba2ad,_0x37384b){var _0xc847e8=this[_0x29e7('0x17')][_0x29e7('0x58')][_0x1ba2ad[_0x29e7('0x60')]][_0x29e7('0x61')];var _0x299c5b=new VoiceQueueSummary(_0x1ba2ad);return _0x299c5b[_0x29e7('0x62')](_0x37384b['agents'],this[_0x29e7('0x12')],_0xc847e8,this[_0x29e7('0x11')][_0x29e7('0x13')]);};VoiceQueueReport[_0x29e7('0xb')]['handleInboundQueueSummaryReport']=function(_0x3ed6d0,_0x52c2c0){var _0x597622=this['createQueueSummaryReport'](_0x3ed6d0,_0x52c2c0);var _0x27e5b1=![];_0x27e5b1=_0x597622['compareToInboundQueue'](_0x3ed6d0);if(_0x27e5b1){Object[_0x29e7('0x63')](_0x3ed6d0,_0x597622);this[_0x29e7('0x11')]['voiceQueues'][_0x3ed6d0[_0x29e7('0x60')]]=_0x3ed6d0;this[_0x29e7('0x52')](_0x597622);}};VoiceQueueReport['prototype'][_0x29e7('0x1e')]=function(_0x4a4804){var _0x101ba6=null;var _0x59e79f=this[_0x29e7('0x17')]['id'];if(this['summary']['queuestatus'][_0x59e79f]){_0x101ba6=this[_0x29e7('0x17')][_0x29e7('0x5d')][_0x59e79f][_0x4a4804[_0x29e7('0x5c')]];}if(!_0x101ba6){this['summary']=initializeSummary();return;}var _0x2bc510=this[_0x29e7('0x15')][_0x101ba6[_0x29e7('0x50')]];if(_0x2bc510[_0x29e7('0x64')]===_0x29e7('0x65')){this[_0x29e7('0x66')](_0x2bc510,_0x101ba6);}else if(_0x2bc510['type']===_0x29e7('0x67')){var _0x547e93=this['createQueueSummaryReport'](_0x2bc510,_0x101ba6);ami[_0x29e7('0x4a')](_0x29e7('0x68'),_0x547e93);}this[_0x29e7('0x17')][_0x29e7('0x69')]-=0x1;var _0x4e4af2=this[_0x29e7('0x17')]['statusRequests']>0x0?!![]:![];if(!_0x4e4af2){return this[_0x29e7('0x1b')](this[_0x29e7('0x17')][_0x29e7('0x6a')]);}};VoiceQueueReport['prototype'][_0x29e7('0x1c')]=function(_0x58b668){var _0x1d3236=this[_0x29e7('0x17')]['id'];if(this[_0x29e7('0x17')][_0x29e7('0x5d')][_0x1d3236]&&this[_0x29e7('0x17')][_0x29e7('0x5d')][_0x1d3236][_0x58b668['actionid']]){this['summary'][_0x29e7('0x5d')][_0x1d3236][_0x58b668[_0x29e7('0x5c')]][_0x29e7('0x12')]['push'](_0x58b668);}};VoiceQueueReport[_0x29e7('0xb')][_0x29e7('0x18')]=function(_0x1cb8de){var _0x4b19aa=this;try{if(this[_0x29e7('0x6b')](_0x1cb8de)&&this[_0x29e7('0x6b')](_0x1cb8de[_0x29e7('0x50')])){logger[_0x29e7('0x47')](_0x29e7('0x6c'),util['inspect'](_0x1cb8de,{'showHidden':![],'depth':null}));var _0x51c424=this['voiceQueues'][_0x1cb8de[_0x29e7('0x50')]];if(_0x51c424){logger[_0x29e7('0x6d')](_0x29e7('0x6e'),_0x51c424[_0x29e7('0x60')]);this[_0x29e7('0x17')]['queues'][_0x51c424['name']]={'summaryEvent':_0x1cb8de};this[_0x29e7('0x17')][_0x29e7('0x69')]+=0x1;return ami[_0x29e7('0x3a')]({'action':'queuestatus','queue':_0x51c424[_0x29e7('0x60')]})[_0x29e7('0x5b')](function(_0x46a8d8){if(!_0x4b19aa[_0x29e7('0x17')][_0x29e7('0x5d')][_0x1cb8de[_0x29e7('0x5c')]]){_0x4b19aa[_0x29e7('0x17')][_0x29e7('0x5d')][_0x1cb8de[_0x29e7('0x5c')]]={};}_0x4b19aa[_0x29e7('0x17')][_0x29e7('0x5d')][_0x1cb8de['actionid']][_0x46a8d8['actionid']]={'queue':_0x51c424[_0x29e7('0x60')],'agents':[]};})[_0x29e7('0x3c')](function(_0x3cb6a7){throw _0x3cb6a7;});}}}catch(_0xb23ea){logger[_0x29e7('0x3f')](_0x29e7('0x5e'),util[_0x29e7('0x40')](_0xb23ea,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x29e7('0xb')][_0x29e7('0x1b')]=function(_0x52f5e){if(this['summary']['statusRequests']>0x0){this[_0x29e7('0x17')][_0x29e7('0x6a')]=_0x52f5e;return;}logger[_0x29e7('0x47')](_0x29e7('0x6f'),util['inspect'](_0x52f5e,{'showHidden':![],'depth':null}));this[_0x29e7('0x17')]=initializeSummary();ami[_0x29e7('0x4a')](_0x29e7('0x70'),{});};VoiceQueueReport[_0x29e7('0xb')]['syncQueueCallerJoin']=function(_0x401108){try{if(this[_0x29e7('0x6b')](_0x401108)){logger[_0x29e7('0x47')](_0x29e7('0x71'),_0x401108['uniqueid'],util[_0x29e7('0x40')](_0x401108,{'showHidden':![],'depth':null}));if(_[_0x29e7('0x56')](this[_0x29e7('0x10')][_0x401108[_0x29e7('0x49')]])){this['queueReports'][_0x401108[_0x29e7('0x49')]]=[];}if(_[_0x29e7('0x56')](this['channels'][_0x401108[_0x29e7('0x49')]])){this[_0x29e7('0x13')][_0x401108[_0x29e7('0x49')]]={};}var _0x267c73=new QueueReport();_0x267c73['queue']=_0x401108[_0x29e7('0x50')];_0x267c73[_0x29e7('0x64')]=this[_0x29e7('0x15')][_0x267c73[_0x29e7('0x50')]]&&this[_0x29e7('0x15')][_0x267c73[_0x29e7('0x50')]][_0x29e7('0x64')]?this[_0x29e7('0x15')][_0x267c73[_0x29e7('0x50')]][_0x29e7('0x64')]||'inbound':_0x29e7('0x65');_0x267c73[_0x29e7('0x72')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x267c73[_0x29e7('0x73')]=_0x401108[_0x29e7('0x73')];_0x267c73[_0x29e7('0x74')]=_0x401108[_0x29e7('0x74')];_0x267c73[_0x29e7('0x49')]=_0x401108[_0x29e7('0x49')];_0x267c73[_0x29e7('0x75')]=this[_0x29e7('0x13')][_0x401108[_0x29e7('0x49')]][_0x29e7('0x75')];logger['info'](_0x29e7('0x76'),_0x267c73['queue'],_0x267c73[_0x29e7('0x64')]);_[_0x29e7('0x77')](_0x267c73,_[_0x29e7('0x78')](_0x401108,_[_0x29e7('0x79')](_0x267c73)));this[_0x29e7('0x10')][_0x401108[_0x29e7('0x49')]][_0x29e7('0x7a')](_0x267c73);this['channels'][_0x401108[_0x29e7('0x49')]]=_0x267c73;this['emitVoiceQueueChannelSave'](_0x267c73,_0x29e7('0x1f'));}}catch(_0x311239){logger[_0x29e7('0x3f')](_0x29e7('0x71'),_0x401108['uniqueid'],util[_0x29e7('0x40')](_0x311239,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x29e7('0xb')][_0x29e7('0x22')]=function(_0x9e7c4b){try{if(this['isNotNull'](_0x9e7c4b)){logger[_0x29e7('0x47')](_0x29e7('0x7b'),_0x9e7c4b[_0x29e7('0x49')],util[_0x29e7('0x40')](_0x9e7c4b,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x9e7c4b[_0x29e7('0x49')]]){var _0x42147b=_[_0x29e7('0x7c')](this[_0x29e7('0x10')][_0x9e7c4b[_0x29e7('0x49')]]);_0x42147b['queuecallercomplete']=![];_0x42147b[_0x29e7('0x7d')]=null;_0x42147b[_0x29e7('0x7e')]=_0x9e7c4b[_0x29e7('0x7e')];_0x42147b['originalposition']=_0x9e7c4b[_0x29e7('0x7f')];_0x42147b[_0x29e7('0x21')]=!![];_0x42147b[_0x29e7('0x80')]=moment()[_0x29e7('0x4b')](_0x29e7('0x81'));_0x42147b[_0x29e7('0x4f')]='ABANDONED';_0x42147b['lastAssignedTo']=null;logger[_0x29e7('0x6d')](_0x29e7('0x82'),_0x42147b[_0x29e7('0x50')],_0x42147b['type']);this[_0x29e7('0x13')][_0x9e7c4b['uniqueid']]=_0x42147b;this[_0x29e7('0x46')](_0x42147b,_0x29e7('0x21'));}}}catch(_0x4cf9d7){logger[_0x29e7('0x3f')](_0x29e7('0x7b'),_0x9e7c4b[_0x29e7('0x49')],util['inspect'](_0x4cf9d7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x29e7('0xb')][_0x29e7('0x23')]=function(_0x18297c){try{if(this[_0x29e7('0x6b')](_0x18297c)){logger[_0x29e7('0x47')](_0x29e7('0x83'),_0x18297c[_0x29e7('0x49')],util['inspect'](_0x18297c,{'showHidden':![],'depth':null}));if(this[_0x29e7('0x10')][_0x18297c[_0x29e7('0x49')]]){var _0x257efa=_[_0x29e7('0x7c')](this[_0x29e7('0x10')][_0x18297c[_0x29e7('0x49')]]);_0x257efa[_0x29e7('0x84')]=moment()[_0x29e7('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x257efa['connectedlinenum']=_0x18297c[_0x29e7('0x85')];_0x257efa[_0x29e7('0x86')]=_0x18297c[_0x29e7('0x86')];logger[_0x29e7('0x6d')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x257efa[_0x29e7('0x50')],_0x257efa[_0x29e7('0x64')],_0x18297c[_0x29e7('0x85')],_0x18297c['connectedlinename']);this[_0x29e7('0x13')][_0x18297c['uniqueid']]=_0x257efa;this['emitVoiceQueueChannelSave'](_0x257efa,_0x29e7('0x87'));}}}catch(_0x3994e7){logger['error'](_0x29e7('0x83'),_0x18297c[_0x29e7('0x49')],util[_0x29e7('0x40')](_0x3994e7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x29e7('0xb')][_0x29e7('0x25')]=function(_0x3b01f8){try{if(this[_0x29e7('0x6b')](_0x3b01f8)){logger[_0x29e7('0x47')](_0x29e7('0x88'),_0x3b01f8['uniqueid'],util['inspect'](_0x3b01f8,{'showHidden':![],'depth':null}));if(this[_0x29e7('0x10')][_0x3b01f8[_0x29e7('0x49')]]){var _0x12c857=_[_0x29e7('0x7c')](this[_0x29e7('0x10')][_0x3b01f8[_0x29e7('0x49')]]);_0x12c857['queuecallercomplete']=!![];_0x12c857[_0x29e7('0x4f')]='COMPLETEDBYAGENT';logger[_0x29e7('0x6d')](_0x29e7('0x89'),_0x12c857['queue'],_0x12c857[_0x29e7('0x64')]);}}}catch(_0x36a8a1){logger[_0x29e7('0x3f')]('[%s][voiceQueueReport][agentconnect]',_0x3b01f8[_0x29e7('0x49')],util[_0x29e7('0x40')](_0x36a8a1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x29e7('0xb')][_0x29e7('0x24')]=function(_0x3c409e){try{if(this['isNotNull'](_0x3c409e)){logger[_0x29e7('0x47')](_0x29e7('0x8a'),_0x3c409e[_0x29e7('0x49')],util[_0x29e7('0x40')](_0x3c409e,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3c409e[_0x29e7('0x49')]]){var _0x3d34c2=_[_0x29e7('0x7c')](this[_0x29e7('0x10')][_0x3c409e[_0x29e7('0x49')]]);_0x3d34c2[_0x29e7('0x21')]=![];_0x3d34c2['queuecallerabandonAt']=null;_0x3d34c2['assigned']=!![];_0x3d34c2[_0x29e7('0x8b')]=_0x3c409e[_0x29e7('0x8c')];_0x3d34c2[_0x29e7('0x7e')]=_0x3c409e[_0x29e7('0x7e')];_0x3d34c2['queuecallercomplete']=!![];_0x3d34c2[_0x29e7('0x8d')]=![];_0x3d34c2[_0x29e7('0x8e')]=null;if(!_0x3d34c2[_0x29e7('0x8f')]){if(_0x3c409e[_0x29e7('0x90')]=='transfer'){_0x3d34c2[_0x29e7('0x4f')]=_0x29e7('0x91');logger[_0x29e7('0x6d')](_0x29e7('0x92'),_0x3d34c2[_0x29e7('0x50')],_0x3d34c2[_0x29e7('0x64')]);}else{if(_[_0x29e7('0x93')](_0x3c409e[_0x29e7('0x94')][_0x29e7('0x95')](),_0x29e7('0x96'))){if(this[_0x29e7('0x10')][_0x3c409e['linkedid']]){var _0x40c451=_['last'](this[_0x29e7('0x10')][_0x3c409e[_0x29e7('0x97')]]);_0x40c451[_0x29e7('0x98')]=![];_0x40c451['queuecallerexit']=!![];_0x40c451[_0x29e7('0x8e')]=moment(_0x3d34c2[_0x29e7('0x72')])[_0x29e7('0x99')](_0x3c409e[_0x29e7('0x7e')],_0x29e7('0x9a'))[_0x29e7('0x4b')](_0x29e7('0x81'));_0x40c451[_0x29e7('0x4f')]=_0x29e7('0x9b');_0x40c451['transfer']=!![];_0x40c451[_0x29e7('0x9c')]=_0x29e7('0x9d');_0x40c451['transferexten']=_0x3c409e[_0x29e7('0x9e')];_0x40c451[_0x29e7('0x9f')]=_0x3c409e[_0x29e7('0x49')];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x40c451['queue'],_0x40c451[_0x29e7('0x64')]);var _0x3f7c45=this[_0x29e7('0x10')][_0x3c409e[_0x29e7('0x97')]];this[_0x29e7('0x10')][_0x3c409e[_0x29e7('0x97')]]=this['queueReports'][_0x3c409e['uniqueid']];this[_0x29e7('0x10')][_0x3c409e[_0x29e7('0x49')]]=_0x3f7c45;}}else{_0x3d34c2[_0x29e7('0x4f')]=_0x29e7('0xa0')+_0x3c409e[_0x29e7('0x90')]['toUpperCase']();logger[_0x29e7('0x6d')](_0x29e7('0xa1'),_0x3d34c2[_0x29e7('0x50')],_0x3d34c2['type'],_0x3d34c2[_0x29e7('0x4f')]);}}}this['channels'][_0x3c409e[_0x29e7('0x49')]]=_0x3d34c2;}}}catch(_0x1fb60f){logger[_0x29e7('0x3f')]('[%s][voiceQueueReport][agentcomplete]',_0x3c409e['uniqueid'],util['inspect'](_0x1fb60f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x29e7('0xb')][_0x29e7('0x27')]=function(_0x526dd9){try{if(this[_0x29e7('0x6b')](_0x526dd9)){logger[_0x29e7('0x47')]('[%s][voiceQueueReport][varset]',_0x526dd9[_0x29e7('0x49')],util['inspect'](_0x526dd9,{'showHidden':![],'depth':null}));this[_0x29e7('0xa2')](_0x526dd9['uniqueid'],_['keys'](_0x526dd9['variable'])[0x0],_0x526dd9[_0x29e7('0xa3')]);if(this[_0x29e7('0x10')][_0x526dd9[_0x29e7('0x49')]]){var _0x4718cd=_[_0x29e7('0x7c')](this[_0x29e7('0x10')][_0x526dd9[_0x29e7('0x49')]]);if(_0x4718cd){if(this[_0x29e7('0x6b')](_0x526dd9[_0x29e7('0xa4')])&&this[_0x29e7('0x6b')](_0x526dd9['variable']['queuestatus'])){switch(_0x526dd9[_0x29e7('0xa3')]){case _0x29e7('0xa5'):_0x4718cd[_0x29e7('0x8d')]=![];_0x4718cd['queuecallerexitAt']=null;break;case _0x29e7('0xa6'):_0x4718cd[_0x29e7('0xa7')]='timeout';_0x4718cd[_0x29e7('0x8d')]=!![];_0x4718cd[_0x29e7('0x8e')]=moment()[_0x29e7('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x4718cd[_0x29e7('0x84')]=moment()['format'](_0x29e7('0x81'));logger[_0x29e7('0x47')](_0x29e7('0xa8'),_0x526dd9[_0x29e7('0x49')],util['inspect'](_0x4718cd,{'showHidden':![],'depth':null}));ami[_0x29e7('0x4a')](_0x29e7('0xa9'),_0x4718cd);break;default:_0x4718cd[_0x29e7('0x8d')]=!![];_0x4718cd['queuecallerexitAt']=moment()['format'](_0x29e7('0x81'));_0x4718cd[_0x29e7('0x84')]=moment()['format'](_0x29e7('0x81'));}_0x4718cd['queuecallerabandon']=![];_0x4718cd['queuecallerabandonAt']=null;_0x4718cd[_0x29e7('0x4f')]=_0x526dd9[_0x29e7('0xa3')];this[_0x29e7('0x13')][_0x526dd9[_0x29e7('0x49')]]=_0x4718cd;this[_0x29e7('0x46')](_0x4718cd,_0x29e7('0x26'));}else if(this[_0x29e7('0x6b')](_0x526dd9['variable'])&&this[_0x29e7('0x6b')](_0x526dd9[_0x29e7('0xa4')]['queueposition'])){if(!_0x4718cd['queuecallerabandon']){_0x4718cd[_0x29e7('0x8d')]=!![];_0x4718cd[_0x29e7('0x8e')]=moment()[_0x29e7('0x4b')](_0x29e7('0x81'));_0x4718cd[_0x29e7('0x4f')]='EXITWITHKEY';_0x4718cd['queuecallerleaveAt']=moment()[_0x29e7('0x4b')](_0x29e7('0x81'));this['channels'][_0x526dd9['uniqueid']]=_0x4718cd;}}logger[_0x29e7('0x6d')](_0x29e7('0xaa'),_0x526dd9[_0x29e7('0x49')],_0x4718cd[_0x29e7('0x50')],_0x4718cd[_0x29e7('0x64')],_[_0x29e7('0x79')](_0x526dd9[_0x29e7('0xa4')])[0x0],_0x526dd9[_0x29e7('0xa3')]);_0x4718cd[_0x29e7('0x42')]=this[_0x29e7('0x42')][_0x526dd9['uniqueid']];}}}}catch(_0x400ea8){logger[_0x29e7('0x3f')](_0x29e7('0xab'),_0x526dd9['uniqueid'],util[_0x29e7('0x40')](_0x400ea8,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x29e7('0xa2')]=function(_0x4d7d30,_0x3e19eb,_0x34900b){var _0x305d58=['rtpaudioqos',_0x29e7('0xac'),_0x29e7('0xad'),_0x29e7('0xae'),_0x29e7('0xaf'),_0x29e7('0xb0'),_0x29e7('0xb1'),_0x29e7('0xb2'),_0x29e7('0xb3'),_0x29e7('0xb4'),'bridgepeer','bridgepvtcallid',_0x29e7('0xb5'),'memberdynamic',_0x29e7('0xb6'),_0x29e7('0xb7'),_0x29e7('0x8c'),_0x29e7('0xb8'),_0x29e7('0xb9')];if(!_['isNil'](_0x3e19eb)&&!_[_0x29e7('0xba')](_0x305d58,_0x3e19eb)){if(_[_0x29e7('0x56')](this[_0x29e7('0x42')][_0x4d7d30])){this[_0x29e7('0x42')][_0x4d7d30]={};}this[_0x29e7('0x42')][_0x4d7d30][_0x3e19eb]=_0x34900b;}};VoiceQueueReport[_0x29e7('0xb')][_0x29e7('0xbb')]=function(_0x3e3a3b,_0xadfc05,_0x1a8c7e){var _0x42fd1a={};for(var _0x1e904b=0x0;_0x1e904b<this[_0x29e7('0x10')][_0x3e3a3b][_0x29e7('0xbc')];_0x1e904b+=0x1){_0x42fd1a=this[_0x29e7('0x10')][_0x3e3a3b][_0x1e904b];if(this[_0x29e7('0x15')][_0x42fd1a[_0x29e7('0x50')]]){if(_0x42fd1a[_0x29e7('0x8d')]&&_0x42fd1a[_0x29e7('0x8f')]!=!![]){this[_0x29e7('0x15')][_0x42fd1a[_0x29e7('0x50')]][_0x29e7('0xbd')]+=0x1;}if(_0x42fd1a[_0x29e7('0x21')]){this['voiceQueues'][_0x42fd1a[_0x29e7('0x50')]][_0x29e7('0xbe')]+=0x1;}this[_0x29e7('0x15')][_0x42fd1a[_0x29e7('0x50')]][_0x29e7('0xbf')]+=moment(_0x42fd1a['queuecallerleaveAt'])[_0x29e7('0xc0')](_0x42fd1a[_0x29e7('0x72')],'seconds')||0x0;if(_0x1e904b===this[_0x29e7('0x10')][_0x3e3a3b][_0x29e7('0xbc')]-0x1){this[_0x29e7('0x15')][_0x42fd1a['queue']][_0x29e7('0xc1')]+=moment()[_0x29e7('0xc2')](0x0)['diff'](_0x42fd1a['queuecallerjoinAt'],_0x29e7('0x9a'));this['voiceQueues'][_0x42fd1a[_0x29e7('0x50')]][_0x29e7('0xc3')]+=0x1;if(_0x42fd1a[_0x29e7('0x98')]){this[_0x29e7('0x15')][_0x42fd1a['queue']]['answered']+=0x1;this[_0x29e7('0x15')][_0x42fd1a[_0x29e7('0x50')]][_0x29e7('0xc4')]+=moment()[_0x29e7('0xc2')](0x0)[_0x29e7('0xc0')](_0x42fd1a[_0x29e7('0x84')],_0x29e7('0x9a'));_0x42fd1a[_0x29e7('0x7d')]=moment()[_0x29e7('0x4b')](_0x29e7('0x81'));_0x42fd1a['queuecallerexit']=![];_0x42fd1a[_0x29e7('0x8e')]=null;}if(_0x42fd1a['queuecallerexit']&&_0x42fd1a[_0x29e7('0x8f')]!=!![]){_0x42fd1a[_0x29e7('0xa7')]=_0x29e7('0xbd');logger[_0x29e7('0x47')](_0x29e7('0xc5'),_0x3e3a3b,util['inspect'](_0x42fd1a,{'showHidden':![],'depth':null}));ami[_0x29e7('0x4a')]('custom:queuecallerunmanaged',_0x42fd1a);}if(_0x42fd1a[_0x29e7('0x21')]){_0x42fd1a[_0x29e7('0xa7')]=_0x29e7('0xbe');logger[_0x29e7('0x47')](_0x29e7('0xc6'),_0x3e3a3b,util[_0x29e7('0x40')](_0x42fd1a,{'showHidden':![],'depth':null}));ami[_0x29e7('0x4a')](_0x29e7('0xc7'),_0x42fd1a);}}else{this['voiceQueues'][_0x42fd1a[_0x29e7('0x50')]]['sumDuration']+=this['voiceQueues'][_0x42fd1a[_0x29e7('0x50')]][_0x29e7('0xbf')];}logger[_0x29e7('0x6d')](_0x29e7('0xc8'),_0x3e3a3b,_0x42fd1a[_0x29e7('0x50')],_0x42fd1a[_0x29e7('0x64')],_0xadfc05);if(_0x1a8c7e&&_0x42fd1a[_0x29e7('0x4f')]===_0x29e7('0xc9')){_0x42fd1a['queuecallerexitreason']=_0x29e7('0xca');}this[_0x29e7('0x13')][_0x3e3a3b]=_0x42fd1a;if(_0x42fd1a[_0x29e7('0x84')]){this['emitVoiceQueueChannelRemove'](_0x42fd1a,_0x29e7('0x28'));}}}logger[_0x29e7('0x47')]('[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:',_0x3e3a3b,util[_0x29e7('0x40')](this['queueReports'][_0x3e3a3b],{'showHidden':![],'depth':null}));ami[_0x29e7('0x4a')]('custom:voiceQueueReport',this[_0x29e7('0x10')][_0x3e3a3b]);if(_0x42fd1a[_0x29e7('0x4f')]===_0x29e7('0xc9')||_0x42fd1a[_0x29e7('0x84')]===null){return;}if(_0x42fd1a[_0x29e7('0x8d')]||_0x42fd1a[_0x29e7('0x21')]||_0x42fd1a['queuecallercomplete']){delete this['queueReports'][_0x3e3a3b];delete this['channels'][_0x3e3a3b];if(this[_0x29e7('0x42')][_0x3e3a3b]){delete this[_0x29e7('0x42')][_0x3e3a3b];}}};VoiceQueueReport[_0x29e7('0xb')][_0x29e7('0x29')]=function(_0x2696cf){try{if(this[_0x29e7('0x6b')](_0x2696cf)){logger[_0x29e7('0x47')]('[%s][voiceQueueReport][hangup]',_0x2696cf[_0x29e7('0x49')],util[_0x29e7('0x40')](_0x2696cf,{'showHidden':![],'depth':null}));if(this[_0x29e7('0x10')][_0x2696cf[_0x29e7('0x49')]]){return this[_0x29e7('0xbb')](_0x2696cf['uniqueid'],_0x2696cf[_0x29e7('0xcb')],![]);}if(this[_0x29e7('0x10')][_0x2696cf[_0x29e7('0x97')]]){if(_0x2696cf[_0x29e7('0xcc')]==='21'){return;}return this['handleHangup'](_0x2696cf['linkedid'],_0x2696cf[_0x29e7('0xcb')],!![]);}var _0x376acc=Object[_0x29e7('0x79')](this[_0x29e7('0x10')]);for(var _0x4de010=0x0;_0x4de010<_0x376acc['length'];_0x4de010++){var _0x4658d3=_[_0x29e7('0x7c')](this['queueReports'][_0x376acc[_0x4de010]]);if(_0x4658d3&&_0x4658d3[_0x29e7('0xcd')]===_0x2696cf[_0x29e7('0x49')]){return this['handleHangup'](_0x4658d3['uniqueid'],_0x2696cf['cause-txt'],!![]);}}}}catch(_0x25edd1){logger[_0x29e7('0x3f')](_0x29e7('0xce'),_0x2696cf[_0x29e7('0x49')],util[_0x29e7('0x40')](_0x25edd1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x29e7('0xb')][_0x29e7('0xcf')]=function(_0x2aa1c9){try{if(this[_0x29e7('0x6b')](_0x2aa1c9)){logger[_0x29e7('0x47')]('[%s][voiceQueueReport][attendedtransfer]',_0x2aa1c9[_0x29e7('0x49')],util[_0x29e7('0x40')](_0x2aa1c9,{'showHidden':![],'depth':null}));var _0x64954;var _0xb2f649;var _0x51263d;if(this[_0x29e7('0x10')][_0x2aa1c9[_0x29e7('0xd0')]]){_0x64954=_['last'](this['queueReports'][_0x2aa1c9[_0x29e7('0xd0')]]);_0x64954[_0x29e7('0xd1')]=_0x2aa1c9[_0x29e7('0xd2')];_0x64954[_0x29e7('0x9f')]=_0x2aa1c9[_0x29e7('0xd3')];_0x64954['queuecallerexitreason']=_0x29e7('0xc9');_0x64954[_0x29e7('0x8f')]=!![];_0x64954[_0x29e7('0x9c')]=_0x29e7('0xd4');if(this[_0x29e7('0x10')][_0x2aa1c9[_0x29e7('0xd3')]]){_0x51263d=this['queueReports'][_0x2aa1c9['secondtransfereruniqueid']];this[_0x29e7('0x10')][_0x2aa1c9['secondtransfereruniqueid']]=this[_0x29e7('0x10')][_0x2aa1c9[_0x29e7('0xd0')]];this['queueReports'][_0x2aa1c9[_0x29e7('0xd0')]]=_0x51263d;_0xb2f649=_[_0x29e7('0x7c')](this[_0x29e7('0x10')][_0x2aa1c9[_0x29e7('0xd0')]]);_0xb2f649[_0x29e7('0x38')]=!![];}logger[_0x29e7('0x6d')](_0x29e7('0xd5'),_0x2aa1c9[_0x29e7('0x49')],_0x64954[_0x29e7('0x50')],_0x64954[_0x29e7('0x64')],_0x64954[_0x29e7('0xd1')],_0x64954[_0x29e7('0x9f')]);}else if(this[_0x29e7('0x10')][_0x2aa1c9['transfertargetuniqueid']]){_0x64954=_[_0x29e7('0x7c')](this[_0x29e7('0x10')][_0x2aa1c9[_0x29e7('0xd6')]]);_0x64954[_0x29e7('0xd1')]=_0x2aa1c9['origtransfererexten'];_0x64954[_0x29e7('0x9f')]=_0x2aa1c9[_0x29e7('0xd7')];_0x64954[_0x29e7('0x4f')]='ATTENDEDTRANSFER';_0x64954[_0x29e7('0x8f')]=!![];_0x64954[_0x29e7('0x9c')]=_0x29e7('0xd4');if(this[_0x29e7('0x10')][_0x2aa1c9[_0x29e7('0xd7')]]){_0x51263d=this[_0x29e7('0x10')][_0x2aa1c9[_0x29e7('0xd7')]];this[_0x29e7('0x10')][_0x2aa1c9[_0x29e7('0xd7')]]=this[_0x29e7('0x10')][_0x2aa1c9[_0x29e7('0xd6')]];this['queueReports'][_0x2aa1c9[_0x29e7('0xd6')]]=_0x51263d;_0xb2f649=_[_0x29e7('0x7c')](this['queueReports'][_0x2aa1c9[_0x29e7('0xd6')]]);_0xb2f649[_0x29e7('0x38')]=!![];}logger['info']('[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s',_0x2aa1c9[_0x29e7('0x49')],_0x64954[_0x29e7('0x50')],_0x64954[_0x29e7('0x64')],_0x64954['transferexten'],_0x64954[_0x29e7('0x9f')]);}else if(this[_0x29e7('0x10')][_0x2aa1c9['origtransfereruniqueid']]){_0x64954=_[_0x29e7('0x7c')](this[_0x29e7('0x10')][_0x2aa1c9[_0x29e7('0xd7')]]);_0x64954[_0x29e7('0xd1')]=_0x2aa1c9[_0x29e7('0xd8')];_0x64954['transferuniqueid']=_0x2aa1c9['origtransfereruniqueid'];_0x64954[_0x29e7('0x4f')]=_0x29e7('0xc9');_0x64954[_0x29e7('0x8f')]=!![];_0x64954[_0x29e7('0x9c')]='ATTENDED';_0x64954[_0x29e7('0x38')]=!![];_0x64954[_0x29e7('0xcd')]=_0x2aa1c9[_0x29e7('0xd0')];}else if(this[_0x29e7('0x10')][_0x2aa1c9[_0x29e7('0xd3')]]){_0x64954=_[_0x29e7('0x7c')](this[_0x29e7('0x10')][_0x2aa1c9[_0x29e7('0xd3')]]);_0x64954['transferexten']=_0x2aa1c9['secondtransfererexten'];_0x64954[_0x29e7('0x9f')]=_0x2aa1c9[_0x29e7('0xd3')];_0x64954[_0x29e7('0x4f')]=_0x29e7('0xc9');_0x64954[_0x29e7('0x8f')]=!![];_0x64954[_0x29e7('0x9c')]=_0x29e7('0xd4');_0x64954[_0x29e7('0x38')]=!![];_0x64954['transferid']=_0x2aa1c9[_0x29e7('0xd6')];}}}catch(_0x57ed62){logger[_0x29e7('0x3f')](_0x29e7('0xd9'),_0x2aa1c9['uniqueid'],util[_0x29e7('0x40')](_0x57ed62,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x29e7('0xb')][_0x29e7('0x30')]=function(_0x2ddf55){try{if(this[_0x29e7('0x6b')](_0x2ddf55)){logger['debug'](_0x29e7('0xda'),_0x2ddf55['uniqueid'],util[_0x29e7('0x40')](_0x2ddf55,{'showHidden':![],'depth':null}));if(this[_0x29e7('0x10')][_0x2ddf55[_0x29e7('0xd0')]]){var _0x44f053=_[_0x29e7('0x7c')](this[_0x29e7('0x10')][_0x2ddf55['transfereeuniqueid']]);_0x44f053[_0x29e7('0x4f')]=_0x29e7('0xdb');_0x44f053[_0x29e7('0x8f')]=!![];_0x44f053[_0x29e7('0x9c')]=_0x29e7('0xdc');_0x44f053[_0x29e7('0xd1')]=_0x2ddf55[_0x29e7('0xdd')];_0x44f053['transferuniqueid']=_0x2ddf55[_0x29e7('0xd0')];logger[_0x29e7('0x6d')](_0x29e7('0xde'),_0x2ddf55['uniqueid'],_0x44f053[_0x29e7('0x50')],_0x44f053[_0x29e7('0x64')],_0x44f053[_0x29e7('0xd1')],_0x44f053['transferuniqueid']);this[_0x29e7('0x29')]({'event':_0x29e7('0xdf'),'uniqueid':_0x2ddf55[_0x29e7('0xd0')],'context':_0x2ddf55[_0x29e7('0xe0')],'channel':_0x2ddf55[_0x29e7('0xe1')]});}}}catch(_0x2c7343){logger['error']('[%s][voiceQueueReport][blindtransfer]',_0x2ddf55[_0x29e7('0x49')],util[_0x29e7('0x40')](_0x2c7343,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x29e7('0xb')][_0x29e7('0xe2')]=function(_0x485877){try{if(this[_0x29e7('0x6b')](_0x485877)){logger[_0x29e7('0x47')](_0x29e7('0xe3'),_0x485877[_0x29e7('0x49')],util[_0x29e7('0x40')](_0x485877,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x485877[_0x29e7('0x49')]]){var _0x50393e=_['last'](this[_0x29e7('0x10')][_0x485877[_0x29e7('0x49')]]);if(!_[_0x29e7('0x39')](_0x50393e[_0x29e7('0x84')])){_0x50393e[_0x29e7('0xe4')]=moment()[_0x29e7('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');logger['info'](_0x29e7('0xe5'),_0x485877[_0x29e7('0x49')],_0x50393e[_0x29e7('0xe4')]);}}}}catch(_0x3915bf){logger['error']('[%s][voiceQueueReport][musiconholdstart]',_0x485877['uniqueid'],util[_0x29e7('0x40')](_0x3915bf,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x29e7('0xb')]['syncMusicOnHoldStop']=function(_0x33ca4a){try{if(this[_0x29e7('0x6b')](_0x33ca4a)){logger[_0x29e7('0x47')](_0x29e7('0xe6'),_0x33ca4a[_0x29e7('0x49')],util[_0x29e7('0x40')](_0x33ca4a,{'showHidden':![],'depth':null}));if(this[_0x29e7('0x10')][_0x33ca4a['uniqueid']]){var _0x11f9f0=_[_0x29e7('0x7c')](this[_0x29e7('0x10')][_0x33ca4a[_0x29e7('0x49')]]);if(!_['isNil'](_0x11f9f0[_0x29e7('0xe4')])){_0x11f9f0['mohtime']+=moment()['milliseconds'](0x0)['diff'](_0x11f9f0[_0x29e7('0xe4')],_0x29e7('0x9a'));logger[_0x29e7('0x6d')](_0x29e7('0xe7'),_0x33ca4a[_0x29e7('0x49')],_0x11f9f0['mohtime']);delete _0x11f9f0[_0x29e7('0xe4')];}}}}catch(_0x509291){logger['error'](_0x29e7('0xe6'),_0x33ca4a['uniqueid'],util[_0x29e7('0x40')](_0x509291,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x29e7('0xb')][_0x29e7('0xe8')]=function(_0x59f9d0){try{if(this[_0x29e7('0x6b')](_0x59f9d0)){logger['debug'](_0x29e7('0xe9'),_0x59f9d0[_0x29e7('0x49')],util[_0x29e7('0x40')](_0x59f9d0,{'showHidden':![],'depth':null}));if(_0x59f9d0[_0x29e7('0xea')]['toLowerCase']()===_0x29e7('0xeb')){_0x59f9d0[_0x29e7('0xec')]=_0x59f9d0['appdata']&&_0x59f9d0[_0x29e7('0xed')]['startsWith'](_0x29e7('0xee'))?_0x59f9d0[_0x29e7('0xed')]:(_0x59f9d0[_0x29e7('0xed')]||_0x59f9d0[_0x29e7('0xec')])[_0x29e7('0x95')]();if(_[_0x29e7('0x93')](_0x59f9d0[_0x29e7('0xec')][_0x29e7('0x95')](),_0x29e7('0xef'))){logger['info'](_0x29e7('0xf0'),_0x59f9d0['uniqueid'],_0x59f9d0[_0x29e7('0xea')],_0x59f9d0['applicationdata']);if(_['isUndefined'](this[_0x29e7('0x13')][_0x59f9d0[_0x29e7('0x49')]]))this[_0x29e7('0x13')][_0x59f9d0[_0x29e7('0x49')]]={};var _0x3fd128=_0x59f9d0['applicationdata'][_0x29e7('0xf1')]('=');var _0x2eb477=_0x3fd128[0x0]['toLowerCase']()[_0x29e7('0xf2')](/cdr\((.*)\)/);if(_0x2eb477)this[_0x29e7('0x13')][_0x59f9d0['uniqueid']][_0x2eb477[0x1]]=_0x3fd128[0x1];}}}}catch(_0x3bfa0d){logger[_0x29e7('0x3f')](_0x29e7('0xf3'),_0x59f9d0[_0x29e7('0x49')],util[_0x29e7('0x40')](_0x3bfa0d,{'showHidden':![],'depth':null}));}};module['exports']=VoiceQueueReport;