5738737f5692ad46104a10b12c124a28de7939a8
[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 _0xa9f1=['values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','talktime','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','onhold','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','localhost','channels','voiceChannels','voiceQueues','agents','variables','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','queue','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','assign','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','user:called','error','info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','routealias','merge','pick','destconnectedlinenum','accountcode','exten','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','interface','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','name','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','transfer','agent','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','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','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','membercalls','memberlastcall','memberpenalty','memberrealtime','includes','agentcompleteAt'];(function(_0x79dc51,_0x2ada04){var _0x108bc9=function(_0x17f11a){while(--_0x17f11a){_0x79dc51['push'](_0x79dc51['shift']());}};_0x108bc9(++_0x2ada04);}(_0xa9f1,0xb4));var _0x1a9f=function(_0x64ea63,_0x4c32d3){_0x64ea63=_0x64ea63-0x0;var _0x45d9a1=_0xa9f1[_0x64ea63];return _0x45d9a1;};'use strict';var _=require('lodash');var moment=require(_0x1a9f('0x0'));var util=require(_0x1a9f('0x1'));var Redis=require(_0x1a9f('0x2'));var config=require(_0x1a9f('0x3'));var logger=require(_0x1a9f('0x4'))(_0x1a9f('0x5'));var ami=require(_0x1a9f('0x6'));config['redis']=_[_0x1a9f('0x7')](config[_0x1a9f('0x8')],{'host':_0x1a9f('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1a9f('0x8')]));function VoiceAgentReport(_0x220a51){this[_0x1a9f('0xa')]={};this[_0x1a9f('0xb')]=_0x220a51[_0x1a9f('0xa')];this[_0x1a9f('0xc')]=_0x220a51[_0x1a9f('0xc')];this[_0x1a9f('0xd')]=_0x220a51[_0x1a9f('0xd')];this[_0x1a9f('0xe')]={};ami['on']('agentcalled',this[_0x1a9f('0xf')][_0x1a9f('0x10')](this));ami['on'](_0x1a9f('0x11'),this[_0x1a9f('0x12')][_0x1a9f('0x10')](this));ami['on'](_0x1a9f('0x13'),this[_0x1a9f('0x14')][_0x1a9f('0x10')](this));ami['on'](_0x1a9f('0x15'),this[_0x1a9f('0x16')][_0x1a9f('0x10')](this));ami['on'](_0x1a9f('0x17'),this[_0x1a9f('0x18')][_0x1a9f('0x10')](this));ami['on'](_0x1a9f('0x19'),this[_0x1a9f('0x1a')][_0x1a9f('0x10')](this));ami['on'](_0x1a9f('0x1b'),this[_0x1a9f('0x1c')]['bind'](this));ami['on'](_0x1a9f('0x1d'),this[_0x1a9f('0x1e')][_0x1a9f('0x10')](this));ami['on'](_0x1a9f('0x1f'),this[_0x1a9f('0x20')][_0x1a9f('0x10')](this));ami['on'](_0x1a9f('0x21'),this[_0x1a9f('0x22')][_0x1a9f('0x10')](this));ami['on']('blindtransfer',this[_0x1a9f('0x23')][_0x1a9f('0x10')](this));}VoiceAgentReport[_0x1a9f('0x24')][_0x1a9f('0x25')]=function(_0x573d2d,_0x580a1e,_0x241629){io['to'](_0x573d2d)[_0x1a9f('0x25')](_0x580a1e,_0x241629);};VoiceAgentReport[_0x1a9f('0x24')][_0x1a9f('0x26')]=function(_0x1a8789){return _0x1a8789!==null&&!_[_0x1a9f('0x27')](_0x1a8789);};VoiceAgentReport[_0x1a9f('0x24')]['syncAgentCalled']=function(_0x1a9b48){try{if(this[_0x1a9f('0x26')](_0x1a9b48)){logger['info'](_0x1a9f('0x28'),_0x1a9b48[_0x1a9f('0x29')],_0x1a9b48[_0x1a9f('0x2a')],_0x1a9b48[_0x1a9f('0x2b')]);logger[_0x1a9f('0x2c')](_0x1a9f('0x2d'),_0x1a9b48[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x1a9b48,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x1a9f('0xa')][_0x1a9b48[_0x1a9f('0x29')]])){this[_0x1a9f('0xa')][_0x1a9b48['uniqueid']]={};}var _0x58873b=this[_0x1a9f('0xd')][_0x1a9b48['interface']];var _0x1c5151=this[_0x1a9f('0xa')][_0x1a9b48[_0x1a9f('0x29')]][_0x1a9b48[_0x1a9f('0x2b')]];var _0x4751ff=this[_0x1a9f('0xc')][_0x1a9b48[_0x1a9f('0x2f')]];var _0x97a123=this[_0x1a9f('0xe')][_0x1a9b48['uniqueid']];if(_['isUndefined'](_0x1c5151)){_0x1c5151={'agentcalledAt':moment()['format'](_0x1a9f('0x30')),'lastevent':_0x1a9f('0x31'),'mandatoryDisposition':_0x4751ff&&_0x4751ff[_0x1a9f('0x32')]?_0x4751ff[_0x1a9f('0x32')]:![],'type':_0x4751ff&&_0x4751ff[_0x1a9f('0x33')]?_0x4751ff['type']:_0x1a9f('0x34'),'variables':_0x97a123,'motionChannel':'voice'};}Object[_0x1a9f('0x35')](_0x1c5151,_['omit'](_0x1a9b48,['event','privilege']));this[_0x1a9f('0xa')][_0x1a9b48['uniqueid']][_0x1a9b48[_0x1a9f('0x2b')]]=_0x1c5151;logger['debug'](_0x1a9f('0x36'),_0x1a9b48['uniqueid'],util['inspect'](_0x1c5151,{'showHidden':![],'depth':null}));ami[_0x1a9f('0x25')]('custom:agentcalled',_0x1c5151);var _0x311c5a={'id':_0x58873b['id'],'calleridnum':_0x1c5151[_0x1a9f('0x37')],'queue':_0x1c5151[_0x1a9f('0x2f')],'variables':_0x1c5151[_0x1a9f('0xe')],'uniqueid':_0x1a9b48[_0x1a9f('0x29')]};logger[_0x1a9f('0x2c')](_0x1a9f('0x38'),_0x1a9b48[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x311c5a,{'showHidden':![],'depth':null}));this[_0x1a9f('0x25')](util[_0x1a9f('0x39')](_0x1a9f('0x3a'),_0x1a9b48[_0x1a9f('0x2a')]),_0x1a9f('0x3b'),_0x311c5a);}}catch(_0x105678){logger[_0x1a9f('0x3c')]('[%s][voiceAgentReport][agentcalled]',_0x1a9b48[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x105678,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1a9f('0x12')]=function(_0x4a0bd5){try{if(this[_0x1a9f('0x26')](_0x4a0bd5)){if(this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]]){for(var _0x2fd629 in this[_0x1a9f('0xa')][_0x4a0bd5['uniqueid']]){if(this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]]['hasOwnProperty'](_0x2fd629)){if(_0x4a0bd5[_0x1a9f('0x2b')]===_0x2fd629){logger[_0x1a9f('0x3d')](_0x1a9f('0x3e'),_0x4a0bd5['uniqueid'],_0x4a0bd5[_0x1a9f('0x2a')],_0x4a0bd5[_0x1a9f('0x2b')]);this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629][_0x1a9f('0x3f')]=moment()[_0x1a9f('0x39')](_0x1a9f('0x30'));this[_0x1a9f('0xa')][_0x4a0bd5['uniqueid']][_0x2fd629][_0x1a9f('0x40')]=_0x4a0bd5[_0x1a9f('0x40')];this[_0x1a9f('0xa')][_0x4a0bd5['uniqueid']][_0x2fd629][_0x1a9f('0x41')]=_0x4a0bd5[_0x1a9f('0x41')];this[_0x1a9f('0xa')][_0x4a0bd5['uniqueid']][_0x2fd629]['destchannelstate']=_0x4a0bd5[_0x1a9f('0x42')];this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629][_0x1a9f('0x43')]=_0x4a0bd5[_0x1a9f('0x43')];this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629][_0x1a9f('0x44')]=_0x4a0bd5[_0x1a9f('0x44')];this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629][_0x1a9f('0x45')]=_0x1a9f('0x46');if(this[_0x1a9f('0xb')][this[_0x1a9f('0xa')][_0x4a0bd5['uniqueid']][_0x2fd629][_0x1a9f('0x29')]]){var _0x1a5605=this[_0x1a9f('0xb')][this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629][_0x1a9f('0x29')]][_0x1a9f('0x47')];this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629][_0x1a9f('0x47')]=_0x1a5605;_0x4a0bd5[_0x1a9f('0x47')]=_0x1a5605;}_[_0x1a9f('0x48')](this[_0x1a9f('0xd')][_0x4a0bd5['interface']],_[_0x1a9f('0x49')](_0x4a0bd5,['queue',_0x1a9f('0x4a'),_0x1a9f('0x47')]));var _0x3aa27c=this[_0x1a9f('0xd')][_0x4a0bd5['interface']];var _0x4f6852={'id':_0x3aa27c['id'],'name':_0x3aa27c['name'],'agentconnected':!![],'destaccountcode':_0x3aa27c[_0x1a9f('0x4b')],'destconnectedlinenum':this['channels'][_0x4a0bd5[_0x1a9f('0x29')]][_0x4a0bd5[_0x1a9f('0x2b')]][_0x1a9f('0x4c')],'queue':this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x4a0bd5[_0x1a9f('0x2b')]][_0x1a9f('0x2f')],'routealias':this[_0x1a9f('0xa')][_0x4a0bd5['uniqueid']][_0x4a0bd5[_0x1a9f('0x2b')]][_0x1a9f('0x47')],'uniqueid':this[_0x1a9f('0xa')][_0x4a0bd5['uniqueid']][_0x4a0bd5[_0x1a9f('0x2b')]][_0x1a9f('0x29')]};ami[_0x1a9f('0x25')](_0x1a9f('0x4d'),this[_0x1a9f('0xa')][_0x4a0bd5['uniqueid']][_0x4a0bd5['destuniqueid']]);this[_0x1a9f('0x25')](util[_0x1a9f('0x39')](_0x1a9f('0x3a'),_0x4a0bd5['membername']),_0x1a9f('0x4e'),_0x4f6852);}else if(!this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629][_0x1a9f('0x13')]&&!this[_0x1a9f('0xa')][_0x4a0bd5['uniqueid']][_0x2fd629][_0x1a9f('0x17')]){logger[_0x1a9f('0x3d')](_0x1a9f('0x4f'),_0x4a0bd5['uniqueid'],this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629]['membername'],_0x2fd629);this['channels'][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629][_0x1a9f('0x13')]=!![];this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629][_0x1a9f('0x50')]=moment()[_0x1a9f('0x39')](_0x1a9f('0x30'));this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629][_0x1a9f('0x51')]=_0x4a0bd5['destuniqueid'];this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629][_0x1a9f('0x52')]=_0x4a0bd5[_0x1a9f('0x2a')];this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629][_0x1a9f('0x45')]=_0x1a9f('0x53');this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629][_0x1a9f('0x54')]=_0x1a9f('0x53');logger['debug'](_0x1a9f('0x55'),_0x4a0bd5[_0x1a9f('0x29')],util['inspect'](this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629],{'showHidden':![],'depth':null}));ami[_0x1a9f('0x25')]('custom:agentansweredelsewhere',this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629]);}else{logger[_0x1a9f('0x2c')]('[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken',_0x4a0bd5['uniqueid']);}}}}}}catch(_0x58c2a4){logger['error']('[%s][voiceAgentReport][agentconnect]',_0x4a0bd5[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x58c2a4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1a9f('0x24')][_0x1a9f('0x14')]=function(_0x288937){try{if(this[_0x1a9f('0x26')](_0x288937)){logger['debug'](_0x1a9f('0x56'),_0x288937[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x288937,{'showHidden':![],'depth':null}));if(this[_0x1a9f('0xa')][_0x288937['uniqueid']]&&this[_0x1a9f('0xa')][_0x288937[_0x1a9f('0x29')]][_0x288937[_0x1a9f('0x2b')]]){logger[_0x1a9f('0x3d')](_0x1a9f('0x57'),_0x288937[_0x1a9f('0x29')],_0x288937[_0x1a9f('0x2a')],_0x288937[_0x1a9f('0x2b')]);var _0x4f49f6=this[_0x1a9f('0xd')][_0x288937[_0x1a9f('0x58')]];var _0x11f1b6=this[_0x1a9f('0xa')][_0x288937['uniqueid']][_0x288937[_0x1a9f('0x2b')]];_0x11f1b6[_0x1a9f('0x13')]=!![];_0x11f1b6[_0x1a9f('0x50')]=moment()[_0x1a9f('0x39')]('YYYY-MM-DD\x20HH:mm:ss');_0x11f1b6[_0x1a9f('0x45')]=_0x1a9f('0x59');_0x11f1b6['reason']='rejected';var _0x4d912f={'id':_0x4f49f6['id'],'name':_0x4f49f6['name'],'queue':_0x11f1b6['queue'],'uniqueid':_0x11f1b6['uniqueid']};logger[_0x1a9f('0x2c')](_0x1a9f('0x5a'),_0x288937[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x4d912f,{'showHidden':![],'depth':null}));this[_0x1a9f('0x25')](util[_0x1a9f('0x39')](_0x1a9f('0x3a'),_0x4f49f6[_0x1a9f('0x5b')]),_0x1a9f('0x5c'),_0x4d912f);ami['emit'](_0x1a9f('0x5d'),_0x11f1b6);this[_0x1a9f('0xa')][_0x288937[_0x1a9f('0x29')]][_0x288937[_0x1a9f('0x2b')]]=Object[_0x1a9f('0x35')]({},_0x11f1b6);}}}catch(_0x4fe0a0){logger[_0x1a9f('0x3c')]('[%s][voiceAgentReport][agentringnoanswer]',_0x288937[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x4fe0a0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1a9f('0x24')][_0x1a9f('0x16')]=function(_0x494502){try{if(this[_0x1a9f('0x26')](_0x494502)){logger['debug'](_0x1a9f('0x5e'),_0x494502['uniqueid'],util['inspect'](_0x494502,{'showHidden':![],'depth':null}));if(this['channels'][_0x494502[_0x1a9f('0x29')]]){for(var _0x233aee in this[_0x1a9f('0xa')][_0x494502[_0x1a9f('0x29')]]){if(this[_0x1a9f('0xa')][_0x494502[_0x1a9f('0x29')]]['hasOwnProperty'](_0x233aee)&&!this[_0x1a9f('0xa')][_0x494502[_0x1a9f('0x29')]][_0x233aee]['agentringnoanswer']&&!this['channels'][_0x494502[_0x1a9f('0x29')]][_0x233aee]['agentcomplete']){logger[_0x1a9f('0x3d')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x494502['uniqueid'],this[_0x1a9f('0xa')][_0x494502[_0x1a9f('0x29')]][_0x233aee]['membername'],_0x233aee);this[_0x1a9f('0xa')][_0x494502['uniqueid']][_0x233aee][_0x1a9f('0x13')]=!![];this[_0x1a9f('0xa')][_0x494502[_0x1a9f('0x29')]][_0x233aee][_0x1a9f('0x50')]=moment()[_0x1a9f('0x39')](_0x1a9f('0x30'));this[_0x1a9f('0xa')][_0x494502['uniqueid']][_0x233aee][_0x1a9f('0x45')]=_0x1a9f('0x5f');this[_0x1a9f('0xa')][_0x494502['uniqueid']][_0x233aee][_0x1a9f('0x54')]=_0x1a9f('0x5f');logger['debug'](_0x1a9f('0x60'),_0x494502[_0x1a9f('0x29')],util['inspect'](this[_0x1a9f('0xa')][_0x494502['uniqueid']][_0x233aee],{'showHidden':![],'depth':null}));ami[_0x1a9f('0x25')](_0x1a9f('0x61'),this['channels'][_0x494502['uniqueid']][_0x233aee]);}}}}}catch(_0x144dcc){logger[_0x1a9f('0x3c')](_0x1a9f('0x62'),_0x494502[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x144dcc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1a9f('0x24')]['syncAgentComplete']=function(_0x17e697){try{if(this[_0x1a9f('0x26')](_0x17e697)){logger[_0x1a9f('0x2c')](_0x1a9f('0x63'),_0x17e697[_0x1a9f('0x29')],util['inspect'](_0x17e697,{'showHidden':![],'depth':null}));if(this[_0x1a9f('0xa')][_0x17e697[_0x1a9f('0x29')]]){for(var _0x3af8c3 in this[_0x1a9f('0xa')][_0x17e697[_0x1a9f('0x29')]]){if(this['channels'][_0x17e697[_0x1a9f('0x29')]][_0x1a9f('0x64')](_0x3af8c3)){if(this[_0x1a9f('0xa')][_0x17e697['uniqueid']][_0x3af8c3][_0x1a9f('0x3f')]&&!this[_0x1a9f('0xa')][_0x17e697[_0x1a9f('0x29')]][_0x3af8c3][_0x1a9f('0x17')]){logger[_0x1a9f('0x3d')](_0x1a9f('0x65'),_0x17e697[_0x1a9f('0x29')],this[_0x1a9f('0xa')][_0x17e697[_0x1a9f('0x29')]][_0x3af8c3][_0x1a9f('0x2a')],_0x3af8c3);this[_0x1a9f('0xa')][_0x17e697[_0x1a9f('0x29')]][_0x3af8c3]['agentcomplete']=!![];this[_0x1a9f('0xa')][_0x17e697[_0x1a9f('0x29')]][_0x3af8c3]['agentcompleteAt']=moment()[_0x1a9f('0x39')](_0x1a9f('0x30'));this['channels'][_0x17e697[_0x1a9f('0x29')]][_0x3af8c3][_0x1a9f('0x45')]=_0x1a9f('0x66');this['channels'][_0x17e697[_0x1a9f('0x29')]][_0x3af8c3][_0x1a9f('0x54')]=_0x17e697[_0x1a9f('0x54')]==_0x1a9f('0x67')?_0x1a9f('0x68'):_0x17e697['reason'];this['channels'][_0x17e697[_0x1a9f('0x29')]][_0x3af8c3]['talktime']=_0x17e697['talktime'];if(this[_0x1a9f('0xc')][_0x17e697[_0x1a9f('0x2f')]]&&this['voiceQueues'][_0x17e697['queue']]['acw']){this[_0x1a9f('0xa')][_0x17e697['uniqueid']][_0x3af8c3][_0x1a9f('0x69')]=this['voiceQueues'][_0x17e697['queue']][_0x1a9f('0x6a')];this[_0x1a9f('0xa')][_0x17e697[_0x1a9f('0x29')]][_0x3af8c3][_0x1a9f('0x6b')]=!![];}this[_0x1a9f('0xd')][_0x17e697[_0x1a9f('0x58')]]=_['omit'](this['agents'][_0x17e697[_0x1a9f('0x58')]],[_0x1a9f('0x2f'),_0x1a9f('0x4a')]);logger[_0x1a9f('0x2c')](_0x1a9f('0x6c'),_0x17e697[_0x1a9f('0x29')],util['inspect'](this[_0x1a9f('0xa')][_0x17e697[_0x1a9f('0x29')]][_0x3af8c3],{'showHidden':![],'depth':null}));ami[_0x1a9f('0x25')](_0x1a9f('0x6d'),this[_0x1a9f('0xa')][_0x17e697[_0x1a9f('0x29')]][_0x3af8c3]);logger[_0x1a9f('0x2c')](_0x1a9f('0x6e'),_0x17e697[_0x1a9f('0x29')],util[_0x1a9f('0x2e')]({'id':this[_0x1a9f('0xd')][_0x17e697[_0x1a9f('0x58')]]['id'],'destaccountcode':_0x17e697[_0x1a9f('0x6f')]},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x1a9f('0x3a'),_0x17e697[_0x1a9f('0x2a')]),_0x1a9f('0x70'),{'id':this['agents'][_0x17e697[_0x1a9f('0x58')]]['id'],'destaccountcode':Number(_0x17e697[_0x1a9f('0x6f')])});}}}}}}catch(_0x26acbf){logger[_0x1a9f('0x3c')](_0x1a9f('0x71'),_0x17e697[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x26acbf,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1a9f('0x24')]['syncVarSet']=function(_0x1a3654){try{if(this[_0x1a9f('0x26')](_0x1a3654)){logger[_0x1a9f('0x2c')](_0x1a9f('0x72'),_0x1a3654[_0x1a9f('0x29')],util['inspect'](_0x1a3654,{'showHidden':![],'depth':null}));this[_0x1a9f('0x73')](_0x1a3654[_0x1a9f('0x29')],_[_0x1a9f('0x74')](_0x1a3654['variable'])[0x0],_0x1a3654[_0x1a9f('0x75')]);if(this[_0x1a9f('0xa')][_0x1a3654['uniqueid']]){for(var _0x458d32 in this[_0x1a9f('0xa')][_0x1a3654[_0x1a9f('0x29')]]){if(this[_0x1a9f('0xa')][_0x1a3654['uniqueid']][_0x1a9f('0x64')](_0x458d32)){logger[_0x1a9f('0x3d')](_0x1a9f('0x76'),_0x1a3654['uniqueid'],_0x458d32,_[_0x1a9f('0x74')](_0x1a3654[_0x1a9f('0x77')])[0x0],_0x1a3654[_0x1a9f('0x75')]);if(_[_0x1a9f('0x27')](this[_0x1a9f('0xa')][_0x1a3654[_0x1a9f('0x29')]][_0x458d32][_0x1a9f('0xe')])){this[_0x1a9f('0xa')][_0x1a3654[_0x1a9f('0x29')]][_0x458d32][_0x1a9f('0xe')]={};}this[_0x1a9f('0xa')][_0x1a3654[_0x1a9f('0x29')]][_0x458d32][_0x1a9f('0xe')]=this['variables'][_0x1a3654[_0x1a9f('0x29')]];}}}}}catch(_0x2e5312){logger[_0x1a9f('0x3c')](_0x1a9f('0x78'),_0x1a3654[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x2e5312,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['addVariable']=function(_0x3ba7b2,_0x35a38a,_0x2c2712){var _0x559a66=['rtpaudioqos',_0x1a9f('0x79'),_0x1a9f('0x7a'),_0x1a9f('0x7b'),_0x1a9f('0x7c'),_0x1a9f('0x7d'),_0x1a9f('0x7e'),_0x1a9f('0x7f'),'sipcallid','sipuri','bridgepeer','bridgepvtcallid',_0x1a9f('0x80'),'memberdynamic','memberinterface',_0x1a9f('0x81'),_0x1a9f('0x2a'),_0x1a9f('0x82'),_0x1a9f('0x83')];if(!_['isNil'](_0x35a38a)&&!_[_0x1a9f('0x84')](_0x559a66,_0x35a38a)){if(_[_0x1a9f('0x27')](this[_0x1a9f('0xe')][_0x3ba7b2])){this['variables'][_0x3ba7b2]={};}this['variables'][_0x3ba7b2][_0x35a38a]=_0x2c2712;}};VoiceAgentReport[_0x1a9f('0x24')][_0x1a9f('0x1c')]=function(_0x38523a){try{if(this['isNotNull'](_0x38523a)){logger[_0x1a9f('0x2c')]('[%s][voiceAgentReport][hangup]\x20event:',_0x38523a[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x38523a,{'showHidden':![],'depth':null}));if(this['channels'][_0x38523a['uniqueid']]){for(var _0x318c97 in this[_0x1a9f('0xa')][_0x38523a[_0x1a9f('0x29')]]){if(this[_0x1a9f('0xa')][_0x38523a[_0x1a9f('0x29')]]['hasOwnProperty'](_0x318c97)){if(this[_0x1a9f('0xa')][_0x38523a['uniqueid']][_0x318c97]['reason']==_0x1a9f('0x67')&&this[_0x1a9f('0xa')][_0x38523a['uniqueid']][_0x318c97][_0x1a9f('0x17')]){logger[_0x1a9f('0x3d')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x38523a[_0x1a9f('0x29')],_0x318c97);this[_0x1a9f('0xa')][_0x38523a[_0x1a9f('0x29')]][_0x318c97][_0x1a9f('0x85')]=moment()[_0x1a9f('0x39')](_0x1a9f('0x30'));}}}logger[_0x1a9f('0x2c')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x38523a[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_[_0x1a9f('0x86')](this[_0x1a9f('0xa')][_0x38523a[_0x1a9f('0x29')]]),{'showHidden':![],'depth':null}));ami[_0x1a9f('0x25')](_0x1a9f('0x87'),_[_0x1a9f('0x86')](this[_0x1a9f('0xa')][_0x38523a[_0x1a9f('0x29')]]));delete this[_0x1a9f('0xa')][_0x38523a['uniqueid']];}if(this[_0x1a9f('0xe')][_0x38523a[_0x1a9f('0x29')]]){delete this[_0x1a9f('0xe')][_0x38523a[_0x1a9f('0x29')]];}}}catch(_0x9683b2){logger['error'](_0x1a9f('0x88'),_0x38523a['uniqueid'],util['inspect'](_0x9683b2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1a9f('0x24')][_0x1a9f('0x22')]=function(_0x172f1d){try{if(this['isNotNull'](_0x172f1d)){logger[_0x1a9f('0x2c')](_0x1a9f('0x89'),_0x172f1d[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x172f1d,{'showHidden':![],'depth':null}));if(this[_0x1a9f('0xa')][_0x172f1d[_0x1a9f('0x8a')]]){for(var _0x4e7d29 in this[_0x1a9f('0xa')][_0x172f1d[_0x1a9f('0x8a')]]){if(this[_0x1a9f('0xa')][_0x172f1d[_0x1a9f('0x8a')]][_0x1a9f('0x64')](_0x4e7d29)){if(_0x172f1d[_0x1a9f('0x8b')]===_0x4e7d29){logger[_0x1a9f('0x3d')](_0x1a9f('0x8c'),_0x172f1d[_0x1a9f('0x29')],this['channels'][_0x172f1d['transfereeuniqueid']][_0x4e7d29][_0x1a9f('0x2a')],_0x4e7d29);var _0x3ffcdd=moment();this[_0x1a9f('0xa')][_0x172f1d[_0x1a9f('0x8a')]][_0x4e7d29]['agentcomplete']=!![];this[_0x1a9f('0xa')][_0x172f1d['transfereeuniqueid']][_0x4e7d29][_0x1a9f('0x85')]=moment()[_0x1a9f('0x39')](_0x1a9f('0x30'));this['channels'][_0x172f1d['transfereeuniqueid']][_0x4e7d29]['lastevent']=_0x1a9f('0x66');this['channels'][_0x172f1d[_0x1a9f('0x8a')]][_0x4e7d29][_0x1a9f('0x54')]=_0x1a9f('0x67');this[_0x1a9f('0xa')][_0x172f1d['transfereeuniqueid']][_0x4e7d29][_0x1a9f('0x8d')]=_0x3ffcdd[_0x1a9f('0x8e')](this['channels'][_0x172f1d[_0x1a9f('0x8a')]][_0x4e7d29][_0x1a9f('0x3f')],_0x1a9f('0x8f'));}}}}if(this[_0x1a9f('0xa')][_0x172f1d[_0x1a9f('0x90')]]){var _0x265c15=this[_0x1a9f('0xa')][_0x172f1d[_0x1a9f('0x90')]];this[_0x1a9f('0xa')][_0x172f1d[_0x1a9f('0x90')]]=this[_0x1a9f('0xa')][_0x172f1d[_0x1a9f('0x8a')]];this['channels'][_0x172f1d[_0x1a9f('0x8a')]]=_0x265c15;}}}catch(_0x488117){logger[_0x1a9f('0x3c')](_0x1a9f('0x91'),_0x172f1d[_0x1a9f('0x29')],util['inspect'](_0x488117,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1a9f('0x24')][_0x1a9f('0x23')]=function(_0x55c25d){try{if(this[_0x1a9f('0x26')](_0x55c25d)){logger['debug'](_0x1a9f('0x92'),_0x55c25d['uniqueid'],util[_0x1a9f('0x2e')](_0x55c25d,{'showHidden':![],'depth':null}));if(this[_0x1a9f('0xa')][_0x55c25d[_0x1a9f('0x8a')]]){for(var _0xee7619 in this[_0x1a9f('0xa')][_0x55c25d['transfereeuniqueid']]){if(this['channels'][_0x55c25d['transfereeuniqueid']]['hasOwnProperty'](_0xee7619)){if(_0x55c25d[_0x1a9f('0x93')]===_0xee7619){logger[_0x1a9f('0x3d')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x55c25d[_0x1a9f('0x29')],this[_0x1a9f('0xa')][_0x55c25d['transfereeuniqueid']][_0xee7619][_0x1a9f('0x2a')],_0xee7619);var _0x4f92b5=moment();this['channels'][_0x55c25d[_0x1a9f('0x8a')]][_0xee7619][_0x1a9f('0x17')]=!![];this[_0x1a9f('0xa')][_0x55c25d['transfereeuniqueid']][_0xee7619][_0x1a9f('0x85')]=_0x4f92b5;this['channels'][_0x55c25d[_0x1a9f('0x8a')]][_0xee7619]['lastevent']=_0x1a9f('0x66');this[_0x1a9f('0xa')][_0x55c25d[_0x1a9f('0x8a')]][_0xee7619][_0x1a9f('0x54')]=_0x1a9f('0x67');this[_0x1a9f('0xa')][_0x55c25d[_0x1a9f('0x8a')]][_0xee7619]['talktime']=_0x4f92b5[_0x1a9f('0x8e')](this['channels'][_0x55c25d['transfereeuniqueid']][_0xee7619]['agentconnectAt'],_0x1a9f('0x8f'));}}}}}}catch(_0x45e06e){logger['error']('[%s][voiceAgentReport][blindtransfer]',_0x55c25d[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x45e06e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1a9f('0x24')][_0x1a9f('0x1e')]=function(_0xcf7ce7){var _0x1e6c48='';try{if(this['isNotNull'](_0xcf7ce7)){logger[_0x1a9f('0x2c')](_0x1a9f('0x94'),_0xcf7ce7[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0xcf7ce7,{'showHidden':![],'depth':null}));if(_0xcf7ce7[_0x1a9f('0x95')]){_0x1e6c48=_0xcf7ce7[_0x1a9f('0x95')][_0x1a9f('0x96')](0x0,_0xcf7ce7[_0x1a9f('0x95')][_0x1a9f('0x97')]('-'));if(this['agents'][_0x1e6c48]){logger[_0x1a9f('0x3d')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0xcf7ce7[_0x1a9f('0x29')],_0x1e6c48);this['agents'][_0x1e6c48]['onhold']=!![];}}}}catch(_0x56624b){logger[_0x1a9f('0x3c')](_0x1a9f('0x98'),_0xcf7ce7[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x56624b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1a9f('0x24')][_0x1a9f('0x20')]=function(_0x4429e9){var _0x472307='';try{if(this[_0x1a9f('0x26')](_0x4429e9)){logger[_0x1a9f('0x2c')](_0x1a9f('0x99'),_0x4429e9[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x4429e9,{'showHidden':![],'depth':null}));if(_0x4429e9[_0x1a9f('0x95')]){_0x472307=_0x4429e9[_0x1a9f('0x95')][_0x1a9f('0x96')](0x0,_0x4429e9['channel'][_0x1a9f('0x97')]('-'));if(this['agents'][_0x472307]){logger[_0x1a9f('0x3d')](_0x1a9f('0x9a'),_0x4429e9[_0x1a9f('0x29')],_0x472307);this[_0x1a9f('0xd')][_0x472307][_0x1a9f('0x9b')]=![];}}}}catch(_0x357f36){logger[_0x1a9f('0x3c')]('[%s][voiceAgentReport][musiconholdstop]',_0x4429e9['uniqueid'],util[_0x1a9f('0x2e')](_0x357f36,{'showHidden':![],'depth':null}));}};module[_0x1a9f('0x9c')]=VoiceAgentReport;