Built motion from commit (unavailable).|2.5.20
[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 _0xfd4b=['diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','voiceQueues','agents','syncAgentCalled','bind','agentconnect','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','syncHangup','syncMusicOnHoldStart','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','uniqueid','inspect','channels','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','variables','omit','event','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','interface','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','agentringnoanswer','info','agentringnoanswerAt','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','addVariable','keys','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','sipcallid','sipuri','bridgepvtcallid','memberdynamic','memberpenalty','memberrealtime','isNil','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xfd4b,0xa1));var _0xbfd4=function(_0x21a07e,_0x179882){_0x21a07e=_0x21a07e-0x0;var _0x30803f=_0xfd4b[_0x21a07e];return _0x30803f;};'use strict';var _=require('lodash');var moment=require(_0xbfd4('0x0'));var util=require(_0xbfd4('0x1'));var Redis=require(_0xbfd4('0x2'));var config=require(_0xbfd4('0x3'));var logger=require(_0xbfd4('0x4'))(_0xbfd4('0x5'));var ami=require(_0xbfd4('0x6'));config[_0xbfd4('0x7')]=_[_0xbfd4('0x8')](config[_0xbfd4('0x7')],{'host':_0xbfd4('0x9'),'port':0x18eb});var io=require(_0xbfd4('0xa'))(new Redis(config['redis']));function VoiceAgentReport(_0x352eb5){this['channels']={};this[_0xbfd4('0xb')]=_0x352eb5[_0xbfd4('0xb')];this[_0xbfd4('0xc')]=_0x352eb5['agents'];this['variables']={};ami['on']('agentcalled',this[_0xbfd4('0xd')][_0xbfd4('0xe')](this));ami['on'](_0xbfd4('0xf'),this['syncAgentConnect'][_0xbfd4('0xe')](this));ami['on']('agentringnoanswer',this[_0xbfd4('0x10')][_0xbfd4('0xe')](this));ami['on'](_0xbfd4('0x11'),this[_0xbfd4('0x12')][_0xbfd4('0xe')](this));ami['on'](_0xbfd4('0x13'),this[_0xbfd4('0x14')][_0xbfd4('0xe')](this));ami['on'](_0xbfd4('0x15'),this[_0xbfd4('0x16')][_0xbfd4('0xe')](this));ami['on']('hangup',this[_0xbfd4('0x17')][_0xbfd4('0xe')](this));ami['on']('musiconholdstart',this[_0xbfd4('0x18')][_0xbfd4('0xe')](this));ami['on']('musiconholdstop',this[_0xbfd4('0x19')][_0xbfd4('0xe')](this));ami['on']('attendedtransfer',this[_0xbfd4('0x1a')][_0xbfd4('0xe')](this));ami['on'](_0xbfd4('0x1b'),this[_0xbfd4('0x1c')][_0xbfd4('0xe')](this));}VoiceAgentReport['prototype']['emit']=function(_0x51d159,_0x4df669,_0x45c602){io['to'](_0x51d159)[_0xbfd4('0x1d')](_0x4df669,_0x45c602);};VoiceAgentReport[_0xbfd4('0x1e')][_0xbfd4('0x1f')]=function(_0x10da8a){return _0x10da8a!==null&&!_[_0xbfd4('0x20')](_0x10da8a);};VoiceAgentReport['prototype'][_0xbfd4('0xd')]=function(_0x39c86d){try{if(this[_0xbfd4('0x1f')](_0x39c86d)){logger['info'](_0xbfd4('0x21'),_0x39c86d['uniqueid'],_0x39c86d[_0xbfd4('0x22')],_0x39c86d[_0xbfd4('0x23')]);logger['debug'](_0xbfd4('0x24'),_0x39c86d[_0xbfd4('0x25')],util[_0xbfd4('0x26')](_0x39c86d,{'showHidden':![],'depth':null}));if(_[_0xbfd4('0x20')](this[_0xbfd4('0x27')][_0x39c86d[_0xbfd4('0x25')]])){this[_0xbfd4('0x27')][_0x39c86d['uniqueid']]={};}if(_[_0xbfd4('0x20')](this[_0xbfd4('0x27')][_0x39c86d[_0xbfd4('0x25')]][_0x39c86d[_0xbfd4('0x23')]])){this[_0xbfd4('0x27')][_0x39c86d[_0xbfd4('0x25')]][_0x39c86d[_0xbfd4('0x23')]]={'agentcalledAt':moment()[_0xbfd4('0x28')](_0xbfd4('0x29')),'lastevent':_0xbfd4('0x2a'),'mandatoryDisposition':this[_0xbfd4('0xb')][_0x39c86d[_0xbfd4('0x2b')]]?this[_0xbfd4('0xb')][_0x39c86d['queue']][_0xbfd4('0x2c')]||![]:![],'type':this[_0xbfd4('0xb')][_0x39c86d[_0xbfd4('0x2b')]]?this['voiceQueues'][_0x39c86d[_0xbfd4('0x2b')]][_0xbfd4('0x2d')]||_0xbfd4('0x2e'):_0xbfd4('0x2e'),'variables':this[_0xbfd4('0x2f')][_0x39c86d[_0xbfd4('0x25')]]};}_['merge'](this['channels'][_0x39c86d['uniqueid']][_0x39c86d['destuniqueid']],_[_0xbfd4('0x30')](_0x39c86d,[_0xbfd4('0x31'),'privilege']));logger[_0xbfd4('0x32')](_0xbfd4('0x33'),_0x39c86d[_0xbfd4('0x25')],util[_0xbfd4('0x26')](this[_0xbfd4('0x27')][_0x39c86d[_0xbfd4('0x25')]][_0x39c86d['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xbfd4('0x1d')](_0xbfd4('0x34'),this['channels'][_0x39c86d[_0xbfd4('0x25')]][_0x39c86d['destuniqueid']]);logger[_0xbfd4('0x32')](_0xbfd4('0x35'),_0x39c86d[_0xbfd4('0x25')],util[_0xbfd4('0x26')](this[_0xbfd4('0x27')][_0x39c86d[_0xbfd4('0x25')]][_0x39c86d[_0xbfd4('0x23')]],{'showHidden':![],'depth':null}));this[_0xbfd4('0x1d')](util[_0xbfd4('0x28')]('user:%s',_0x39c86d[_0xbfd4('0x22')]),'user:called',this['channels'][_0x39c86d['uniqueid']][_0x39c86d[_0xbfd4('0x23')]]);}}catch(_0x194f2f){logger[_0xbfd4('0x36')](_0xbfd4('0x37'),_0x39c86d['uniqueid'],util[_0xbfd4('0x26')](_0x194f2f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbfd4('0x1e')]['syncAgentConnect']=function(_0x41fb98){try{if(this[_0xbfd4('0x1f')](_0x41fb98)){if(this[_0xbfd4('0x27')][_0x41fb98[_0xbfd4('0x25')]]){logger[_0xbfd4('0x32')]('[%s][voiceAgentReport][agentconnect]\x20event:',_0x41fb98[_0xbfd4('0x25')],util[_0xbfd4('0x26')](_0x41fb98,{'showHidden':![],'depth':null}));for(var _0x114e00 in this[_0xbfd4('0x27')][_0x41fb98['uniqueid']]){if(this[_0xbfd4('0x27')][_0x41fb98[_0xbfd4('0x25')]][_0xbfd4('0x38')](_0x114e00)){if(_0x41fb98[_0xbfd4('0x23')]===_0x114e00){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x41fb98['uniqueid'],_0x41fb98['membername'],_0x41fb98[_0xbfd4('0x23')]);this[_0xbfd4('0x27')][_0x41fb98[_0xbfd4('0x25')]][_0x114e00][_0xbfd4('0x39')]=moment()[_0xbfd4('0x28')](_0xbfd4('0x29'));this['channels'][_0x41fb98[_0xbfd4('0x25')]][_0x114e00][_0xbfd4('0x3a')]=_0x41fb98[_0xbfd4('0x3a')];this[_0xbfd4('0x27')][_0x41fb98['uniqueid']][_0x114e00][_0xbfd4('0x3b')]=_0x41fb98['connectedlinenum'];this['channels'][_0x41fb98['uniqueid']][_0x114e00]['destchannelstate']=_0x41fb98[_0xbfd4('0x3c')];this[_0xbfd4('0x27')][_0x41fb98[_0xbfd4('0x25')]][_0x114e00][_0xbfd4('0x3d')]=_0x41fb98[_0xbfd4('0x3d')];this[_0xbfd4('0x27')][_0x41fb98[_0xbfd4('0x25')]][_0x114e00][_0xbfd4('0x3e')]=_0x41fb98['holdtime'];this['channels'][_0x41fb98[_0xbfd4('0x25')]][_0x114e00][_0xbfd4('0x3f')]=_0xbfd4('0x40');_['merge'](this[_0xbfd4('0xc')][_0x41fb98[_0xbfd4('0x41')]],_['pick'](_0x41fb98,[_0xbfd4('0x2b'),_0xbfd4('0x42')]));logger[_0xbfd4('0x32')](_0xbfd4('0x43'),_0x41fb98[_0xbfd4('0x25')],util[_0xbfd4('0x26')](this[_0xbfd4('0x27')][_0x41fb98['uniqueid']][_0x41fb98['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0xbfd4('0x44'),this[_0xbfd4('0x27')][_0x41fb98[_0xbfd4('0x25')]][_0x41fb98[_0xbfd4('0x23')]]);logger[_0xbfd4('0x32')](_0xbfd4('0x45'),_0x41fb98['uniqueid'],util['inspect'](this[_0xbfd4('0x27')][_0x41fb98['uniqueid']][_0x41fb98[_0xbfd4('0x23')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xbfd4('0x28')](_0xbfd4('0x46'),_0x41fb98[_0xbfd4('0x22')]),_0xbfd4('0x47'),this['channels'][_0x41fb98[_0xbfd4('0x25')]][_0x41fb98['destuniqueid']]);}else if(!this[_0xbfd4('0x27')][_0x41fb98[_0xbfd4('0x25')]][_0x114e00][_0xbfd4('0x48')]&&!this[_0xbfd4('0x27')][_0x41fb98[_0xbfd4('0x25')]][_0x114e00]['agentcomplete']){logger[_0xbfd4('0x49')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x41fb98[_0xbfd4('0x25')],this[_0xbfd4('0x27')][_0x41fb98[_0xbfd4('0x25')]][_0x114e00]['membername'],_0x114e00);this[_0xbfd4('0x27')][_0x41fb98['uniqueid']][_0x114e00][_0xbfd4('0x48')]=!![];this[_0xbfd4('0x27')][_0x41fb98[_0xbfd4('0x25')]][_0x114e00][_0xbfd4('0x4a')]=moment()[_0xbfd4('0x28')](_0xbfd4('0x29'));this['channels'][_0x41fb98[_0xbfd4('0x25')]][_0x114e00]['answeredelsewheredestinationuniqueid']=_0x41fb98[_0xbfd4('0x23')];this['channels'][_0x41fb98['uniqueid']][_0x114e00][_0xbfd4('0x4b')]=_0x41fb98[_0xbfd4('0x22')];this[_0xbfd4('0x27')][_0x41fb98[_0xbfd4('0x25')]][_0x114e00]['lastevent']=_0xbfd4('0x4c');this['channels'][_0x41fb98['uniqueid']][_0x114e00][_0xbfd4('0x4d')]=_0xbfd4('0x4c');logger['debug'](_0xbfd4('0x4e'),_0x41fb98[_0xbfd4('0x25')],util['inspect'](this[_0xbfd4('0x27')][_0x41fb98['uniqueid']][_0x114e00],{'showHidden':![],'depth':null}));ami['emit'](_0xbfd4('0x4f'),this['channels'][_0x41fb98[_0xbfd4('0x25')]][_0x114e00]);}}}}}}catch(_0x1890cc){logger[_0xbfd4('0x36')]('[%s][voiceAgentReport][agentconnect]',_0x41fb98[_0xbfd4('0x25')],util[_0xbfd4('0x26')](_0x1890cc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbfd4('0x1e')]['syncAgentRingNoAnswer']=function(_0x3bb7d8){try{if(this[_0xbfd4('0x1f')](_0x3bb7d8)){logger['debug'](_0xbfd4('0x50'),_0x3bb7d8[_0xbfd4('0x25')],util[_0xbfd4('0x26')](_0x3bb7d8,{'showHidden':![],'depth':null}));if(this[_0xbfd4('0x27')][_0x3bb7d8[_0xbfd4('0x25')]]&&this[_0xbfd4('0x27')][_0x3bb7d8[_0xbfd4('0x25')]][_0x3bb7d8['destuniqueid']]){logger[_0xbfd4('0x49')](_0xbfd4('0x51'),_0x3bb7d8[_0xbfd4('0x25')],_0x3bb7d8[_0xbfd4('0x22')],_0x3bb7d8[_0xbfd4('0x23')]);this['channels'][_0x3bb7d8['uniqueid']][_0x3bb7d8['destuniqueid']][_0xbfd4('0x48')]=!![];this[_0xbfd4('0x27')][_0x3bb7d8['uniqueid']][_0x3bb7d8[_0xbfd4('0x23')]][_0xbfd4('0x4a')]=moment()[_0xbfd4('0x28')](_0xbfd4('0x29'));this['channels'][_0x3bb7d8['uniqueid']][_0x3bb7d8[_0xbfd4('0x23')]][_0xbfd4('0x3f')]='rejected';this[_0xbfd4('0x27')][_0x3bb7d8[_0xbfd4('0x25')]][_0x3bb7d8[_0xbfd4('0x23')]]['reason']=_0xbfd4('0x52');logger[_0xbfd4('0x32')](_0xbfd4('0x53'),_0x3bb7d8[_0xbfd4('0x25')],util[_0xbfd4('0x26')](this[_0xbfd4('0x27')][_0x3bb7d8[_0xbfd4('0x25')]][_0x3bb7d8[_0xbfd4('0x23')]],{'showHidden':![],'depth':null}));ami[_0xbfd4('0x1d')](_0xbfd4('0x54'),this[_0xbfd4('0x27')][_0x3bb7d8[_0xbfd4('0x25')]][_0x3bb7d8[_0xbfd4('0x23')]]);}}}catch(_0x1ef2fb){logger[_0xbfd4('0x36')]('[%s][voiceAgentReport][agentringnoanswer]',_0x3bb7d8[_0xbfd4('0x25')],util['inspect'](_0x1ef2fb,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbfd4('0x1e')][_0xbfd4('0x12')]=function(_0x2c087a){try{if(this['isNotNull'](_0x2c087a)){logger[_0xbfd4('0x32')](_0xbfd4('0x55'),_0x2c087a['uniqueid'],util['inspect'](_0x2c087a,{'showHidden':![],'depth':null}));if(this[_0xbfd4('0x27')][_0x2c087a['uniqueid']]){for(var _0x149956 in this[_0xbfd4('0x27')][_0x2c087a['uniqueid']]){if(this[_0xbfd4('0x27')][_0x2c087a['uniqueid']][_0xbfd4('0x38')](_0x149956)&&!this[_0xbfd4('0x27')][_0x2c087a['uniqueid']][_0x149956][_0xbfd4('0x48')]&&!this['channels'][_0x2c087a[_0xbfd4('0x25')]][_0x149956][_0xbfd4('0x13')]){logger[_0xbfd4('0x49')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2c087a[_0xbfd4('0x25')],this['channels'][_0x2c087a[_0xbfd4('0x25')]][_0x149956]['membername'],_0x149956);this[_0xbfd4('0x27')][_0x2c087a[_0xbfd4('0x25')]][_0x149956][_0xbfd4('0x48')]=!![];this[_0xbfd4('0x27')][_0x2c087a[_0xbfd4('0x25')]][_0x149956]['agentringnoanswerAt']=moment()[_0xbfd4('0x28')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xbfd4('0x27')][_0x2c087a[_0xbfd4('0x25')]][_0x149956][_0xbfd4('0x3f')]=_0xbfd4('0x56');this[_0xbfd4('0x27')][_0x2c087a['uniqueid']][_0x149956][_0xbfd4('0x4d')]='abandoned';logger['debug'](_0xbfd4('0x57'),_0x2c087a[_0xbfd4('0x25')],util['inspect'](this[_0xbfd4('0x27')][_0x2c087a[_0xbfd4('0x25')]][_0x149956],{'showHidden':![],'depth':null}));ami['emit']('custom:agentqueuecallerabandon',this[_0xbfd4('0x27')][_0x2c087a['uniqueid']][_0x149956]);}}}}}catch(_0x330d10){logger[_0xbfd4('0x36')](_0xbfd4('0x58'),_0x2c087a['uniqueid'],util[_0xbfd4('0x26')](_0x330d10,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbfd4('0x1e')][_0xbfd4('0x14')]=function(_0x24023c){try{if(this[_0xbfd4('0x1f')](_0x24023c)){logger[_0xbfd4('0x32')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x24023c[_0xbfd4('0x25')],util[_0xbfd4('0x26')](_0x24023c,{'showHidden':![],'depth':null}));if(this['channels'][_0x24023c[_0xbfd4('0x25')]]){for(var _0x2d7918 in this[_0xbfd4('0x27')][_0x24023c[_0xbfd4('0x25')]]){if(this[_0xbfd4('0x27')][_0x24023c['uniqueid']][_0xbfd4('0x38')](_0x2d7918)){if(this['channels'][_0x24023c['uniqueid']][_0x2d7918][_0xbfd4('0x39')]&&!this[_0xbfd4('0x27')][_0x24023c[_0xbfd4('0x25')]][_0x2d7918][_0xbfd4('0x13')]){logger[_0xbfd4('0x49')](_0xbfd4('0x59'),_0x24023c[_0xbfd4('0x25')],this[_0xbfd4('0x27')][_0x24023c['uniqueid']][_0x2d7918][_0xbfd4('0x22')],_0x2d7918);this[_0xbfd4('0x27')][_0x24023c[_0xbfd4('0x25')]][_0x2d7918][_0xbfd4('0x13')]=!![];this[_0xbfd4('0x27')][_0x24023c[_0xbfd4('0x25')]][_0x2d7918][_0xbfd4('0x5a')]=moment()[_0xbfd4('0x28')](_0xbfd4('0x29'));this['channels'][_0x24023c['uniqueid']][_0x2d7918]['lastevent']=_0xbfd4('0x5b');this[_0xbfd4('0x27')][_0x24023c[_0xbfd4('0x25')]][_0x2d7918][_0xbfd4('0x4d')]=_0x24023c[_0xbfd4('0x4d')]==_0xbfd4('0x5c')?_0xbfd4('0x5d'):_0x24023c[_0xbfd4('0x4d')];this[_0xbfd4('0x27')][_0x24023c[_0xbfd4('0x25')]][_0x2d7918][_0xbfd4('0x5e')]=_0x24023c[_0xbfd4('0x5e')];if(this[_0xbfd4('0xb')][_0x24023c[_0xbfd4('0x2b')]]&&this[_0xbfd4('0xb')][_0x24023c[_0xbfd4('0x2b')]]['acw']){this[_0xbfd4('0x27')][_0x24023c[_0xbfd4('0x25')]][_0x2d7918][_0xbfd4('0x5f')]=this[_0xbfd4('0xb')][_0x24023c[_0xbfd4('0x2b')]][_0xbfd4('0x60')];this[_0xbfd4('0x27')][_0x24023c[_0xbfd4('0x25')]][_0x2d7918][_0xbfd4('0x61')]=!![];}this[_0xbfd4('0xc')][_0x24023c[_0xbfd4('0x41')]]=_[_0xbfd4('0x30')](this['agents'][_0x24023c[_0xbfd4('0x41')]],[_0xbfd4('0x2b'),_0xbfd4('0x42')]);logger[_0xbfd4('0x32')](_0xbfd4('0x62'),_0x24023c[_0xbfd4('0x25')],util[_0xbfd4('0x26')](this[_0xbfd4('0x27')][_0x24023c[_0xbfd4('0x25')]][_0x2d7918],{'showHidden':![],'depth':null}));ami['emit'](_0xbfd4('0x63'),this[_0xbfd4('0x27')][_0x24023c[_0xbfd4('0x25')]][_0x2d7918]);logger[_0xbfd4('0x32')](_0xbfd4('0x64'),_0x24023c['uniqueid'],util['inspect'](this[_0xbfd4('0x27')][_0x24023c[_0xbfd4('0x25')]][_0x2d7918],{'showHidden':![],'depth':null}));this[_0xbfd4('0x1d')](util['format'](_0xbfd4('0x46'),_0x24023c['membername']),_0xbfd4('0x65'),this[_0xbfd4('0x27')][_0x24023c['uniqueid']][_0x2d7918]);}}}}}}catch(_0x194fa2){logger['error'](_0xbfd4('0x66'),_0x24023c[_0xbfd4('0x25')],util[_0xbfd4('0x26')](_0x194fa2,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xbfd4('0x16')]=function(_0x75fc0a){try{if(this['isNotNull'](_0x75fc0a)){logger[_0xbfd4('0x32')]('[%s][voiceAgentReport][varset]\x20event:',_0x75fc0a[_0xbfd4('0x25')],util['inspect'](_0x75fc0a,{'showHidden':![],'depth':null}));this[_0xbfd4('0x67')](_0x75fc0a[_0xbfd4('0x25')],_[_0xbfd4('0x68')](_0x75fc0a['variable'])[0x0],_0x75fc0a[_0xbfd4('0x69')]);if(this[_0xbfd4('0x27')][_0x75fc0a[_0xbfd4('0x25')]]){for(var _0x321c4d in this[_0xbfd4('0x27')][_0x75fc0a[_0xbfd4('0x25')]]){if(this['channels'][_0x75fc0a[_0xbfd4('0x25')]][_0xbfd4('0x38')](_0x321c4d)){logger[_0xbfd4('0x49')](_0xbfd4('0x6a'),_0x75fc0a[_0xbfd4('0x25')],_0x321c4d,_[_0xbfd4('0x68')](_0x75fc0a['variable'])[0x0],_0x75fc0a[_0xbfd4('0x69')]);if(_[_0xbfd4('0x20')](this[_0xbfd4('0x27')][_0x75fc0a[_0xbfd4('0x25')]][_0x321c4d]['variables'])){this[_0xbfd4('0x27')][_0x75fc0a[_0xbfd4('0x25')]][_0x321c4d][_0xbfd4('0x2f')]={};}this[_0xbfd4('0x27')][_0x75fc0a[_0xbfd4('0x25')]][_0x321c4d]['variables']=this[_0xbfd4('0x2f')][_0x75fc0a[_0xbfd4('0x25')]];}}}}}catch(_0x4d957e){logger[_0xbfd4('0x36')](_0xbfd4('0x6b'),_0x75fc0a[_0xbfd4('0x25')],util['inspect'](_0x4d957e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xbfd4('0x67')]=function(_0x28e147,_0x309cc0,_0x325fe0){var _0x119d64=[_0xbfd4('0x6c'),_0xbfd4('0x6d'),_0xbfd4('0x6e'),_0xbfd4('0x6f'),_0xbfd4('0x70'),'rtpaudioqoslossbridged',_0xbfd4('0x71'),'rtpaudioqosrttbridged',_0xbfd4('0x72'),_0xbfd4('0x73'),'bridgepeer',_0xbfd4('0x74'),'membercalls',_0xbfd4('0x75'),'memberinterface','memberlastcall',_0xbfd4('0x22'),_0xbfd4('0x76'),_0xbfd4('0x77')];if(!_[_0xbfd4('0x78')](_0x309cc0)&&!_['includes'](_0x119d64,_0x309cc0)){if(_[_0xbfd4('0x20')](this[_0xbfd4('0x2f')][_0x28e147])){this[_0xbfd4('0x2f')][_0x28e147]={};}this[_0xbfd4('0x2f')][_0x28e147][_0x309cc0]=_0x325fe0;}};VoiceAgentReport[_0xbfd4('0x1e')][_0xbfd4('0x17')]=function(_0x356edc){try{if(this[_0xbfd4('0x1f')](_0x356edc)){logger[_0xbfd4('0x32')](_0xbfd4('0x79'),_0x356edc[_0xbfd4('0x25')],util[_0xbfd4('0x26')](_0x356edc,{'showHidden':![],'depth':null}));if(this[_0xbfd4('0x27')][_0x356edc['uniqueid']]){for(var _0x707e84 in this[_0xbfd4('0x27')][_0x356edc[_0xbfd4('0x25')]]){if(this[_0xbfd4('0x27')][_0x356edc[_0xbfd4('0x25')]][_0xbfd4('0x38')](_0x707e84)){if(this['channels'][_0x356edc['uniqueid']][_0x707e84]['reason']=='transfer'&&this[_0xbfd4('0x27')][_0x356edc[_0xbfd4('0x25')]][_0x707e84][_0xbfd4('0x13')]){logger[_0xbfd4('0x49')](_0xbfd4('0x7a'),_0x356edc[_0xbfd4('0x25')],_0x707e84);this[_0xbfd4('0x27')][_0x356edc[_0xbfd4('0x25')]][_0x707e84][_0xbfd4('0x5a')]=moment()[_0xbfd4('0x28')](_0xbfd4('0x29'));}}}logger[_0xbfd4('0x32')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x356edc[_0xbfd4('0x25')],util[_0xbfd4('0x26')](_[_0xbfd4('0x7b')](this[_0xbfd4('0x27')][_0x356edc[_0xbfd4('0x25')]]),{'showHidden':![],'depth':null}));ami[_0xbfd4('0x1d')](_0xbfd4('0x7c'),_[_0xbfd4('0x7b')](this[_0xbfd4('0x27')][_0x356edc['uniqueid']]));delete this['channels'][_0x356edc['uniqueid']];}if(this[_0xbfd4('0x2f')][_0x356edc[_0xbfd4('0x25')]]){delete this['variables'][_0x356edc['uniqueid']];}}}catch(_0x1c2ef8){logger['error'](_0xbfd4('0x7d'),_0x356edc[_0xbfd4('0x25')],util['inspect'](_0x1c2ef8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbfd4('0x1e')]['syncAttendedTransfer']=function(_0x1e7d0e){try{if(this[_0xbfd4('0x1f')](_0x1e7d0e)){logger['debug'](_0xbfd4('0x7e'),_0x1e7d0e['uniqueid'],util[_0xbfd4('0x26')](_0x1e7d0e,{'showHidden':![],'depth':null}));if(this['channels'][_0x1e7d0e[_0xbfd4('0x7f')]]){for(var _0x4f6828 in this['channels'][_0x1e7d0e[_0xbfd4('0x7f')]]){if(this['channels'][_0x1e7d0e[_0xbfd4('0x7f')]]['hasOwnProperty'](_0x4f6828)){if(_0x1e7d0e['origtransfereruniqueid']===_0x4f6828){logger[_0xbfd4('0x49')](_0xbfd4('0x80'),_0x1e7d0e[_0xbfd4('0x25')],this[_0xbfd4('0x27')][_0x1e7d0e[_0xbfd4('0x7f')]][_0x4f6828]['membername'],_0x4f6828);var _0x44f410=moment();this['channels'][_0x1e7d0e[_0xbfd4('0x7f')]][_0x4f6828]['agentcomplete']=!![];this[_0xbfd4('0x27')][_0x1e7d0e[_0xbfd4('0x7f')]][_0x4f6828][_0xbfd4('0x5a')]=moment()['format'](_0xbfd4('0x29'));this[_0xbfd4('0x27')][_0x1e7d0e['transfereeuniqueid']][_0x4f6828][_0xbfd4('0x3f')]=_0xbfd4('0x5b');this[_0xbfd4('0x27')][_0x1e7d0e[_0xbfd4('0x7f')]][_0x4f6828][_0xbfd4('0x4d')]='transfer';this[_0xbfd4('0x27')][_0x1e7d0e[_0xbfd4('0x7f')]][_0x4f6828][_0xbfd4('0x5e')]=_0x44f410[_0xbfd4('0x81')](this['channels'][_0x1e7d0e['transfereeuniqueid']][_0x4f6828][_0xbfd4('0x39')],_0xbfd4('0x82'));}}}}if(this[_0xbfd4('0x27')][_0x1e7d0e['secondtransfereruniqueid']]){var _0x37720d=this[_0xbfd4('0x27')][_0x1e7d0e[_0xbfd4('0x83')]];this[_0xbfd4('0x27')][_0x1e7d0e[_0xbfd4('0x83')]]=this[_0xbfd4('0x27')][_0x1e7d0e[_0xbfd4('0x7f')]];this['channels'][_0x1e7d0e[_0xbfd4('0x7f')]]=_0x37720d;}}}catch(_0x522f19){logger[_0xbfd4('0x36')](_0xbfd4('0x84'),_0x1e7d0e[_0xbfd4('0x25')],util[_0xbfd4('0x26')](_0x522f19,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbfd4('0x1e')][_0xbfd4('0x1c')]=function(_0xd68c39){try{if(this[_0xbfd4('0x1f')](_0xd68c39)){logger[_0xbfd4('0x32')](_0xbfd4('0x85'),_0xd68c39[_0xbfd4('0x25')],util[_0xbfd4('0x26')](_0xd68c39,{'showHidden':![],'depth':null}));if(this[_0xbfd4('0x27')][_0xd68c39[_0xbfd4('0x7f')]]){for(var _0x1924e5 in this['channels'][_0xd68c39['transfereeuniqueid']]){if(this[_0xbfd4('0x27')][_0xd68c39[_0xbfd4('0x7f')]][_0xbfd4('0x38')](_0x1924e5)){if(_0xd68c39[_0xbfd4('0x86')]===_0x1924e5){logger[_0xbfd4('0x49')](_0xbfd4('0x87'),_0xd68c39[_0xbfd4('0x25')],this[_0xbfd4('0x27')][_0xd68c39[_0xbfd4('0x7f')]][_0x1924e5][_0xbfd4('0x22')],_0x1924e5);var _0x24e578=moment();this[_0xbfd4('0x27')][_0xd68c39[_0xbfd4('0x7f')]][_0x1924e5][_0xbfd4('0x13')]=!![];this[_0xbfd4('0x27')][_0xd68c39[_0xbfd4('0x7f')]][_0x1924e5][_0xbfd4('0x5a')]=_0x24e578;this[_0xbfd4('0x27')][_0xd68c39[_0xbfd4('0x7f')]][_0x1924e5][_0xbfd4('0x3f')]=_0xbfd4('0x5b');this[_0xbfd4('0x27')][_0xd68c39[_0xbfd4('0x7f')]][_0x1924e5]['reason']=_0xbfd4('0x5c');this['channels'][_0xd68c39['transfereeuniqueid']][_0x1924e5]['talktime']=_0x24e578[_0xbfd4('0x81')](this[_0xbfd4('0x27')][_0xd68c39[_0xbfd4('0x7f')]][_0x1924e5][_0xbfd4('0x39')],_0xbfd4('0x82'));}}}}}}catch(_0x448610){logger[_0xbfd4('0x36')](_0xbfd4('0x88'),_0xd68c39[_0xbfd4('0x25')],util[_0xbfd4('0x26')](_0x448610,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbfd4('0x1e')][_0xbfd4('0x18')]=function(_0x4ea9cd){var _0x8f728c='';try{if(this[_0xbfd4('0x1f')](_0x4ea9cd)){logger[_0xbfd4('0x32')](_0xbfd4('0x89'),_0x4ea9cd[_0xbfd4('0x25')],util[_0xbfd4('0x26')](_0x4ea9cd,{'showHidden':![],'depth':null}));if(_0x4ea9cd[_0xbfd4('0x8a')]){_0x8f728c=_0x4ea9cd['channel']['substring'](0x0,_0x4ea9cd['channel'][_0xbfd4('0x8b')]('-'));if(this[_0xbfd4('0xc')][_0x8f728c]){logger['info'](_0xbfd4('0x8c'),_0x4ea9cd[_0xbfd4('0x25')],_0x8f728c);this[_0xbfd4('0xc')][_0x8f728c][_0xbfd4('0x8d')]=!![];}}}}catch(_0x215fdc){logger[_0xbfd4('0x36')]('[%s][voiceAgentReport][musiconholdstart]',_0x4ea9cd['uniqueid'],util[_0xbfd4('0x26')](_0x215fdc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbfd4('0x1e')][_0xbfd4('0x19')]=function(_0x478bd7){var _0x204595='';try{if(this['isNotNull'](_0x478bd7)){logger['debug'](_0xbfd4('0x8e'),_0x478bd7[_0xbfd4('0x25')],util['inspect'](_0x478bd7,{'showHidden':![],'depth':null}));if(_0x478bd7[_0xbfd4('0x8a')]){_0x204595=_0x478bd7[_0xbfd4('0x8a')]['substring'](0x0,_0x478bd7[_0xbfd4('0x8a')][_0xbfd4('0x8b')]('-'));if(this['agents'][_0x204595]){logger[_0xbfd4('0x49')](_0xbfd4('0x8f'),_0x478bd7[_0xbfd4('0x25')],_0x204595);this[_0xbfd4('0xc')][_0x204595]['onhold']=![];}}}}catch(_0x1cd9db){logger[_0xbfd4('0x36')]('[%s][voiceAgentReport][musiconholdstop]',_0x478bd7[_0xbfd4('0x25')],util[_0xbfd4('0x26')](_0x1cd9db,{'showHidden':![],'depth':null}));}};module[_0xbfd4('0x90')]=VoiceAgentReport;