Built motion from commit (unavailable).|2.5.13
[motion2.git] / server / services / ami / report / voiceQueueReport.js
index 7f02b72..ee9ec47 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xff58=['emitVoiceQueueSummary','type','inbound','strategy','answered','available','pTalking','sumDuration','total','abandoned','waiting','Trunk','active','callerid','Interval','voice_queue:save','isNotNull','queues','then','queue','countBy','toNumber','callers','loggedIn','loggedin','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','inspect','syncNewExten','isUndefined','uniqueid','queuecallerjoinAt','position','count','merge','pick','keys','emitVoiceQueueChannelSave','[syncQueueCallerJoin][VoiceQueueReport]','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','[syncQueueCallerAbandon][VoiceQueueReport]','YYYY-MM-DD\x20HH:mm:ss','connectedlinenum','connectedlinename','queuecallerexitreason','COMPLETEDBYAGENT','assigned','membername','queuecallerexit','queuecallerexitAt','transfer','reason','startsWith','toLowerCase','linkedid','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferuniqueid','COMPLETEDBY','toUpperCase','addVariable','variable','queuestatus','value','CONTINUE','lastevent','timeout','queuecallerleaveAt','EXITWITHKEY','[syncVarSet][VoiceQueueReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','includes','unmanaged','sumHoldTime','diff','length','milliseconds','custom:queuecallerunmanaged','custom:queuecallerabandon','syncAttendedTransfer','transfereeuniqueid','transferexten','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[syncAttendedTransfer][VoiceQueueReport]','BLINDTRANSFER','BLIND','extension','context','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','[syncMusicOnHoldStart][VoiceQueueReport]','mohstarttime','mohtime','[syncMusicOnHoldStop][VoiceQueueReport]','exports','lodash','moment','util','md5','ioredis','../../../config/environment','../../../config/logger','../ami','../model/queueReport','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','agents','channels','voiceQueues','flagQueueSummary','campaigns','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','queueStatusComplete','unlockRR','clearZombieChannels','switch','isNil','Action','status','channel','catch','message','No\x20such\x20channel','queueReports','error','[voiceQueueReport][checkQueueReport]','variables','[voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','emit','format','name','voice_queue_channel:save','info','stringify','voice_queue_channel:remove'];(function(_0xf43d98,_0x205203){var _0x22c563=function(_0x2fd1ae){while(--_0x2fd1ae){_0xf43d98['push'](_0xf43d98['shift']());}};_0x22c563(++_0x205203);}(_0xff58,0x79));var _0x8ff5=function(_0x5bfb00,_0x52ffc4){_0x5bfb00=_0x5bfb00-0x0;var _0x24885f=_0xff58[_0x5bfb00];return _0x24885f;};'use strict';var _=require(_0x8ff5('0x0'));var moment=require(_0x8ff5('0x1'));var BPromise=require('bluebird');var util=require(_0x8ff5('0x2'));var md5=require(_0x8ff5('0x3'));var Redis=require(_0x8ff5('0x4'));var config=require(_0x8ff5('0x5'));var logger=require(_0x8ff5('0x6'))('ami');var ami=require(_0x8ff5('0x7'));var QueueReport=require(_0x8ff5('0x8'));config['redis']=_[_0x8ff5('0x9')](config[_0x8ff5('0xa')],{'host':_0x8ff5('0xb'),'port':0x18eb});var io=require(_0x8ff5('0xc'))(new Redis(config[_0x8ff5('0xa')]));var Sequence=function(){};Sequence[_0x8ff5('0xd')][_0x8ff5('0xe')]=function(_0x194b35){this[_0x8ff5('0xf')]=this[_0x8ff5('0xf')]?this[_0x8ff5('0xf')][_0x8ff5('0x10')](_0x194b35):_0x194b35();};function VoiceQueueReport(_0x2b6839){this[_0x8ff5('0x11')]=new Sequence();this['queueReports']={};this['agents']=_0x2b6839[_0x8ff5('0x12')];this[_0x8ff5('0x13')]=_0x2b6839['queueChannels'];this[_0x8ff5('0x14')]=_0x2b6839[_0x8ff5('0x14')];this[_0x8ff5('0x15')]=!![];this[_0x8ff5('0x16')]=_0x2b6839[_0x8ff5('0x16')];this['variables']={};ami['on'](_0x8ff5('0x17'),this[_0x8ff5('0x18')][_0x8ff5('0x19')](this));ami['on'](_0x8ff5('0x1a'),this[_0x8ff5('0x1b')][_0x8ff5('0x19')](this));ami['on']('queuecallerjoin',this['syncQueueCallerJoin'][_0x8ff5('0x19')](this));ami['on'](_0x8ff5('0x1c'),this[_0x8ff5('0x1d')][_0x8ff5('0x19')](this));ami['on'](_0x8ff5('0x1e'),this[_0x8ff5('0x1f')]['bind'](this));ami['on'](_0x8ff5('0x20'),this[_0x8ff5('0x21')][_0x8ff5('0x19')](this));ami['on'](_0x8ff5('0x22'),this[_0x8ff5('0x23')][_0x8ff5('0x19')](this));ami['on'](_0x8ff5('0x24'),this[_0x8ff5('0x25')][_0x8ff5('0x19')](this));ami['on'](_0x8ff5('0x26'),this[_0x8ff5('0x27')][_0x8ff5('0x19')](this));ami['on']('fullybooted',this[_0x8ff5('0x28')][_0x8ff5('0x19')](this));ami['on'](_0x8ff5('0x29'),this[_0x8ff5('0x2a')][_0x8ff5('0x19')](this));ami['on'](_0x8ff5('0x2b'),this[_0x8ff5('0x2c')][_0x8ff5('0x19')](this));ami['on'](_0x8ff5('0x2d'),this['syncAttendedTransfer'][_0x8ff5('0x19')](this));ami['on'](_0x8ff5('0x2e'),this[_0x8ff5('0x2f')][_0x8ff5('0x19')](this));this[_0x8ff5('0x30')]();this[_0x8ff5('0x31')]();}function isNotNull(_0xb0f50f){return _0xb0f50f!==null&&!_['isUndefined'](_0xb0f50f);}function clearChannels(_0x18239e){if(!_[_0x8ff5('0x32')](_0x18239e)){for(var _0x28ef50 in _0x18239e){if(_0x18239e[_0x8ff5('0x33')](_0x28ef50)){delete _0x18239e[_0x28ef50];}}}}function clearCampaigns(_0x1b3532){if(!_[_0x8ff5('0x32')](_0x1b3532)){for(var _0x51d541 in _0x1b3532){if(_0x1b3532['hasOwnProperty'](_0x51d541)){_0x1b3532[_0x51d541][_0x8ff5('0x34')]=0x0;}}}}function clearVoiceQueues(_0x1ac558){if(!_[_0x8ff5('0x32')](_0x1ac558)){for(var _0x4f7bd3 in _0x1ac558){if(_0x1ac558['hasOwnProperty'](_0x4f7bd3)){_0x1ac558[_0x4f7bd3][_0x8ff5('0x34')]=0x0;_0x1ac558[_0x4f7bd3][_0x8ff5('0x35')]=0x0;_0x1ac558[_0x4f7bd3]['pTalking']=0x0;_0x1ac558[_0x4f7bd3]['waiting']=0x0;_0x1ac558[_0x4f7bd3][_0x8ff5('0x36')]=!![];}}}}function clearAgentBooked(_0x5f32d5){if(!_[_0x8ff5('0x32')](_0x5f32d5)){for(var _0x3be2e8 in _0x5f32d5){if(_0x5f32d5[_0x8ff5('0x33')](_0x3be2e8)){_0x5f32d5[_0x3be2e8][_0x8ff5('0x37')]=!![];}}}}VoiceQueueReport[_0x8ff5('0xd')][_0x8ff5('0x38')]=function(){var _0x35bc42=this;for(var _0x8d590d in this[_0x8ff5('0x13')]){if(this[_0x8ff5('0x13')][_0x8ff5('0x33')](_0x8d590d)&&!this['channels'][_0x8d590d][_0x8ff5('0x39')]){this[_0x8ff5('0x11')][_0x8ff5('0xe')](function(){if(!_[_0x8ff5('0x3a')](_0x35bc42[_0x8ff5('0x13')][_0x8d590d])){return ami[_0x8ff5('0x3b')]({'action':_0x8ff5('0x3c'),'channel':_0x35bc42[_0x8ff5('0x13')][_0x8d590d][_0x8ff5('0x3d')]})[_0x8ff5('0x3e')](function(_0x598d61){if(_0x598d61[_0x8ff5('0x3f')]===_0x8ff5('0x40')){setTimeout(function(){if(_0x35bc42['channels'][_0x8d590d]){delete _0x35bc42[_0x8ff5('0x13')][_0x8d590d];logger['error']('[voiceQueueReport][checkChannel]',_0x8d590d);}if(_0x35bc42[_0x8ff5('0x41')][_0x8d590d]){delete _0x35bc42[_0x8ff5('0x41')][_0x8d590d];logger[_0x8ff5('0x42')](_0x8ff5('0x43'),_0x8d590d);}if(_0x35bc42['variables'][_0x8d590d]){delete _0x35bc42[_0x8ff5('0x44')][_0x8d590d];logger[_0x8ff5('0x42')](_0x8ff5('0x45'),_0x8d590d);}},0x1f40);}});}});}}};VoiceQueueReport[_0x8ff5('0xd')]['syncFullyBooted']=function(){logger['error'](_0x8ff5('0x46'));clearChannels(this[_0x8ff5('0x13')]);this['clearQueueReport'](this[_0x8ff5('0x41')]);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0x8ff5('0x14')]);clearCampaigns(this[_0x8ff5('0x16')]);};VoiceQueueReport[_0x8ff5('0xd')][_0x8ff5('0x47')]=function(_0x58d741){var _0x4f8489=this;if(!_[_0x8ff5('0x32')](_0x58d741)){for(var _0x1f3b32 in _0x58d741){if(_0x58d741['hasOwnProperty'](_0x1f3b32)){_0x4f8489[_0x8ff5('0x48')](_0x58d741[_0x1f3b32]);delete _0x58d741[_0x1f3b32];}}}};function loggerCatch(_0x58f498){return function(_0x2e7739){logger[_0x8ff5('0x42')](_0x58f498,util['inspect'](_0x2e7739,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0x8ff5('0xd')][_0x8ff5('0x49')]=function(_0x1d8b61,_0x1d841f,_0x407dbd){io['to'](_0x1d8b61)[_0x8ff5('0x49')](_0x1d841f,_0x407dbd);};VoiceQueueReport[_0x8ff5('0xd')]['emitVoiceQueueChannelSave']=function(_0x7fc1bd){this['emit'](util[_0x8ff5('0x4a')]('voice:queue:%s',_0x7fc1bd[_0x8ff5('0x4b')]),_0x8ff5('0x4c'),_0x7fc1bd);};VoiceQueueReport[_0x8ff5('0xd')][_0x8ff5('0x48')]=function(_0x5d7218){logger[_0x8ff5('0x4d')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x8ff5('0x4e')](_0x5d7218));this[_0x8ff5('0x49')](util[_0x8ff5('0x4a')]('voice:queue:%s',_0x5d7218[_0x8ff5('0x4b')]),_0x8ff5('0x4f'),_0x5d7218);};VoiceQueueReport['prototype'][_0x8ff5('0x50')]=function(_0x2a0d5a){if(_0x2a0d5a[_0x8ff5('0x51')]===_0x8ff5('0x52')){var _0x3492b3={'id':_0x2a0d5a['id'],'name':_0x2a0d5a[_0x8ff5('0x4b')],'strategy':_0x2a0d5a[_0x8ff5('0x53')],'answered':_0x2a0d5a[_0x8ff5('0x54')],'available':_0x2a0d5a[_0x8ff5('0x55')],'loggedIn':_0x2a0d5a['loggedIn'],'pTalking':_0x2a0d5a[_0x8ff5('0x56')],'sumBillable':_0x2a0d5a['sumBillable'],'sumDuration':_0x2a0d5a[_0x8ff5('0x57')],'sumHoldTime':_0x2a0d5a['sumHoldTime']||0x0,'talking':_0x2a0d5a['talking'],'total':_0x2a0d5a[_0x8ff5('0x58')],'type':_0x2a0d5a[_0x8ff5('0x51')],'unmanaged':_0x2a0d5a['unmanaged'],'abandoned':_0x2a0d5a[_0x8ff5('0x59')],'waiting':_0x2a0d5a[_0x8ff5('0x5a')]};if(_0x2a0d5a[_0x8ff5('0x5b')]){_0x3492b3['Trunk']={'id':_0x2a0d5a[_0x8ff5('0x5b')]['id'],'name':_0x2a0d5a['Trunk'][_0x8ff5('0x4b')],'active':_0x2a0d5a['Trunk'][_0x8ff5('0x5c')],'callerid':_0x2a0d5a[_0x8ff5('0x5b')][_0x8ff5('0x5d')]};}if(_0x2a0d5a['Interval']){_0x3492b3[_0x8ff5('0x5e')]={'id':_0x2a0d5a[_0x8ff5('0x5e')]['id'],'name':_0x2a0d5a[_0x8ff5('0x5e')]['name']};}var _0x1d5c3f=md5(JSON[_0x8ff5('0x4e')](_0x3492b3));if(_0x2a0d5a[_0x8ff5('0x3')]!==_0x1d5c3f){_0x2a0d5a['md5']=_0x1d5c3f;this[_0x8ff5('0x49')](util[_0x8ff5('0x4a')]('voice:queue:%s',_0x3492b3['name']),_0x8ff5('0x5f'),_0x3492b3);}}};VoiceQueueReport[_0x8ff5('0xd')][_0x8ff5('0x60')]=function(_0x365cb7){return _0x365cb7!==null&&!_['isUndefined'](_0x365cb7);};VoiceQueueReport[_0x8ff5('0xd')][_0x8ff5('0x31')]=function(){var _0x1cd18c=this;setInterval(function(){_0x1cd18c[_0x8ff5('0x38')]();ami[_0x8ff5('0x3b')]({'action':_0x8ff5('0x61')})['catch'](loggerCatch('[queues]'));},0x2710);};VoiceQueueReport[_0x8ff5('0xd')]['loopQueueSummary']=function(){var _0x2259e9=this;setInterval(function(){if(_0x2259e9[_0x8ff5('0x15')]){return ami[_0x8ff5('0x3b')]({'action':'queuesummary'})[_0x8ff5('0x62')](function(_0x5149da){_0x2259e9[_0x8ff5('0x15')]=![];})[_0x8ff5('0x3e')](loggerCatch('[queuesummary]'));}},0x3e8);};VoiceQueueReport[_0x8ff5('0xd')]['syncQueueSummary']=function(_0x56bbb8){try{if(this['isNotNull'](_0x56bbb8)&&this[_0x8ff5('0x60')](_0x56bbb8[_0x8ff5('0x63')])){if(this[_0x8ff5('0x14')][_0x56bbb8['queue']]){var _0x56e73b=_[_0x8ff5('0x64')](this[_0x8ff5('0x13')],_0x8ff5('0x63'))[_0x56bbb8['queue']]||0x0;var _0x48df49=_0x56e73b-_0x56bbb8['callers'];if(this[_0x8ff5('0x14')][_0x56bbb8[_0x8ff5('0x63')]][_0x8ff5('0x5a')]!==_[_0x8ff5('0x65')](_0x56bbb8[_0x8ff5('0x66')])||this[_0x8ff5('0x14')][_0x56bbb8[_0x8ff5('0x63')]][_0x8ff5('0x67')]!==_['toNumber'](_0x56bbb8[_0x8ff5('0x68')])||this[_0x8ff5('0x14')][_0x56bbb8[_0x8ff5('0x63')]][_0x8ff5('0x55')]!==_[_0x8ff5('0x65')](_0x56bbb8['available'])||this[_0x8ff5('0x14')][_0x56bbb8[_0x8ff5('0x63')]][_0x8ff5('0x35')]!==_0x48df49){this[_0x8ff5('0x14')][_0x56bbb8[_0x8ff5('0x63')]][_0x8ff5('0x5a')]=_['toNumber'](_0x56bbb8['callers']);this[_0x8ff5('0x14')][_0x56bbb8[_0x8ff5('0x63')]][_0x8ff5('0x67')]=_[_0x8ff5('0x65')](_0x56bbb8['loggedin']);this[_0x8ff5('0x14')][_0x56bbb8[_0x8ff5('0x63')]][_0x8ff5('0x55')]=_[_0x8ff5('0x65')](_0x56bbb8[_0x8ff5('0x55')]);this['voiceQueues'][_0x56bbb8[_0x8ff5('0x63')]][_0x8ff5('0x35')]=_0x48df49>0x0?_0x48df49:0x0;this[_0x8ff5('0x14')][_0x56bbb8[_0x8ff5('0x63')]][_0x8ff5('0x35')]=this[_0x8ff5('0x14')][_0x56bbb8['queue']][_0x8ff5('0x35')]>_['toNumber'](_0x56bbb8[_0x8ff5('0x68')])?_[_0x8ff5('0x65')](_0x56bbb8[_0x8ff5('0x68')]):this[_0x8ff5('0x14')][_0x56bbb8['queue']][_0x8ff5('0x35')];this[_0x8ff5('0x50')](this[_0x8ff5('0x14')][_0x56bbb8[_0x8ff5('0x63')]]);}ami['emit'](_0x8ff5('0x69'),this[_0x8ff5('0x14')][_0x56bbb8['queue']]);}}}catch(_0x184107){logger['error'](_0x8ff5('0x6a'),util[_0x8ff5('0x6b')](_0x184107,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8ff5('0xd')][_0x8ff5('0x1b')]=function(_0x181bd9){this[_0x8ff5('0x15')]=!![];};VoiceQueueReport['prototype'][_0x8ff5('0x6c')]=function(_0x574a6a){};VoiceQueueReport[_0x8ff5('0xd')]['syncQueueCallerJoin']=function(_0x3c4371){try{if(this[_0x8ff5('0x60')](_0x3c4371)){if(_[_0x8ff5('0x6d')](this[_0x8ff5('0x41')][_0x3c4371[_0x8ff5('0x6e')]])){this['queueReports'][_0x3c4371['uniqueid']]=[];this['channels'][_0x3c4371['uniqueid']]={};}var _0xd002f7=new QueueReport();_0xd002f7[_0x8ff5('0x4b')]=_0x3c4371[_0x8ff5('0x63')];_0xd002f7['type']=this['voiceQueues'][_0xd002f7[_0x8ff5('0x4b')]]&&this[_0x8ff5('0x14')][_0xd002f7['name']][_0x8ff5('0x51')]?this['voiceQueues'][_0xd002f7[_0x8ff5('0x4b')]][_0x8ff5('0x51')]||_0x8ff5('0x52'):_0x8ff5('0x52');_0xd002f7[_0x8ff5('0x63')]=_0x3c4371[_0x8ff5('0x63')];_0xd002f7[_0x8ff5('0x6f')]=moment()[_0x8ff5('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0xd002f7[_0x8ff5('0x70')]=_0x3c4371[_0x8ff5('0x70')];_0xd002f7[_0x8ff5('0x71')]=_0x3c4371['count'];_[_0x8ff5('0x72')](_0xd002f7,_[_0x8ff5('0x73')](_0x3c4371,_[_0x8ff5('0x74')](_0xd002f7)));this['queueReports'][_0x3c4371[_0x8ff5('0x6e')]]['push'](_0xd002f7);this[_0x8ff5('0x13')][_0x3c4371[_0x8ff5('0x6e')]]=_0xd002f7;this[_0x8ff5('0x75')](_0xd002f7);}}catch(_0x39a7cf){logger[_0x8ff5('0x42')](_0x8ff5('0x76'),util[_0x8ff5('0x6b')](_0x39a7cf,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x47fd1b){try{if(this[_0x8ff5('0x60')](_0x47fd1b)){if(this['queueReports'][_0x47fd1b[_0x8ff5('0x6e')]]){var _0xc8292c=_[_0x8ff5('0x77')](this[_0x8ff5('0x41')][_0x47fd1b['uniqueid']]);_0xc8292c[_0x8ff5('0x78')]=![];_0xc8292c[_0x8ff5('0x79')]=null;_0xc8292c[_0x8ff5('0x7a')]=_0x47fd1b['holdtime'];_0xc8292c[_0x8ff5('0x7b')]=_0x47fd1b[_0x8ff5('0x7b')];_0xc8292c[_0x8ff5('0x1c')]=!![];_0xc8292c[_0x8ff5('0x7c')]=moment()[_0x8ff5('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0xc8292c['queuecallerexitreason']=_0x8ff5('0x7d');_0xc8292c[_0x8ff5('0x7e')]=null;this[_0x8ff5('0x13')][_0x47fd1b[_0x8ff5('0x6e')]]=_0xc8292c;this[_0x8ff5('0x48')](_0xc8292c);}}}catch(_0x441168){logger[_0x8ff5('0x42')](_0x8ff5('0x7f'),util[_0x8ff5('0x6b')](_0x441168,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8ff5('0xd')]['syncQueueCallerLeave']=function(_0x30032b){try{if(this[_0x8ff5('0x60')](_0x30032b)){if(this[_0x8ff5('0x41')][_0x30032b[_0x8ff5('0x6e')]]){var _0x3c50e7=_[_0x8ff5('0x77')](this[_0x8ff5('0x41')][_0x30032b[_0x8ff5('0x6e')]]);_0x3c50e7['queuecallerleaveAt']=moment()[_0x8ff5('0x4a')](_0x8ff5('0x80'));_0x3c50e7['connectedlinenum']=_0x30032b[_0x8ff5('0x81')];_0x3c50e7['connectedlinename']=_0x30032b[_0x8ff5('0x82')];this['channels'][_0x30032b[_0x8ff5('0x6e')]]=_0x3c50e7;this[_0x8ff5('0x75')](_0x3c50e7);}}}catch(_0x5a4fb6){logger[_0x8ff5('0x42')]('[syncQueueCallerLeave][VoiceQueueReport]',util[_0x8ff5('0x6b')](_0x5a4fb6,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x8ff5('0x23')]=function(_0x2d0fbf){try{if(this[_0x8ff5('0x60')](_0x2d0fbf)){if(this[_0x8ff5('0x41')][_0x2d0fbf[_0x8ff5('0x6e')]]){var _0x2ffefc=_[_0x8ff5('0x77')](this[_0x8ff5('0x41')][_0x2d0fbf['uniqueid']]);_0x2ffefc['queuecallercomplete']=!![];_0x2ffefc[_0x8ff5('0x83')]=_0x8ff5('0x84');}}}catch(_0x5a11d0){logger[_0x8ff5('0x42')]('[syncAgentConnect][VoiceQueueReport]',util[_0x8ff5('0x6b')](_0x5a11d0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8ff5('0xd')][_0x8ff5('0x21')]=function(_0x5ebb7a){try{if(this['isNotNull'](_0x5ebb7a)){if(this['queueReports'][_0x5ebb7a[_0x8ff5('0x6e')]]){var _0x2bfecf=_[_0x8ff5('0x77')](this['queueReports'][_0x5ebb7a[_0x8ff5('0x6e')]]);_0x2bfecf['queuecallerabandon']=![];_0x2bfecf[_0x8ff5('0x7c')]=null;_0x2bfecf[_0x8ff5('0x85')]=!![];_0x2bfecf[_0x8ff5('0x7e')]=_0x5ebb7a[_0x8ff5('0x86')];_0x2bfecf[_0x8ff5('0x7a')]=_0x5ebb7a[_0x8ff5('0x7a')];_0x2bfecf[_0x8ff5('0x78')]=!![];_0x2bfecf[_0x8ff5('0x87')]=![];_0x2bfecf[_0x8ff5('0x88')]=null;if(!_0x2bfecf[_0x8ff5('0x89')]){if(_0x5ebb7a[_0x8ff5('0x8a')]==_0x8ff5('0x89')){_0x2bfecf[_0x8ff5('0x83')]='COMPLETED';}else{if(_[_0x8ff5('0x8b')](_0x5ebb7a[_0x8ff5('0x3d')][_0x8ff5('0x8c')](),'local/')){if(this[_0x8ff5('0x41')][_0x5ebb7a[_0x8ff5('0x8d')]]){var _0x1ec5aa=_['last'](this[_0x8ff5('0x41')][_0x5ebb7a[_0x8ff5('0x8d')]]);_0x1ec5aa[_0x8ff5('0x78')]=![];_0x1ec5aa[_0x8ff5('0x87')]=!![];_0x1ec5aa['queuecallerexitAt']=moment(_0x2bfecf[_0x8ff5('0x6f')])[_0x8ff5('0x8e')](_0x5ebb7a[_0x8ff5('0x7a')],_0x8ff5('0x8f'))[_0x8ff5('0x4a')](_0x8ff5('0x80'));_0x1ec5aa[_0x8ff5('0x83')]=_0x8ff5('0x90');_0x1ec5aa[_0x8ff5('0x89')]=!![];_0x1ec5aa[_0x8ff5('0x91')]=_0x8ff5('0x92');_0x1ec5aa['transferexten']=_0x5ebb7a['destexten'];_0x1ec5aa[_0x8ff5('0x93')]=_0x5ebb7a[_0x8ff5('0x6e')];var _0x4de69e=this[_0x8ff5('0x41')][_0x5ebb7a[_0x8ff5('0x8d')]];this[_0x8ff5('0x41')][_0x5ebb7a[_0x8ff5('0x8d')]]=this[_0x8ff5('0x41')][_0x5ebb7a[_0x8ff5('0x6e')]];this[_0x8ff5('0x41')][_0x5ebb7a[_0x8ff5('0x6e')]]=_0x4de69e;}}else{_0x2bfecf[_0x8ff5('0x83')]=_0x8ff5('0x94')+_0x5ebb7a[_0x8ff5('0x8a')][_0x8ff5('0x95')]();}}}this[_0x8ff5('0x13')][_0x5ebb7a[_0x8ff5('0x6e')]]=_0x2bfecf;this[_0x8ff5('0x48')](_0x2bfecf);}}}catch(_0x3bf667){logger[_0x8ff5('0x42')]('[syncAgentComplete][VoiceQueueReport]',util[_0x8ff5('0x6b')](_0x3bf667,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8ff5('0xd')][_0x8ff5('0x25')]=function(_0x1447ef){try{if(this[_0x8ff5('0x60')](_0x1447ef)){this[_0x8ff5('0x96')](_0x1447ef['uniqueid'],_['keys'](_0x1447ef[_0x8ff5('0x97')])[0x0],_0x1447ef['value']);if(this['queueReports'][_0x1447ef[_0x8ff5('0x6e')]]){var _0x30cd0e=_[_0x8ff5('0x77')](this[_0x8ff5('0x41')][_0x1447ef[_0x8ff5('0x6e')]]);if(_0x30cd0e){if(this[_0x8ff5('0x60')](_0x1447ef['variable'])&&this[_0x8ff5('0x60')](_0x1447ef[_0x8ff5('0x97')][_0x8ff5('0x98')])){switch(_0x1447ef[_0x8ff5('0x99')]){case _0x8ff5('0x9a'):_0x30cd0e[_0x8ff5('0x87')]=![];_0x30cd0e[_0x8ff5('0x88')]=null;break;case'TIMEOUT':_0x30cd0e[_0x8ff5('0x9b')]=_0x8ff5('0x9c');ami[_0x8ff5('0x49')]('custom:timeout',_0x30cd0e);break;default:_0x30cd0e['queuecallerexit']=!![];_0x30cd0e[_0x8ff5('0x88')]=moment()[_0x8ff5('0x4a')](_0x8ff5('0x80'));_0x30cd0e[_0x8ff5('0x9d')]=moment()[_0x8ff5('0x4a')](_0x8ff5('0x80'));}_0x30cd0e[_0x8ff5('0x1c')]=![];_0x30cd0e[_0x8ff5('0x7c')]=null;_0x30cd0e[_0x8ff5('0x83')]=_0x1447ef[_0x8ff5('0x99')];this['channels'][_0x1447ef[_0x8ff5('0x6e')]]=_0x30cd0e;this[_0x8ff5('0x48')](_0x30cd0e);}else if(this['isNotNull'](_0x1447ef['variable'])&&this[_0x8ff5('0x60')](_0x1447ef[_0x8ff5('0x97')]['queueposition'])){if(!_0x30cd0e[_0x8ff5('0x1c')]){_0x30cd0e[_0x8ff5('0x87')]=!![];_0x30cd0e[_0x8ff5('0x88')]=moment()[_0x8ff5('0x4a')](_0x8ff5('0x80'));_0x30cd0e[_0x8ff5('0x83')]=_0x8ff5('0x9e');_0x30cd0e['queuecallerleaveAt']=moment()[_0x8ff5('0x4a')](_0x8ff5('0x80'));this['channels'][_0x1447ef['uniqueid']]=_0x30cd0e;}}_0x30cd0e['variables']=this[_0x8ff5('0x44')][_0x1447ef[_0x8ff5('0x6e')]];}}}}catch(_0x5b5e42){logger[_0x8ff5('0x42')](_0x8ff5('0x9f'),util[_0x8ff5('0x6b')](_0x5b5e42,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8ff5('0xd')][_0x8ff5('0x96')]=function(_0x28aeb9,_0x387248,_0x904c6a){var _0x3b12fc=[_0x8ff5('0xa0'),_0x8ff5('0xa1'),_0x8ff5('0xa2'),_0x8ff5('0xa3'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x8ff5('0xa4'),_0x8ff5('0xa5'),'sipcallid','sipuri','bridgepeer',_0x8ff5('0xa6'),_0x8ff5('0xa7'),_0x8ff5('0xa8'),'memberinterface',_0x8ff5('0xa9'),_0x8ff5('0x86'),_0x8ff5('0xaa'),'memberrealtime'];if(!_[_0x8ff5('0x3a')](_0x387248)&&!_[_0x8ff5('0xab')](_0x3b12fc,_0x387248)){if(_['isUndefined'](this[_0x8ff5('0x44')][_0x28aeb9])){this[_0x8ff5('0x44')][_0x28aeb9]={};}this['variables'][_0x28aeb9][_0x387248]=_0x904c6a;}};VoiceQueueReport[_0x8ff5('0xd')][_0x8ff5('0x27')]=function(_0x40a5cb){try{if(this[_0x8ff5('0x60')](_0x40a5cb)){if(this['queueReports'][_0x40a5cb['uniqueid']]){for(var _0x307d02=0x0,_0x345d11={};_0x307d02<this[_0x8ff5('0x41')][_0x40a5cb[_0x8ff5('0x6e')]]['length'];_0x307d02+=0x1){_0x345d11=this['queueReports'][_0x40a5cb[_0x8ff5('0x6e')]][_0x307d02];if(this[_0x8ff5('0x14')][_0x345d11[_0x8ff5('0x63')]]){if(_0x345d11[_0x8ff5('0x87')]){this[_0x8ff5('0x14')][_0x345d11['queue']][_0x8ff5('0xac')]+=0x1;}if(_0x345d11[_0x8ff5('0x1c')]){this['voiceQueues'][_0x345d11[_0x8ff5('0x63')]][_0x8ff5('0x59')]+=0x1;}this[_0x8ff5('0x14')][_0x345d11[_0x8ff5('0x63')]][_0x8ff5('0xad')]+=moment(_0x345d11[_0x8ff5('0x9d')])[_0x8ff5('0xae')](_0x345d11[_0x8ff5('0x6f')],_0x8ff5('0x8f'))||0x0;if(_0x307d02===this[_0x8ff5('0x41')][_0x40a5cb[_0x8ff5('0x6e')]][_0x8ff5('0xaf')]-0x1){this[_0x8ff5('0x14')][_0x345d11[_0x8ff5('0x63')]][_0x8ff5('0x57')]+=moment()['milliseconds'](0x0)[_0x8ff5('0xae')](_0x345d11[_0x8ff5('0x6f')],'seconds');this[_0x8ff5('0x14')][_0x345d11[_0x8ff5('0x63')]][_0x8ff5('0x58')]+=0x1;if(_0x345d11['queuecallercomplete']){this[_0x8ff5('0x14')][_0x345d11[_0x8ff5('0x63')]][_0x8ff5('0x54')]+=0x1;this[_0x8ff5('0x14')][_0x345d11[_0x8ff5('0x63')]]['sumBillable']+=moment()[_0x8ff5('0xb0')](0x0)[_0x8ff5('0xae')](_0x345d11['queuecallerleaveAt'],_0x8ff5('0x8f'));_0x345d11[_0x8ff5('0x79')]=moment()[_0x8ff5('0x4a')](_0x8ff5('0x80'));_0x345d11[_0x8ff5('0x87')]=![];_0x345d11[_0x8ff5('0x88')]=null;}if(_0x345d11[_0x8ff5('0x87')]){_0x345d11[_0x8ff5('0x9b')]=_0x8ff5('0xac');ami['emit'](_0x8ff5('0xb1'),_0x345d11);}if(_0x345d11[_0x8ff5('0x1c')]){_0x345d11[_0x8ff5('0x9b')]='abandoned';ami[_0x8ff5('0x49')](_0x8ff5('0xb2'),_0x345d11);}}else{this[_0x8ff5('0x14')][_0x345d11[_0x8ff5('0x63')]][_0x8ff5('0x57')]+=this[_0x8ff5('0x14')][_0x345d11[_0x8ff5('0x63')]]['sumHoldTime'];}this[_0x8ff5('0x13')][_0x40a5cb[_0x8ff5('0x6e')]]=_0x345d11;this['emitVoiceQueueChannelRemove'](_0x345d11);this[_0x8ff5('0x50')](this['voiceQueues'][_0x345d11['queue']]);}}ami[_0x8ff5('0x49')]('custom:voiceQueueReport',this[_0x8ff5('0x41')][_0x40a5cb[_0x8ff5('0x6e')]]);delete this[_0x8ff5('0x41')][_0x40a5cb[_0x8ff5('0x6e')]];delete this[_0x8ff5('0x13')][_0x40a5cb[_0x8ff5('0x6e')]];}if(this[_0x8ff5('0x44')][_0x40a5cb[_0x8ff5('0x6e')]]){delete this[_0x8ff5('0x44')][_0x40a5cb[_0x8ff5('0x6e')]];}}}catch(_0x2d19a9){logger['error']('[syncHangup][VoiceQueueReport]',util[_0x8ff5('0x6b')](_0x2d19a9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8ff5('0xd')][_0x8ff5('0xb3')]=function(_0x2d2d52){try{if(this[_0x8ff5('0x60')](_0x2d2d52)){var _0x5be7ac;if(this[_0x8ff5('0x41')][_0x2d2d52[_0x8ff5('0xb4')]]){_0x5be7ac=_[_0x8ff5('0x77')](this[_0x8ff5('0x41')][_0x2d2d52['transfereeuniqueid']]);_0x5be7ac[_0x8ff5('0xb5')]=_0x2d2d52[_0x8ff5('0xb6')];_0x5be7ac[_0x8ff5('0x93')]=_0x2d2d52[_0x8ff5('0xb7')];_0x5be7ac[_0x8ff5('0x83')]=_0x8ff5('0xb8');_0x5be7ac[_0x8ff5('0x89')]=!![];_0x5be7ac[_0x8ff5('0x91')]=_0x8ff5('0xb9');if(this[_0x8ff5('0x41')][_0x2d2d52[_0x8ff5('0xb7')]]){var _0x4b4ea3=this[_0x8ff5('0x41')][_0x2d2d52[_0x8ff5('0xb7')]];this['queueReports'][_0x2d2d52['secondtransfereruniqueid']]=this[_0x8ff5('0x41')][_0x2d2d52[_0x8ff5('0xb4')]];this[_0x8ff5('0x41')][_0x2d2d52[_0x8ff5('0xb4')]]=_0x4b4ea3;var _0x47648a=_[_0x8ff5('0x77')](this[_0x8ff5('0x41')][_0x2d2d52[_0x8ff5('0xb4')]]);_0x47648a['switch']=!![];}}else if(this[_0x8ff5('0x41')][_0x2d2d52[_0x8ff5('0xba')]]){_0x5be7ac=_[_0x8ff5('0x77')](this[_0x8ff5('0x41')][_0x2d2d52[_0x8ff5('0xba')]]);_0x5be7ac['transferexten']=_0x2d2d52[_0x8ff5('0xbb')];_0x5be7ac[_0x8ff5('0x93')]=_0x2d2d52[_0x8ff5('0xbc')];_0x5be7ac['queuecallerexitreason']=_0x8ff5('0xb8');_0x5be7ac[_0x8ff5('0x89')]=!![];_0x5be7ac[_0x8ff5('0x91')]=_0x8ff5('0xb9');if(this['queueReports'][_0x2d2d52[_0x8ff5('0xbc')]]){var _0x4b4ea3=this[_0x8ff5('0x41')][_0x2d2d52[_0x8ff5('0xbc')]];this['queueReports'][_0x2d2d52['origtransfereruniqueid']]=this['queueReports'][_0x2d2d52[_0x8ff5('0xba')]];this[_0x8ff5('0x41')][_0x2d2d52[_0x8ff5('0xba')]]=_0x4b4ea3;var _0x47648a=_['last'](this[_0x8ff5('0x41')][_0x2d2d52[_0x8ff5('0xba')]]);_0x47648a[_0x8ff5('0x39')]=!![];}}}}catch(_0x570fff){logger[_0x8ff5('0x42')](_0x8ff5('0xbd'),util[_0x8ff5('0x6b')](_0x570fff,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncBlindTransfer']=function(_0x1486b6){try{if(this[_0x8ff5('0x60')](_0x1486b6)){if(this[_0x8ff5('0x41')][_0x1486b6[_0x8ff5('0xb4')]]){var _0xf7bb8c=_[_0x8ff5('0x77')](this['queueReports'][_0x1486b6[_0x8ff5('0xb4')]]);_0xf7bb8c[_0x8ff5('0x83')]=_0x8ff5('0xbe');_0xf7bb8c['transfer']=!![];_0xf7bb8c[_0x8ff5('0x91')]=_0x8ff5('0xbf');_0xf7bb8c[_0x8ff5('0xb5')]=_0x1486b6[_0x8ff5('0xc0')];_0xf7bb8c[_0x8ff5('0x93')]=_0x1486b6['transfereeuniqueid'];this[_0x8ff5('0x27')]({'event':'BlindTransfer','uniqueid':_0x1486b6[_0x8ff5('0xb4')],'context':_0x1486b6[_0x8ff5('0xc1')],'channel':_0x1486b6[_0x8ff5('0xc2')]});}}}catch(_0x5bac5c){logger[_0x8ff5('0x42')](_0x8ff5('0xc3'),util[_0x8ff5('0x6b')](_0x5bac5c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8ff5('0xd')][_0x8ff5('0x2a')]=function(_0x4cb596){try{if(this[_0x8ff5('0x60')](_0x4cb596)){if(this['queueReports'][_0x4cb596['uniqueid']]){var _0xb80a3d=_[_0x8ff5('0x77')](this[_0x8ff5('0x41')][_0x4cb596[_0x8ff5('0x6e')]]);if(!_[_0x8ff5('0x3a')](_0xb80a3d['queuecallerleaveAt'])){_0xb80a3d['mohstarttime']=moment()[_0x8ff5('0x4a')](_0x8ff5('0x80'));}}}}catch(_0x24b56a){logger[_0x8ff5('0x42')](_0x8ff5('0xc4'),util[_0x8ff5('0x6b')](_0x24b56a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8ff5('0xd')][_0x8ff5('0x2c')]=function(_0x272a0a){try{if(this[_0x8ff5('0x60')](_0x272a0a)){if(this[_0x8ff5('0x41')][_0x272a0a[_0x8ff5('0x6e')]]){var _0x438bf1=_[_0x8ff5('0x77')](this[_0x8ff5('0x41')][_0x272a0a[_0x8ff5('0x6e')]]);if(!_[_0x8ff5('0x3a')](_0x438bf1[_0x8ff5('0xc5')])){_0x438bf1[_0x8ff5('0xc6')]+=moment()[_0x8ff5('0xb0')](0x0)['diff'](_0x438bf1[_0x8ff5('0xc5')],_0x8ff5('0x8f'));delete _0x438bf1[_0x8ff5('0xc5')];}}}}catch(_0x4f2aeb){logger[_0x8ff5('0x42')](_0x8ff5('0xc7'),util[_0x8ff5('0x6b')](_0x4f2aeb,{'showHidden':![],'depth':null}));}};module[_0x8ff5('0xc8')]=VoiceQueueReport;
\ No newline at end of file
+var _0x3419=['switch','isNil','Action','status','channel','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit',']\x20sending\x20voice_queue_channel:save\x20event:','format','voice:queue:%s','name','voice_queue_channel:save','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:remove\x20event:','uniqueid','emitVoiceQueueSummary','type','inbound','strategy','answered','available','pTalking','sumBillable','sumHoldTime','unmanaged','abandoned','Trunk','active','callerid','Interval','[voiceQueueReport][','isNotNull','queues','loopQueueSummary','queuesummary','[voiceQueueReport][queuesummary]','syncQueueSummary','queue','[voiceQueueReport][queuesummary]\x20event:','info','countBy','callers','loggedIn','toNumber','loggedin','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','syncQueueSummaryComplete','[voiceQueueReport][queuesummarycomplete]\x20event:','syncQueueCallerJoin','[%s][voiceQueueReport][queuecallerjoin]','isUndefined','queuecallerjoinAt','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','keys','push','emitVoiceQueueChannelSave','last','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitreason','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerabandon]','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallercomplete','queuecallerexitAt','transfer','COMPLETED','startsWith','toLowerCase','local/','linkedid','queuecallerexit','add','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','reason','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','syncVarSet','[%s][voiceQueueReport][varset]','addVariable','variable','value','CONTINUE','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','varset','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','includes','[%s][voiceQueueReport][hangup]','length','diff','seconds','sumDuration','milliseconds','total','queuecallercompleteAt','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','syncHangup','BlindTransfer','context','transfererchannel','syncMusicOnHoldStart','mohstarttime','[%s][voiceQueueReport][musiconholdstart]','syncMusicOnHoldStop','mohtime','[%s][voiceQueueReport][musiconholdstop]','exports','lodash','moment','util','md5','ioredis','../../../config/logger','ami','../ami','../model/queueReport','redis','localhost','prototype','enqueue','tail','finally','sequence','queueReports','agents','channels','voiceQueues','flagQueueSummary','campaigns','variables','bind','queuesummarycomplete','queuecallerjoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','hangup','fullybooted','syncFullyBooted','blindtransfer','syncBlindTransfer','loopQueueShow','hasOwnProperty','isEmpty','originated','talking','waiting','queueStatusComplete','unlockRR','clearZombieChannels'];(function(_0x987e6d,_0xa1fe60){var _0x345ab8=function(_0x2e8f45){while(--_0x2e8f45){_0x987e6d['push'](_0x987e6d['shift']());}};_0x345ab8(++_0xa1fe60);}(_0x3419,0xb3));var _0x9341=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x3419[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x9341('0x0'));var moment=require(_0x9341('0x1'));var util=require(_0x9341('0x2'));var md5=require(_0x9341('0x3'));var Redis=require(_0x9341('0x4'));var config=require('../../../config/environment');var logger=require(_0x9341('0x5'))(_0x9341('0x6'));var ami=require(_0x9341('0x7'));var QueueReport=require(_0x9341('0x8'));config[_0x9341('0x9')]=_['defaults'](config[_0x9341('0x9')],{'host':_0x9341('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9341('0x9')]));var Sequence=function(){};Sequence[_0x9341('0xb')][_0x9341('0xc')]=function(_0x3b736e){this[_0x9341('0xd')]=this[_0x9341('0xd')]?this['tail'][_0x9341('0xe')](_0x3b736e):_0x3b736e();};function VoiceQueueReport(_0x54f6db){this[_0x9341('0xf')]=new Sequence();this[_0x9341('0x10')]={};this[_0x9341('0x11')]=_0x54f6db['agents'];this[_0x9341('0x12')]=_0x54f6db['queueChannels'];this[_0x9341('0x13')]=_0x54f6db[_0x9341('0x13')];this[_0x9341('0x14')]=!![];this[_0x9341('0x15')]=_0x54f6db['campaigns'];this[_0x9341('0x16')]={};ami['on']('queuesummary',this['syncQueueSummary'][_0x9341('0x17')](this));ami['on'](_0x9341('0x18'),this['syncQueueSummaryComplete'][_0x9341('0x17')](this));ami['on'](_0x9341('0x19'),this['syncQueueCallerJoin'][_0x9341('0x17')](this));ami['on'](_0x9341('0x1a'),this[_0x9341('0x1b')]['bind'](this));ami['on'](_0x9341('0x1c'),this[_0x9341('0x1d')][_0x9341('0x17')](this));ami['on'](_0x9341('0x1e'),this[_0x9341('0x1f')][_0x9341('0x17')](this));ami['on'](_0x9341('0x20'),this[_0x9341('0x21')][_0x9341('0x17')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0x9341('0x22'),this['syncHangup']['bind'](this));ami['on'](_0x9341('0x23'),this[_0x9341('0x24')][_0x9341('0x17')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart']['bind'](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0x9341('0x17')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0x9341('0x25'),this[_0x9341('0x26')]['bind'](this));this['loopQueueSummary']();this[_0x9341('0x27')]();}function clearChannels(_0x5cca93){if(!_['isEmpty'](_0x5cca93)){for(var _0x3c269a in _0x5cca93){if(_0x5cca93[_0x9341('0x28')](_0x3c269a)){delete _0x5cca93[_0x3c269a];}}}}function clearCampaigns(_0x4e1eca){if(!_[_0x9341('0x29')](_0x4e1eca)){for(var _0x3761a1 in _0x4e1eca){if(_0x4e1eca[_0x9341('0x28')](_0x3761a1)){_0x4e1eca[_0x3761a1]['originated']=0x0;}}}}function clearVoiceQueues(_0x240e22){if(!_[_0x9341('0x29')](_0x240e22)){for(var _0x4698b3 in _0x240e22){if(_0x240e22['hasOwnProperty'](_0x4698b3)){_0x240e22[_0x4698b3][_0x9341('0x2a')]=0x0;_0x240e22[_0x4698b3][_0x9341('0x2b')]=0x0;_0x240e22[_0x4698b3]['pTalking']=0x0;_0x240e22[_0x4698b3][_0x9341('0x2c')]=0x0;_0x240e22[_0x4698b3][_0x9341('0x2d')]=!![];}}}}function clearAgentBooked(_0xd2864e){if(!_['isEmpty'](_0xd2864e)){for(var _0x5b719e in _0xd2864e){if(_0xd2864e[_0x9341('0x28')](_0x5b719e)){_0xd2864e[_0x5b719e][_0x9341('0x2e')]=!![];}}}}VoiceQueueReport[_0x9341('0xb')][_0x9341('0x2f')]=function(){var _0x31f15b=this;for(var _0x59e287 in this['channels']){if(this[_0x9341('0x12')][_0x9341('0x28')](_0x59e287)&&!this[_0x9341('0x12')][_0x59e287][_0x9341('0x30')]){this[_0x9341('0xf')][_0x9341('0xc')](function(){if(!_[_0x9341('0x31')](_0x31f15b[_0x9341('0x12')][_0x59e287])){return ami[_0x9341('0x32')]({'action':_0x9341('0x33'),'channel':_0x31f15b[_0x9341('0x12')][_0x59e287][_0x9341('0x34')]})[_0x9341('0x35')](function(_0x2b2a47){if(_0x2b2a47[_0x9341('0x36')]===_0x9341('0x37')){setTimeout(function(){if(_0x31f15b['channels'][_0x59e287]){delete _0x31f15b[_0x9341('0x12')][_0x59e287];logger[_0x9341('0x38')](_0x9341('0x39'),_0x59e287,util[_0x9341('0x3a')](_0x2b2a47,{'showHidden':![],'depth':null}));}if(_0x31f15b['queueReports'][_0x59e287]){delete _0x31f15b[_0x9341('0x10')][_0x59e287];logger[_0x9341('0x38')](_0x9341('0x3b'),_0x59e287,util[_0x9341('0x3a')](_0x2b2a47,{'showHidden':![],'depth':null}));}if(_0x31f15b['variables'][_0x59e287]){delete _0x31f15b[_0x9341('0x16')][_0x59e287];logger[_0x9341('0x38')](_0x9341('0x3c'),_0x59e287,util[_0x9341('0x3a')](_0x2b2a47,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0x9341('0x24')]=function(){logger[_0x9341('0x38')](_0x9341('0x3d'));clearChannels(this['channels']);this[_0x9341('0x3e')](this[_0x9341('0x10')]);clearAgentBooked(this[_0x9341('0x11')]);clearVoiceQueues(this[_0x9341('0x13')]);clearCampaigns(this[_0x9341('0x15')]);};VoiceQueueReport[_0x9341('0xb')][_0x9341('0x3e')]=function(_0x1b5d5a){var _0x28c3fc=this;if(!_[_0x9341('0x29')](_0x1b5d5a)){for(var _0xb3a7a4 in _0x1b5d5a){if(_0x1b5d5a[_0x9341('0x28')](_0xb3a7a4)){_0x28c3fc[_0x9341('0x3f')](_0x1b5d5a[_0xb3a7a4],_0x9341('0x40'));delete _0x1b5d5a[_0xb3a7a4];}}}};VoiceQueueReport[_0x9341('0xb')][_0x9341('0x41')]=function(_0x64773b,_0x253e01,_0xdefed1){io['to'](_0x64773b)[_0x9341('0x41')](_0x253e01,_0xdefed1);};VoiceQueueReport['prototype']['emitVoiceQueueChannelSave']=function(_0x364c1e,_0x3dd5f6){logger['debug']('[%s][voiceQueueReport]['+_0x3dd5f6+_0x9341('0x42'),_0x364c1e['uniqueid'],util[_0x9341('0x3a')](_0x364c1e,{'showHidden':![],'depth':null}));this['emit'](util[_0x9341('0x43')](_0x9341('0x44'),_0x364c1e[_0x9341('0x45')]),_0x9341('0x46'),_0x364c1e);};VoiceQueueReport['prototype'][_0x9341('0x3f')]=function(_0x313bf6,_0x495148){logger[_0x9341('0x47')](_0x9341('0x48')+_0x495148+_0x9341('0x49'),_0x313bf6[_0x9341('0x4a')],util[_0x9341('0x3a')](_0x313bf6,{'showHidden':![],'depth':null}));this[_0x9341('0x41')](util[_0x9341('0x43')](_0x9341('0x44'),_0x313bf6[_0x9341('0x45')]),'voice_queue_channel:remove',_0x313bf6);};VoiceQueueReport[_0x9341('0xb')][_0x9341('0x4b')]=function(_0x20e5e5,_0x13abea){if(_0x20e5e5[_0x9341('0x4c')]===_0x9341('0x4d')){var _0x31368a={'id':_0x20e5e5['id'],'name':_0x20e5e5['name'],'strategy':_0x20e5e5[_0x9341('0x4e')],'answered':_0x20e5e5[_0x9341('0x4f')],'available':_0x20e5e5[_0x9341('0x50')],'loggedIn':_0x20e5e5['loggedIn'],'pTalking':_0x20e5e5[_0x9341('0x51')],'sumBillable':_0x20e5e5[_0x9341('0x52')],'sumDuration':_0x20e5e5['sumDuration'],'sumHoldTime':_0x20e5e5[_0x9341('0x53')]||0x0,'talking':_0x20e5e5[_0x9341('0x2b')],'total':_0x20e5e5['total'],'type':_0x20e5e5[_0x9341('0x4c')],'unmanaged':_0x20e5e5[_0x9341('0x54')],'abandoned':_0x20e5e5[_0x9341('0x55')],'waiting':_0x20e5e5['waiting']};if(_0x20e5e5[_0x9341('0x56')]){_0x31368a['Trunk']={'id':_0x20e5e5[_0x9341('0x56')]['id'],'name':_0x20e5e5[_0x9341('0x56')][_0x9341('0x45')],'active':_0x20e5e5['Trunk'][_0x9341('0x57')],'callerid':_0x20e5e5[_0x9341('0x56')][_0x9341('0x58')]};}if(_0x20e5e5[_0x9341('0x59')]){_0x31368a[_0x9341('0x59')]={'id':_0x20e5e5[_0x9341('0x59')]['id'],'name':_0x20e5e5[_0x9341('0x59')][_0x9341('0x45')]};}var _0x9af7bb=md5(JSON['stringify'](_0x31368a));if(_0x20e5e5[_0x9341('0x3')]!==_0x9af7bb){_0x20e5e5['md5']=_0x9af7bb;logger[_0x9341('0x47')](_0x9341('0x5a')+_0x13abea+']\x20sending\x20voice_queue:save\x20event:',util[_0x9341('0x3a')](_0x31368a,{'showHidden':![],'depth':null}));this['emit'](util[_0x9341('0x43')](_0x9341('0x44'),_0x31368a[_0x9341('0x45')]),'voice_queue:save',_0x31368a);}}};VoiceQueueReport[_0x9341('0xb')][_0x9341('0x5b')]=function(_0x366d9a){return _0x366d9a!==null&&!_['isUndefined'](_0x366d9a);};VoiceQueueReport[_0x9341('0xb')][_0x9341('0x27')]=function(){var _0x30a5d1=this;setInterval(function(){_0x30a5d1[_0x9341('0x2f')]();ami[_0x9341('0x32')]({'action':_0x9341('0x5c')})[_0x9341('0x35')](function(_0x10c8c8){logger[_0x9341('0x38')]('[voiceQueueReport][queues]',util['inspect'](_0x10c8c8,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x9341('0xb')][_0x9341('0x5d')]=function(){var _0x16f245=this;setInterval(function(){if(_0x16f245['flagQueueSummary']){return ami[_0x9341('0x32')]({'action':_0x9341('0x5e')})['then'](function(_0x2c4a0c){_0x16f245[_0x9341('0x14')]=![];})[_0x9341('0x35')](function(_0x5032b3){logger['error'](_0x9341('0x5f'),util['inspect'](_0x5032b3,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x9341('0xb')][_0x9341('0x60')]=function(_0x32effe){try{if(this[_0x9341('0x5b')](_0x32effe)&&this[_0x9341('0x5b')](_0x32effe[_0x9341('0x61')])){logger['debug'](_0x9341('0x62'),util['inspect'](_0x32effe,{'showHidden':![],'depth':null}));if(this[_0x9341('0x13')][_0x32effe[_0x9341('0x61')]]){logger[_0x9341('0x63')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x32effe[_0x9341('0x61')]);var _0x3f6995=_[_0x9341('0x64')](this[_0x9341('0x12')],'queue')[_0x32effe[_0x9341('0x61')]]||0x0;var _0x275836=_0x3f6995-_0x32effe[_0x9341('0x65')];if(this[_0x9341('0x13')][_0x32effe[_0x9341('0x61')]]['waiting']!==_['toNumber'](_0x32effe[_0x9341('0x65')])||this['voiceQueues'][_0x32effe[_0x9341('0x61')]][_0x9341('0x66')]!==_[_0x9341('0x67')](_0x32effe[_0x9341('0x68')])||this[_0x9341('0x13')][_0x32effe['queue']][_0x9341('0x50')]!==_[_0x9341('0x67')](_0x32effe[_0x9341('0x50')])||this[_0x9341('0x13')][_0x32effe[_0x9341('0x61')]][_0x9341('0x2b')]!==_0x275836){this['voiceQueues'][_0x32effe['queue']][_0x9341('0x2c')]=_['toNumber'](_0x32effe[_0x9341('0x65')]);this[_0x9341('0x13')][_0x32effe[_0x9341('0x61')]][_0x9341('0x66')]=_[_0x9341('0x67')](_0x32effe[_0x9341('0x68')]);this['voiceQueues'][_0x32effe[_0x9341('0x61')]][_0x9341('0x50')]=_[_0x9341('0x67')](_0x32effe['available']);this[_0x9341('0x13')][_0x32effe[_0x9341('0x61')]][_0x9341('0x2b')]=_0x275836>0x0?_0x275836:0x0;this[_0x9341('0x13')][_0x32effe[_0x9341('0x61')]]['talking']=this[_0x9341('0x13')][_0x32effe[_0x9341('0x61')]][_0x9341('0x2b')]>_[_0x9341('0x67')](_0x32effe[_0x9341('0x68')])?_['toNumber'](_0x32effe[_0x9341('0x68')]):this[_0x9341('0x13')][_0x32effe[_0x9341('0x61')]]['talking'];this[_0x9341('0x4b')](this[_0x9341('0x13')][_0x32effe[_0x9341('0x61')]],'queuesummary');}logger[_0x9341('0x47')](_0x9341('0x69'),util[_0x9341('0x3a')](this[_0x9341('0x13')][_0x32effe[_0x9341('0x61')]],{'showHidden':![],'depth':null}));ami[_0x9341('0x41')](_0x9341('0x6a'),this[_0x9341('0x13')][_0x32effe['queue']]);}}}catch(_0x1b82a7){logger[_0x9341('0x38')]('[voiceQueueReport][queuesummary]',util[_0x9341('0x3a')](_0x1b82a7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9341('0xb')][_0x9341('0x6b')]=function(_0x8f1450){logger[_0x9341('0x47')](_0x9341('0x6c'),util[_0x9341('0x3a')](_0x8f1450,{'showHidden':![],'depth':null}));this[_0x9341('0x14')]=!![];};VoiceQueueReport[_0x9341('0xb')][_0x9341('0x6d')]=function(_0x3e600f){try{if(this['isNotNull'](_0x3e600f)){logger[_0x9341('0x47')](_0x9341('0x6e'),_0x3e600f[_0x9341('0x4a')],util[_0x9341('0x3a')](_0x3e600f,{'showHidden':![],'depth':null}));if(_[_0x9341('0x6f')](this[_0x9341('0x10')][_0x3e600f[_0x9341('0x4a')]])){this[_0x9341('0x10')][_0x3e600f[_0x9341('0x4a')]]=[];this[_0x9341('0x12')][_0x3e600f[_0x9341('0x4a')]]={};}var _0x364ef5=new QueueReport();_0x364ef5['name']=_0x3e600f[_0x9341('0x61')];_0x364ef5[_0x9341('0x4c')]=this[_0x9341('0x13')][_0x364ef5[_0x9341('0x45')]]&&this[_0x9341('0x13')][_0x364ef5[_0x9341('0x45')]]['type']?this[_0x9341('0x13')][_0x364ef5[_0x9341('0x45')]][_0x9341('0x4c')]||_0x9341('0x4d'):'inbound';_0x364ef5['queue']=_0x3e600f[_0x9341('0x61')];_0x364ef5[_0x9341('0x70')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x364ef5[_0x9341('0x71')]=_0x3e600f[_0x9341('0x71')];_0x364ef5['count']=_0x3e600f[_0x9341('0x72')];_0x364ef5[_0x9341('0x4a')]=_0x3e600f[_0x9341('0x4a')];logger[_0x9341('0x63')](_0x9341('0x73'),_0x364ef5[_0x9341('0x45')],_0x364ef5[_0x9341('0x4c')]);_[_0x9341('0x74')](_0x364ef5,_[_0x9341('0x75')](_0x3e600f,_[_0x9341('0x76')](_0x364ef5)));this[_0x9341('0x10')][_0x3e600f[_0x9341('0x4a')]][_0x9341('0x77')](_0x364ef5);this[_0x9341('0x12')][_0x3e600f[_0x9341('0x4a')]]=_0x364ef5;this[_0x9341('0x78')](_0x364ef5,_0x9341('0x19'));}}catch(_0x195a33){logger[_0x9341('0x38')](_0x9341('0x6e'),_0x3e600f[_0x9341('0x4a')],util['inspect'](_0x195a33,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9341('0xb')][_0x9341('0x1b')]=function(_0x5c7b5a){try{if(this[_0x9341('0x5b')](_0x5c7b5a)){logger[_0x9341('0x47')]('[%s][voiceQueueReport][queuecallerabandon]',_0x5c7b5a['uniqueid'],util[_0x9341('0x3a')](_0x5c7b5a,{'showHidden':![],'depth':null}));if(this[_0x9341('0x10')][_0x5c7b5a[_0x9341('0x4a')]]){var _0x5878b8=_[_0x9341('0x79')](this['queueReports'][_0x5c7b5a[_0x9341('0x4a')]]);_0x5878b8['queuecallercomplete']=![];_0x5878b8['queuecallercompleteAt']=null;_0x5878b8[_0x9341('0x7a')]=_0x5c7b5a[_0x9341('0x7a')];_0x5878b8['originalposition']=_0x5c7b5a[_0x9341('0x7b')];_0x5878b8['queuecallerabandon']=!![];_0x5878b8[_0x9341('0x7c')]=moment()[_0x9341('0x43')](_0x9341('0x7d'));_0x5878b8[_0x9341('0x7e')]='ABANDONED';_0x5878b8[_0x9341('0x7f')]=null;logger[_0x9341('0x63')](_0x9341('0x80'),_0x5878b8[_0x9341('0x45')],_0x5878b8[_0x9341('0x4c')]);this[_0x9341('0x12')][_0x5c7b5a[_0x9341('0x4a')]]=_0x5878b8;this[_0x9341('0x3f')](_0x5878b8,'queuecallerabandon');}}}catch(_0x192a93){logger['error'](_0x9341('0x81'),_0x5c7b5a[_0x9341('0x4a')],util[_0x9341('0x3a')](_0x192a93,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9341('0xb')][_0x9341('0x1d')]=function(_0x4a36bf){try{if(this['isNotNull'](_0x4a36bf)){logger['debug'](_0x9341('0x82'),_0x4a36bf['uniqueid'],util[_0x9341('0x3a')](_0x4a36bf,{'showHidden':![],'depth':null}));if(this[_0x9341('0x10')][_0x4a36bf['uniqueid']]){var _0x4243cd=_['last'](this[_0x9341('0x10')][_0x4a36bf[_0x9341('0x4a')]]);_0x4243cd[_0x9341('0x83')]=moment()[_0x9341('0x43')](_0x9341('0x7d'));_0x4243cd['connectedlinenum']=_0x4a36bf[_0x9341('0x84')];_0x4243cd[_0x9341('0x85')]=_0x4a36bf[_0x9341('0x85')];logger[_0x9341('0x63')](_0x9341('0x86'),_0x4243cd[_0x9341('0x45')],_0x4243cd[_0x9341('0x4c')],_0x4a36bf[_0x9341('0x84')],_0x4a36bf[_0x9341('0x85')]);this['channels'][_0x4a36bf[_0x9341('0x4a')]]=_0x4243cd;this[_0x9341('0x78')](_0x4243cd,'queuecallerleave');}}}catch(_0x1fc9c9){logger[_0x9341('0x38')](_0x9341('0x82'),_0x4a36bf[_0x9341('0x4a')],util[_0x9341('0x3a')](_0x1fc9c9,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9341('0x21')]=function(_0x35ffa5){try{if(this[_0x9341('0x5b')](_0x35ffa5)){logger[_0x9341('0x47')](_0x9341('0x87'),_0x35ffa5[_0x9341('0x4a')],util['inspect'](_0x35ffa5,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x35ffa5[_0x9341('0x4a')]]){var _0x77bf48=_[_0x9341('0x79')](this[_0x9341('0x10')][_0x35ffa5[_0x9341('0x4a')]]);_0x77bf48['queuecallercomplete']=!![];_0x77bf48[_0x9341('0x7e')]=_0x9341('0x88');logger[_0x9341('0x63')](_0x9341('0x89'),_0x77bf48[_0x9341('0x45')],_0x77bf48[_0x9341('0x4c')]);}}}catch(_0x28b616){logger[_0x9341('0x38')]('[%s][voiceQueueReport][agentconnect]',_0x35ffa5[_0x9341('0x4a')],util[_0x9341('0x3a')](_0x28b616,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9341('0xb')]['syncAgentComplete']=function(_0x661b2f){try{if(this['isNotNull'](_0x661b2f)){logger[_0x9341('0x47')](_0x9341('0x8a'),_0x661b2f[_0x9341('0x4a')],util[_0x9341('0x3a')](_0x661b2f,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x661b2f[_0x9341('0x4a')]]){var _0x4afd5b=_[_0x9341('0x79')](this[_0x9341('0x10')][_0x661b2f[_0x9341('0x4a')]]);_0x4afd5b[_0x9341('0x1a')]=![];_0x4afd5b[_0x9341('0x7c')]=null;_0x4afd5b[_0x9341('0x8b')]=!![];_0x4afd5b[_0x9341('0x7f')]=_0x661b2f[_0x9341('0x8c')];_0x4afd5b['holdtime']=_0x661b2f['holdtime'];_0x4afd5b[_0x9341('0x8d')]=!![];_0x4afd5b['queuecallerexit']=![];_0x4afd5b[_0x9341('0x8e')]=null;if(!_0x4afd5b[_0x9341('0x8f')]){if(_0x661b2f['reason']==_0x9341('0x8f')){_0x4afd5b['queuecallerexitreason']=_0x9341('0x90');logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x4afd5b[_0x9341('0x45')],_0x4afd5b[_0x9341('0x4c')]);}else{if(_[_0x9341('0x91')](_0x661b2f['channel'][_0x9341('0x92')](),_0x9341('0x93'))){if(this[_0x9341('0x10')][_0x661b2f[_0x9341('0x94')]]){var _0x42cb3e=_[_0x9341('0x79')](this['queueReports'][_0x661b2f[_0x9341('0x94')]]);_0x42cb3e[_0x9341('0x8d')]=![];_0x42cb3e[_0x9341('0x95')]=!![];_0x42cb3e[_0x9341('0x8e')]=moment(_0x4afd5b[_0x9341('0x70')])[_0x9341('0x96')](_0x661b2f[_0x9341('0x7a')],'seconds')[_0x9341('0x43')](_0x9341('0x7d'));_0x42cb3e[_0x9341('0x7e')]=_0x9341('0x97');_0x42cb3e[_0x9341('0x8f')]=!![];_0x42cb3e[_0x9341('0x98')]=_0x9341('0x99');_0x42cb3e[_0x9341('0x9a')]=_0x661b2f[_0x9341('0x9b')];_0x42cb3e[_0x9341('0x9c')]=_0x661b2f[_0x9341('0x4a')];logger['info'](_0x9341('0x9d'),_0x42cb3e[_0x9341('0x45')],_0x42cb3e[_0x9341('0x4c')]);var _0x48eda3=this[_0x9341('0x10')][_0x661b2f[_0x9341('0x94')]];this['queueReports'][_0x661b2f[_0x9341('0x94')]]=this[_0x9341('0x10')][_0x661b2f[_0x9341('0x4a')]];this[_0x9341('0x10')][_0x661b2f[_0x9341('0x4a')]]=_0x48eda3;}}else{_0x4afd5b[_0x9341('0x7e')]=_0x9341('0x9e')+_0x661b2f[_0x9341('0x9f')][_0x9341('0xa0')]();logger[_0x9341('0x63')](_0x9341('0xa1'),_0x4afd5b['name'],_0x4afd5b[_0x9341('0x4c')],_0x4afd5b[_0x9341('0x7e')]);}}}this[_0x9341('0x12')][_0x661b2f['uniqueid']]=_0x4afd5b;this[_0x9341('0x3f')](_0x4afd5b,'agentcomplete');}}}catch(_0x49dc01){logger[_0x9341('0x38')](_0x9341('0x8a'),_0x661b2f[_0x9341('0x4a')],util[_0x9341('0x3a')](_0x49dc01,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9341('0xb')][_0x9341('0xa2')]=function(_0x5899e2){try{if(this[_0x9341('0x5b')](_0x5899e2)){logger['debug'](_0x9341('0xa3'),_0x5899e2[_0x9341('0x4a')],util[_0x9341('0x3a')](_0x5899e2,{'showHidden':![],'depth':null}));this[_0x9341('0xa4')](_0x5899e2[_0x9341('0x4a')],_[_0x9341('0x76')](_0x5899e2[_0x9341('0xa5')])[0x0],_0x5899e2[_0x9341('0xa6')]);if(this[_0x9341('0x10')][_0x5899e2[_0x9341('0x4a')]]){var _0x44cf43=_['last'](this[_0x9341('0x10')][_0x5899e2[_0x9341('0x4a')]]);if(_0x44cf43){if(this[_0x9341('0x5b')](_0x5899e2[_0x9341('0xa5')])&&this[_0x9341('0x5b')](_0x5899e2[_0x9341('0xa5')]['queuestatus'])){switch(_0x5899e2[_0x9341('0xa6')]){case _0x9341('0xa7'):_0x44cf43[_0x9341('0x95')]=![];_0x44cf43[_0x9341('0x8e')]=null;break;case'TIMEOUT':_0x44cf43[_0x9341('0xa8')]=_0x9341('0xa9');_0x44cf43[_0x9341('0x95')]=!![];_0x44cf43[_0x9341('0x8e')]=moment()[_0x9341('0x43')](_0x9341('0x7d'));_0x44cf43[_0x9341('0x83')]=moment()[_0x9341('0x43')](_0x9341('0x7d'));logger['debug'](_0x9341('0xaa'),_0x5899e2[_0x9341('0x4a')],util[_0x9341('0x3a')](_0x44cf43,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0x44cf43);break;default:_0x44cf43[_0x9341('0x95')]=!![];_0x44cf43[_0x9341('0x8e')]=moment()[_0x9341('0x43')](_0x9341('0x7d'));_0x44cf43[_0x9341('0x83')]=moment()[_0x9341('0x43')]('YYYY-MM-DD\x20HH:mm:ss');}_0x44cf43['queuecallerabandon']=![];_0x44cf43[_0x9341('0x7c')]=null;_0x44cf43['queuecallerexitreason']=_0x5899e2['value'];this['channels'][_0x5899e2[_0x9341('0x4a')]]=_0x44cf43;this[_0x9341('0x3f')](_0x44cf43,_0x9341('0xab'));}else if(this[_0x9341('0x5b')](_0x5899e2['variable'])&&this[_0x9341('0x5b')](_0x5899e2['variable']['queueposition'])){if(!_0x44cf43[_0x9341('0x1a')]){_0x44cf43[_0x9341('0x95')]=!![];_0x44cf43[_0x9341('0x8e')]=moment()[_0x9341('0x43')](_0x9341('0x7d'));_0x44cf43[_0x9341('0x7e')]=_0x9341('0xac');_0x44cf43[_0x9341('0x83')]=moment()[_0x9341('0x43')](_0x9341('0x7d'));this[_0x9341('0x12')][_0x5899e2[_0x9341('0x4a')]]=_0x44cf43;}}logger[_0x9341('0x63')](_0x9341('0xad'),_0x5899e2['uniqueid'],_0x44cf43['name'],_0x44cf43[_0x9341('0x4c')],_['keys'](_0x5899e2[_0x9341('0xa5')])[0x0],_0x5899e2['value']);_0x44cf43[_0x9341('0x16')]=this['variables'][_0x5899e2[_0x9341('0x4a')]];}}}}catch(_0x1a3113){logger[_0x9341('0x38')](_0x9341('0xa3'),_0x5899e2[_0x9341('0x4a')],util[_0x9341('0x3a')](_0x1a3113,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x27f803,_0x11a73d,_0x438029){var _0x2ca741=['rtpaudioqos',_0x9341('0xae'),_0x9341('0xaf'),_0x9341('0xb0'),_0x9341('0xb1'),_0x9341('0xb2'),'rtpaudioqosrtt',_0x9341('0xb3'),_0x9341('0xb4'),_0x9341('0xb5'),_0x9341('0xb6'),_0x9341('0xb7'),'membercalls',_0x9341('0xb8'),_0x9341('0xb9'),_0x9341('0xba'),_0x9341('0x8c'),_0x9341('0xbb'),'memberrealtime'];if(!_[_0x9341('0x31')](_0x11a73d)&&!_[_0x9341('0xbc')](_0x2ca741,_0x11a73d)){if(_['isUndefined'](this[_0x9341('0x16')][_0x27f803])){this['variables'][_0x27f803]={};}this[_0x9341('0x16')][_0x27f803][_0x11a73d]=_0x438029;}};VoiceQueueReport[_0x9341('0xb')]['syncHangup']=function(_0x1cbea3){try{if(this[_0x9341('0x5b')](_0x1cbea3)){logger[_0x9341('0x47')](_0x9341('0xbd'),_0x1cbea3[_0x9341('0x4a')],util[_0x9341('0x3a')](_0x1cbea3,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1cbea3[_0x9341('0x4a')]]){for(var _0x24a1f7=0x0,_0x4cf61a={};_0x24a1f7<this[_0x9341('0x10')][_0x1cbea3[_0x9341('0x4a')]][_0x9341('0xbe')];_0x24a1f7+=0x1){_0x4cf61a=this[_0x9341('0x10')][_0x1cbea3[_0x9341('0x4a')]][_0x24a1f7];if(this[_0x9341('0x13')][_0x4cf61a[_0x9341('0x61')]]){if(_0x4cf61a['queuecallerexit']){this[_0x9341('0x13')][_0x4cf61a[_0x9341('0x61')]][_0x9341('0x54')]+=0x1;}if(_0x4cf61a[_0x9341('0x1a')]){this[_0x9341('0x13')][_0x4cf61a[_0x9341('0x61')]][_0x9341('0x55')]+=0x1;}this[_0x9341('0x13')][_0x4cf61a[_0x9341('0x61')]][_0x9341('0x53')]+=moment(_0x4cf61a[_0x9341('0x83')])[_0x9341('0xbf')](_0x4cf61a[_0x9341('0x70')],_0x9341('0xc0'))||0x0;if(_0x24a1f7===this[_0x9341('0x10')][_0x1cbea3[_0x9341('0x4a')]][_0x9341('0xbe')]-0x1){this[_0x9341('0x13')][_0x4cf61a[_0x9341('0x61')]][_0x9341('0xc1')]+=moment()[_0x9341('0xc2')](0x0)[_0x9341('0xbf')](_0x4cf61a[_0x9341('0x70')],'seconds');this[_0x9341('0x13')][_0x4cf61a[_0x9341('0x61')]][_0x9341('0xc3')]+=0x1;if(_0x4cf61a[_0x9341('0x8d')]){this[_0x9341('0x13')][_0x4cf61a[_0x9341('0x61')]][_0x9341('0x4f')]+=0x1;this[_0x9341('0x13')][_0x4cf61a[_0x9341('0x61')]][_0x9341('0x52')]+=moment()[_0x9341('0xc2')](0x0)[_0x9341('0xbf')](_0x4cf61a[_0x9341('0x83')],_0x9341('0xc0'));_0x4cf61a[_0x9341('0xc4')]=moment()[_0x9341('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x4cf61a[_0x9341('0x95')]=![];_0x4cf61a[_0x9341('0x8e')]=null;}if(_0x4cf61a[_0x9341('0x95')]){_0x4cf61a['lastevent']=_0x9341('0x54');logger[_0x9341('0x47')](_0x9341('0xc5'),_0x1cbea3[_0x9341('0x4a')],util[_0x9341('0x3a')](_0x4cf61a,{'showHidden':![],'depth':null}));ami['emit']('custom:queuecallerunmanaged',_0x4cf61a);}if(_0x4cf61a[_0x9341('0x1a')]){_0x4cf61a[_0x9341('0xa8')]=_0x9341('0x55');logger[_0x9341('0x47')](_0x9341('0xc6'),_0x1cbea3['uniqueid'],util['inspect'](_0x4cf61a,{'showHidden':![],'depth':null}));ami[_0x9341('0x41')](_0x9341('0xc7'),_0x4cf61a);}}else{this[_0x9341('0x13')][_0x4cf61a[_0x9341('0x61')]][_0x9341('0xc1')]+=this['voiceQueues'][_0x4cf61a['queue']][_0x9341('0x53')];}logger['info'](_0x9341('0xc8'),_0x1cbea3[_0x9341('0x4a')],_0x4cf61a['name'],_0x4cf61a[_0x9341('0x4c')],_0x1cbea3['cause-txt']);this[_0x9341('0x12')][_0x1cbea3[_0x9341('0x4a')]]=_0x4cf61a;this[_0x9341('0x3f')](_0x4cf61a,_0x9341('0x22'));this[_0x9341('0x4b')](this['voiceQueues'][_0x4cf61a[_0x9341('0x61')]],_0x9341('0x22'));}}logger[_0x9341('0x47')](_0x9341('0xc9'),_0x1cbea3['uniqueid'],util[_0x9341('0x3a')](this[_0x9341('0x10')][_0x1cbea3[_0x9341('0x4a')]],{'showHidden':![],'depth':null}));ami[_0x9341('0x41')](_0x9341('0xca'),this[_0x9341('0x10')][_0x1cbea3['uniqueid']]);delete this['queueReports'][_0x1cbea3[_0x9341('0x4a')]];delete this['channels'][_0x1cbea3[_0x9341('0x4a')]];}if(this[_0x9341('0x16')][_0x1cbea3[_0x9341('0x4a')]]){delete this[_0x9341('0x16')][_0x1cbea3[_0x9341('0x4a')]];}}}catch(_0xba58cc){logger[_0x9341('0x38')](_0x9341('0xbd'),_0x1cbea3[_0x9341('0x4a')],util[_0x9341('0x3a')](_0xba58cc,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAttendedTransfer']=function(_0x4a422d){try{if(this[_0x9341('0x5b')](_0x4a422d)){logger[_0x9341('0x47')](_0x9341('0xcb'),_0x4a422d[_0x9341('0x4a')],util[_0x9341('0x3a')](_0x4a422d,{'showHidden':![],'depth':null}));var _0x4d32f8;if(this[_0x9341('0x10')][_0x4a422d[_0x9341('0xcc')]]){_0x4d32f8=_[_0x9341('0x79')](this[_0x9341('0x10')][_0x4a422d[_0x9341('0xcc')]]);_0x4d32f8['transferexten']=_0x4a422d['secondtransfererexten'];_0x4d32f8[_0x9341('0x9c')]=_0x4a422d[_0x9341('0xcd')];_0x4d32f8[_0x9341('0x7e')]=_0x9341('0xce');_0x4d32f8[_0x9341('0x8f')]=!![];_0x4d32f8[_0x9341('0x98')]=_0x9341('0xcf');if(this[_0x9341('0x10')][_0x4a422d['secondtransfereruniqueid']]){var _0x55bf74=this['queueReports'][_0x4a422d['secondtransfereruniqueid']];this[_0x9341('0x10')][_0x4a422d['secondtransfereruniqueid']]=this[_0x9341('0x10')][_0x4a422d[_0x9341('0xcc')]];this['queueReports'][_0x4a422d[_0x9341('0xcc')]]=_0x55bf74;var _0xf19efe=_[_0x9341('0x79')](this[_0x9341('0x10')][_0x4a422d['transfereeuniqueid']]);_0xf19efe[_0x9341('0x30')]=!![];}logger[_0x9341('0x63')](_0x9341('0xd0'),_0x4a422d[_0x9341('0x4a')],_0x4d32f8[_0x9341('0x45')],_0x4d32f8['type'],_0x4d32f8['transferexten'],_0x4d32f8['transferuniqueid']);}else if(this[_0x9341('0x10')][_0x4a422d[_0x9341('0xd1')]]){_0x4d32f8=_[_0x9341('0x79')](this[_0x9341('0x10')][_0x4a422d['transfertargetuniqueid']]);_0x4d32f8[_0x9341('0x9a')]=_0x4a422d[_0x9341('0xd2')];_0x4d32f8[_0x9341('0x9c')]=_0x4a422d[_0x9341('0xd3')];_0x4d32f8['queuecallerexitreason']=_0x9341('0xce');_0x4d32f8[_0x9341('0x8f')]=!![];_0x4d32f8[_0x9341('0x98')]=_0x9341('0xcf');if(this[_0x9341('0x10')][_0x4a422d['origtransfereruniqueid']]){var _0x55bf74=this[_0x9341('0x10')][_0x4a422d['origtransfereruniqueid']];this[_0x9341('0x10')][_0x4a422d[_0x9341('0xd3')]]=this[_0x9341('0x10')][_0x4a422d[_0x9341('0xd1')]];this[_0x9341('0x10')][_0x4a422d[_0x9341('0xd1')]]=_0x55bf74;var _0xf19efe=_[_0x9341('0x79')](this[_0x9341('0x10')][_0x4a422d[_0x9341('0xd1')]]);_0xf19efe[_0x9341('0x30')]=!![];}logger[_0x9341('0x63')]('[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s',_0x4a422d[_0x9341('0x4a')],_0x4d32f8[_0x9341('0x45')],_0x4d32f8[_0x9341('0x4c')],_0x4d32f8['transferexten'],_0x4d32f8[_0x9341('0x9c')]);}}}catch(_0x162364){logger['error'](_0x9341('0xcb'),_0x4a422d[_0x9341('0x4a')],util[_0x9341('0x3a')](_0x162364,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9341('0x26')]=function(_0x367396){try{if(this[_0x9341('0x5b')](_0x367396)){logger['debug']('[%s][voiceQueueReport][blindtransfer]',_0x367396[_0x9341('0x4a')],util[_0x9341('0x3a')](_0x367396,{'showHidden':![],'depth':null}));if(this[_0x9341('0x10')][_0x367396[_0x9341('0xcc')]]){var _0x5e59e3=_[_0x9341('0x79')](this[_0x9341('0x10')][_0x367396[_0x9341('0xcc')]]);_0x5e59e3['queuecallerexitreason']=_0x9341('0xd4');_0x5e59e3[_0x9341('0x8f')]=!![];_0x5e59e3[_0x9341('0x98')]=_0x9341('0xd5');_0x5e59e3[_0x9341('0x9a')]=_0x367396[_0x9341('0xd6')];_0x5e59e3[_0x9341('0x9c')]=_0x367396[_0x9341('0xcc')];logger['info'](_0x9341('0xd7'),_0x367396[_0x9341('0x4a')],_0x5e59e3[_0x9341('0x45')],_0x5e59e3['type'],_0x5e59e3['transferexten'],_0x5e59e3[_0x9341('0x9c')]);this[_0x9341('0xd8')]({'event':_0x9341('0xd9'),'uniqueid':_0x367396[_0x9341('0xcc')],'context':_0x367396[_0x9341('0xda')],'channel':_0x367396[_0x9341('0xdb')]});}}}catch(_0x3eccf0){logger[_0x9341('0x38')]('[%s][voiceQueueReport][blindtransfer]',_0x367396[_0x9341('0x4a')],util[_0x9341('0x3a')](_0x3eccf0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9341('0xb')][_0x9341('0xdc')]=function(_0x5eb4ca){try{if(this[_0x9341('0x5b')](_0x5eb4ca)){logger['debug']('[%s][voiceQueueReport][musiconholdstart]',_0x5eb4ca[_0x9341('0x4a')],util['inspect'](_0x5eb4ca,{'showHidden':![],'depth':null}));if(this[_0x9341('0x10')][_0x5eb4ca[_0x9341('0x4a')]]){var _0x2eed05=_[_0x9341('0x79')](this[_0x9341('0x10')][_0x5eb4ca[_0x9341('0x4a')]]);if(!_[_0x9341('0x31')](_0x2eed05[_0x9341('0x83')])){_0x2eed05[_0x9341('0xdd')]=moment()[_0x9341('0x43')](_0x9341('0x7d'));logger[_0x9341('0x63')]('[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s',_0x5eb4ca[_0x9341('0x4a')],_0x2eed05['mohstarttime']);}}}}catch(_0x2fb67b){logger[_0x9341('0x38')](_0x9341('0xde'),_0x5eb4ca['uniqueid'],util[_0x9341('0x3a')](_0x2fb67b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9341('0xb')][_0x9341('0xdf')]=function(_0x14e142){try{if(this[_0x9341('0x5b')](_0x14e142)){logger[_0x9341('0x47')]('[%s][voiceQueueReport][musiconholdstop]',_0x14e142[_0x9341('0x4a')],util['inspect'](_0x14e142,{'showHidden':![],'depth':null}));if(this[_0x9341('0x10')][_0x14e142[_0x9341('0x4a')]]){var _0x26dae4=_['last'](this[_0x9341('0x10')][_0x14e142['uniqueid']]);if(!_[_0x9341('0x31')](_0x26dae4[_0x9341('0xdd')])){_0x26dae4[_0x9341('0xe0')]+=moment()[_0x9341('0xc2')](0x0)[_0x9341('0xbf')](_0x26dae4[_0x9341('0xdd')],_0x9341('0xc0'));logger[_0x9341('0x63')]('[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s',_0x14e142[_0x9341('0x4a')],_0x26dae4['mohtime']);delete _0x26dae4[_0x9341('0xdd')];}}}}catch(_0x1d7d25){logger['error'](_0x9341('0xe1'),_0x14e142[_0x9341('0x4a')],util[_0x9341('0x3a')](_0x1d7d25,{'showHidden':![],'depth':null}));}};module[_0x9341('0xe2')]=VoiceQueueReport;
\ No newline at end of file