Built motion from commit (unavailable).|2.5.10
[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 _0xc304=['YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','format','user:%s','user:called','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','destchannelstate','destchannelstatedesc','holdtime','connect','merge','interface','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','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:','custom:agentansweredelsewhere','error','[%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:','hasOwnProperty','lastevent','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','transfer','agent','talktime','acwtime','acwTimeout','agentacw','agents','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','syncVarSet','[%s][voiceAgentReport][varset]\x20event:','addVariable','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','values','custom:voiceAgentReport','[%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:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ami','../ami','redis','defaults','localhost','channels','voiceQueues','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','info','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect'];(function(_0x5e8557,_0x553196){var _0x48d65a=function(_0x2a5f25){while(--_0x2a5f25){_0x5e8557['push'](_0x5e8557['shift']());}};_0x48d65a(++_0x553196);}(_0xc304,0x19f));var _0x4c30=function(_0x16e0c8,_0x4861eb){_0x16e0c8=_0x16e0c8-0x0;var _0xe4b5af=_0xc304[_0x16e0c8];return _0xe4b5af;};'use strict';var _=require(_0x4c30('0x0'));var moment=require(_0x4c30('0x1'));var util=require(_0x4c30('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x4c30('0x3'));var ami=require(_0x4c30('0x4'));config[_0x4c30('0x5')]=_[_0x4c30('0x6')](config['redis'],{'host':_0x4c30('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4c30('0x5')]));function VoiceAgentReport(_0x459071){this[_0x4c30('0x8')]={};this['voiceQueues']=_0x459071[_0x4c30('0x9')];this['agents']=_0x459071['agents'];this[_0x4c30('0xa')]={};ami['on'](_0x4c30('0xb'),this[_0x4c30('0xc')][_0x4c30('0xd')](this));ami['on'](_0x4c30('0xe'),this[_0x4c30('0xf')][_0x4c30('0xd')](this));ami['on'](_0x4c30('0x10'),this[_0x4c30('0x11')][_0x4c30('0xd')](this));ami['on'](_0x4c30('0x12'),this[_0x4c30('0x13')][_0x4c30('0xd')](this));ami['on'](_0x4c30('0x14'),this[_0x4c30('0x15')][_0x4c30('0xd')](this));ami['on'](_0x4c30('0x16'),this['syncVarSet']['bind'](this));ami['on'](_0x4c30('0x17'),this[_0x4c30('0x18')]['bind'](this));ami['on'](_0x4c30('0x19'),this[_0x4c30('0x1a')][_0x4c30('0xd')](this));ami['on'](_0x4c30('0x1b'),this[_0x4c30('0x1c')][_0x4c30('0xd')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x4c30('0xd')](this));ami['on']('blindtransfer',this[_0x4c30('0x1d')][_0x4c30('0xd')](this));}VoiceAgentReport['prototype'][_0x4c30('0x1e')]=function(_0xf95931,_0x1aac9b,_0x15dfdb){io['to'](_0xf95931)[_0x4c30('0x1e')](_0x1aac9b,_0x15dfdb);};VoiceAgentReport[_0x4c30('0x1f')][_0x4c30('0x20')]=function(_0x787282){return _0x787282!==null&&!_[_0x4c30('0x21')](_0x787282);};VoiceAgentReport[_0x4c30('0x1f')][_0x4c30('0xc')]=function(_0x5763ad){try{if(this[_0x4c30('0x20')](_0x5763ad)){logger[_0x4c30('0x22')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x5763ad[_0x4c30('0x23')],_0x5763ad[_0x4c30('0x24')],_0x5763ad[_0x4c30('0x25')]);logger[_0x4c30('0x26')](_0x4c30('0x27'),_0x5763ad['uniqueid'],util[_0x4c30('0x28')](_0x5763ad,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x4c30('0x8')][_0x5763ad[_0x4c30('0x23')]])){this[_0x4c30('0x8')][_0x5763ad[_0x4c30('0x23')]]={};}if(_[_0x4c30('0x21')](this[_0x4c30('0x8')][_0x5763ad[_0x4c30('0x23')]][_0x5763ad['destuniqueid']])){this['channels'][_0x5763ad[_0x4c30('0x23')]][_0x5763ad[_0x4c30('0x25')]]={'agentcalledAt':moment()['format'](_0x4c30('0x29')),'lastevent':_0x4c30('0x2a'),'mandatoryDisposition':this['voiceQueues'][_0x5763ad[_0x4c30('0x2b')]]?this[_0x4c30('0x9')][_0x5763ad[_0x4c30('0x2b')]][_0x4c30('0x2c')]||![]:![],'type':this['voiceQueues'][_0x5763ad[_0x4c30('0x2b')]]?this[_0x4c30('0x9')][_0x5763ad[_0x4c30('0x2b')]][_0x4c30('0x2d')]||'inbound':_0x4c30('0x2e'),'variables':this[_0x4c30('0xa')][_0x5763ad[_0x4c30('0x23')]]};}_['merge'](this[_0x4c30('0x8')][_0x5763ad['uniqueid']][_0x5763ad[_0x4c30('0x25')]],_[_0x4c30('0x2f')](_0x5763ad,[_0x4c30('0x30'),_0x4c30('0x31')]));logger['debug'](_0x4c30('0x32'),_0x5763ad[_0x4c30('0x23')],util[_0x4c30('0x28')](this[_0x4c30('0x8')][_0x5763ad[_0x4c30('0x23')]][_0x5763ad['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x4c30('0x1e')](_0x4c30('0x33'),this[_0x4c30('0x8')][_0x5763ad[_0x4c30('0x23')]][_0x5763ad[_0x4c30('0x25')]]);logger[_0x4c30('0x26')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x5763ad[_0x4c30('0x23')],util[_0x4c30('0x28')](this[_0x4c30('0x8')][_0x5763ad[_0x4c30('0x23')]][_0x5763ad[_0x4c30('0x25')]],{'showHidden':![],'depth':null}));this[_0x4c30('0x1e')](util[_0x4c30('0x34')](_0x4c30('0x35'),_0x5763ad[_0x4c30('0x24')]),_0x4c30('0x36'),this[_0x4c30('0x8')][_0x5763ad[_0x4c30('0x23')]][_0x5763ad[_0x4c30('0x25')]]);}}catch(_0x4621eb){logger['error']('[%s][voiceAgentReport][agentcalled]',_0x5763ad[_0x4c30('0x23')],util['inspect'](_0x4621eb,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4c30('0x1f')][_0x4c30('0xf')]=function(_0x35d721){try{if(this[_0x4c30('0x20')](_0x35d721)){if(this[_0x4c30('0x8')][_0x35d721[_0x4c30('0x23')]]){logger[_0x4c30('0x26')](_0x4c30('0x37'),_0x35d721[_0x4c30('0x23')],util['inspect'](_0x35d721,{'showHidden':![],'depth':null}));for(var _0x3de5bb in this[_0x4c30('0x8')][_0x35d721[_0x4c30('0x23')]]){if(this[_0x4c30('0x8')][_0x35d721[_0x4c30('0x23')]]['hasOwnProperty'](_0x3de5bb)){if(_0x35d721[_0x4c30('0x25')]===_0x3de5bb){logger[_0x4c30('0x22')](_0x4c30('0x38'),_0x35d721[_0x4c30('0x23')],_0x35d721[_0x4c30('0x24')],_0x35d721[_0x4c30('0x25')]);this[_0x4c30('0x8')][_0x35d721[_0x4c30('0x23')]][_0x3de5bb][_0x4c30('0x39')]=moment()[_0x4c30('0x34')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4c30('0x8')][_0x35d721[_0x4c30('0x23')]][_0x3de5bb][_0x4c30('0x3a')]=_0x35d721[_0x4c30('0x3a')];this[_0x4c30('0x8')][_0x35d721[_0x4c30('0x23')]][_0x3de5bb]['connectedlinenum']=_0x35d721['connectedlinenum'];this[_0x4c30('0x8')][_0x35d721[_0x4c30('0x23')]][_0x3de5bb][_0x4c30('0x3b')]=_0x35d721[_0x4c30('0x3b')];this[_0x4c30('0x8')][_0x35d721[_0x4c30('0x23')]][_0x3de5bb][_0x4c30('0x3c')]=_0x35d721['destchannelstatedesc'];this['channels'][_0x35d721['uniqueid']][_0x3de5bb]['holdtime']=_0x35d721[_0x4c30('0x3d')];this[_0x4c30('0x8')][_0x35d721['uniqueid']][_0x3de5bb]['lastevent']=_0x4c30('0x3e');_[_0x4c30('0x3f')](this['agents'][_0x35d721[_0x4c30('0x40')]],_['pick'](_0x35d721,[_0x4c30('0x2b'),_0x4c30('0x41')]));logger[_0x4c30('0x26')](_0x4c30('0x42'),_0x35d721[_0x4c30('0x23')],util[_0x4c30('0x28')](this[_0x4c30('0x8')][_0x35d721[_0x4c30('0x23')]][_0x35d721[_0x4c30('0x25')]],{'showHidden':![],'depth':null}));ami['emit'](_0x4c30('0x43'),this[_0x4c30('0x8')][_0x35d721[_0x4c30('0x23')]][_0x35d721[_0x4c30('0x25')]]);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x35d721[_0x4c30('0x23')],util[_0x4c30('0x28')](this[_0x4c30('0x8')][_0x35d721['uniqueid']][_0x35d721[_0x4c30('0x25')]],{'showHidden':![],'depth':null}));this[_0x4c30('0x1e')](util[_0x4c30('0x34')](_0x4c30('0x35'),_0x35d721[_0x4c30('0x24')]),_0x4c30('0x44'),this[_0x4c30('0x8')][_0x35d721[_0x4c30('0x23')]][_0x35d721[_0x4c30('0x25')]]);}else if(!this[_0x4c30('0x8')][_0x35d721[_0x4c30('0x23')]][_0x3de5bb][_0x4c30('0x10')]&&!this['channels'][_0x35d721[_0x4c30('0x23')]][_0x3de5bb][_0x4c30('0x14')]){logger[_0x4c30('0x22')](_0x4c30('0x45'),_0x35d721[_0x4c30('0x23')],this[_0x4c30('0x8')][_0x35d721[_0x4c30('0x23')]][_0x3de5bb][_0x4c30('0x24')],_0x3de5bb);this['channels'][_0x35d721[_0x4c30('0x23')]][_0x3de5bb]['agentringnoanswer']=!![];this['channels'][_0x35d721[_0x4c30('0x23')]][_0x3de5bb][_0x4c30('0x46')]=moment()[_0x4c30('0x34')](_0x4c30('0x29'));this[_0x4c30('0x8')][_0x35d721[_0x4c30('0x23')]][_0x3de5bb][_0x4c30('0x47')]=_0x35d721['destuniqueid'];this[_0x4c30('0x8')][_0x35d721[_0x4c30('0x23')]][_0x3de5bb][_0x4c30('0x48')]=_0x35d721[_0x4c30('0x24')];this[_0x4c30('0x8')][_0x35d721['uniqueid']][_0x3de5bb]['lastevent']=_0x4c30('0x49');this[_0x4c30('0x8')][_0x35d721[_0x4c30('0x23')]][_0x3de5bb][_0x4c30('0x4a')]=_0x4c30('0x49');logger['debug'](_0x4c30('0x4b'),_0x35d721[_0x4c30('0x23')],util['inspect'](this[_0x4c30('0x8')][_0x35d721['uniqueid']][_0x3de5bb],{'showHidden':![],'depth':null}));ami[_0x4c30('0x1e')](_0x4c30('0x4c'),this[_0x4c30('0x8')][_0x35d721[_0x4c30('0x23')]][_0x3de5bb]);}}}}}}catch(_0x73a9ce){logger[_0x4c30('0x4d')]('[%s][voiceAgentReport][agentconnect]',_0x35d721['uniqueid'],util[_0x4c30('0x28')](_0x73a9ce,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentRingNoAnswer']=function(_0x2886db){try{if(this[_0x4c30('0x20')](_0x2886db)){logger[_0x4c30('0x26')](_0x4c30('0x4e'),_0x2886db[_0x4c30('0x23')],util[_0x4c30('0x28')](_0x2886db,{'showHidden':![],'depth':null}));if(this[_0x4c30('0x8')][_0x2886db[_0x4c30('0x23')]]&&this[_0x4c30('0x8')][_0x2886db[_0x4c30('0x23')]][_0x2886db[_0x4c30('0x25')]]){logger['info'](_0x4c30('0x4f'),_0x2886db[_0x4c30('0x23')],_0x2886db[_0x4c30('0x24')],_0x2886db[_0x4c30('0x25')]);this[_0x4c30('0x8')][_0x2886db[_0x4c30('0x23')]][_0x2886db[_0x4c30('0x25')]][_0x4c30('0x10')]=!![];this['channels'][_0x2886db[_0x4c30('0x23')]][_0x2886db['destuniqueid']][_0x4c30('0x46')]=moment()[_0x4c30('0x34')](_0x4c30('0x29'));this[_0x4c30('0x8')][_0x2886db[_0x4c30('0x23')]][_0x2886db[_0x4c30('0x25')]]['lastevent']=_0x4c30('0x50');this[_0x4c30('0x8')][_0x2886db['uniqueid']][_0x2886db[_0x4c30('0x25')]][_0x4c30('0x4a')]='rejected';logger[_0x4c30('0x26')](_0x4c30('0x51'),_0x2886db[_0x4c30('0x23')],util[_0x4c30('0x28')](this[_0x4c30('0x8')][_0x2886db['uniqueid']][_0x2886db[_0x4c30('0x25')]],{'showHidden':![],'depth':null}));ami[_0x4c30('0x1e')](_0x4c30('0x52'),this[_0x4c30('0x8')][_0x2886db['uniqueid']][_0x2886db[_0x4c30('0x25')]]);}}}catch(_0x29c327){logger[_0x4c30('0x4d')]('[%s][voiceAgentReport][agentringnoanswer]',_0x2886db[_0x4c30('0x23')],util[_0x4c30('0x28')](_0x29c327,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x4c30('0x13')]=function(_0x13e141){try{if(this[_0x4c30('0x20')](_0x13e141)){logger[_0x4c30('0x26')](_0x4c30('0x53'),_0x13e141[_0x4c30('0x23')],util[_0x4c30('0x28')](_0x13e141,{'showHidden':![],'depth':null}));if(this[_0x4c30('0x8')][_0x13e141[_0x4c30('0x23')]]){for(var _0x176d2f in this['channels'][_0x13e141[_0x4c30('0x23')]]){if(this[_0x4c30('0x8')][_0x13e141[_0x4c30('0x23')]][_0x4c30('0x54')](_0x176d2f)&&!this[_0x4c30('0x8')][_0x13e141['uniqueid']][_0x176d2f][_0x4c30('0x10')]&&!this[_0x4c30('0x8')][_0x13e141[_0x4c30('0x23')]][_0x176d2f]['agentcomplete']){logger[_0x4c30('0x22')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x13e141['uniqueid'],this[_0x4c30('0x8')][_0x13e141[_0x4c30('0x23')]][_0x176d2f][_0x4c30('0x24')],_0x176d2f);this[_0x4c30('0x8')][_0x13e141[_0x4c30('0x23')]][_0x176d2f][_0x4c30('0x10')]=!![];this[_0x4c30('0x8')][_0x13e141[_0x4c30('0x23')]][_0x176d2f][_0x4c30('0x46')]=moment()[_0x4c30('0x34')](_0x4c30('0x29'));this[_0x4c30('0x8')][_0x13e141[_0x4c30('0x23')]][_0x176d2f][_0x4c30('0x55')]=_0x4c30('0x56');this[_0x4c30('0x8')][_0x13e141[_0x4c30('0x23')]][_0x176d2f][_0x4c30('0x4a')]='abandoned';logger[_0x4c30('0x26')](_0x4c30('0x57'),_0x13e141[_0x4c30('0x23')],util[_0x4c30('0x28')](this['channels'][_0x13e141[_0x4c30('0x23')]][_0x176d2f],{'showHidden':![],'depth':null}));ami[_0x4c30('0x1e')](_0x4c30('0x58'),this['channels'][_0x13e141[_0x4c30('0x23')]][_0x176d2f]);}}}}}catch(_0x3ae7a4){logger[_0x4c30('0x4d')](_0x4c30('0x59'),_0x13e141[_0x4c30('0x23')],util[_0x4c30('0x28')](_0x3ae7a4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4c30('0x1f')][_0x4c30('0x15')]=function(_0xea2a44){try{if(this[_0x4c30('0x20')](_0xea2a44)){logger[_0x4c30('0x26')](_0x4c30('0x5a'),_0xea2a44[_0x4c30('0x23')],util[_0x4c30('0x28')](_0xea2a44,{'showHidden':![],'depth':null}));if(this[_0x4c30('0x8')][_0xea2a44[_0x4c30('0x23')]]){for(var _0x1d293b in this['channels'][_0xea2a44[_0x4c30('0x23')]]){if(this[_0x4c30('0x8')][_0xea2a44[_0x4c30('0x23')]][_0x4c30('0x54')](_0x1d293b)){if(this['channels'][_0xea2a44[_0x4c30('0x23')]][_0x1d293b][_0x4c30('0x39')]&&!this[_0x4c30('0x8')][_0xea2a44[_0x4c30('0x23')]][_0x1d293b][_0x4c30('0x14')]){logger[_0x4c30('0x22')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0xea2a44[_0x4c30('0x23')],this[_0x4c30('0x8')][_0xea2a44[_0x4c30('0x23')]][_0x1d293b][_0x4c30('0x24')],_0x1d293b);this['channels'][_0xea2a44[_0x4c30('0x23')]][_0x1d293b][_0x4c30('0x14')]=!![];this[_0x4c30('0x8')][_0xea2a44[_0x4c30('0x23')]][_0x1d293b][_0x4c30('0x5b')]=moment()[_0x4c30('0x34')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4c30('0x8')][_0xea2a44[_0x4c30('0x23')]][_0x1d293b][_0x4c30('0x55')]=_0x4c30('0x5c');this['channels'][_0xea2a44[_0x4c30('0x23')]][_0x1d293b]['reason']=_0xea2a44[_0x4c30('0x4a')]==_0x4c30('0x5d')?_0x4c30('0x5e'):_0xea2a44['reason'];this[_0x4c30('0x8')][_0xea2a44[_0x4c30('0x23')]][_0x1d293b][_0x4c30('0x5f')]=_0xea2a44[_0x4c30('0x5f')];if(this['voiceQueues'][_0xea2a44['queue']]&&this[_0x4c30('0x9')][_0xea2a44[_0x4c30('0x2b')]]['acw']){this[_0x4c30('0x8')][_0xea2a44[_0x4c30('0x23')]][_0x1d293b][_0x4c30('0x60')]=this[_0x4c30('0x9')][_0xea2a44['queue']][_0x4c30('0x61')];this[_0x4c30('0x8')][_0xea2a44[_0x4c30('0x23')]][_0x1d293b][_0x4c30('0x62')]=!![];}this[_0x4c30('0x63')][_0xea2a44['interface']]=_[_0x4c30('0x2f')](this[_0x4c30('0x63')][_0xea2a44['interface']],['queue',_0x4c30('0x41')]);logger[_0x4c30('0x26')](_0x4c30('0x64'),_0xea2a44['uniqueid'],util[_0x4c30('0x28')](this[_0x4c30('0x8')][_0xea2a44[_0x4c30('0x23')]][_0x1d293b],{'showHidden':![],'depth':null}));ami[_0x4c30('0x1e')](_0x4c30('0x65'),this[_0x4c30('0x8')][_0xea2a44[_0x4c30('0x23')]][_0x1d293b]);logger[_0x4c30('0x26')](_0x4c30('0x66'),_0xea2a44[_0x4c30('0x23')],util['inspect'](this['channels'][_0xea2a44[_0x4c30('0x23')]][_0x1d293b],{'showHidden':![],'depth':null}));this[_0x4c30('0x1e')](util[_0x4c30('0x34')](_0x4c30('0x35'),_0xea2a44[_0x4c30('0x24')]),_0x4c30('0x67'),this[_0x4c30('0x8')][_0xea2a44['uniqueid']][_0x1d293b]);}}}}}}catch(_0x535a9f){logger['error'](_0x4c30('0x68'),_0xea2a44[_0x4c30('0x23')],util[_0x4c30('0x28')](_0x535a9f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4c30('0x1f')][_0x4c30('0x69')]=function(_0xb9a9e5){try{if(this[_0x4c30('0x20')](_0xb9a9e5)){logger[_0x4c30('0x26')](_0x4c30('0x6a'),_0xb9a9e5[_0x4c30('0x23')],util[_0x4c30('0x28')](_0xb9a9e5,{'showHidden':![],'depth':null}));this[_0x4c30('0x6b')](_0xb9a9e5[_0x4c30('0x23')],_['keys'](_0xb9a9e5[_0x4c30('0x6c')])[0x0],_0xb9a9e5[_0x4c30('0x6d')]);if(this['channels'][_0xb9a9e5['uniqueid']]){for(var _0x50f6af in this['channels'][_0xb9a9e5[_0x4c30('0x23')]]){if(this[_0x4c30('0x8')][_0xb9a9e5[_0x4c30('0x23')]][_0x4c30('0x54')](_0x50f6af)){logger['info'](_0x4c30('0x6e'),_0xb9a9e5[_0x4c30('0x23')],_0x50f6af,_[_0x4c30('0x6f')](_0xb9a9e5['variable'])[0x0],_0xb9a9e5[_0x4c30('0x6d')]);if(_['isUndefined'](this[_0x4c30('0x8')][_0xb9a9e5[_0x4c30('0x23')]][_0x50f6af][_0x4c30('0xa')])){this[_0x4c30('0x8')][_0xb9a9e5[_0x4c30('0x23')]][_0x50f6af][_0x4c30('0xa')]={};}this[_0x4c30('0x8')][_0xb9a9e5['uniqueid']][_0x50f6af][_0x4c30('0xa')]=this[_0x4c30('0xa')][_0xb9a9e5['uniqueid']];}}}}}catch(_0x6cb7c4){logger['error'](_0x4c30('0x70'),_0xb9a9e5[_0x4c30('0x23')],util[_0x4c30('0x28')](_0x6cb7c4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4c30('0x1f')][_0x4c30('0x6b')]=function(_0x73495d,_0xe57aed,_0x3564b8){var _0x2f4887=[_0x4c30('0x71'),_0x4c30('0x72'),_0x4c30('0x73'),_0x4c30('0x74'),_0x4c30('0x75'),_0x4c30('0x76'),_0x4c30('0x77'),_0x4c30('0x78'),_0x4c30('0x79'),_0x4c30('0x7a'),'bridgepeer',_0x4c30('0x7b'),_0x4c30('0x7c'),_0x4c30('0x7d'),_0x4c30('0x7e'),_0x4c30('0x7f'),_0x4c30('0x24'),_0x4c30('0x80'),'memberrealtime'];if(!_[_0x4c30('0x81')](_0xe57aed)&&!_['includes'](_0x2f4887,_0xe57aed)){if(_['isUndefined'](this['variables'][_0x73495d])){this[_0x4c30('0xa')][_0x73495d]={};}this[_0x4c30('0xa')][_0x73495d][_0xe57aed]=_0x3564b8;}};VoiceAgentReport['prototype'][_0x4c30('0x18')]=function(_0x226dfa){try{if(this[_0x4c30('0x20')](_0x226dfa)){logger['debug'](_0x4c30('0x82'),_0x226dfa[_0x4c30('0x23')],util[_0x4c30('0x28')](_0x226dfa,{'showHidden':![],'depth':null}));if(this[_0x4c30('0x8')][_0x226dfa[_0x4c30('0x23')]]){for(var _0x2c36ec in this['channels'][_0x226dfa['uniqueid']]){if(this[_0x4c30('0x8')][_0x226dfa['uniqueid']]['hasOwnProperty'](_0x2c36ec)){if(this[_0x4c30('0x8')][_0x226dfa[_0x4c30('0x23')]][_0x2c36ec]['reason']==_0x4c30('0x5d')&&this['channels'][_0x226dfa[_0x4c30('0x23')]][_0x2c36ec][_0x4c30('0x14')]){logger['info'](_0x4c30('0x83'),_0x226dfa[_0x4c30('0x23')],_0x2c36ec);this[_0x4c30('0x8')][_0x226dfa[_0x4c30('0x23')]][_0x2c36ec][_0x4c30('0x5b')]=moment()[_0x4c30('0x34')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x4c30('0x26')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x226dfa['uniqueid'],util[_0x4c30('0x28')](_[_0x4c30('0x84')](this['channels'][_0x226dfa['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0x4c30('0x1e')](_0x4c30('0x85'),_[_0x4c30('0x84')](this[_0x4c30('0x8')][_0x226dfa[_0x4c30('0x23')]]));delete this['channels'][_0x226dfa['uniqueid']];}if(this['variables'][_0x226dfa['uniqueid']]){delete this[_0x4c30('0xa')][_0x226dfa['uniqueid']];}}}catch(_0x26c97f){logger['error']('[%s][voiceAgentReport][hangup]',_0x226dfa[_0x4c30('0x23')],util['inspect'](_0x26c97f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4c30('0x1f')]['syncAttendedTransfer']=function(_0x2cc88e){try{if(this['isNotNull'](_0x2cc88e)){logger[_0x4c30('0x26')](_0x4c30('0x86'),_0x2cc88e[_0x4c30('0x23')],util[_0x4c30('0x28')](_0x2cc88e,{'showHidden':![],'depth':null}));if(this[_0x4c30('0x8')][_0x2cc88e[_0x4c30('0x87')]]){for(var _0x3968e6 in this['channels'][_0x2cc88e[_0x4c30('0x87')]]){if(this[_0x4c30('0x8')][_0x2cc88e[_0x4c30('0x87')]][_0x4c30('0x54')](_0x3968e6)){if(_0x2cc88e[_0x4c30('0x88')]===_0x3968e6){logger[_0x4c30('0x22')](_0x4c30('0x89'),_0x2cc88e[_0x4c30('0x23')],this[_0x4c30('0x8')][_0x2cc88e['transfereeuniqueid']][_0x3968e6][_0x4c30('0x24')],_0x3968e6);var _0x2d63bb=moment();this['channels'][_0x2cc88e[_0x4c30('0x87')]][_0x3968e6]['agentcomplete']=!![];this[_0x4c30('0x8')][_0x2cc88e['transfereeuniqueid']][_0x3968e6][_0x4c30('0x5b')]=moment()[_0x4c30('0x34')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4c30('0x8')][_0x2cc88e['transfereeuniqueid']][_0x3968e6]['lastevent']='complete';this[_0x4c30('0x8')][_0x2cc88e[_0x4c30('0x87')]][_0x3968e6][_0x4c30('0x4a')]='transfer';this[_0x4c30('0x8')][_0x2cc88e[_0x4c30('0x87')]][_0x3968e6][_0x4c30('0x5f')]=_0x2d63bb[_0x4c30('0x8a')](this[_0x4c30('0x8')][_0x2cc88e['transfereeuniqueid']][_0x3968e6][_0x4c30('0x39')],_0x4c30('0x8b'));}}}}if(this['channels'][_0x2cc88e[_0x4c30('0x8c')]]){var _0x3a07c6=this['channels'][_0x2cc88e[_0x4c30('0x8c')]];this[_0x4c30('0x8')][_0x2cc88e[_0x4c30('0x8c')]]=this[_0x4c30('0x8')][_0x2cc88e['transfereeuniqueid']];this[_0x4c30('0x8')][_0x2cc88e['transfereeuniqueid']]=_0x3a07c6;}}}catch(_0x316263){logger['error'](_0x4c30('0x8d'),_0x2cc88e['uniqueid'],util['inspect'](_0x316263,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4c30('0x1f')]['syncBlindTransfer']=function(_0x2842a9){try{if(this[_0x4c30('0x20')](_0x2842a9)){logger[_0x4c30('0x26')](_0x4c30('0x8e'),_0x2842a9['uniqueid'],util[_0x4c30('0x28')](_0x2842a9,{'showHidden':![],'depth':null}));if(this[_0x4c30('0x8')][_0x2842a9[_0x4c30('0x87')]]){for(var _0xc44d26 in this[_0x4c30('0x8')][_0x2842a9[_0x4c30('0x87')]]){if(this[_0x4c30('0x8')][_0x2842a9['transfereeuniqueid']][_0x4c30('0x54')](_0xc44d26)){if(_0x2842a9['transfereruniqueid']===_0xc44d26){logger['info'](_0x4c30('0x8f'),_0x2842a9[_0x4c30('0x23')],this[_0x4c30('0x8')][_0x2842a9[_0x4c30('0x87')]][_0xc44d26][_0x4c30('0x24')],_0xc44d26);var _0x513c88=moment();this[_0x4c30('0x8')][_0x2842a9[_0x4c30('0x87')]][_0xc44d26][_0x4c30('0x14')]=!![];this[_0x4c30('0x8')][_0x2842a9[_0x4c30('0x87')]][_0xc44d26][_0x4c30('0x5b')]=_0x513c88;this['channels'][_0x2842a9[_0x4c30('0x87')]][_0xc44d26][_0x4c30('0x55')]=_0x4c30('0x5c');this[_0x4c30('0x8')][_0x2842a9[_0x4c30('0x87')]][_0xc44d26][_0x4c30('0x4a')]=_0x4c30('0x5d');this[_0x4c30('0x8')][_0x2842a9[_0x4c30('0x87')]][_0xc44d26][_0x4c30('0x5f')]=_0x513c88[_0x4c30('0x8a')](this[_0x4c30('0x8')][_0x2842a9['transfereeuniqueid']][_0xc44d26][_0x4c30('0x39')],_0x4c30('0x8b'));}}}}}}catch(_0x26611a){logger[_0x4c30('0x4d')](_0x4c30('0x90'),_0x2842a9[_0x4c30('0x23')],util[_0x4c30('0x28')](_0x26611a,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x4c30('0x1a')]=function(_0x2c5352){var _0xe9d721='';try{if(this[_0x4c30('0x20')](_0x2c5352)){logger[_0x4c30('0x26')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x2c5352[_0x4c30('0x23')],util[_0x4c30('0x28')](_0x2c5352,{'showHidden':![],'depth':null}));if(_0x2c5352[_0x4c30('0x91')]){_0xe9d721=_0x2c5352[_0x4c30('0x91')][_0x4c30('0x92')](0x0,_0x2c5352[_0x4c30('0x91')]['lastIndexOf']('-'));if(this[_0x4c30('0x63')][_0xe9d721]){logger[_0x4c30('0x22')](_0x4c30('0x93'),_0x2c5352[_0x4c30('0x23')],_0xe9d721);this[_0x4c30('0x63')][_0xe9d721][_0x4c30('0x94')]=!![];}}}}catch(_0x50d5da){logger['error']('[%s][voiceAgentReport][musiconholdstart]',_0x2c5352[_0x4c30('0x23')],util[_0x4c30('0x28')](_0x50d5da,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4c30('0x1f')][_0x4c30('0x1c')]=function(_0x23b5f1){var _0x522711='';try{if(this[_0x4c30('0x20')](_0x23b5f1)){logger[_0x4c30('0x26')](_0x4c30('0x95'),_0x23b5f1[_0x4c30('0x23')],util['inspect'](_0x23b5f1,{'showHidden':![],'depth':null}));if(_0x23b5f1[_0x4c30('0x91')]){_0x522711=_0x23b5f1[_0x4c30('0x91')][_0x4c30('0x92')](0x0,_0x23b5f1[_0x4c30('0x91')]['lastIndexOf']('-'));if(this[_0x4c30('0x63')][_0x522711]){logger[_0x4c30('0x22')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x23b5f1[_0x4c30('0x23')],_0x522711);this[_0x4c30('0x63')][_0x522711][_0x4c30('0x94')]=![];}}}}catch(_0x110a7d){logger[_0x4c30('0x4d')](_0x4c30('0x96'),_0x23b5f1[_0x4c30('0x23')],util[_0x4c30('0x28')](_0x110a7d,{'showHidden':![],'depth':null}));}};module[_0x4c30('0x97')]=VoiceAgentReport;