d42a50988a26f5181386c2de2aabf90c26955555
[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 _0x3e05=['util','md5','../../../config/environment','ami','../ami','../model/queueReport','defaults','redis','socket.io-emitter','tail','sequence','agents','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','queuesummarycomplete','syncQueueSummaryComplete','bind','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','newexten','syncNewExten','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','pTalking','queueStatusComplete','prototype','clearZombieChannels','channels','switch','enqueue','isNil','Action','status','channel','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','clearQueueReport','queueReports','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave',']\x20sending\x20voice_queue_channel:save\x20event:','voice:queue:%s','name','voice_queue_channel:save','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:remove\x20event:','uniqueid','voice_queue_presence:remove','emitVoiceQueueSummary','type','inbound','strategy','answered','available','sumBillable','talking','total','abandoned','waiting','Trunk','callerid','Interval','stringify','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','format','voice_queue:save','isNotNull','isUndefined','[voiceQueueReport][queues]','then','[voiceQueueReport][queuesummary]','queue','info','[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','toNumber','loggedIn','loggedin','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[voiceQueueReport][queuesummarycomplete]\x20event:','YYYY-MM-DD\x20HH:mm:ss','position','count','routealias','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','push','queuecallerjoin','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','holdtime','originalposition','queuecallerabandonAt','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','queuecallerexitreason','COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','syncAgentComplete','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallerexit','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','toLowerCase','local/','linkedid','queuecallerjoinAt','add','seconds','FORWARDTRANSFER','FORWARD','toUpperCase','[%s][voiceQueueReport][varset]','addVariable','keys','variable','value','queuestatus','CONTINUE','queuecallerexitAt','TIMEOUT','lastevent','timeout','custom:timeout','queueposition','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','length','unmanaged','sumHoldTime','diff','sumDuration','milliseconds','queuecallercompleteAt','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][hangup]','syncAttendedTransfer','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','transferexten','secondtransfererexten','secondtransfereruniqueid','transfertype','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfereruniqueid','ATTENDEDTRANSFER','transferuniqueid','syncBlindTransfer','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][newexten]\x20event:','applicationdata','appdata','startsWith','CDR(routeAlias)','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','[%s][voiceQueueReport][newexten]','lodash','moment'];(function(_0x3a9427,_0x27078f){var _0x2f8840=function(_0x546dbf){while(--_0x546dbf){_0x3a9427['push'](_0x3a9427['shift']());}};_0x2f8840(++_0x27078f);}(_0x3e05,0xf1));var _0x53e0=function(_0x29cc0e,_0x433c81){_0x29cc0e=_0x29cc0e-0x0;var _0x29acb9=_0x3e05[_0x29cc0e];return _0x29acb9;};'use strict';var _=require(_0x53e0('0x0'));var moment=require(_0x53e0('0x1'));var util=require(_0x53e0('0x2'));var md5=require(_0x53e0('0x3'));var Redis=require('ioredis');var config=require(_0x53e0('0x4'));var logger=require('../../../config/logger')(_0x53e0('0x5'));var ami=require(_0x53e0('0x6'));var QueueReport=require(_0x53e0('0x7'));config['redis']=_[_0x53e0('0x8')](config[_0x53e0('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x53e0('0xa'))(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x2372b4){this['tail']=this[_0x53e0('0xb')]?this['tail']['finally'](_0x2372b4):_0x2372b4();};function VoiceQueueReport(_0x268fc0){this[_0x53e0('0xc')]=new Sequence();this['queueReports']={};this[_0x53e0('0xd')]=_0x268fc0[_0x53e0('0xd')];this['channels']=_0x268fc0[_0x53e0('0xe')];this['voiceQueues']=_0x268fc0[_0x53e0('0xf')];this[_0x53e0('0x10')]=!![];this[_0x53e0('0x11')]=_0x268fc0['campaigns'];this[_0x53e0('0x12')]={};ami['on'](_0x53e0('0x13'),this[_0x53e0('0x14')]['bind'](this));ami['on'](_0x53e0('0x15'),this[_0x53e0('0x16')][_0x53e0('0x17')](this));ami['on']('queuecallerjoin',this[_0x53e0('0x18')][_0x53e0('0x17')](this));ami['on'](_0x53e0('0x19'),this[_0x53e0('0x1a')][_0x53e0('0x17')](this));ami['on'](_0x53e0('0x1b'),this[_0x53e0('0x1c')][_0x53e0('0x17')](this));ami['on'](_0x53e0('0x1d'),this['syncAgentComplete']['bind'](this));ami['on']('agentconnect',this[_0x53e0('0x1e')][_0x53e0('0x17')](this));ami['on'](_0x53e0('0x1f'),this[_0x53e0('0x20')][_0x53e0('0x17')](this));ami['on'](_0x53e0('0x21'),this[_0x53e0('0x22')][_0x53e0('0x17')](this));ami['on'](_0x53e0('0x23'),this[_0x53e0('0x24')][_0x53e0('0x17')](this));ami['on'](_0x53e0('0x25'),this[_0x53e0('0x26')]['bind'](this));ami['on'](_0x53e0('0x27'),this[_0x53e0('0x28')][_0x53e0('0x17')](this));ami['on'](_0x53e0('0x29'),this[_0x53e0('0x2a')]['bind'](this));ami['on'](_0x53e0('0x2b'),this['syncAttendedTransfer'][_0x53e0('0x17')](this));ami['on'](_0x53e0('0x2c'),this['syncBlindTransfer'][_0x53e0('0x17')](this));this[_0x53e0('0x2d')]();this[_0x53e0('0x2e')]();}function clearChannels(_0x366a7c){if(!_['isEmpty'](_0x366a7c)){for(var _0x390a14 in _0x366a7c){if(_0x366a7c['hasOwnProperty'](_0x390a14)){delete _0x366a7c[_0x390a14];}}}}function clearCampaigns(_0x1889f6){if(!_[_0x53e0('0x2f')](_0x1889f6)){for(var _0x45d13f in _0x1889f6){if(_0x1889f6[_0x53e0('0x30')](_0x45d13f)){_0x1889f6[_0x45d13f][_0x53e0('0x31')]=0x0;}}}}function clearVoiceQueues(_0x1f509c){if(!_[_0x53e0('0x2f')](_0x1f509c)){for(var _0x15022d in _0x1f509c){if(_0x1f509c[_0x53e0('0x30')](_0x15022d)){_0x1f509c[_0x15022d][_0x53e0('0x31')]=0x0;_0x1f509c[_0x15022d]['talking']=0x0;_0x1f509c[_0x15022d][_0x53e0('0x32')]=0x0;_0x1f509c[_0x15022d]['waiting']=0x0;_0x1f509c[_0x15022d][_0x53e0('0x33')]=!![];}}}}function clearAgentBooked(_0x57a061){if(!_[_0x53e0('0x2f')](_0x57a061)){for(var _0x155d26 in _0x57a061){if(_0x57a061[_0x53e0('0x30')](_0x155d26)){_0x57a061[_0x155d26]['unlockRR']=!![];}}}}VoiceQueueReport[_0x53e0('0x34')][_0x53e0('0x35')]=function(){var _0x5ade25=this;for(var _0x2a36a1 in this[_0x53e0('0x36')]){if(this['channels'][_0x53e0('0x30')](_0x2a36a1)&&!this[_0x53e0('0x36')][_0x2a36a1][_0x53e0('0x37')]){this['sequence'][_0x53e0('0x38')](function(){if(!_[_0x53e0('0x39')](_0x5ade25['channels'][_0x2a36a1])){return ami[_0x53e0('0x3a')]({'action':_0x53e0('0x3b'),'channel':_0x5ade25[_0x53e0('0x36')][_0x2a36a1][_0x53e0('0x3c')]})[_0x53e0('0x3d')](function(_0x2f55d5){if(_0x2f55d5[_0x53e0('0x3e')]===_0x53e0('0x3f')){setTimeout(function(){if(_0x5ade25[_0x53e0('0x36')][_0x2a36a1]){delete _0x5ade25[_0x53e0('0x36')][_0x2a36a1];logger[_0x53e0('0x40')](_0x53e0('0x41'),_0x2a36a1,util[_0x53e0('0x42')](_0x2f55d5,{'showHidden':![],'depth':null}));}if(_0x5ade25['queueReports'][_0x2a36a1]){delete _0x5ade25['queueReports'][_0x2a36a1];logger['error'](_0x53e0('0x43'),_0x2a36a1,util[_0x53e0('0x42')](_0x2f55d5,{'showHidden':![],'depth':null}));}if(_0x5ade25[_0x53e0('0x12')][_0x2a36a1]){delete _0x5ade25[_0x53e0('0x12')][_0x2a36a1];logger[_0x53e0('0x40')](_0x53e0('0x44'),_0x2a36a1,util[_0x53e0('0x42')](_0x2f55d5,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x53e0('0x34')][_0x53e0('0x24')]=function(){logger[_0x53e0('0x40')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0x53e0('0x36')]);this[_0x53e0('0x45')](this[_0x53e0('0x46')]);clearAgentBooked(this[_0x53e0('0xd')]);clearVoiceQueues(this[_0x53e0('0xf')]);clearCampaigns(this['campaigns']);};VoiceQueueReport[_0x53e0('0x34')][_0x53e0('0x45')]=function(_0x423a60){var _0xee2586=this;if(!_[_0x53e0('0x2f')](_0x423a60)){for(var _0x135998 in _0x423a60){if(_0x423a60[_0x53e0('0x30')](_0x135998)){_0xee2586[_0x53e0('0x47')](_0x423a60[_0x135998],_0x53e0('0x48'));delete _0x423a60[_0x135998];}}}};VoiceQueueReport[_0x53e0('0x34')][_0x53e0('0x49')]=function(_0x38e299,_0x1f5a41,_0x2a1132){io['to'](_0x38e299)[_0x53e0('0x49')](_0x1f5a41,_0x2a1132);};VoiceQueueReport['prototype'][_0x53e0('0x4a')]=function(_0x4d437a,_0x12c9a2){logger['debug']('[%s][voiceQueueReport]['+_0x12c9a2+_0x53e0('0x4b'),_0x4d437a['uniqueid'],util[_0x53e0('0x42')](_0x4d437a,{'showHidden':![],'depth':null}));this[_0x53e0('0x49')](util['format'](_0x53e0('0x4c'),_0x4d437a[_0x53e0('0x4d')]),_0x53e0('0x4e'),_0x4d437a);io[_0x53e0('0x49')]('voice_queue_presence:save',_0x4d437a);};VoiceQueueReport[_0x53e0('0x34')][_0x53e0('0x47')]=function(_0x5a832f,_0x1ba878){logger[_0x53e0('0x4f')](_0x53e0('0x50')+_0x1ba878+_0x53e0('0x51'),_0x5a832f[_0x53e0('0x52')],util[_0x53e0('0x42')](_0x5a832f,{'showHidden':![],'depth':null}));this['emit'](util['format']('voice:queue:%s',_0x5a832f[_0x53e0('0x4d')]),'voice_queue_channel:remove',_0x5a832f);io[_0x53e0('0x49')](_0x53e0('0x53'),_0x5a832f);};VoiceQueueReport[_0x53e0('0x34')][_0x53e0('0x54')]=function(_0x145f22,_0x10e0d5){if(_0x145f22[_0x53e0('0x55')]===_0x53e0('0x56')){var _0x21c72b={'id':_0x145f22['id'],'name':_0x145f22['name'],'strategy':_0x145f22[_0x53e0('0x57')],'answered':_0x145f22[_0x53e0('0x58')],'available':_0x145f22[_0x53e0('0x59')],'loggedIn':_0x145f22['loggedIn'],'pTalking':_0x145f22[_0x53e0('0x32')],'sumBillable':_0x145f22[_0x53e0('0x5a')],'sumDuration':_0x145f22['sumDuration'],'sumHoldTime':_0x145f22['sumHoldTime']||0x0,'talking':_0x145f22[_0x53e0('0x5b')],'total':_0x145f22[_0x53e0('0x5c')],'type':_0x145f22[_0x53e0('0x55')],'unmanaged':_0x145f22['unmanaged'],'abandoned':_0x145f22[_0x53e0('0x5d')],'waiting':_0x145f22[_0x53e0('0x5e')]};if(_0x145f22[_0x53e0('0x5f')]){_0x21c72b[_0x53e0('0x5f')]={'id':_0x145f22['Trunk']['id'],'name':_0x145f22['Trunk'][_0x53e0('0x4d')],'active':_0x145f22[_0x53e0('0x5f')]['active'],'callerid':_0x145f22[_0x53e0('0x5f')][_0x53e0('0x60')]};}if(_0x145f22[_0x53e0('0x61')]){_0x21c72b[_0x53e0('0x61')]={'id':_0x145f22[_0x53e0('0x61')]['id'],'name':_0x145f22['Interval'][_0x53e0('0x4d')]};}var _0x59925e=md5(JSON[_0x53e0('0x62')](_0x21c72b));if(_0x145f22[_0x53e0('0x3')]!==_0x59925e){_0x145f22['md5']=_0x59925e;logger[_0x53e0('0x4f')](_0x53e0('0x63')+_0x10e0d5+_0x53e0('0x64'),util[_0x53e0('0x42')](_0x21c72b,{'showHidden':![],'depth':null}));this[_0x53e0('0x49')](util[_0x53e0('0x65')](_0x53e0('0x4c'),_0x21c72b['name']),_0x53e0('0x66'),_0x21c72b);}}};VoiceQueueReport['prototype'][_0x53e0('0x67')]=function(_0x166f62){return _0x166f62!==null&&!_[_0x53e0('0x68')](_0x166f62);};VoiceQueueReport['prototype']['loopQueueShow']=function(){var _0x5a7594=this;setInterval(function(){_0x5a7594[_0x53e0('0x35')]();ami[_0x53e0('0x3a')]({'action':'queues'})[_0x53e0('0x3d')](function(_0x1ec1e7){logger[_0x53e0('0x40')](_0x53e0('0x69'),util[_0x53e0('0x42')](_0x1ec1e7,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport['prototype'][_0x53e0('0x2d')]=function(){var _0x4f35d3=this;setInterval(function(){if(_0x4f35d3[_0x53e0('0x10')]){return ami[_0x53e0('0x3a')]({'action':_0x53e0('0x13')})[_0x53e0('0x6a')](function(_0x4fef0c){_0x4f35d3[_0x53e0('0x10')]=![];})[_0x53e0('0x3d')](function(_0x18b424){logger[_0x53e0('0x40')](_0x53e0('0x6b'),util[_0x53e0('0x42')](_0x18b424,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x53e0('0x34')][_0x53e0('0x14')]=function(_0x161568){try{if(this[_0x53e0('0x67')](_0x161568)&&this[_0x53e0('0x67')](_0x161568[_0x53e0('0x6c')])){logger[_0x53e0('0x4f')]('[voiceQueueReport][queuesummary]\x20event:',util[_0x53e0('0x42')](_0x161568,{'showHidden':![],'depth':null}));if(this[_0x53e0('0xf')][_0x161568[_0x53e0('0x6c')]]){logger[_0x53e0('0x6d')](_0x53e0('0x6e'),_0x161568[_0x53e0('0x6c')]);var _0x42febd=_[_0x53e0('0x6f')](this['channels'],_0x53e0('0x6c'))[_0x161568[_0x53e0('0x6c')]]||0x0;var _0x47a9e2=_0x42febd-_0x161568[_0x53e0('0x70')];if(this[_0x53e0('0xf')][_0x161568[_0x53e0('0x6c')]]['waiting']!==_[_0x53e0('0x71')](_0x161568[_0x53e0('0x70')])||this['voiceQueues'][_0x161568[_0x53e0('0x6c')]][_0x53e0('0x72')]!==_[_0x53e0('0x71')](_0x161568['loggedin'])||this[_0x53e0('0xf')][_0x161568[_0x53e0('0x6c')]][_0x53e0('0x59')]!==_['toNumber'](_0x161568[_0x53e0('0x59')])||this['voiceQueues'][_0x161568[_0x53e0('0x6c')]][_0x53e0('0x5b')]!==_0x47a9e2){this['voiceQueues'][_0x161568['queue']][_0x53e0('0x5e')]=_[_0x53e0('0x71')](_0x161568[_0x53e0('0x70')]);this[_0x53e0('0xf')][_0x161568[_0x53e0('0x6c')]]['loggedIn']=_[_0x53e0('0x71')](_0x161568['loggedin']);this[_0x53e0('0xf')][_0x161568[_0x53e0('0x6c')]][_0x53e0('0x59')]=_[_0x53e0('0x71')](_0x161568[_0x53e0('0x59')]);this[_0x53e0('0xf')][_0x161568[_0x53e0('0x6c')]][_0x53e0('0x5b')]=_0x47a9e2>0x0?_0x47a9e2:0x0;this[_0x53e0('0xf')][_0x161568[_0x53e0('0x6c')]][_0x53e0('0x5b')]=this['voiceQueues'][_0x161568['queue']]['talking']>_[_0x53e0('0x71')](_0x161568[_0x53e0('0x73')])?_[_0x53e0('0x71')](_0x161568[_0x53e0('0x73')]):this[_0x53e0('0xf')][_0x161568[_0x53e0('0x6c')]][_0x53e0('0x5b')];this['emitVoiceQueueSummary'](this[_0x53e0('0xf')][_0x161568[_0x53e0('0x6c')]],_0x53e0('0x13'));}logger['debug'](_0x53e0('0x74'),util[_0x53e0('0x42')](this[_0x53e0('0xf')][_0x161568[_0x53e0('0x6c')]],{'showHidden':![],'depth':null}));ami[_0x53e0('0x49')](_0x53e0('0x75'),this[_0x53e0('0xf')][_0x161568[_0x53e0('0x6c')]]);}}}catch(_0x18e565){logger[_0x53e0('0x40')]('[voiceQueueReport][queuesummary]',util[_0x53e0('0x42')](_0x18e565,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x53e0('0x34')][_0x53e0('0x16')]=function(_0x51ac3a){logger[_0x53e0('0x4f')](_0x53e0('0x76'),util[_0x53e0('0x42')](_0x51ac3a,{'showHidden':![],'depth':null}));this[_0x53e0('0x10')]=!![];};VoiceQueueReport[_0x53e0('0x34')][_0x53e0('0x18')]=function(_0x576d9f){try{if(this[_0x53e0('0x67')](_0x576d9f)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x576d9f[_0x53e0('0x52')],util[_0x53e0('0x42')](_0x576d9f,{'showHidden':![],'depth':null}));if(_[_0x53e0('0x68')](this['queueReports'][_0x576d9f[_0x53e0('0x52')]]))this[_0x53e0('0x46')][_0x576d9f[_0x53e0('0x52')]]=[];if(_[_0x53e0('0x68')](this[_0x53e0('0x36')][_0x576d9f[_0x53e0('0x52')]]))this[_0x53e0('0x36')][_0x576d9f[_0x53e0('0x52')]]={};var _0x10e42a=new QueueReport();_0x10e42a['name']=_0x576d9f['queue'];_0x10e42a[_0x53e0('0x55')]=this[_0x53e0('0xf')][_0x10e42a['name']]&&this[_0x53e0('0xf')][_0x10e42a['name']][_0x53e0('0x55')]?this[_0x53e0('0xf')][_0x10e42a['name']][_0x53e0('0x55')]||_0x53e0('0x56'):_0x53e0('0x56');_0x10e42a[_0x53e0('0x6c')]=_0x576d9f[_0x53e0('0x6c')];_0x10e42a['queuecallerjoinAt']=moment()['format'](_0x53e0('0x77'));_0x10e42a[_0x53e0('0x78')]=_0x576d9f[_0x53e0('0x78')];_0x10e42a[_0x53e0('0x79')]=_0x576d9f[_0x53e0('0x79')];_0x10e42a[_0x53e0('0x52')]=_0x576d9f[_0x53e0('0x52')];_0x10e42a[_0x53e0('0x7a')]=this[_0x53e0('0x36')][_0x576d9f[_0x53e0('0x52')]][_0x53e0('0x7a')];logger['info'](_0x53e0('0x7b'),_0x10e42a[_0x53e0('0x4d')],_0x10e42a[_0x53e0('0x55')]);_[_0x53e0('0x7c')](_0x10e42a,_[_0x53e0('0x7d')](_0x576d9f,_['keys'](_0x10e42a)));this[_0x53e0('0x46')][_0x576d9f[_0x53e0('0x52')]][_0x53e0('0x7e')](_0x10e42a);this[_0x53e0('0x36')][_0x576d9f[_0x53e0('0x52')]]=_0x10e42a;this['emitVoiceQueueChannelSave'](_0x10e42a,_0x53e0('0x7f'));}}catch(_0x8b7386){logger[_0x53e0('0x40')]('[%s][voiceQueueReport][queuecallerjoin]',_0x576d9f[_0x53e0('0x52')],util[_0x53e0('0x42')](_0x8b7386,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x53e0('0x34')][_0x53e0('0x1a')]=function(_0xdacf65){try{if(this[_0x53e0('0x67')](_0xdacf65)){logger[_0x53e0('0x4f')](_0x53e0('0x80'),_0xdacf65['uniqueid'],util['inspect'](_0xdacf65,{'showHidden':![],'depth':null}));if(this[_0x53e0('0x46')][_0xdacf65[_0x53e0('0x52')]]){var _0x113a77=_[_0x53e0('0x81')](this['queueReports'][_0xdacf65[_0x53e0('0x52')]]);_0x113a77[_0x53e0('0x82')]=![];_0x113a77['queuecallercompleteAt']=null;_0x113a77['holdtime']=_0xdacf65[_0x53e0('0x83')];_0x113a77[_0x53e0('0x84')]=_0xdacf65[_0x53e0('0x84')];_0x113a77[_0x53e0('0x19')]=!![];_0x113a77[_0x53e0('0x85')]=moment()[_0x53e0('0x65')](_0x53e0('0x77'));_0x113a77['queuecallerexitreason']='ABANDONED';_0x113a77[_0x53e0('0x86')]=null;logger['info'](_0x53e0('0x87'),_0x113a77[_0x53e0('0x4d')],_0x113a77['type']);this[_0x53e0('0x36')][_0xdacf65['uniqueid']]=_0x113a77;this[_0x53e0('0x47')](_0x113a77,_0x53e0('0x19'));}}}catch(_0x37ad92){logger[_0x53e0('0x40')](_0x53e0('0x80'),_0xdacf65[_0x53e0('0x52')],util[_0x53e0('0x42')](_0x37ad92,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x53e0('0x34')]['syncQueueCallerLeave']=function(_0x459ac9){try{if(this[_0x53e0('0x67')](_0x459ac9)){logger[_0x53e0('0x4f')](_0x53e0('0x88'),_0x459ac9[_0x53e0('0x52')],util['inspect'](_0x459ac9,{'showHidden':![],'depth':null}));if(this[_0x53e0('0x46')][_0x459ac9[_0x53e0('0x52')]]){var _0x1dc429=_[_0x53e0('0x81')](this[_0x53e0('0x46')][_0x459ac9[_0x53e0('0x52')]]);_0x1dc429[_0x53e0('0x89')]=moment()[_0x53e0('0x65')](_0x53e0('0x77'));_0x1dc429[_0x53e0('0x8a')]=_0x459ac9['connectedlinenum'];_0x1dc429[_0x53e0('0x8b')]=_0x459ac9['connectedlinename'];logger[_0x53e0('0x6d')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x1dc429[_0x53e0('0x4d')],_0x1dc429['type'],_0x459ac9[_0x53e0('0x8a')],_0x459ac9[_0x53e0('0x8b')]);this['channels'][_0x459ac9[_0x53e0('0x52')]]=_0x1dc429;this[_0x53e0('0x4a')](_0x1dc429,'queuecallerleave');}}}catch(_0x388223){logger['error'](_0x53e0('0x88'),_0x459ac9[_0x53e0('0x52')],util[_0x53e0('0x42')](_0x388223,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x53e0('0x34')][_0x53e0('0x1e')]=function(_0x3deb02){try{if(this[_0x53e0('0x67')](_0x3deb02)){logger[_0x53e0('0x4f')]('[%s][voiceQueueReport][agentconnect]',_0x3deb02[_0x53e0('0x52')],util[_0x53e0('0x42')](_0x3deb02,{'showHidden':![],'depth':null}));if(this[_0x53e0('0x46')][_0x3deb02[_0x53e0('0x52')]]){var _0x34d920=_[_0x53e0('0x81')](this[_0x53e0('0x46')][_0x3deb02['uniqueid']]);_0x34d920[_0x53e0('0x82')]=!![];_0x34d920[_0x53e0('0x8c')]=_0x53e0('0x8d');logger[_0x53e0('0x6d')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x34d920[_0x53e0('0x4d')],_0x34d920[_0x53e0('0x55')]);}}}catch(_0x3fb246){logger[_0x53e0('0x40')](_0x53e0('0x8e'),_0x3deb02[_0x53e0('0x52')],util[_0x53e0('0x42')](_0x3fb246,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x53e0('0x8f')]=function(_0x4c831c){try{if(this[_0x53e0('0x67')](_0x4c831c)){logger[_0x53e0('0x4f')](_0x53e0('0x90'),_0x4c831c[_0x53e0('0x52')],util[_0x53e0('0x42')](_0x4c831c,{'showHidden':![],'depth':null}));if(this[_0x53e0('0x46')][_0x4c831c[_0x53e0('0x52')]]){var _0x44637e=_[_0x53e0('0x81')](this['queueReports'][_0x4c831c['uniqueid']]);_0x44637e['queuecallerabandon']=![];_0x44637e[_0x53e0('0x85')]=null;_0x44637e[_0x53e0('0x91')]=!![];_0x44637e['lastAssignedTo']=_0x4c831c[_0x53e0('0x92')];_0x44637e[_0x53e0('0x83')]=_0x4c831c['holdtime'];_0x44637e[_0x53e0('0x82')]=!![];_0x44637e[_0x53e0('0x93')]=![];_0x44637e['queuecallerexitAt']=null;if(!_0x44637e[_0x53e0('0x94')]){if(_0x4c831c[_0x53e0('0x95')]==_0x53e0('0x94')){_0x44637e[_0x53e0('0x8c')]=_0x53e0('0x96');logger['info'](_0x53e0('0x97'),_0x44637e['name'],_0x44637e[_0x53e0('0x55')]);}else{if(_['startsWith'](_0x4c831c['channel'][_0x53e0('0x98')](),_0x53e0('0x99'))){if(this[_0x53e0('0x46')][_0x4c831c[_0x53e0('0x9a')]]){var _0x2b570c=_[_0x53e0('0x81')](this[_0x53e0('0x46')][_0x4c831c[_0x53e0('0x9a')]]);_0x2b570c[_0x53e0('0x82')]=![];_0x2b570c['queuecallerexit']=!![];_0x2b570c['queuecallerexitAt']=moment(_0x44637e[_0x53e0('0x9b')])[_0x53e0('0x9c')](_0x4c831c['holdtime'],_0x53e0('0x9d'))[_0x53e0('0x65')](_0x53e0('0x77'));_0x2b570c[_0x53e0('0x8c')]=_0x53e0('0x9e');_0x2b570c[_0x53e0('0x94')]=!![];_0x2b570c['transfertype']=_0x53e0('0x9f');_0x2b570c['transferexten']=_0x4c831c['destexten'];_0x2b570c['transferuniqueid']=_0x4c831c[_0x53e0('0x52')];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x2b570c['name'],_0x2b570c[_0x53e0('0x55')]);var _0x33b178=this[_0x53e0('0x46')][_0x4c831c[_0x53e0('0x9a')]];this['queueReports'][_0x4c831c[_0x53e0('0x9a')]]=this[_0x53e0('0x46')][_0x4c831c[_0x53e0('0x52')]];this[_0x53e0('0x46')][_0x4c831c[_0x53e0('0x52')]]=_0x33b178;}}else{_0x44637e['queuecallerexitreason']='COMPLETEDBY'+_0x4c831c[_0x53e0('0x95')][_0x53e0('0xa0')]();logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x44637e[_0x53e0('0x4d')],_0x44637e[_0x53e0('0x55')],_0x44637e[_0x53e0('0x8c')]);}}}this[_0x53e0('0x36')][_0x4c831c[_0x53e0('0x52')]]=_0x44637e;this[_0x53e0('0x47')](_0x44637e,_0x53e0('0x1d'));}}}catch(_0x39dff1){logger[_0x53e0('0x40')]('[%s][voiceQueueReport][agentcomplete]',_0x4c831c[_0x53e0('0x52')],util['inspect'](_0x39dff1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x53e0('0x34')][_0x53e0('0x20')]=function(_0x34a213){try{if(this[_0x53e0('0x67')](_0x34a213)){logger[_0x53e0('0x4f')](_0x53e0('0xa1'),_0x34a213[_0x53e0('0x52')],util['inspect'](_0x34a213,{'showHidden':![],'depth':null}));this[_0x53e0('0xa2')](_0x34a213[_0x53e0('0x52')],_[_0x53e0('0xa3')](_0x34a213[_0x53e0('0xa4')])[0x0],_0x34a213[_0x53e0('0xa5')]);if(this[_0x53e0('0x46')][_0x34a213['uniqueid']]){var _0x3c3a6f=_[_0x53e0('0x81')](this[_0x53e0('0x46')][_0x34a213['uniqueid']]);if(_0x3c3a6f){if(this['isNotNull'](_0x34a213['variable'])&&this[_0x53e0('0x67')](_0x34a213[_0x53e0('0xa4')][_0x53e0('0xa6')])){switch(_0x34a213[_0x53e0('0xa5')]){case _0x53e0('0xa7'):_0x3c3a6f['queuecallerexit']=![];_0x3c3a6f[_0x53e0('0xa8')]=null;break;case _0x53e0('0xa9'):_0x3c3a6f[_0x53e0('0xaa')]=_0x53e0('0xab');_0x3c3a6f[_0x53e0('0x93')]=!![];_0x3c3a6f[_0x53e0('0xa8')]=moment()[_0x53e0('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0x3c3a6f[_0x53e0('0x89')]=moment()['format'](_0x53e0('0x77'));logger[_0x53e0('0x4f')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x34a213[_0x53e0('0x52')],util[_0x53e0('0x42')](_0x3c3a6f,{'showHidden':![],'depth':null}));ami[_0x53e0('0x49')](_0x53e0('0xac'),_0x3c3a6f);break;default:_0x3c3a6f[_0x53e0('0x93')]=!![];_0x3c3a6f[_0x53e0('0xa8')]=moment()[_0x53e0('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0x3c3a6f[_0x53e0('0x89')]=moment()[_0x53e0('0x65')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3c3a6f[_0x53e0('0x19')]=![];_0x3c3a6f[_0x53e0('0x85')]=null;_0x3c3a6f[_0x53e0('0x8c')]=_0x34a213[_0x53e0('0xa5')];this[_0x53e0('0x36')][_0x34a213[_0x53e0('0x52')]]=_0x3c3a6f;this[_0x53e0('0x47')](_0x3c3a6f,_0x53e0('0x1f'));}else if(this[_0x53e0('0x67')](_0x34a213[_0x53e0('0xa4')])&&this[_0x53e0('0x67')](_0x34a213[_0x53e0('0xa4')][_0x53e0('0xad')])){if(!_0x3c3a6f['queuecallerabandon']){_0x3c3a6f['queuecallerexit']=!![];_0x3c3a6f[_0x53e0('0xa8')]=moment()[_0x53e0('0x65')](_0x53e0('0x77'));_0x3c3a6f[_0x53e0('0x8c')]='EXITWITHKEY';_0x3c3a6f['queuecallerleaveAt']=moment()[_0x53e0('0x65')](_0x53e0('0x77'));this[_0x53e0('0x36')][_0x34a213[_0x53e0('0x52')]]=_0x3c3a6f;}}logger[_0x53e0('0x6d')](_0x53e0('0xae'),_0x34a213[_0x53e0('0x52')],_0x3c3a6f[_0x53e0('0x4d')],_0x3c3a6f[_0x53e0('0x55')],_[_0x53e0('0xa3')](_0x34a213['variable'])[0x0],_0x34a213[_0x53e0('0xa5')]);_0x3c3a6f[_0x53e0('0x12')]=this[_0x53e0('0x12')][_0x34a213[_0x53e0('0x52')]];}}}}catch(_0x54cc81){logger['error'](_0x53e0('0xa1'),_0x34a213[_0x53e0('0x52')],util[_0x53e0('0x42')](_0x54cc81,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x53e0('0x34')]['addVariable']=function(_0x1d1f89,_0x9888bb,_0x37e4ae){var _0x10efb1=[_0x53e0('0xaf'),_0x53e0('0xb0'),_0x53e0('0xb1'),_0x53e0('0xb2'),_0x53e0('0xb3'),_0x53e0('0xb4'),_0x53e0('0xb5'),_0x53e0('0xb6'),_0x53e0('0xb7'),_0x53e0('0xb8'),_0x53e0('0xb9'),_0x53e0('0xba'),_0x53e0('0xbb'),'memberdynamic',_0x53e0('0xbc'),_0x53e0('0xbd'),_0x53e0('0x92'),_0x53e0('0xbe'),_0x53e0('0xbf')];if(!_[_0x53e0('0x39')](_0x9888bb)&&!_[_0x53e0('0xc0')](_0x10efb1,_0x9888bb)){if(_[_0x53e0('0x68')](this[_0x53e0('0x12')][_0x1d1f89])){this[_0x53e0('0x12')][_0x1d1f89]={};}this['variables'][_0x1d1f89][_0x9888bb]=_0x37e4ae;}};VoiceQueueReport[_0x53e0('0x34')][_0x53e0('0x22')]=function(_0x238740){try{if(this['isNotNull'](_0x238740)){logger['debug']('[%s][voiceQueueReport][hangup]',_0x238740[_0x53e0('0x52')],util[_0x53e0('0x42')](_0x238740,{'showHidden':![],'depth':null}));if(this[_0x53e0('0x46')][_0x238740[_0x53e0('0x52')]]){for(var _0x101e72=0x0,_0xcd5e4b={};_0x101e72<this['queueReports'][_0x238740[_0x53e0('0x52')]][_0x53e0('0xc1')];_0x101e72+=0x1){_0xcd5e4b=this[_0x53e0('0x46')][_0x238740[_0x53e0('0x52')]][_0x101e72];if(this['voiceQueues'][_0xcd5e4b[_0x53e0('0x6c')]]){if(_0xcd5e4b['queuecallerexit']&&_0xcd5e4b['transfer']!=!![]){this[_0x53e0('0xf')][_0xcd5e4b[_0x53e0('0x6c')]][_0x53e0('0xc2')]+=0x1;}if(_0xcd5e4b[_0x53e0('0x19')]){this[_0x53e0('0xf')][_0xcd5e4b[_0x53e0('0x6c')]][_0x53e0('0x5d')]+=0x1;}this[_0x53e0('0xf')][_0xcd5e4b['queue']][_0x53e0('0xc3')]+=moment(_0xcd5e4b['queuecallerleaveAt'])[_0x53e0('0xc4')](_0xcd5e4b['queuecallerjoinAt'],_0x53e0('0x9d'))||0x0;if(_0x101e72===this['queueReports'][_0x238740[_0x53e0('0x52')]][_0x53e0('0xc1')]-0x1){this[_0x53e0('0xf')][_0xcd5e4b[_0x53e0('0x6c')]][_0x53e0('0xc5')]+=moment()['milliseconds'](0x0)[_0x53e0('0xc4')](_0xcd5e4b['queuecallerjoinAt'],_0x53e0('0x9d'));this[_0x53e0('0xf')][_0xcd5e4b['queue']]['total']+=0x1;if(_0xcd5e4b[_0x53e0('0x82')]){this[_0x53e0('0xf')][_0xcd5e4b[_0x53e0('0x6c')]][_0x53e0('0x58')]+=0x1;this[_0x53e0('0xf')][_0xcd5e4b[_0x53e0('0x6c')]][_0x53e0('0x5a')]+=moment()[_0x53e0('0xc6')](0x0)[_0x53e0('0xc4')](_0xcd5e4b['queuecallerleaveAt'],_0x53e0('0x9d'));_0xcd5e4b[_0x53e0('0xc7')]=moment()[_0x53e0('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0xcd5e4b[_0x53e0('0x93')]=![];_0xcd5e4b['queuecallerexitAt']=null;}if(_0xcd5e4b[_0x53e0('0x93')]&&_0xcd5e4b[_0x53e0('0x94')]!=!![]){_0xcd5e4b[_0x53e0('0xaa')]=_0x53e0('0xc2');logger[_0x53e0('0x4f')](_0x53e0('0xc8'),_0x238740[_0x53e0('0x52')],util['inspect'](_0xcd5e4b,{'showHidden':![],'depth':null}));ami[_0x53e0('0x49')](_0x53e0('0xc9'),_0xcd5e4b);}if(_0xcd5e4b[_0x53e0('0x19')]){_0xcd5e4b[_0x53e0('0xaa')]=_0x53e0('0x5d');logger[_0x53e0('0x4f')](_0x53e0('0xca'),_0x238740[_0x53e0('0x52')],util['inspect'](_0xcd5e4b,{'showHidden':![],'depth':null}));ami['emit']('custom:queuecallerabandon',_0xcd5e4b);}}else{this['voiceQueues'][_0xcd5e4b['queue']]['sumDuration']+=this[_0x53e0('0xf')][_0xcd5e4b['queue']]['sumHoldTime'];}logger['info'](_0x53e0('0xcb'),_0x238740[_0x53e0('0x52')],_0xcd5e4b['name'],_0xcd5e4b[_0x53e0('0x55')],_0x238740[_0x53e0('0xcc')]);this['channels'][_0x238740['uniqueid']]=_0xcd5e4b;this[_0x53e0('0x47')](_0xcd5e4b,_0x53e0('0x21'));this[_0x53e0('0x54')](this['voiceQueues'][_0xcd5e4b['queue']],_0x53e0('0x21'));}}logger['debug'](_0x53e0('0xcd'),_0x238740[_0x53e0('0x52')],util[_0x53e0('0x42')](this[_0x53e0('0x46')][_0x238740[_0x53e0('0x52')]],{'showHidden':![],'depth':null}));ami['emit'](_0x53e0('0xce'),this[_0x53e0('0x46')][_0x238740[_0x53e0('0x52')]]);delete this[_0x53e0('0x46')][_0x238740[_0x53e0('0x52')]];delete this[_0x53e0('0x36')][_0x238740['uniqueid']];}if(this[_0x53e0('0x12')][_0x238740[_0x53e0('0x52')]]){delete this[_0x53e0('0x12')][_0x238740[_0x53e0('0x52')]];}}}catch(_0xf82c8b){logger[_0x53e0('0x40')](_0x53e0('0xcf'),_0x238740[_0x53e0('0x52')],util[_0x53e0('0x42')](_0xf82c8b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x53e0('0x34')][_0x53e0('0xd0')]=function(_0x215734){try{if(this[_0x53e0('0x67')](_0x215734)){logger[_0x53e0('0x4f')](_0x53e0('0xd1'),_0x215734[_0x53e0('0x52')],util[_0x53e0('0x42')](_0x215734,{'showHidden':![],'depth':null}));var _0x26a253;if(this[_0x53e0('0x46')][_0x215734[_0x53e0('0xd2')]]){_0x26a253=_[_0x53e0('0x81')](this[_0x53e0('0x46')][_0x215734[_0x53e0('0xd2')]]);_0x26a253[_0x53e0('0xd3')]=_0x215734[_0x53e0('0xd4')];_0x26a253['transferuniqueid']=_0x215734[_0x53e0('0xd5')];_0x26a253['queuecallerexitreason']='ATTENDEDTRANSFER';_0x26a253[_0x53e0('0x94')]=!![];_0x26a253[_0x53e0('0xd6')]=_0x53e0('0xd7');if(this[_0x53e0('0x46')][_0x215734[_0x53e0('0xd5')]]){var _0x2ad796=this[_0x53e0('0x46')][_0x215734[_0x53e0('0xd5')]];this[_0x53e0('0x46')][_0x215734[_0x53e0('0xd5')]]=this[_0x53e0('0x46')][_0x215734['transfereeuniqueid']];this['queueReports'][_0x215734['transfereeuniqueid']]=_0x2ad796;var _0x4f2e83=_[_0x53e0('0x81')](this['queueReports'][_0x215734[_0x53e0('0xd2')]]);_0x4f2e83[_0x53e0('0x37')]=!![];}logger[_0x53e0('0x6d')](_0x53e0('0xd8'),_0x215734[_0x53e0('0x52')],_0x26a253[_0x53e0('0x4d')],_0x26a253[_0x53e0('0x55')],_0x26a253[_0x53e0('0xd3')],_0x26a253['transferuniqueid']);}else if(this[_0x53e0('0x46')][_0x215734[_0x53e0('0xd9')]]){_0x26a253=_['last'](this[_0x53e0('0x46')][_0x215734[_0x53e0('0xd9')]]);_0x26a253[_0x53e0('0xd3')]=_0x215734['origtransfererexten'];_0x26a253['transferuniqueid']=_0x215734[_0x53e0('0xda')];_0x26a253[_0x53e0('0x8c')]=_0x53e0('0xdb');_0x26a253['transfer']=!![];_0x26a253[_0x53e0('0xd6')]=_0x53e0('0xd7');if(this[_0x53e0('0x46')][_0x215734[_0x53e0('0xda')]]){var _0x2ad796=this[_0x53e0('0x46')][_0x215734[_0x53e0('0xda')]];this['queueReports'][_0x215734[_0x53e0('0xda')]]=this['queueReports'][_0x215734[_0x53e0('0xd9')]];this[_0x53e0('0x46')][_0x215734[_0x53e0('0xd9')]]=_0x2ad796;var _0x4f2e83=_[_0x53e0('0x81')](this['queueReports'][_0x215734[_0x53e0('0xd9')]]);_0x4f2e83[_0x53e0('0x37')]=!![];}logger[_0x53e0('0x6d')](_0x53e0('0xd8'),_0x215734[_0x53e0('0x52')],_0x26a253[_0x53e0('0x4d')],_0x26a253['type'],_0x26a253[_0x53e0('0xd3')],_0x26a253[_0x53e0('0xdc')]);}}}catch(_0x1633fc){logger[_0x53e0('0x40')]('[%s][voiceQueueReport][attendedtransfer]',_0x215734[_0x53e0('0x52')],util[_0x53e0('0x42')](_0x1633fc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x53e0('0x34')][_0x53e0('0xdd')]=function(_0x172441){try{if(this['isNotNull'](_0x172441)){logger[_0x53e0('0x4f')](_0x53e0('0xde'),_0x172441[_0x53e0('0x52')],util[_0x53e0('0x42')](_0x172441,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x172441[_0x53e0('0xd2')]]){var _0x2bd48f=_[_0x53e0('0x81')](this[_0x53e0('0x46')][_0x172441[_0x53e0('0xd2')]]);_0x2bd48f[_0x53e0('0x8c')]=_0x53e0('0xdf');_0x2bd48f['transfer']=!![];_0x2bd48f['transfertype']='BLIND';_0x2bd48f[_0x53e0('0xd3')]=_0x172441[_0x53e0('0xe0')];_0x2bd48f[_0x53e0('0xdc')]=_0x172441[_0x53e0('0xd2')];logger[_0x53e0('0x6d')](_0x53e0('0xe1'),_0x172441[_0x53e0('0x52')],_0x2bd48f[_0x53e0('0x4d')],_0x2bd48f[_0x53e0('0x55')],_0x2bd48f[_0x53e0('0xd3')],_0x2bd48f[_0x53e0('0xdc')]);this[_0x53e0('0x22')]({'event':_0x53e0('0xe2'),'uniqueid':_0x172441[_0x53e0('0xd2')],'context':_0x172441[_0x53e0('0xe3')],'channel':_0x172441[_0x53e0('0xe4')]});}}}catch(_0x3a326e){logger[_0x53e0('0x40')](_0x53e0('0xde'),_0x172441['uniqueid'],util['inspect'](_0x3a326e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x53e0('0x34')][_0x53e0('0x28')]=function(_0x25bec){try{if(this['isNotNull'](_0x25bec)){logger['debug'](_0x53e0('0xe5'),_0x25bec['uniqueid'],util[_0x53e0('0x42')](_0x25bec,{'showHidden':![],'depth':null}));if(this[_0x53e0('0x46')][_0x25bec[_0x53e0('0x52')]]){var _0x2e29d9=_[_0x53e0('0x81')](this[_0x53e0('0x46')][_0x25bec['uniqueid']]);if(!_['isNil'](_0x2e29d9[_0x53e0('0x89')])){_0x2e29d9[_0x53e0('0xe6')]=moment()[_0x53e0('0x65')](_0x53e0('0x77'));logger[_0x53e0('0x6d')](_0x53e0('0xe7'),_0x25bec[_0x53e0('0x52')],_0x2e29d9['mohstarttime']);}}}}catch(_0x20d413){logger['error'](_0x53e0('0xe5'),_0x25bec['uniqueid'],util[_0x53e0('0x42')](_0x20d413,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x53e0('0x34')][_0x53e0('0x2a')]=function(_0x1051e7){try{if(this[_0x53e0('0x67')](_0x1051e7)){logger[_0x53e0('0x4f')](_0x53e0('0xe8'),_0x1051e7[_0x53e0('0x52')],util[_0x53e0('0x42')](_0x1051e7,{'showHidden':![],'depth':null}));if(this[_0x53e0('0x46')][_0x1051e7[_0x53e0('0x52')]]){var _0x126406=_['last'](this[_0x53e0('0x46')][_0x1051e7['uniqueid']]);if(!_['isNil'](_0x126406[_0x53e0('0xe6')])){_0x126406['mohtime']+=moment()['milliseconds'](0x0)['diff'](_0x126406[_0x53e0('0xe6')],_0x53e0('0x9d'));logger['info']('[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s',_0x1051e7[_0x53e0('0x52')],_0x126406[_0x53e0('0xe9')]);delete _0x126406['mohstarttime'];}}}}catch(_0x5b586a){logger[_0x53e0('0x40')](_0x53e0('0xe8'),_0x1051e7[_0x53e0('0x52')],util[_0x53e0('0x42')](_0x5b586a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncNewExten']=function(_0x53b874){try{if(this[_0x53e0('0x67')](_0x53b874)){logger['debug'](_0x53e0('0xea'),_0x53b874[_0x53e0('0x52')],util[_0x53e0('0x42')](_0x53b874,{'showHidden':![],'depth':null}));if(_0x53b874['application'][_0x53e0('0x98')]()==='set'){_0x53b874[_0x53e0('0xeb')]=_0x53b874[_0x53e0('0xec')]&&_0x53b874['appdata'][_0x53e0('0xed')](_0x53e0('0xee'))?_0x53b874['appdata']:(_0x53b874[_0x53e0('0xec')]||_0x53b874[_0x53e0('0xeb')])['toLowerCase']();if(_[_0x53e0('0xed')](_0x53b874[_0x53e0('0xeb')][_0x53e0('0x98')](),_0x53e0('0xef'))){logger['info'](_0x53e0('0xf0'),_0x53b874['uniqueid'],_0x53b874['application'],_0x53b874[_0x53e0('0xeb')]);if(_[_0x53e0('0x68')](this[_0x53e0('0x36')][_0x53b874[_0x53e0('0x52')]]))this[_0x53e0('0x36')][_0x53b874['uniqueid']]={};var _0x333e22=_0x53b874['applicationdata'][_0x53e0('0xf1')]('=');var _0x4bc716=_0x333e22[0x0][_0x53e0('0x98')]()['match'](/cdr\((.*)\)/);if(_0x4bc716)this[_0x53e0('0x36')][_0x53b874['uniqueid']][_0x4bc716[0x1]]=_0x333e22[0x1];}}}}catch(_0xed9bea){logger['error'](_0x53e0('0xf2'),_0x53b874[_0x53e0('0x52')],util['inspect'](_0xed9bea,{'showHidden':![],'depth':null}));}};module['exports']=VoiceQueueReport;