Built motion from commit (unavailable).|2.3.1
[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 _0xdcc4=['mohtime','[syncMusicOnHoldStop][VoiceQueueReport]','exports','lodash','moment','bluebird','util','ioredis','../../../config/environment','../ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','sequence','queueReports','agents','queueChannels','voiceQueues','flagQueueSummary','variables','queuesummary','syncQueueSummary','bind','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueShow','isUndefined','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','unlockRR','prototype','channels','switch','isNil','Action','status','message','No\x20such\x20channel','error','[voiceQueueReport][checkQueueReport]','[voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','campaigns','inspect','emit','emitVoiceQueueChannelSave','name','voice_queue_channel:save','emitVoiceQueueChannelRemove','format','voice:queue:%s','voice_queue_channel:remove','strategy','available','loggedIn','sumBillable','sumHoldTime','total','unmanaged','abandoned','Trunk','active','callerid','Interval','stringify','md5','queues','catch','[queues]','loopQueueSummary','then','[queuesummary]','isNotNull','countBy','queue','callers','toNumber','loggedin','emitVoiceQueueSummary','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','syncNewExten','uniqueid','type','inbound','queuecallerjoinAt','count','merge','pick','keys','push','[syncQueueCallerJoin][VoiceQueueReport]','syncQueueCallerAbandon','last','queuecallercomplete','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','lastAssignedTo','queuecallerleaveAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinenum','connectedlinename','[syncAgentConnect][VoiceQueueReport]','assigned','membername','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','startsWith','toLowerCase','local/','linkedid','add','seconds','FORWARDTRANSFER','transfertype','transferexten','destexten','transferuniqueid','COMPLETEDBY','toUpperCase','[syncAgentComplete][VoiceQueueReport]','syncVarSet','addVariable','variable','value','queuestatus','CONTINUE','EXITWITHKEY','[syncVarSet][VoiceQueueReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','length','diff','sumDuration','milliseconds','answered','queuecallercompleteAt','lastevent','custom:queuecallerunmanaged','custom:queuecallerabandon','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','transfereeuniqueid','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','ATTENDEDTRANSFER','[syncAttendedTransfer][VoiceQueueReport]','BLINDTRANSFER','extension','context','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','[syncMusicOnHoldStart][VoiceQueueReport]','mohstarttime'];(function(_0x1eb585,_0x202476){var _0x497ee2=function(_0x36dffa){while(--_0x36dffa){_0x1eb585['push'](_0x1eb585['shift']());}};_0x497ee2(++_0x202476);}(_0xdcc4,0x1a3));var _0x4dcc=function(_0x2019ac,_0x32933c){_0x2019ac=_0x2019ac-0x0;var _0x3def0a=_0xdcc4[_0x2019ac];return _0x3def0a;};'use strict';var _=require(_0x4dcc('0x0'));var moment=require(_0x4dcc('0x1'));var BPromise=require(_0x4dcc('0x2'));var util=require(_0x4dcc('0x3'));var md5=require('md5');var Redis=require(_0x4dcc('0x4'));var config=require(_0x4dcc('0x5'));var logger=require('../../../config/logger')('ami');var ami=require(_0x4dcc('0x6'));var QueueReport=require(_0x4dcc('0x7'));config[_0x4dcc('0x8')]=_[_0x4dcc('0x9')](config[_0x4dcc('0x8')],{'host':_0x4dcc('0xa'),'port':0x18eb});var io=require(_0x4dcc('0xb'))(new Redis(config[_0x4dcc('0x8')]));var Sequence=function(){};Sequence['prototype'][_0x4dcc('0xc')]=function(_0x473887){this['tail']=this[_0x4dcc('0xd')]?this['tail'][_0x4dcc('0xe')](_0x473887):_0x473887();};function VoiceQueueReport(_0x379b7a){this[_0x4dcc('0xf')]=new Sequence();this[_0x4dcc('0x10')]={};this[_0x4dcc('0x11')]=_0x379b7a[_0x4dcc('0x11')];this['channels']=_0x379b7a[_0x4dcc('0x12')];this[_0x4dcc('0x13')]=_0x379b7a[_0x4dcc('0x13')];this[_0x4dcc('0x14')]=!![];this['campaigns']=_0x379b7a['campaigns'];this[_0x4dcc('0x15')]={};ami['on'](_0x4dcc('0x16'),this[_0x4dcc('0x17')][_0x4dcc('0x18')](this));ami['on']('queuesummarycomplete',this[_0x4dcc('0x19')]['bind'](this));ami['on'](_0x4dcc('0x1a'),this[_0x4dcc('0x1b')]['bind'](this));ami['on'](_0x4dcc('0x1c'),this['syncQueueCallerAbandon'][_0x4dcc('0x18')](this));ami['on']('queuecallerleave',this[_0x4dcc('0x1d')][_0x4dcc('0x18')](this));ami['on'](_0x4dcc('0x1e'),this[_0x4dcc('0x1f')][_0x4dcc('0x18')](this));ami['on'](_0x4dcc('0x20'),this[_0x4dcc('0x21')][_0x4dcc('0x18')](this));ami['on'](_0x4dcc('0x22'),this['syncVarSet']['bind'](this));ami['on'](_0x4dcc('0x23'),this[_0x4dcc('0x24')][_0x4dcc('0x18')](this));ami['on'](_0x4dcc('0x25'),this[_0x4dcc('0x26')][_0x4dcc('0x18')](this));ami['on'](_0x4dcc('0x27'),this[_0x4dcc('0x28')][_0x4dcc('0x18')](this));ami['on'](_0x4dcc('0x29'),this[_0x4dcc('0x2a')]['bind'](this));ami['on'](_0x4dcc('0x2b'),this[_0x4dcc('0x2c')]['bind'](this));ami['on'](_0x4dcc('0x2d'),this[_0x4dcc('0x2e')]['bind'](this));this['loopQueueSummary']();this[_0x4dcc('0x2f')]();}function isNotNull(_0x50f5fd){return _0x50f5fd!==null&&!_[_0x4dcc('0x30')](_0x50f5fd);}function clearChannels(_0x3f8f41){if(!_[_0x4dcc('0x31')](_0x3f8f41)){for(var _0x3da160 in _0x3f8f41){if(_0x3f8f41[_0x4dcc('0x32')](_0x3da160)){delete _0x3f8f41[_0x3da160];}}}}function clearCampaigns(_0x14c3f0){if(!_[_0x4dcc('0x31')](_0x14c3f0)){for(var _0x47a717 in _0x14c3f0){if(_0x14c3f0['hasOwnProperty'](_0x47a717)){_0x14c3f0[_0x47a717][_0x4dcc('0x33')]=0x0;}}}}function clearVoiceQueues(_0x523d7a){if(!_['isEmpty'](_0x523d7a)){for(var _0x2a0cc4 in _0x523d7a){if(_0x523d7a[_0x4dcc('0x32')](_0x2a0cc4)){_0x523d7a[_0x2a0cc4][_0x4dcc('0x33')]=0x0;_0x523d7a[_0x2a0cc4][_0x4dcc('0x34')]=0x0;_0x523d7a[_0x2a0cc4][_0x4dcc('0x35')]=0x0;_0x523d7a[_0x2a0cc4][_0x4dcc('0x36')]=0x0;_0x523d7a[_0x2a0cc4]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x34f6f5){if(!_[_0x4dcc('0x31')](_0x34f6f5)){for(var _0x202956 in _0x34f6f5){if(_0x34f6f5['hasOwnProperty'](_0x202956)){_0x34f6f5[_0x202956][_0x4dcc('0x37')]=!![];}}}}VoiceQueueReport[_0x4dcc('0x38')]['clearZombieChannels']=function(){var _0x45a451=this;for(var _0x28e83a in this[_0x4dcc('0x39')]){if(this[_0x4dcc('0x39')][_0x4dcc('0x32')](_0x28e83a)&&!this['channels'][_0x28e83a][_0x4dcc('0x3a')]){this[_0x4dcc('0xf')][_0x4dcc('0xc')](function(){if(!_[_0x4dcc('0x3b')](_0x45a451[_0x4dcc('0x39')][_0x28e83a])){return ami[_0x4dcc('0x3c')]({'action':_0x4dcc('0x3d'),'channel':_0x45a451[_0x4dcc('0x39')][_0x28e83a]['channel']})['catch'](function(_0x6caecd){if(_0x6caecd[_0x4dcc('0x3e')]===_0x4dcc('0x3f')){setTimeout(function(){if(_0x45a451['channels'][_0x28e83a]){delete _0x45a451[_0x4dcc('0x39')][_0x28e83a];logger[_0x4dcc('0x40')]('[voiceQueueReport][checkChannel]',_0x28e83a);}if(_0x45a451['queueReports'][_0x28e83a]){delete _0x45a451['queueReports'][_0x28e83a];logger['error'](_0x4dcc('0x41'),_0x28e83a);}if(_0x45a451['variables'][_0x28e83a]){delete _0x45a451[_0x4dcc('0x15')][_0x28e83a];logger[_0x4dcc('0x40')](_0x4dcc('0x42'),_0x28e83a);}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0x4dcc('0x26')]=function(){logger['error'](_0x4dcc('0x43'));clearChannels(this[_0x4dcc('0x39')]);this[_0x4dcc('0x44')](this['queueReports']);clearAgentBooked(this[_0x4dcc('0x11')]);clearVoiceQueues(this[_0x4dcc('0x13')]);clearCampaigns(this[_0x4dcc('0x45')]);};VoiceQueueReport['prototype'][_0x4dcc('0x44')]=function(_0x539640){var _0x31b911=this;if(!_[_0x4dcc('0x31')](_0x539640)){for(var _0x272c53 in _0x539640){if(_0x539640[_0x4dcc('0x32')](_0x272c53)){_0x31b911['emitVoiceQueueChannelRemove'](_0x539640[_0x272c53]);delete _0x539640[_0x272c53];}}}};function loggerCatch(_0x595d53){return function(_0x1abfeb){logger[_0x4dcc('0x40')](_0x595d53,util[_0x4dcc('0x46')](_0x1abfeb,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0x4dcc('0x38')][_0x4dcc('0x47')]=function(_0x3bd458,_0xf3e99b,_0x134f76){io['to'](_0x3bd458)[_0x4dcc('0x47')](_0xf3e99b,_0x134f76);};VoiceQueueReport[_0x4dcc('0x38')][_0x4dcc('0x48')]=function(_0x24db97){this[_0x4dcc('0x47')](util['format']('voice:queue:%s',_0x24db97[_0x4dcc('0x49')]),_0x4dcc('0x4a'),_0x24db97);};VoiceQueueReport[_0x4dcc('0x38')][_0x4dcc('0x4b')]=function(_0x106e9d){this['emit'](util[_0x4dcc('0x4c')](_0x4dcc('0x4d'),_0x106e9d[_0x4dcc('0x49')]),_0x4dcc('0x4e'),_0x106e9d);};VoiceQueueReport['prototype']['emitVoiceQueueSummary']=function(_0x1a40aa){if(_0x1a40aa['type']==='inbound'){var _0x1dc889={'id':_0x1a40aa['id'],'name':_0x1a40aa[_0x4dcc('0x49')],'strategy':_0x1a40aa[_0x4dcc('0x4f')],'answered':_0x1a40aa['answered'],'available':_0x1a40aa[_0x4dcc('0x50')],'loggedIn':_0x1a40aa[_0x4dcc('0x51')],'pTalking':_0x1a40aa[_0x4dcc('0x35')],'sumBillable':_0x1a40aa[_0x4dcc('0x52')],'sumDuration':_0x1a40aa['sumDuration'],'sumHoldTime':_0x1a40aa[_0x4dcc('0x53')]||0x0,'talking':_0x1a40aa[_0x4dcc('0x34')],'total':_0x1a40aa[_0x4dcc('0x54')],'type':_0x1a40aa['type'],'unmanaged':_0x1a40aa[_0x4dcc('0x55')],'abandoned':_0x1a40aa[_0x4dcc('0x56')],'waiting':_0x1a40aa[_0x4dcc('0x36')]};if(_0x1a40aa[_0x4dcc('0x57')]){_0x1dc889[_0x4dcc('0x57')]={'id':_0x1a40aa[_0x4dcc('0x57')]['id'],'name':_0x1a40aa[_0x4dcc('0x57')][_0x4dcc('0x49')],'active':_0x1a40aa[_0x4dcc('0x57')][_0x4dcc('0x58')],'callerid':_0x1a40aa['Trunk'][_0x4dcc('0x59')]};}if(_0x1a40aa[_0x4dcc('0x5a')]){_0x1dc889['Interval']={'id':_0x1a40aa['Interval']['id'],'name':_0x1a40aa[_0x4dcc('0x5a')][_0x4dcc('0x49')]};}var _0x50ba12=md5(JSON[_0x4dcc('0x5b')](_0x1dc889));if(_0x1a40aa[_0x4dcc('0x5c')]!==_0x50ba12){_0x1a40aa[_0x4dcc('0x5c')]=_0x50ba12;this[_0x4dcc('0x47')](util[_0x4dcc('0x4c')](_0x4dcc('0x4d'),_0x1dc889[_0x4dcc('0x49')]),'voice_queue:save',_0x1dc889);}}};VoiceQueueReport['prototype']['isNotNull']=function(_0x9c1f78){return _0x9c1f78!==null&&!_[_0x4dcc('0x30')](_0x9c1f78);};VoiceQueueReport[_0x4dcc('0x38')][_0x4dcc('0x2f')]=function(){var _0x4c33cc=this;setInterval(function(){_0x4c33cc['clearZombieChannels']();ami[_0x4dcc('0x3c')]({'action':_0x4dcc('0x5d')})[_0x4dcc('0x5e')](loggerCatch(_0x4dcc('0x5f')));},0x2710);};VoiceQueueReport[_0x4dcc('0x38')][_0x4dcc('0x60')]=function(){var _0x14a9ad=this;setInterval(function(){if(_0x14a9ad[_0x4dcc('0x14')]){return ami[_0x4dcc('0x3c')]({'action':'queuesummary'})[_0x4dcc('0x61')](function(_0x4451b7){_0x14a9ad['flagQueueSummary']=![];})[_0x4dcc('0x5e')](loggerCatch(_0x4dcc('0x62')));}},0x3e8);};VoiceQueueReport['prototype'][_0x4dcc('0x17')]=function(_0x526a38){try{if(this[_0x4dcc('0x63')](_0x526a38)&&this[_0x4dcc('0x63')](_0x526a38['queue'])){if(this[_0x4dcc('0x13')][_0x526a38['queue']]){var _0x56e0c8=_[_0x4dcc('0x64')](this[_0x4dcc('0x39')],'queue')[_0x526a38[_0x4dcc('0x65')]]||0x0;var _0x4a4309=_0x56e0c8-_0x526a38[_0x4dcc('0x66')];if(this[_0x4dcc('0x13')][_0x526a38[_0x4dcc('0x65')]][_0x4dcc('0x36')]!==_['toNumber'](_0x526a38[_0x4dcc('0x66')])||this[_0x4dcc('0x13')][_0x526a38[_0x4dcc('0x65')]][_0x4dcc('0x51')]!==_[_0x4dcc('0x67')](_0x526a38[_0x4dcc('0x68')])||this[_0x4dcc('0x13')][_0x526a38['queue']][_0x4dcc('0x50')]!==_[_0x4dcc('0x67')](_0x526a38[_0x4dcc('0x50')])||this[_0x4dcc('0x13')][_0x526a38[_0x4dcc('0x65')]][_0x4dcc('0x34')]!==_0x4a4309){this[_0x4dcc('0x13')][_0x526a38['queue']][_0x4dcc('0x36')]=_['toNumber'](_0x526a38[_0x4dcc('0x66')]);this[_0x4dcc('0x13')][_0x526a38['queue']]['loggedIn']=_[_0x4dcc('0x67')](_0x526a38['loggedin']);this[_0x4dcc('0x13')][_0x526a38[_0x4dcc('0x65')]][_0x4dcc('0x50')]=_[_0x4dcc('0x67')](_0x526a38[_0x4dcc('0x50')]);this['voiceQueues'][_0x526a38[_0x4dcc('0x65')]][_0x4dcc('0x34')]=_0x4a4309>0x0?_0x4a4309:0x0;this[_0x4dcc('0x13')][_0x526a38['queue']][_0x4dcc('0x34')]=this[_0x4dcc('0x13')][_0x526a38[_0x4dcc('0x65')]][_0x4dcc('0x34')]>_['toNumber'](_0x526a38[_0x4dcc('0x68')])?_[_0x4dcc('0x67')](_0x526a38['loggedin']):this['voiceQueues'][_0x526a38['queue']][_0x4dcc('0x34')];this[_0x4dcc('0x69')](this[_0x4dcc('0x13')][_0x526a38['queue']]);}ami[_0x4dcc('0x47')](_0x4dcc('0x6a'),this[_0x4dcc('0x13')][_0x526a38[_0x4dcc('0x65')]]);}}}catch(_0x2835ed){logger[_0x4dcc('0x40')](_0x4dcc('0x6b'),util[_0x4dcc('0x46')](_0x2835ed,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4dcc('0x38')]['syncQueueSummaryComplete']=function(_0xb00246){this[_0x4dcc('0x14')]=!![];};VoiceQueueReport[_0x4dcc('0x38')][_0x4dcc('0x6c')]=function(_0x4a0d65){};VoiceQueueReport[_0x4dcc('0x38')][_0x4dcc('0x1b')]=function(_0x4cf163){try{if(this[_0x4dcc('0x63')](_0x4cf163)){if(_[_0x4dcc('0x30')](this['queueReports'][_0x4cf163[_0x4dcc('0x6d')]])){this[_0x4dcc('0x10')][_0x4cf163[_0x4dcc('0x6d')]]=[];this[_0x4dcc('0x39')][_0x4cf163[_0x4dcc('0x6d')]]={};}var _0x581460=new QueueReport();_0x581460['name']=_0x4cf163['queue'];_0x581460[_0x4dcc('0x6e')]=this[_0x4dcc('0x13')][_0x581460[_0x4dcc('0x49')]]&&this[_0x4dcc('0x13')][_0x581460['name']][_0x4dcc('0x6e')]?this[_0x4dcc('0x13')][_0x581460[_0x4dcc('0x49')]]['type']||_0x4dcc('0x6f'):_0x4dcc('0x6f');_0x581460[_0x4dcc('0x65')]=_0x4cf163[_0x4dcc('0x65')];_0x581460[_0x4dcc('0x70')]=moment()[_0x4dcc('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x581460['position']=_0x4cf163['position'];_0x581460[_0x4dcc('0x71')]=_0x4cf163[_0x4dcc('0x71')];_[_0x4dcc('0x72')](_0x581460,_[_0x4dcc('0x73')](_0x4cf163,_[_0x4dcc('0x74')](_0x581460)));this[_0x4dcc('0x10')][_0x4cf163[_0x4dcc('0x6d')]][_0x4dcc('0x75')](_0x581460);this[_0x4dcc('0x39')][_0x4cf163[_0x4dcc('0x6d')]]=_0x581460;this['emitVoiceQueueChannelSave'](_0x581460);}}catch(_0x167abe){logger[_0x4dcc('0x40')](_0x4dcc('0x76'),util['inspect'](_0x167abe,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4dcc('0x38')][_0x4dcc('0x77')]=function(_0x511b29){try{if(this['isNotNull'](_0x511b29)){if(this['queueReports'][_0x511b29['uniqueid']]){var _0xab5ddd=_[_0x4dcc('0x78')](this['queueReports'][_0x511b29[_0x4dcc('0x6d')]]);_0xab5ddd[_0x4dcc('0x79')]=![];_0xab5ddd['queuecallercompleteAt']=null;_0xab5ddd[_0x4dcc('0x7a')]=_0x511b29[_0x4dcc('0x7a')];_0xab5ddd['originalposition']=_0x511b29[_0x4dcc('0x7b')];_0xab5ddd[_0x4dcc('0x1c')]=!![];_0xab5ddd[_0x4dcc('0x7c')]=moment()[_0x4dcc('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0xab5ddd[_0x4dcc('0x7d')]=_0x4dcc('0x7e');_0xab5ddd[_0x4dcc('0x7f')]=null;this[_0x4dcc('0x39')][_0x511b29['uniqueid']]=_0xab5ddd;this[_0x4dcc('0x4b')](_0xab5ddd);}}}catch(_0x2cf1bb){logger[_0x4dcc('0x40')]('[syncQueueCallerAbandon][VoiceQueueReport]',util[_0x4dcc('0x46')](_0x2cf1bb,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x4dcc('0x1d')]=function(_0x58358e){try{if(this[_0x4dcc('0x63')](_0x58358e)){if(this[_0x4dcc('0x10')][_0x58358e['uniqueid']]){var _0x5c7dc1=_[_0x4dcc('0x78')](this[_0x4dcc('0x10')][_0x58358e[_0x4dcc('0x6d')]]);_0x5c7dc1[_0x4dcc('0x80')]=moment()[_0x4dcc('0x4c')](_0x4dcc('0x81'));_0x5c7dc1[_0x4dcc('0x82')]=_0x58358e['connectedlinenum'];_0x5c7dc1[_0x4dcc('0x83')]=_0x58358e[_0x4dcc('0x83')];this['channels'][_0x58358e[_0x4dcc('0x6d')]]=_0x5c7dc1;this['emitVoiceQueueChannelSave'](_0x5c7dc1);}}}catch(_0x305582){logger[_0x4dcc('0x40')]('[syncQueueCallerLeave][VoiceQueueReport]',util[_0x4dcc('0x46')](_0x305582,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4dcc('0x38')][_0x4dcc('0x21')]=function(_0x30e805){try{if(this['isNotNull'](_0x30e805)){if(this[_0x4dcc('0x10')][_0x30e805['uniqueid']]){var _0x3350e8=_[_0x4dcc('0x78')](this[_0x4dcc('0x10')][_0x30e805[_0x4dcc('0x6d')]]);_0x3350e8[_0x4dcc('0x79')]=!![];_0x3350e8[_0x4dcc('0x7d')]='COMPLETEDBYAGENT';}}}catch(_0x3747fc){logger['error'](_0x4dcc('0x84'),util[_0x4dcc('0x46')](_0x3747fc,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x4dcc('0x1f')]=function(_0x51c55e){try{if(this[_0x4dcc('0x63')](_0x51c55e)){if(this[_0x4dcc('0x10')][_0x51c55e[_0x4dcc('0x6d')]]){var _0x19bc15=_['last'](this[_0x4dcc('0x10')][_0x51c55e[_0x4dcc('0x6d')]]);_0x19bc15[_0x4dcc('0x1c')]=![];_0x19bc15['queuecallerabandonAt']=null;_0x19bc15[_0x4dcc('0x85')]=!![];_0x19bc15[_0x4dcc('0x7f')]=_0x51c55e[_0x4dcc('0x86')];_0x19bc15['holdtime']=_0x51c55e['holdtime'];_0x19bc15[_0x4dcc('0x79')]=!![];_0x19bc15[_0x4dcc('0x87')]=![];_0x19bc15[_0x4dcc('0x88')]=null;if(!_0x19bc15[_0x4dcc('0x89')]){if(_0x51c55e[_0x4dcc('0x8a')]==_0x4dcc('0x89')){_0x19bc15['queuecallerexitreason']=_0x4dcc('0x8b');}else{if(_[_0x4dcc('0x8c')](_0x51c55e['channel'][_0x4dcc('0x8d')](),_0x4dcc('0x8e'))){if(this['queueReports'][_0x51c55e[_0x4dcc('0x8f')]]){var _0x5767e7=_[_0x4dcc('0x78')](this[_0x4dcc('0x10')][_0x51c55e['linkedid']]);_0x5767e7[_0x4dcc('0x79')]=![];_0x5767e7['queuecallerexit']=!![];_0x5767e7[_0x4dcc('0x88')]=moment(_0x19bc15[_0x4dcc('0x70')])[_0x4dcc('0x90')](_0x51c55e[_0x4dcc('0x7a')],_0x4dcc('0x91'))[_0x4dcc('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x5767e7['queuecallerexitreason']=_0x4dcc('0x92');_0x5767e7[_0x4dcc('0x89')]=!![];_0x5767e7[_0x4dcc('0x93')]='FORWARD';_0x5767e7[_0x4dcc('0x94')]=_0x51c55e[_0x4dcc('0x95')];_0x5767e7[_0x4dcc('0x96')]=_0x51c55e[_0x4dcc('0x6d')];var _0x4f8401=this[_0x4dcc('0x10')][_0x51c55e['linkedid']];this[_0x4dcc('0x10')][_0x51c55e[_0x4dcc('0x8f')]]=this[_0x4dcc('0x10')][_0x51c55e[_0x4dcc('0x6d')]];this[_0x4dcc('0x10')][_0x51c55e['uniqueid']]=_0x4f8401;}}else{_0x19bc15[_0x4dcc('0x7d')]=_0x4dcc('0x97')+_0x51c55e[_0x4dcc('0x8a')][_0x4dcc('0x98')]();}}}this[_0x4dcc('0x39')][_0x51c55e[_0x4dcc('0x6d')]]=_0x19bc15;this[_0x4dcc('0x4b')](_0x19bc15);}}}catch(_0x17d540){logger[_0x4dcc('0x40')](_0x4dcc('0x99'),util[_0x4dcc('0x46')](_0x17d540,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4dcc('0x38')][_0x4dcc('0x9a')]=function(_0x3c580d){try{if(this[_0x4dcc('0x63')](_0x3c580d)){this[_0x4dcc('0x9b')](_0x3c580d[_0x4dcc('0x6d')],_[_0x4dcc('0x74')](_0x3c580d[_0x4dcc('0x9c')])[0x0],_0x3c580d[_0x4dcc('0x9d')]);if(this[_0x4dcc('0x10')][_0x3c580d['uniqueid']]){var _0x522d9f=_[_0x4dcc('0x78')](this[_0x4dcc('0x10')][_0x3c580d[_0x4dcc('0x6d')]]);if(_0x522d9f){if(this[_0x4dcc('0x63')](_0x3c580d['variable'])&&this[_0x4dcc('0x63')](_0x3c580d[_0x4dcc('0x9c')][_0x4dcc('0x9e')])){switch(_0x3c580d[_0x4dcc('0x9d')]){case _0x4dcc('0x9f'):_0x522d9f['queuecallerexit']=![];_0x522d9f[_0x4dcc('0x88')]=null;break;default:_0x522d9f['queuecallerexit']=!![];_0x522d9f[_0x4dcc('0x88')]=moment()['format'](_0x4dcc('0x81'));_0x522d9f[_0x4dcc('0x80')]=moment()[_0x4dcc('0x4c')](_0x4dcc('0x81'));}_0x522d9f[_0x4dcc('0x1c')]=![];_0x522d9f[_0x4dcc('0x7c')]=null;_0x522d9f[_0x4dcc('0x7d')]=_0x3c580d['value'];this[_0x4dcc('0x39')][_0x3c580d[_0x4dcc('0x6d')]]=_0x522d9f;this[_0x4dcc('0x4b')](_0x522d9f);}else if(this[_0x4dcc('0x63')](_0x3c580d['variable'])&&this['isNotNull'](_0x3c580d['variable']['queueposition'])){if(!_0x522d9f['queuecallerabandon']){_0x522d9f[_0x4dcc('0x87')]=!![];_0x522d9f[_0x4dcc('0x88')]=moment()['format'](_0x4dcc('0x81'));_0x522d9f[_0x4dcc('0x7d')]=_0x4dcc('0xa0');_0x522d9f[_0x4dcc('0x80')]=moment()[_0x4dcc('0x4c')](_0x4dcc('0x81'));this[_0x4dcc('0x39')][_0x3c580d[_0x4dcc('0x6d')]]=_0x522d9f;}}_0x522d9f[_0x4dcc('0x15')]=this[_0x4dcc('0x15')][_0x3c580d[_0x4dcc('0x6d')]];}}}}catch(_0x182060){logger[_0x4dcc('0x40')](_0x4dcc('0xa1'),util['inspect'](_0x182060,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4dcc('0x38')][_0x4dcc('0x9b')]=function(_0x2dd2b8,_0x3c7a8a,_0x362f4d){var _0x4a23a8=[_0x4dcc('0xa2'),_0x4dcc('0xa3'),_0x4dcc('0xa4'),_0x4dcc('0xa5'),_0x4dcc('0xa6'),_0x4dcc('0xa7'),_0x4dcc('0xa8'),_0x4dcc('0xa9'),_0x4dcc('0xaa'),_0x4dcc('0xab'),_0x4dcc('0xac'),_0x4dcc('0xad'),_0x4dcc('0xae'),'memberdynamic',_0x4dcc('0xaf'),_0x4dcc('0xb0'),_0x4dcc('0x86'),_0x4dcc('0xb1'),_0x4dcc('0xb2')];if(!_[_0x4dcc('0x3b')](_0x3c7a8a)&&!_[_0x4dcc('0xb3')](_0x4a23a8,_0x3c7a8a)){if(_[_0x4dcc('0x30')](this['variables'][_0x2dd2b8])){this[_0x4dcc('0x15')][_0x2dd2b8]={};}this[_0x4dcc('0x15')][_0x2dd2b8][_0x3c7a8a]=_0x362f4d;}};VoiceQueueReport['prototype'][_0x4dcc('0x24')]=function(_0x25af2d){try{if(this['isNotNull'](_0x25af2d)){if(this[_0x4dcc('0x10')][_0x25af2d[_0x4dcc('0x6d')]]){for(var _0xe20283=0x0,_0x4d4341={};_0xe20283<this[_0x4dcc('0x10')][_0x25af2d['uniqueid']][_0x4dcc('0xb4')];_0xe20283+=0x1){_0x4d4341=this[_0x4dcc('0x10')][_0x25af2d[_0x4dcc('0x6d')]][_0xe20283];if(this['voiceQueues'][_0x4d4341[_0x4dcc('0x65')]]){if(_0x4d4341[_0x4dcc('0x87')]){this[_0x4dcc('0x13')][_0x4d4341[_0x4dcc('0x65')]][_0x4dcc('0x55')]+=0x1;}if(_0x4d4341[_0x4dcc('0x1c')]){this['voiceQueues'][_0x4d4341['queue']][_0x4dcc('0x56')]+=0x1;}this['voiceQueues'][_0x4d4341[_0x4dcc('0x65')]][_0x4dcc('0x53')]+=moment(_0x4d4341[_0x4dcc('0x80')])[_0x4dcc('0xb5')](_0x4d4341[_0x4dcc('0x70')],'seconds')||0x0;if(_0xe20283===this[_0x4dcc('0x10')][_0x25af2d[_0x4dcc('0x6d')]][_0x4dcc('0xb4')]-0x1){this[_0x4dcc('0x13')][_0x4d4341[_0x4dcc('0x65')]][_0x4dcc('0xb6')]+=moment()[_0x4dcc('0xb7')](0x0)[_0x4dcc('0xb5')](_0x4d4341[_0x4dcc('0x70')],_0x4dcc('0x91'));this[_0x4dcc('0x13')][_0x4d4341[_0x4dcc('0x65')]][_0x4dcc('0x54')]+=0x1;if(_0x4d4341[_0x4dcc('0x79')]){this[_0x4dcc('0x13')][_0x4d4341[_0x4dcc('0x65')]][_0x4dcc('0xb8')]+=0x1;this['voiceQueues'][_0x4d4341[_0x4dcc('0x65')]][_0x4dcc('0x52')]+=moment()['milliseconds'](0x0)[_0x4dcc('0xb5')](_0x4d4341['queuecallerleaveAt'],_0x4dcc('0x91'));_0x4d4341[_0x4dcc('0xb9')]=moment()[_0x4dcc('0x4c')](_0x4dcc('0x81'));_0x4d4341['queuecallerexit']=![];_0x4d4341['queuecallerexitAt']=null;}if(_0x4d4341[_0x4dcc('0x87')]){_0x4d4341[_0x4dcc('0xba')]='unmanaged';ami['emit'](_0x4dcc('0xbb'),_0x4d4341);}if(_0x4d4341['queuecallerabandon']){_0x4d4341[_0x4dcc('0xba')]=_0x4dcc('0x56');ami[_0x4dcc('0x47')](_0x4dcc('0xbc'),_0x4d4341);}}else{this[_0x4dcc('0x13')][_0x4d4341[_0x4dcc('0x65')]][_0x4dcc('0xb6')]+=this[_0x4dcc('0x13')][_0x4d4341[_0x4dcc('0x65')]]['sumHoldTime'];}this[_0x4dcc('0x39')][_0x25af2d[_0x4dcc('0x6d')]]=_0x4d4341;this['emitVoiceQueueChannelRemove'](_0x4d4341);this[_0x4dcc('0x69')](this[_0x4dcc('0x13')][_0x4d4341[_0x4dcc('0x65')]]);}}ami[_0x4dcc('0x47')](_0x4dcc('0xbd'),this['queueReports'][_0x25af2d[_0x4dcc('0x6d')]]);delete this['queueReports'][_0x25af2d[_0x4dcc('0x6d')]];delete this[_0x4dcc('0x39')][_0x25af2d[_0x4dcc('0x6d')]];}if(this[_0x4dcc('0x15')][_0x25af2d['uniqueid']]){delete this[_0x4dcc('0x15')][_0x25af2d['uniqueid']];}}}catch(_0x3eaf71){logger[_0x4dcc('0x40')](_0x4dcc('0xbe'),util[_0x4dcc('0x46')](_0x3eaf71,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4dcc('0x38')][_0x4dcc('0x2c')]=function(_0x1ac0fe){try{if(this['isNotNull'](_0x1ac0fe)){var _0x222eb8;if(this[_0x4dcc('0x10')][_0x1ac0fe[_0x4dcc('0xbf')]]){_0x222eb8=_[_0x4dcc('0x78')](this['queueReports'][_0x1ac0fe[_0x4dcc('0xbf')]]);_0x222eb8[_0x4dcc('0x94')]=_0x1ac0fe['secondtransfererexten'];_0x222eb8['transferuniqueid']=_0x1ac0fe[_0x4dcc('0xc0')];_0x222eb8[_0x4dcc('0x7d')]='ATTENDEDTRANSFER';_0x222eb8['transfer']=!![];_0x222eb8[_0x4dcc('0x93')]=_0x4dcc('0xc1');if(this['queueReports'][_0x1ac0fe['secondtransfereruniqueid']]){var _0x364dc2=this[_0x4dcc('0x10')][_0x1ac0fe[_0x4dcc('0xc0')]];this[_0x4dcc('0x10')][_0x1ac0fe[_0x4dcc('0xc0')]]=this[_0x4dcc('0x10')][_0x1ac0fe[_0x4dcc('0xbf')]];this[_0x4dcc('0x10')][_0x1ac0fe[_0x4dcc('0xbf')]]=_0x364dc2;var _0x2d0c97=_[_0x4dcc('0x78')](this[_0x4dcc('0x10')][_0x1ac0fe[_0x4dcc('0xbf')]]);_0x2d0c97['switch']=!![];}}else if(this[_0x4dcc('0x10')][_0x1ac0fe[_0x4dcc('0xc2')]]){_0x222eb8=_[_0x4dcc('0x78')](this[_0x4dcc('0x10')][_0x1ac0fe[_0x4dcc('0xc2')]]);_0x222eb8[_0x4dcc('0x94')]=_0x1ac0fe['origtransfererexten'];_0x222eb8[_0x4dcc('0x96')]=_0x1ac0fe[_0x4dcc('0xc3')];_0x222eb8[_0x4dcc('0x7d')]=_0x4dcc('0xc4');_0x222eb8[_0x4dcc('0x89')]=!![];_0x222eb8[_0x4dcc('0x93')]=_0x4dcc('0xc1');if(this['queueReports'][_0x1ac0fe[_0x4dcc('0xc3')]]){var _0x364dc2=this['queueReports'][_0x1ac0fe[_0x4dcc('0xc3')]];this[_0x4dcc('0x10')][_0x1ac0fe[_0x4dcc('0xc3')]]=this[_0x4dcc('0x10')][_0x1ac0fe['transfertargetuniqueid']];this[_0x4dcc('0x10')][_0x1ac0fe[_0x4dcc('0xc2')]]=_0x364dc2;var _0x2d0c97=_[_0x4dcc('0x78')](this[_0x4dcc('0x10')][_0x1ac0fe['transfertargetuniqueid']]);_0x2d0c97[_0x4dcc('0x3a')]=!![];}}}}catch(_0x243dfa){logger['error'](_0x4dcc('0xc5'),util[_0x4dcc('0x46')](_0x243dfa,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4dcc('0x38')][_0x4dcc('0x2e')]=function(_0x1b622c){try{if(this[_0x4dcc('0x63')](_0x1b622c)){if(this[_0x4dcc('0x10')][_0x1b622c[_0x4dcc('0xbf')]]){var _0x20dfd1=_[_0x4dcc('0x78')](this[_0x4dcc('0x10')][_0x1b622c[_0x4dcc('0xbf')]]);_0x20dfd1[_0x4dcc('0x7d')]=_0x4dcc('0xc6');_0x20dfd1['transfer']=!![];_0x20dfd1[_0x4dcc('0x93')]='BLIND';_0x20dfd1['transferexten']=_0x1b622c[_0x4dcc('0xc7')];_0x20dfd1[_0x4dcc('0x96')]=_0x1b622c[_0x4dcc('0xbf')];this[_0x4dcc('0x24')]({'event':'BlindTransfer','uniqueid':_0x1b622c[_0x4dcc('0xbf')],'context':_0x1b622c[_0x4dcc('0xc8')],'channel':_0x1b622c[_0x4dcc('0xc9')]});}}}catch(_0x4a6f49){logger[_0x4dcc('0x40')](_0x4dcc('0xca'),util[_0x4dcc('0x46')](_0x4a6f49,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4dcc('0x38')][_0x4dcc('0x28')]=function(_0x493311){try{if(this[_0x4dcc('0x63')](_0x493311)){if(this[_0x4dcc('0x10')][_0x493311['uniqueid']]){var _0x65e64f=_[_0x4dcc('0x78')](this['queueReports'][_0x493311[_0x4dcc('0x6d')]]);if(!_[_0x4dcc('0x3b')](_0x65e64f['queuecallerleaveAt'])){_0x65e64f['mohstarttime']=moment()[_0x4dcc('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');}}}}catch(_0x255702){logger[_0x4dcc('0x40')](_0x4dcc('0xcb'),util[_0x4dcc('0x46')](_0x255702,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x4dcc('0x2a')]=function(_0x3ba9d8){try{if(this[_0x4dcc('0x63')](_0x3ba9d8)){if(this[_0x4dcc('0x10')][_0x3ba9d8[_0x4dcc('0x6d')]]){var _0x37e55b=_[_0x4dcc('0x78')](this[_0x4dcc('0x10')][_0x3ba9d8[_0x4dcc('0x6d')]]);if(!_[_0x4dcc('0x3b')](_0x37e55b[_0x4dcc('0xcc')])){_0x37e55b[_0x4dcc('0xcd')]+=moment()[_0x4dcc('0xb7')](0x0)[_0x4dcc('0xb5')](_0x37e55b[_0x4dcc('0xcc')],_0x4dcc('0x91'));delete _0x37e55b['mohstarttime'];}}}}catch(_0x54d5e3){logger[_0x4dcc('0x40')](_0x4dcc('0xce'),util[_0x4dcc('0x46')](_0x54d5e3,{'showHidden':![],'depth':null}));}};module[_0x4dcc('0xcf')]=VoiceQueueReport;