36722048eaae8d8a78fc3dd14e98afe4ed345728
[motion2.git] / server / services / ami / report / voiceAgentReport.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 _0xbd49=['[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentconnectAt','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','variable','[%s][voiceAgentReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','channel','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','substring','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','util','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','isUndefined','called','queue','mandatoryDisposition','type','inbound','merge','omit','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','inspect','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','YYYY-MM-DD\x20HH:mm:ss','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answered_elsewhere','reason','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','custom:agentqueuecallerabandon'];(function(_0x28baa3,_0x4f7c5a){var _0x1db879=function(_0x1eca44){while(--_0x1eca44){_0x28baa3['push'](_0x28baa3['shift']());}};_0x1db879(++_0x4f7c5a);}(_0xbd49,0xe1));var _0x9bd4=function(_0x14b926,_0x2eefcd){_0x14b926=_0x14b926-0x0;var _0xf2b3bf=_0xbd49[_0x14b926];return _0xf2b3bf;};'use strict';var _=require(_0x9bd4('0x0'));var moment=require('moment');var util=require(_0x9bd4('0x1'));var Redis=require('ioredis');var config=require(_0x9bd4('0x2'));var logger=require(_0x9bd4('0x3'))(_0x9bd4('0x4'));var ami=require(_0x9bd4('0x5'));config[_0x9bd4('0x6')]=_['defaults'](config[_0x9bd4('0x6')],{'host':_0x9bd4('0x7'),'port':0x18eb});var io=require(_0x9bd4('0x8'))(new Redis(config[_0x9bd4('0x6')]));function VoiceAgentReport(_0x952a38){this[_0x9bd4('0x9')]={};this[_0x9bd4('0xa')]=_0x952a38['voiceQueues'];this[_0x9bd4('0xb')]=_0x952a38['agents'];this[_0x9bd4('0xc')]={};ami['on'](_0x9bd4('0xd'),this[_0x9bd4('0xe')][_0x9bd4('0xf')](this));ami['on'](_0x9bd4('0x10'),this[_0x9bd4('0x11')]['bind'](this));ami['on'](_0x9bd4('0x12'),this[_0x9bd4('0x13')][_0x9bd4('0xf')](this));ami['on'](_0x9bd4('0x14'),this[_0x9bd4('0x15')][_0x9bd4('0xf')](this));ami['on'](_0x9bd4('0x16'),this[_0x9bd4('0x17')][_0x9bd4('0xf')](this));ami['on'](_0x9bd4('0x18'),this[_0x9bd4('0x19')][_0x9bd4('0xf')](this));ami['on'](_0x9bd4('0x1a'),this[_0x9bd4('0x1b')][_0x9bd4('0xf')](this));ami['on'](_0x9bd4('0x1c'),this['syncMusicOnHoldStart'][_0x9bd4('0xf')](this));ami['on']('musiconholdstop',this[_0x9bd4('0x1d')][_0x9bd4('0xf')](this));ami['on'](_0x9bd4('0x1e'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0x9bd4('0x1f'),this[_0x9bd4('0x20')]['bind'](this));}VoiceAgentReport['prototype']['emit']=function(_0x211f02,_0x44195f,_0x4c4886){io['to'](_0x211f02)[_0x9bd4('0x21')](_0x44195f,_0x4c4886);};VoiceAgentReport[_0x9bd4('0x22')][_0x9bd4('0x23')]=function(_0x2e740f){return _0x2e740f!==null&&!_['isUndefined'](_0x2e740f);};VoiceAgentReport[_0x9bd4('0x22')][_0x9bd4('0xe')]=function(_0x314245){try{if(this[_0x9bd4('0x23')](_0x314245)){logger[_0x9bd4('0x24')](_0x9bd4('0x25'),_0x314245[_0x9bd4('0x26')],_0x314245[_0x9bd4('0x27')],_0x314245[_0x9bd4('0x28')]);logger[_0x9bd4('0x29')](_0x9bd4('0x2a'),_0x314245[_0x9bd4('0x26')],util['inspect'](_0x314245,{'showHidden':![],'depth':null}));if(_[_0x9bd4('0x2b')](this[_0x9bd4('0x9')][_0x314245[_0x9bd4('0x26')]])){this[_0x9bd4('0x9')][_0x314245[_0x9bd4('0x26')]]={};}if(_[_0x9bd4('0x2b')](this[_0x9bd4('0x9')][_0x314245['uniqueid']][_0x314245[_0x9bd4('0x28')]])){this['channels'][_0x314245['uniqueid']][_0x314245['destuniqueid']]={'agentcalledAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x9bd4('0x2c'),'mandatoryDisposition':this[_0x9bd4('0xa')][_0x314245[_0x9bd4('0x2d')]]?this['voiceQueues'][_0x314245[_0x9bd4('0x2d')]][_0x9bd4('0x2e')]||![]:![],'type':this['voiceQueues'][_0x314245[_0x9bd4('0x2d')]]?this[_0x9bd4('0xa')][_0x314245[_0x9bd4('0x2d')]][_0x9bd4('0x2f')]||_0x9bd4('0x30'):_0x9bd4('0x30'),'variables':this[_0x9bd4('0xc')][_0x314245[_0x9bd4('0x26')]]};}_[_0x9bd4('0x31')](this[_0x9bd4('0x9')][_0x314245['uniqueid']][_0x314245[_0x9bd4('0x28')]],_[_0x9bd4('0x32')](_0x314245,['event',_0x9bd4('0x33')]));logger[_0x9bd4('0x29')](_0x9bd4('0x34'),_0x314245[_0x9bd4('0x26')],util[_0x9bd4('0x35')](this['channels'][_0x314245[_0x9bd4('0x26')]][_0x314245['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x9bd4('0x36'),this[_0x9bd4('0x9')][_0x314245['uniqueid']][_0x314245['destuniqueid']]);logger[_0x9bd4('0x29')](_0x9bd4('0x37'),_0x314245[_0x9bd4('0x26')],util[_0x9bd4('0x35')](this[_0x9bd4('0x9')][_0x314245[_0x9bd4('0x26')]][_0x314245['destuniqueid']],{'showHidden':![],'depth':null}));this['emit'](util[_0x9bd4('0x38')](_0x9bd4('0x39'),_0x314245[_0x9bd4('0x27')]),_0x9bd4('0x3a'),this['channels'][_0x314245[_0x9bd4('0x26')]][_0x314245[_0x9bd4('0x28')]]);}}catch(_0x4647f2){logger[_0x9bd4('0x3b')](_0x9bd4('0x3c'),_0x314245[_0x9bd4('0x26')],util[_0x9bd4('0x35')](_0x4647f2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9bd4('0x22')][_0x9bd4('0x11')]=function(_0x2ee336){try{if(this[_0x9bd4('0x23')](_0x2ee336)){if(this[_0x9bd4('0x9')][_0x2ee336['uniqueid']]){logger[_0x9bd4('0x29')](_0x9bd4('0x3d'),_0x2ee336[_0x9bd4('0x26')],util['inspect'](_0x2ee336,{'showHidden':![],'depth':null}));for(var _0xa684bf in this[_0x9bd4('0x9')][_0x2ee336['uniqueid']]){if(this[_0x9bd4('0x9')][_0x2ee336['uniqueid']][_0x9bd4('0x3e')](_0xa684bf)){if(_0x2ee336[_0x9bd4('0x28')]===_0xa684bf){logger[_0x9bd4('0x24')](_0x9bd4('0x3f'),_0x2ee336['uniqueid'],_0x2ee336['membername'],_0x2ee336['destuniqueid']);this[_0x9bd4('0x9')][_0x2ee336['uniqueid']][_0xa684bf]['agentconnectAt']=moment()['format'](_0x9bd4('0x40'));this[_0x9bd4('0x9')][_0x2ee336['uniqueid']][_0xa684bf][_0x9bd4('0x41')]=_0x2ee336[_0x9bd4('0x41')];this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf][_0x9bd4('0x42')]=_0x2ee336[_0x9bd4('0x42')];this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf][_0x9bd4('0x43')]=_0x2ee336[_0x9bd4('0x43')];this['channels'][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf][_0x9bd4('0x44')]=_0x2ee336['destchannelstatedesc'];this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf][_0x9bd4('0x45')]=_0x2ee336[_0x9bd4('0x45')];this['channels'][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf][_0x9bd4('0x46')]=_0x9bd4('0x47');_[_0x9bd4('0x31')](this[_0x9bd4('0xb')][_0x2ee336[_0x9bd4('0x48')]],_[_0x9bd4('0x49')](_0x2ee336,[_0x9bd4('0x2d'),_0x9bd4('0x4a')]));logger[_0x9bd4('0x29')](_0x9bd4('0x4b'),_0x2ee336[_0x9bd4('0x26')],util[_0x9bd4('0x35')](this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0x2ee336['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x9bd4('0x21')](_0x9bd4('0x4c'),this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0x2ee336[_0x9bd4('0x28')]]);logger[_0x9bd4('0x29')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x2ee336[_0x9bd4('0x26')],util[_0x9bd4('0x35')](this['channels'][_0x2ee336[_0x9bd4('0x26')]][_0x2ee336[_0x9bd4('0x28')]],{'showHidden':![],'depth':null}));this[_0x9bd4('0x21')](util['format'](_0x9bd4('0x39'),_0x2ee336[_0x9bd4('0x27')]),_0x9bd4('0x4d'),this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0x2ee336['destuniqueid']]);}else if(!this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf][_0x9bd4('0x12')]&&!this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf][_0x9bd4('0x16')]){logger[_0x9bd4('0x24')](_0x9bd4('0x4e'),_0x2ee336[_0x9bd4('0x26')],this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf][_0x9bd4('0x27')],_0xa684bf);this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf]['agentringnoanswer']=!![];this['channels'][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf][_0x9bd4('0x4f')]=moment()['format'](_0x9bd4('0x40'));this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf]['answeredelsewheredestinationuniqueid']=_0x2ee336[_0x9bd4('0x28')];this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf]['answeredelsewheremembername']=_0x2ee336[_0x9bd4('0x27')];this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf][_0x9bd4('0x46')]=_0x9bd4('0x50');this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf][_0x9bd4('0x51')]=_0x9bd4('0x50');logger['debug']('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x2ee336['uniqueid'],util['inspect'](this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf],{'showHidden':![],'depth':null}));ami[_0x9bd4('0x21')](_0x9bd4('0x52'),this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf]);}}}}}}catch(_0x1adec8){logger['error'](_0x9bd4('0x53'),_0x2ee336[_0x9bd4('0x26')],util['inspect'](_0x1adec8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9bd4('0x22')]['syncAgentRingNoAnswer']=function(_0xcf9977){try{if(this[_0x9bd4('0x23')](_0xcf9977)){logger[_0x9bd4('0x29')](_0x9bd4('0x54'),_0xcf9977[_0x9bd4('0x26')],util[_0x9bd4('0x35')](_0xcf9977,{'showHidden':![],'depth':null}));if(this[_0x9bd4('0x9')][_0xcf9977['uniqueid']]&&this[_0x9bd4('0x9')][_0xcf9977['uniqueid']][_0xcf9977[_0x9bd4('0x28')]]){logger[_0x9bd4('0x24')](_0x9bd4('0x55'),_0xcf9977[_0x9bd4('0x26')],_0xcf9977[_0x9bd4('0x27')],_0xcf9977[_0x9bd4('0x28')]);this[_0x9bd4('0x9')][_0xcf9977[_0x9bd4('0x26')]][_0xcf9977[_0x9bd4('0x28')]]['agentringnoanswer']=!![];this['channels'][_0xcf9977[_0x9bd4('0x26')]][_0xcf9977['destuniqueid']][_0x9bd4('0x4f')]=moment()[_0x9bd4('0x38')](_0x9bd4('0x40'));this['channels'][_0xcf9977[_0x9bd4('0x26')]][_0xcf9977[_0x9bd4('0x28')]][_0x9bd4('0x46')]='rejected';this[_0x9bd4('0x9')][_0xcf9977[_0x9bd4('0x26')]][_0xcf9977[_0x9bd4('0x28')]][_0x9bd4('0x51')]=_0x9bd4('0x56');logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0xcf9977[_0x9bd4('0x26')],util[_0x9bd4('0x35')](this[_0x9bd4('0x9')][_0xcf9977[_0x9bd4('0x26')]][_0xcf9977[_0x9bd4('0x28')]],{'showHidden':![],'depth':null}));ami['emit'](_0x9bd4('0x57'),this[_0x9bd4('0x9')][_0xcf9977[_0x9bd4('0x26')]][_0xcf9977[_0x9bd4('0x28')]]);}}}catch(_0x27ea21){logger[_0x9bd4('0x3b')](_0x9bd4('0x58'),_0xcf9977[_0x9bd4('0x26')],util[_0x9bd4('0x35')](_0x27ea21,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9bd4('0x22')][_0x9bd4('0x15')]=function(_0x16f52c){try{if(this[_0x9bd4('0x23')](_0x16f52c)){logger[_0x9bd4('0x29')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x16f52c[_0x9bd4('0x26')],util[_0x9bd4('0x35')](_0x16f52c,{'showHidden':![],'depth':null}));if(this['channels'][_0x16f52c[_0x9bd4('0x26')]]){for(var _0x14aa1d in this['channels'][_0x16f52c[_0x9bd4('0x26')]]){if(this[_0x9bd4('0x9')][_0x16f52c[_0x9bd4('0x26')]]['hasOwnProperty'](_0x14aa1d)&&!this[_0x9bd4('0x9')][_0x16f52c[_0x9bd4('0x26')]][_0x14aa1d][_0x9bd4('0x12')]&&!this[_0x9bd4('0x9')][_0x16f52c[_0x9bd4('0x26')]][_0x14aa1d]['agentcomplete']){logger[_0x9bd4('0x24')](_0x9bd4('0x59'),_0x16f52c[_0x9bd4('0x26')],this['channels'][_0x16f52c[_0x9bd4('0x26')]][_0x14aa1d][_0x9bd4('0x27')],_0x14aa1d);this[_0x9bd4('0x9')][_0x16f52c[_0x9bd4('0x26')]][_0x14aa1d][_0x9bd4('0x12')]=!![];this[_0x9bd4('0x9')][_0x16f52c[_0x9bd4('0x26')]][_0x14aa1d][_0x9bd4('0x4f')]=moment()[_0x9bd4('0x38')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x16f52c['uniqueid']][_0x14aa1d][_0x9bd4('0x46')]='abandoned';this[_0x9bd4('0x9')][_0x16f52c['uniqueid']][_0x14aa1d]['reason']='abandoned';logger[_0x9bd4('0x29')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x16f52c[_0x9bd4('0x26')],util[_0x9bd4('0x35')](this[_0x9bd4('0x9')][_0x16f52c[_0x9bd4('0x26')]][_0x14aa1d],{'showHidden':![],'depth':null}));ami[_0x9bd4('0x21')](_0x9bd4('0x5a'),this['channels'][_0x16f52c[_0x9bd4('0x26')]][_0x14aa1d]);}}}}}catch(_0x5aeb94){logger[_0x9bd4('0x3b')](_0x9bd4('0x5b'),_0x16f52c['uniqueid'],util[_0x9bd4('0x35')](_0x5aeb94,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x9bd4('0x17')]=function(_0x4f10f0){try{if(this[_0x9bd4('0x23')](_0x4f10f0)){logger['debug'](_0x9bd4('0x5c'),_0x4f10f0[_0x9bd4('0x26')],util['inspect'](_0x4f10f0,{'showHidden':![],'depth':null}));if(this[_0x9bd4('0x9')][_0x4f10f0[_0x9bd4('0x26')]]){for(var _0x163b87 in this['channels'][_0x4f10f0[_0x9bd4('0x26')]]){if(this[_0x9bd4('0x9')][_0x4f10f0['uniqueid']][_0x9bd4('0x3e')](_0x163b87)){if(this[_0x9bd4('0x9')][_0x4f10f0['uniqueid']][_0x163b87][_0x9bd4('0x5d')]&&!this['channels'][_0x4f10f0[_0x9bd4('0x26')]][_0x163b87][_0x9bd4('0x16')]){logger[_0x9bd4('0x24')](_0x9bd4('0x5e'),_0x4f10f0[_0x9bd4('0x26')],this[_0x9bd4('0x9')][_0x4f10f0[_0x9bd4('0x26')]][_0x163b87][_0x9bd4('0x27')],_0x163b87);this[_0x9bd4('0x9')][_0x4f10f0[_0x9bd4('0x26')]][_0x163b87]['agentcomplete']=!![];this[_0x9bd4('0x9')][_0x4f10f0[_0x9bd4('0x26')]][_0x163b87][_0x9bd4('0x5f')]=moment()[_0x9bd4('0x38')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x9bd4('0x9')][_0x4f10f0['uniqueid']][_0x163b87][_0x9bd4('0x46')]=_0x9bd4('0x60');this[_0x9bd4('0x9')][_0x4f10f0[_0x9bd4('0x26')]][_0x163b87][_0x9bd4('0x51')]=_0x4f10f0[_0x9bd4('0x51')]==_0x9bd4('0x61')?'agent':_0x4f10f0['reason'];this[_0x9bd4('0x9')][_0x4f10f0[_0x9bd4('0x26')]][_0x163b87][_0x9bd4('0x62')]=_0x4f10f0['talktime'];if(this[_0x9bd4('0xa')][_0x4f10f0[_0x9bd4('0x2d')]]&&this[_0x9bd4('0xa')][_0x4f10f0[_0x9bd4('0x2d')]][_0x9bd4('0x63')]){this[_0x9bd4('0x9')][_0x4f10f0[_0x9bd4('0x26')]][_0x163b87][_0x9bd4('0x64')]=this[_0x9bd4('0xa')][_0x4f10f0['queue']][_0x9bd4('0x65')];this[_0x9bd4('0x9')][_0x4f10f0['uniqueid']][_0x163b87][_0x9bd4('0x66')]=!![];}this['agents'][_0x4f10f0[_0x9bd4('0x48')]]=_[_0x9bd4('0x32')](this[_0x9bd4('0xb')][_0x4f10f0['interface']],[_0x9bd4('0x2d'),_0x9bd4('0x4a')]);logger[_0x9bd4('0x29')](_0x9bd4('0x67'),_0x4f10f0[_0x9bd4('0x26')],util[_0x9bd4('0x35')](this[_0x9bd4('0x9')][_0x4f10f0[_0x9bd4('0x26')]][_0x163b87],{'showHidden':![],'depth':null}));ami[_0x9bd4('0x21')](_0x9bd4('0x68'),this[_0x9bd4('0x9')][_0x4f10f0[_0x9bd4('0x26')]][_0x163b87]);logger[_0x9bd4('0x29')](_0x9bd4('0x69'),_0x4f10f0[_0x9bd4('0x26')],util['inspect'](this['channels'][_0x4f10f0['uniqueid']][_0x163b87],{'showHidden':![],'depth':null}));this[_0x9bd4('0x21')](util['format']('user:%s',_0x4f10f0[_0x9bd4('0x27')]),_0x9bd4('0x6a'),this['channels'][_0x4f10f0[_0x9bd4('0x26')]][_0x163b87]);}}}}}}catch(_0x6fec0b){logger[_0x9bd4('0x3b')](_0x9bd4('0x6b'),_0x4f10f0[_0x9bd4('0x26')],util[_0x9bd4('0x35')](_0x6fec0b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9bd4('0x22')]['syncVarSet']=function(_0x5e8280){try{if(this[_0x9bd4('0x23')](_0x5e8280)){logger['debug'](_0x9bd4('0x6c'),_0x5e8280['uniqueid'],util[_0x9bd4('0x35')](_0x5e8280,{'showHidden':![],'depth':null}));this[_0x9bd4('0x6d')](_0x5e8280[_0x9bd4('0x26')],_[_0x9bd4('0x6e')](_0x5e8280['variable'])[0x0],_0x5e8280[_0x9bd4('0x6f')]);if(this[_0x9bd4('0x9')][_0x5e8280[_0x9bd4('0x26')]]){for(var _0x3bd3c7 in this[_0x9bd4('0x9')][_0x5e8280[_0x9bd4('0x26')]]){if(this[_0x9bd4('0x9')][_0x5e8280[_0x9bd4('0x26')]]['hasOwnProperty'](_0x3bd3c7)){logger[_0x9bd4('0x24')](_0x9bd4('0x70'),_0x5e8280['uniqueid'],_0x3bd3c7,_[_0x9bd4('0x6e')](_0x5e8280[_0x9bd4('0x71')])[0x0],_0x5e8280[_0x9bd4('0x6f')]);if(_[_0x9bd4('0x2b')](this[_0x9bd4('0x9')][_0x5e8280[_0x9bd4('0x26')]][_0x3bd3c7]['variables'])){this[_0x9bd4('0x9')][_0x5e8280[_0x9bd4('0x26')]][_0x3bd3c7]['variables']={};}this[_0x9bd4('0x9')][_0x5e8280[_0x9bd4('0x26')]][_0x3bd3c7][_0x9bd4('0xc')]=this['variables'][_0x5e8280[_0x9bd4('0x26')]];}}}}}catch(_0x5b0d25){logger[_0x9bd4('0x3b')](_0x9bd4('0x72'),_0x5e8280[_0x9bd4('0x26')],util['inspect'](_0x5b0d25,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x9bd4('0x6d')]=function(_0x413cb0,_0x6e4149,_0x3cbadb){var _0x247c5a=['rtpaudioqos',_0x9bd4('0x73'),_0x9bd4('0x74'),_0x9bd4('0x75'),'rtpaudioqosloss',_0x9bd4('0x76'),_0x9bd4('0x77'),_0x9bd4('0x78'),_0x9bd4('0x79'),_0x9bd4('0x7a'),_0x9bd4('0x7b'),_0x9bd4('0x7c'),_0x9bd4('0x7d'),_0x9bd4('0x7e'),'memberinterface',_0x9bd4('0x7f'),_0x9bd4('0x27'),_0x9bd4('0x80'),_0x9bd4('0x81')];if(!_[_0x9bd4('0x82')](_0x6e4149)&&!_[_0x9bd4('0x83')](_0x247c5a,_0x6e4149)){if(_[_0x9bd4('0x2b')](this[_0x9bd4('0xc')][_0x413cb0])){this[_0x9bd4('0xc')][_0x413cb0]={};}this[_0x9bd4('0xc')][_0x413cb0][_0x6e4149]=_0x3cbadb;}};VoiceAgentReport[_0x9bd4('0x22')]['syncHangup']=function(_0x4e3868){try{if(this[_0x9bd4('0x23')](_0x4e3868)){logger[_0x9bd4('0x29')]('[%s][voiceAgentReport][hangup]\x20event:',_0x4e3868[_0x9bd4('0x26')],util['inspect'](_0x4e3868,{'showHidden':![],'depth':null}));if(this['channels'][_0x4e3868['uniqueid']]){for(var _0x169568 in this[_0x9bd4('0x9')][_0x4e3868[_0x9bd4('0x26')]]){if(this[_0x9bd4('0x9')][_0x4e3868[_0x9bd4('0x26')]][_0x9bd4('0x3e')](_0x169568)){if(this[_0x9bd4('0x9')][_0x4e3868['uniqueid']][_0x169568]['reason']==_0x9bd4('0x61')&&this[_0x9bd4('0x9')][_0x4e3868[_0x9bd4('0x26')]][_0x169568][_0x9bd4('0x16')]){logger[_0x9bd4('0x24')](_0x9bd4('0x84'),_0x4e3868['uniqueid'],_0x169568);this[_0x9bd4('0x9')][_0x4e3868[_0x9bd4('0x26')]][_0x169568][_0x9bd4('0x5f')]=moment()[_0x9bd4('0x38')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x9bd4('0x29')](_0x9bd4('0x85'),_0x4e3868[_0x9bd4('0x26')],util[_0x9bd4('0x35')](_[_0x9bd4('0x86')](this[_0x9bd4('0x9')][_0x4e3868['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0x9bd4('0x21')](_0x9bd4('0x87'),_[_0x9bd4('0x86')](this[_0x9bd4('0x9')][_0x4e3868[_0x9bd4('0x26')]]));delete this['channels'][_0x4e3868[_0x9bd4('0x26')]];}if(this[_0x9bd4('0xc')][_0x4e3868[_0x9bd4('0x26')]]){delete this[_0x9bd4('0xc')][_0x4e3868[_0x9bd4('0x26')]];}}}catch(_0x282ec4){logger[_0x9bd4('0x3b')](_0x9bd4('0x88'),_0x4e3868[_0x9bd4('0x26')],util[_0x9bd4('0x35')](_0x282ec4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9bd4('0x22')][_0x9bd4('0x89')]=function(_0xd0cdc3){try{if(this['isNotNull'](_0xd0cdc3)){logger[_0x9bd4('0x29')](_0x9bd4('0x8a'),_0xd0cdc3[_0x9bd4('0x26')],util[_0x9bd4('0x35')](_0xd0cdc3,{'showHidden':![],'depth':null}));if(this[_0x9bd4('0x9')][_0xd0cdc3[_0x9bd4('0x8b')]]){for(var _0x2b83e9 in this[_0x9bd4('0x9')][_0xd0cdc3['transfereeuniqueid']]){if(this[_0x9bd4('0x9')][_0xd0cdc3[_0x9bd4('0x8b')]]['hasOwnProperty'](_0x2b83e9)){if(_0xd0cdc3[_0x9bd4('0x8c')]===_0x2b83e9){logger[_0x9bd4('0x24')](_0x9bd4('0x8d'),_0xd0cdc3[_0x9bd4('0x26')],this[_0x9bd4('0x9')][_0xd0cdc3[_0x9bd4('0x8b')]][_0x2b83e9][_0x9bd4('0x27')],_0x2b83e9);var _0x1afd0f=moment();this['channels'][_0xd0cdc3[_0x9bd4('0x8b')]][_0x2b83e9][_0x9bd4('0x16')]=!![];this[_0x9bd4('0x9')][_0xd0cdc3[_0x9bd4('0x8b')]][_0x2b83e9]['agentcompleteAt']=moment()['format'](_0x9bd4('0x40'));this[_0x9bd4('0x9')][_0xd0cdc3[_0x9bd4('0x8b')]][_0x2b83e9][_0x9bd4('0x46')]=_0x9bd4('0x60');this[_0x9bd4('0x9')][_0xd0cdc3[_0x9bd4('0x8b')]][_0x2b83e9][_0x9bd4('0x51')]='transfer';this[_0x9bd4('0x9')][_0xd0cdc3[_0x9bd4('0x8b')]][_0x2b83e9]['talktime']=_0x1afd0f[_0x9bd4('0x8e')](this[_0x9bd4('0x9')][_0xd0cdc3['transfereeuniqueid']][_0x2b83e9][_0x9bd4('0x5d')],_0x9bd4('0x8f'));}}}}if(this[_0x9bd4('0x9')][_0xd0cdc3[_0x9bd4('0x90')]]){var _0x253f33=this[_0x9bd4('0x9')][_0xd0cdc3['secondtransfereruniqueid']];this[_0x9bd4('0x9')][_0xd0cdc3['secondtransfereruniqueid']]=this[_0x9bd4('0x9')][_0xd0cdc3[_0x9bd4('0x8b')]];this[_0x9bd4('0x9')][_0xd0cdc3[_0x9bd4('0x8b')]]=_0x253f33;}}}catch(_0x4abba5){logger['error'](_0x9bd4('0x91'),_0xd0cdc3[_0x9bd4('0x26')],util[_0x9bd4('0x35')](_0x4abba5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9bd4('0x22')][_0x9bd4('0x20')]=function(_0x5cac87){try{if(this[_0x9bd4('0x23')](_0x5cac87)){logger[_0x9bd4('0x29')](_0x9bd4('0x92'),_0x5cac87['uniqueid'],util[_0x9bd4('0x35')](_0x5cac87,{'showHidden':![],'depth':null}));if(this[_0x9bd4('0x9')][_0x5cac87['transfereeuniqueid']]){for(var _0x10ed22 in this[_0x9bd4('0x9')][_0x5cac87[_0x9bd4('0x8b')]]){if(this[_0x9bd4('0x9')][_0x5cac87[_0x9bd4('0x8b')]][_0x9bd4('0x3e')](_0x10ed22)){if(_0x5cac87[_0x9bd4('0x93')]===_0x10ed22){logger['info'](_0x9bd4('0x94'),_0x5cac87[_0x9bd4('0x26')],this[_0x9bd4('0x9')][_0x5cac87[_0x9bd4('0x8b')]][_0x10ed22]['membername'],_0x10ed22);var _0x50f20a=moment();this['channels'][_0x5cac87[_0x9bd4('0x8b')]][_0x10ed22][_0x9bd4('0x16')]=!![];this[_0x9bd4('0x9')][_0x5cac87[_0x9bd4('0x8b')]][_0x10ed22][_0x9bd4('0x5f')]=_0x50f20a;this[_0x9bd4('0x9')][_0x5cac87[_0x9bd4('0x8b')]][_0x10ed22]['lastevent']=_0x9bd4('0x60');this[_0x9bd4('0x9')][_0x5cac87[_0x9bd4('0x8b')]][_0x10ed22][_0x9bd4('0x51')]=_0x9bd4('0x61');this[_0x9bd4('0x9')][_0x5cac87[_0x9bd4('0x8b')]][_0x10ed22][_0x9bd4('0x62')]=_0x50f20a['diff'](this[_0x9bd4('0x9')][_0x5cac87[_0x9bd4('0x8b')]][_0x10ed22]['agentconnectAt'],_0x9bd4('0x8f'));}}}}}}catch(_0x10d1a3){logger['error']('[%s][voiceAgentReport][blindtransfer]',_0x5cac87[_0x9bd4('0x26')],util[_0x9bd4('0x35')](_0x10d1a3,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStart']=function(_0x2ba1de){var _0x4d140d='';try{if(this[_0x9bd4('0x23')](_0x2ba1de)){logger['debug']('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x2ba1de[_0x9bd4('0x26')],util[_0x9bd4('0x35')](_0x2ba1de,{'showHidden':![],'depth':null}));if(_0x2ba1de[_0x9bd4('0x95')]){_0x4d140d=_0x2ba1de[_0x9bd4('0x95')]['substring'](0x0,_0x2ba1de['channel']['lastIndexOf']('-'));if(this[_0x9bd4('0xb')][_0x4d140d]){logger['info'](_0x9bd4('0x96'),_0x2ba1de[_0x9bd4('0x26')],_0x4d140d);this['agents'][_0x4d140d][_0x9bd4('0x97')]=!![];}}}}catch(_0xb22ad7){logger[_0x9bd4('0x3b')](_0x9bd4('0x98'),_0x2ba1de[_0x9bd4('0x26')],util[_0x9bd4('0x35')](_0xb22ad7,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x9bd4('0x1d')]=function(_0x122e5a){var _0xee9104='';try{if(this['isNotNull'](_0x122e5a)){logger[_0x9bd4('0x29')](_0x9bd4('0x99'),_0x122e5a['uniqueid'],util[_0x9bd4('0x35')](_0x122e5a,{'showHidden':![],'depth':null}));if(_0x122e5a[_0x9bd4('0x95')]){_0xee9104=_0x122e5a[_0x9bd4('0x95')][_0x9bd4('0x9a')](0x0,_0x122e5a[_0x9bd4('0x95')]['lastIndexOf']('-'));if(this[_0x9bd4('0xb')][_0xee9104]){logger[_0x9bd4('0x24')](_0x9bd4('0x9b'),_0x122e5a[_0x9bd4('0x26')],_0xee9104);this[_0x9bd4('0xb')][_0xee9104][_0x9bd4('0x97')]=![];}}}}catch(_0x2db14c){logger[_0x9bd4('0x3b')](_0x9bd4('0x9c'),_0x122e5a[_0x9bd4('0x26')],util['inspect'](_0x2db14c,{'showHidden':![],'depth':null}));}};module[_0x9bd4('0x9d')]=VoiceAgentReport;