Built motion from commit b0a9a629.|2.6.33
[motion2.git] / server / services / ami / report / voiceCallReport.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 _0xd6e0=['transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','../../../config/environment','../../../config/logger','../ami','../model/channel','../rpc/setting','set','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','defaults','redis','localhost','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','syncNewChannel','newstate','syncNewState','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','musiconholdstart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','error','[voiceCallReport][coreshowchannels]','prototype','isNotNull','isUndefined','emit','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','context','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','inspect','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','queue','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','seconds','includes','lastapplication','lastdata','startsWith','cdr(','split','match','type','isNil','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','diff','connectedlinename','toNumber','UserId','membername','destinationchannel','from-sip','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','find','monitors','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','cause-txt','endtime','billableseconds','holdtime','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','resolve','then','transferType','undefined','transferToInternal','stopRecordingOnTransfer','Action','catch','StopMixMonitor','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transfertargetcalleridnum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','some','origtransfererlinkedid','routeid','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','extension','BLIND'];(function(_0x139dc1,_0x53c217){var _0x14926f=function(_0x59f507){while(--_0x59f507){_0x139dc1['push'](_0x139dc1['shift']());}};_0x14926f(++_0x53c217);}(_0xd6e0,0xda));var _0x0d6e=function(_0x4404ff,_0x13d7a9){_0x4404ff=_0x4404ff-0x0;var _0x5e7b19=_0xd6e0[_0x4404ff];return _0x5e7b19;};'use strict';var _=require(_0x0d6e('0x0'));var moment=require(_0x0d6e('0x1'));var util=require(_0x0d6e('0x2'));var path=require(_0x0d6e('0x3'));var Redis=require('ioredis');var config=require(_0x0d6e('0x4'));var logger=require(_0x0d6e('0x5'))('ami');var ami=require(_0x0d6e('0x6'));var Channel=require(_0x0d6e('0x7'));var RpcSetting=require(_0x0d6e('0x8'));var applications=[_0x0d6e('0x9'),'queue','agi',_0x0d6e('0xa'),_0x0d6e('0xb'),_0x0d6e('0xc')];var dispositions=[_0x0d6e('0xd'),'FAILED',_0x0d6e('0xe'),_0x0d6e('0xd'),'NO\x20ANSWER',_0x0d6e('0xd'),_0x0d6e('0xf'),'BUSY','FAILED','FAILED',_0x0d6e('0xe')];config['redis']=_[_0x0d6e('0x10')](config[_0x0d6e('0x11')],{'host':_0x0d6e('0x12'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0d6e('0x11')]));function VoiceCallReport(_0x5bc55d){this[_0x0d6e('0x13')]=_0x5bc55d['channels'];this[_0x0d6e('0x14')]=_0x5bc55d['agents'];this[_0x0d6e('0x15')]={};ami['on'](_0x0d6e('0x16'),this[_0x0d6e('0x17')][_0x0d6e('0x18')](this));ami['on'](_0x0d6e('0x19'),this[_0x0d6e('0x17')][_0x0d6e('0x18')](this));ami['on']('newchannel',this[_0x0d6e('0x1a')][_0x0d6e('0x18')](this));ami['on'](_0x0d6e('0x1b'),this[_0x0d6e('0x1c')][_0x0d6e('0x18')](this));ami['on']('varset',this['syncVarSet'][_0x0d6e('0x18')](this));ami['on'](_0x0d6e('0x1d'),this[_0x0d6e('0x1e')][_0x0d6e('0x18')](this));ami['on'](_0x0d6e('0x1f'),this[_0x0d6e('0x20')][_0x0d6e('0x18')](this));ami['on'](_0x0d6e('0x21'),this[_0x0d6e('0x22')][_0x0d6e('0x18')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x0d6e('0x18')](this));ami['on'](_0x0d6e('0x23'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0x0d6e('0x24'),this['syncMusicOnHoldStop'][_0x0d6e('0x18')](this));try{logger[_0x0d6e('0x25')](_0x0d6e('0x26'));ami['actionCoreShowChannels']();}catch(_0x21b160){logger[_0x0d6e('0x27')](_0x0d6e('0x28'),util['inspect'](_0x21b160,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x0d6e('0x29')][_0x0d6e('0x2a')]=function(_0x2b7e6b){return _0x2b7e6b!==null&&!_[_0x0d6e('0x2b')](_0x2b7e6b);};VoiceCallReport[_0x0d6e('0x29')][_0x0d6e('0x2c')]=function(_0x3fa265,_0x4f12d1,_0x5595b5){io['to'](_0x3fa265)[_0x0d6e('0x2c')](_0x4f12d1,_0x5595b5);};VoiceCallReport[_0x0d6e('0x29')][_0x0d6e('0x20')]=function(_0x1125c0){try{if(this['isNotNull'](_0x1125c0)){logger[_0x0d6e('0x25')]('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x1125c0[_0x0d6e('0x2d')],_0x1125c0[_0x0d6e('0x2e')],_0x1125c0[_0x0d6e('0x2f')]);logger[_0x0d6e('0x30')](_0x0d6e('0x31'),_0x1125c0[_0x0d6e('0x2d')],util['inspect'](_0x1125c0,{'showHidden':![],'depth':null}));if(_0x1125c0[_0x0d6e('0x2d')]===_0x1125c0[_0x0d6e('0x32')]){if(!_[_0x0d6e('0x2b')](this[_0x0d6e('0x13')][_0x1125c0['uniqueid']])){_[_0x0d6e('0x33')](this[_0x0d6e('0x13')][_0x1125c0['uniqueid']],_[_0x0d6e('0x34')](_0x1125c0,_[_0x0d6e('0x35')](this['channels'][_0x1125c0[_0x0d6e('0x2d')]])));}}if(_0x1125c0[_0x0d6e('0x36')]==='from-sip'){var _0x148801=this['agents'][_0x1125c0['channel']['split']('-')[0x0]];if(_0x148801){if(_0x1125c0[_0x0d6e('0x37')]==_0x0d6e('0x38')){_0x148801[_0x0d6e('0x39')]=_0x1125c0[_0x0d6e('0x3a')];this['emit'](util[_0x0d6e('0x3b')](_0x0d6e('0x3c'),_0x148801[_0x0d6e('0x3d')]),_0x0d6e('0x3e'),{'id':_0x148801['id'],'destaccountcode':_0x148801[_0x0d6e('0x3f')],'destconnectedlinenum':_0x1125c0[_0x0d6e('0x3a')]});}}}}}catch(_0x11e701){logger[_0x0d6e('0x27')](_0x0d6e('0x40'),_0x1125c0[_0x0d6e('0x2d')],util[_0x0d6e('0x41')](_0x11e701,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0d6e('0x29')][_0x0d6e('0x1a')]=function(_0x1d5b3e){try{if(this[_0x0d6e('0x2a')](_0x1d5b3e)){logger['debug'](_0x0d6e('0x42'),_0x1d5b3e['uniqueid'],util[_0x0d6e('0x41')](_0x1d5b3e,{'showHidden':![],'depth':null}));if(this['channels'][_0x1d5b3e[_0x0d6e('0x2d')]]){return;}if(_0x1d5b3e[_0x0d6e('0x43')]===_0x0d6e('0x44')){return;}if(_0x1d5b3e[_0x0d6e('0x2d')]!==_0x1d5b3e[_0x0d6e('0x32')]&&!this[_0x0d6e('0x15')][_0x1d5b3e['linkedid']]){return;}logger[_0x0d6e('0x25')](_0x0d6e('0x45'),_0x1d5b3e[_0x0d6e('0x2d')],_0x1d5b3e[_0x0d6e('0x36')],_0x1d5b3e['exten']);this['channels'][_0x1d5b3e[_0x0d6e('0x2d')]]=new Channel();this[_0x0d6e('0x13')][_0x1d5b3e[_0x0d6e('0x2d')]][_0x0d6e('0x46')]=moment()['format'](_0x0d6e('0x47'));this[_0x0d6e('0x13')][_0x1d5b3e[_0x0d6e('0x2d')]][_0x0d6e('0x48')]=dispositions[_['toNumber'](_0x1d5b3e[_0x0d6e('0x49')])];_[_0x0d6e('0x33')](this[_0x0d6e('0x13')][_0x1d5b3e[_0x0d6e('0x2d')]],_[_0x0d6e('0x34')](_0x1d5b3e,_[_0x0d6e('0x35')](this[_0x0d6e('0x13')][_0x1d5b3e['uniqueid']])));if(_0x1d5b3e[_0x0d6e('0x36')]==='from-sip'){var _0x55658b=this[_0x0d6e('0x14')][_0x1d5b3e['channel']['split']('-')[0x0]];if(_0x55658b&&typeof _0x55658b[_0x0d6e('0x39')]==='undefined'){_0x55658b[_0x0d6e('0x39')]=_0x1d5b3e[_0x0d6e('0x37')];logger[_0x0d6e('0x30')](_0x0d6e('0x4a'),_0x1d5b3e[_0x0d6e('0x2d')],util[_0x0d6e('0x41')]({'id':_0x55658b['id'],'destaccountcode':_0x55658b[_0x0d6e('0x3f')],'destconnectedlinenum':_0x1d5b3e[_0x0d6e('0x37')]},{'showHidden':![],'depth':null}));this[_0x0d6e('0x2c')](util['format'](_0x0d6e('0x3c'),_0x55658b[_0x0d6e('0x3d')]),_0x0d6e('0x3e'),{'id':_0x55658b['id'],'destaccountcode':_0x55658b[_0x0d6e('0x3f')],'destconnectedlinenum':_0x1d5b3e['exten']});}}}}catch(_0x1fa4e6){logger[_0x0d6e('0x27')]('[%s][voiceCallReport][newchannel]',_0x1d5b3e[_0x0d6e('0x2d')],util[_0x0d6e('0x41')](_0x1fa4e6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0d6e('0x29')]['syncNewExten']=function(_0x2f3982){try{if(this['isNotNull'](_0x2f3982)){logger[_0x0d6e('0x30')](_0x0d6e('0x4b'),_0x2f3982[_0x0d6e('0x2d')],util[_0x0d6e('0x41')](_0x2f3982,{'showHidden':![],'depth':null}));if(_0x2f3982[_0x0d6e('0x43')]==='OutgoingSpoolFailed'||_0x2f3982[_0x0d6e('0x37')]==='h')return;if(_0x2f3982[_0x0d6e('0x2d')]===_0x2f3982[_0x0d6e('0x32')]||this[_0x0d6e('0x15')][_0x2f3982[_0x0d6e('0x32')]]){_0x2f3982[_0x0d6e('0x4c')]=_0x2f3982['application']?_0x2f3982['application'][_0x0d6e('0x4d')]():undefined;_0x2f3982[_0x0d6e('0x4e')]=_0x2f3982[_0x0d6e('0x4f')]||_0x2f3982[_0x0d6e('0x4e')];if(_0x2f3982[_0x0d6e('0x4f')]&&_0x2f3982[_0x0d6e('0x4c')]!==_0x0d6e('0x50')){_0x2f3982[_0x0d6e('0x4e')]=_0x2f3982['applicationdata'][_0x0d6e('0x4d')]();}logger[_0x0d6e('0x25')](_0x0d6e('0x51'),_0x2f3982[_0x0d6e('0x2d')],_0x2f3982[_0x0d6e('0x4c')],_0x2f3982['applicationdata']);if(_['isUndefined'](this['channels'][_0x2f3982[_0x0d6e('0x2d')]])){this[_0x0d6e('0x13')][_0x2f3982['uniqueid']]=new Channel();this[_0x0d6e('0x13')][_0x2f3982[_0x0d6e('0x2d')]]['starttime']=_0x2f3982['duration']?moment()[_0x0d6e('0x52')](moment['duration'](_0x2f3982[_0x0d6e('0x53')])['seconds'](),_0x0d6e('0x54'))[_0x0d6e('0x3b')](_0x0d6e('0x47')):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0d6e('0x13')][_0x2f3982[_0x0d6e('0x2d')]][_0x0d6e('0x48')]=_0x0d6e('0xd');}_[_0x0d6e('0x33')](this['channels'][_0x2f3982['uniqueid']],_['pick'](_0x2f3982,_[_0x0d6e('0x35')](this[_0x0d6e('0x13')][_0x2f3982['uniqueid']])));if(_[_0x0d6e('0x55')](applications,_0x2f3982[_0x0d6e('0x4c')])){this[_0x0d6e('0x13')][_0x2f3982['uniqueid']][_0x0d6e('0x56')]=_0x2f3982['application'];this[_0x0d6e('0x13')][_0x2f3982['uniqueid']][_0x0d6e('0x57')]=_0x2f3982['applicationdata'];if(_0x2f3982[_0x0d6e('0x4c')]===_0x0d6e('0x9')&&_[_0x0d6e('0x58')](_0x2f3982[_0x0d6e('0x4e')][_0x0d6e('0x4d')](),_0x0d6e('0x59'))){var _0x1c3866=_0x2f3982[_0x0d6e('0x4e')][_0x0d6e('0x5a')]('=');var _0x5922dd=_0x1c3866[0x0][_0x0d6e('0x4d')]()[_0x0d6e('0x5b')](/cdr\((.*)\)/);if(_0x5922dd){if(_0x5922dd[0x1]===_0x0d6e('0x5c')&&!_[_0x0d6e('0x5d')](this['channels'][_0x2f3982[_0x0d6e('0x2d')]][_0x5922dd[0x1]]))return;this[_0x0d6e('0x13')][_0x2f3982[_0x0d6e('0x2d')]][_0x5922dd[0x1]]=_0x1c3866[0x1];}}else if(_0x2f3982['application']===_0x0d6e('0x50')){this[_0x0d6e('0x13')][_0x2f3982[_0x0d6e('0x2d')]]['queue']=_0x2f3982['applicationdata'][_0x0d6e('0x5a')](',')[0x0];}}}}}catch(_0x360c98){logger['error']('[%s][voiceCallReport][newexten]',_0x2f3982['uniqueid'],util[_0x0d6e('0x41')](_0x360c98,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewState']=function(_0x1143c9){try{if(this[_0x0d6e('0x2a')](_0x1143c9)){logger[_0x0d6e('0x25')](_0x0d6e('0x5e'),_0x1143c9['uniqueid'],_0x1143c9['linkedid'],_0x1143c9['calleridname'],_0x1143c9[_0x0d6e('0x2f')]);logger[_0x0d6e('0x30')](_0x0d6e('0x5f'),_0x1143c9['uniqueid'],util[_0x0d6e('0x41')](_0x1143c9,{'showHidden':![],'depth':null}));if(_0x1143c9[_0x0d6e('0x49')]!=='6')return;var _0x504b2a=this[_0x0d6e('0x14')][_0x1143c9[_0x0d6e('0x43')][_0x0d6e('0x5a')]('-')[0x0]];if(_0x1143c9[_0x0d6e('0x2d')]!==_0x1143c9[_0x0d6e('0x32')]){var _0x58a48c=moment();if(this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x32')]]){if(!this['channels'][_0x1143c9[_0x0d6e('0x32')]][_0x0d6e('0x60')]){this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x32')]]['answered']=!![];this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x32')]][_0x0d6e('0x61')]=_0x58a48c['format']('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x32')]]['starttime']){this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x32')]]['holdtime']=_0x58a48c[_0x0d6e('0x62')](this[_0x0d6e('0x13')][_0x1143c9['linkedid']][_0x0d6e('0x46')],_0x0d6e('0x54'));}}this['channels'][_0x1143c9[_0x0d6e('0x32')]][_0x0d6e('0x32')]=_0x1143c9[_0x0d6e('0x2d')];if(_0x1143c9['calleridnum']!==_0x0d6e('0x38')){this[_0x0d6e('0x13')][_0x1143c9['linkedid']][_0x0d6e('0x3a')]=_0x1143c9[_0x0d6e('0x2f')];}this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x32')]][_0x0d6e('0x63')]=_0x1143c9[_0x0d6e('0x2e')];this[_0x0d6e('0x13')][_0x1143c9['linkedid']]['destinationchannel']=_0x1143c9['channel'];this[_0x0d6e('0x13')][_0x1143c9['linkedid']]['disposition']=dispositions[_[_0x0d6e('0x64')](_0x1143c9[_0x0d6e('0x49')])];if(_0x504b2a){this['channels'][_0x1143c9[_0x0d6e('0x32')]][_0x0d6e('0x65')]=_0x504b2a['id'];this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x32')]][_0x0d6e('0x66')]=_0x504b2a[_0x0d6e('0x3d')];}}if(this['channels'][_0x1143c9['uniqueid']]){if(!this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x2d')]][_0x0d6e('0x60')]){this[_0x0d6e('0x13')][_0x1143c9['uniqueid']][_0x0d6e('0x60')]=!![];this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x2d')]]['answertime']=_0x58a48c['format'](_0x0d6e('0x47'));if(this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x2d')]][_0x0d6e('0x46')]){this['channels'][_0x1143c9[_0x0d6e('0x2d')]]['holdtime']=_0x58a48c[_0x0d6e('0x62')](this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x2d')]][_0x0d6e('0x46')],'seconds');}}if(_0x1143c9['calleridnum']!==_0x0d6e('0x38')){this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x2d')]][_0x0d6e('0x3a')]=_0x1143c9[_0x0d6e('0x2f')];}this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x2d')]][_0x0d6e('0x63')]=_0x1143c9[_0x0d6e('0x2e')];this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x2d')]][_0x0d6e('0x67')]=_0x1143c9[_0x0d6e('0x43')];this[_0x0d6e('0x13')][_0x1143c9['uniqueid']][_0x0d6e('0x48')]=dispositions[_['toNumber'](_0x1143c9['channelstate'])];}}else{if(this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x2d')]]){if(_0x504b2a){this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x2d')]][_0x0d6e('0x65')]=_0x504b2a['id'];this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x2d')]]['membername']=_0x504b2a[_0x0d6e('0x3d')];}}}if(_0x1143c9['context']===_0x0d6e('0x68')){if(_0x504b2a){_0x504b2a[_0x0d6e('0x39')]=_0x1143c9[_0x0d6e('0x37')];var _0x5e0cc3;if(this['channels'][_0x1143c9[_0x0d6e('0x2d')]]){_0x5e0cc3=this['channels'][_0x1143c9[_0x0d6e('0x2d')]][_0x0d6e('0x50')];}else if(this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x32')]]){_0x5e0cc3=this[_0x0d6e('0x13')][_0x1143c9['linkedid']][_0x0d6e('0x50')];}_0x504b2a[_0x0d6e('0x50')]=_0x5e0cc3;var _0x13aaf9={'id':_0x504b2a['id'],'name':_0x504b2a[_0x0d6e('0x3d')],'agentconnected':!![],'destaccountcode':_0x504b2a['accountcode'],'destconnectedlinenum':_0x1143c9[_0x0d6e('0x37')],'queue':_0x5e0cc3||undefined,'uniqueid':_0x1143c9[_0x0d6e('0x32')]};logger[_0x0d6e('0x30')](_0x0d6e('0x69'),_0x1143c9[_0x0d6e('0x2d')],util['inspect'](_0x13aaf9,{'showHidden':![],'depth':null}));this['emit'](util['format']('user:%s',_0x504b2a['name']),_0x0d6e('0x3e'),_0x13aaf9);}}}}catch(_0x5cdfd7){logger[_0x0d6e('0x27')](_0x0d6e('0x6a'),_0x1143c9[_0x0d6e('0x2d')],util[_0x0d6e('0x41')](_0x5cdfd7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0d6e('0x29')][_0x0d6e('0x6b')]=function(_0x51166b,_0x591ac4){try{if(this[_0x0d6e('0x13')][_0x51166b]){logger[_0x0d6e('0x25')](_0x0d6e('0x6c'),_0x51166b,_0x591ac4);this[_0x0d6e('0x13')][_0x51166b][_0x0d6e('0x6d')]=!![];if(_[_0x0d6e('0x6e')](_0x591ac4,_0x0d6e('0x6f'))){_0x591ac4=_0x591ac4[_0x0d6e('0x70')](_0x0d6e('0x6f'),_0x0d6e('0x71'));}this['channels'][_0x51166b]['monitorFilename']=_0x591ac4;var _0x24bf8c=_[_0x0d6e('0x72')](this[_0x0d6e('0x13')][_0x51166b]['monitors'],{'filename':_0x591ac4});if(_[_0x0d6e('0x5d')](_0x24bf8c)){this['channels'][_0x51166b][_0x0d6e('0x73')]['push']({'filename':_0x591ac4,'createdAt':moment()[_0x0d6e('0x3b')](_0x0d6e('0x47')),'mixmonitorid':'','status':_0x0d6e('0x74')});}}}catch(_0x4f051e){logger['error'](_0x0d6e('0x75'),_0x51166b,util['inspect'](_0x4f051e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0d6e('0x29')]['syncVarSet']=function(_0xea1254){try{if(this[_0x0d6e('0x2a')](_0xea1254)){logger['debug'](_0x0d6e('0x76'),_0xea1254[_0x0d6e('0x2d')],util[_0x0d6e('0x41')](_0xea1254,{'showHidden':![],'depth':null}));if(this['channels'][_0xea1254[_0x0d6e('0x2d')]]&&_0xea1254[_0x0d6e('0x43')]!=_0x0d6e('0x44')){if(this['isNotNull'](_0xea1254['variable'])){if(this[_0x0d6e('0x2a')](_0xea1254[_0x0d6e('0x77')][_0x0d6e('0x78')])){logger[_0x0d6e('0x25')](_0x0d6e('0x79'),_0xea1254['uniqueid'],_0xea1254['value']);this[_0x0d6e('0x6b')](_0xea1254[_0x0d6e('0x2d')],_0xea1254[_0x0d6e('0x7a')]);}else if(this[_0x0d6e('0x2a')](_0xea1254[_0x0d6e('0x77')]['xmd-phone'])){logger[_0x0d6e('0x25')](_0x0d6e('0x7b'),_0xea1254['uniqueid'],_0xea1254[_0x0d6e('0x7a')]);this[_0x0d6e('0x13')][_0xea1254['uniqueid']][_0x0d6e('0x2f')]=_0xea1254[_0x0d6e('0x7a')];}else if(this[_0x0d6e('0x2a')](_0xea1254[_0x0d6e('0x77')][_0x0d6e('0x7c')])){logger['info'](_0x0d6e('0x7d'),_0xea1254[_0x0d6e('0x2d')],_0xea1254[_0x0d6e('0x7a')]);this['channels'][_0xea1254[_0x0d6e('0x2d')]]['callerid']=_0xea1254['value'];}else if(this[_0x0d6e('0x2a')](_0xea1254[_0x0d6e('0x77')][_0x0d6e('0x7e')])){logger[_0x0d6e('0x25')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0xea1254[_0x0d6e('0x2d')],_0xea1254[_0x0d6e('0x7a')]);this['channels'][_0xea1254[_0x0d6e('0x2d')]][_0x0d6e('0x5c')]=_0xea1254[_0x0d6e('0x7a')];}else if(this['isNotNull'](_0xea1254[_0x0d6e('0x77')][_0x0d6e('0x7f')])){logger[_0x0d6e('0x25')](_0x0d6e('0x80'),_0xea1254[_0x0d6e('0x2d')],_0xea1254[_0x0d6e('0x7a')][_0x0d6e('0x5a')](',')[0x0]);this[_0x0d6e('0x13')][_0xea1254[_0x0d6e('0x2d')]]['queue']=_0xea1254['value'][_0x0d6e('0x5a')](',')[0x0];}else if(this[_0x0d6e('0x2a')](_0xea1254[_0x0d6e('0x77')][_0x0d6e('0x81')])){logger[_0x0d6e('0x25')](_0x0d6e('0x82'),_0xea1254[_0x0d6e('0x2d')],_0xea1254['value']);this[_0x0d6e('0x13')][_0xea1254['uniqueid']]['originatecalleridnum']=_0xea1254['value'];}else if(this[_0x0d6e('0x2a')](_0xea1254[_0x0d6e('0x77')][_0x0d6e('0x83')])){logger[_0x0d6e('0x25')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0xea1254[_0x0d6e('0x2d')],_0xea1254[_0x0d6e('0x7a')]);this[_0x0d6e('0x13')][_0xea1254[_0x0d6e('0x2d')]][_0x0d6e('0x84')]=_0xea1254[_0x0d6e('0x7a')];}else if(this[_0x0d6e('0x2a')](_0xea1254[_0x0d6e('0x77')][_0x0d6e('0x85')])){logger[_0x0d6e('0x25')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0xea1254['uniqueid'],_0xea1254[_0x0d6e('0x7a')]);this[_0x0d6e('0x13')][_0xea1254[_0x0d6e('0x2d')]][_0x0d6e('0x86')]=_0xea1254['value'];}else if(this[_0x0d6e('0x2a')](_0xea1254[_0x0d6e('0x77')][_0x0d6e('0x87')])){logger['info'](_0x0d6e('0x88'),_0xea1254['uniqueid'],_0xea1254['value']);this[_0x0d6e('0x13')][_0xea1254[_0x0d6e('0x2d')]][_0x0d6e('0x50')]=_0xea1254[_0x0d6e('0x7a')];}else if(this[_0x0d6e('0x2a')](_0xea1254[_0x0d6e('0x77')][_0x0d6e('0x89')])){logger[_0x0d6e('0x25')](_0x0d6e('0x8a'),_0xea1254[_0x0d6e('0x2d')],_0xea1254[_0x0d6e('0x7a')]);this[_0x0d6e('0x13')][_0xea1254[_0x0d6e('0x2d')]][_0x0d6e('0x8b')]=_0xea1254[_0x0d6e('0x7a')];}}}else if(this[_0x0d6e('0x2a')](_0xea1254[_0x0d6e('0x77')]['mixmonitor_filename'])){if(_0xea1254['value']){var _0xbd602a=path[_0x0d6e('0x8c')](_0xea1254[_0x0d6e('0x7a')])[_0x0d6e('0x3d')];logger[_0x0d6e('0x25')](_0x0d6e('0x79'),_0xbd602a,_0xea1254['value']);this[_0x0d6e('0x6b')](_0xbd602a,_0xea1254[_0x0d6e('0x7a')]);}}else if(this[_0x0d6e('0x13')][_0xea1254['linkedid']]){if(this[_0x0d6e('0x2a')](_0xea1254[_0x0d6e('0x77')])){if(this[_0x0d6e('0x2a')](_0xea1254[_0x0d6e('0x77')][_0x0d6e('0x89')])){logger[_0x0d6e('0x25')](_0x0d6e('0x8a'),_0xea1254['linkedid'],_0xea1254[_0x0d6e('0x7a')]);this[_0x0d6e('0x13')][_0xea1254[_0x0d6e('0x32')]][_0x0d6e('0x8d')]=_0xea1254[_0x0d6e('0x7a')];}}}}}catch(_0x4450ba){logger[_0x0d6e('0x27')](_0x0d6e('0x8e'),_0xea1254[_0x0d6e('0x2d')],util[_0x0d6e('0x41')](_0x4450ba,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0d6e('0x29')][_0x0d6e('0x1e')]=function(_0x41b7bb){try{if(this[_0x0d6e('0x2a')](_0x41b7bb)){logger[_0x0d6e('0x30')](_0x0d6e('0x8f'),_0x41b7bb[_0x0d6e('0x2d')],util['inspect'](_0x41b7bb,{'showHidden':![],'depth':null}));if(this[_0x0d6e('0x15')][_0x41b7bb['linkedid']]){if(this[_0x0d6e('0x13')][this['blindTransfers'][_0x41b7bb[_0x0d6e('0x32')]][_0x0d6e('0x32')]]){this[_0x0d6e('0x13')][this[_0x0d6e('0x15')][_0x41b7bb['linkedid']]['linkedid']][_0x0d6e('0x2d')]=_0x41b7bb[_0x0d6e('0x2d')];this[_0x0d6e('0x13')][this[_0x0d6e('0x15')][_0x41b7bb['linkedid']]['linkedid']][_0x0d6e('0x60')]=this[_0x0d6e('0x13')][_0x41b7bb['uniqueid']][_0x0d6e('0x60')];this[_0x0d6e('0x13')][this[_0x0d6e('0x15')][_0x41b7bb[_0x0d6e('0x32')]][_0x0d6e('0x32')]]['answertime']=this[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]][_0x0d6e('0x61')];this[_0x0d6e('0x13')][this[_0x0d6e('0x15')][_0x41b7bb['linkedid']][_0x0d6e('0x32')]][_0x0d6e('0x67')]=this[_0x0d6e('0x13')][this[_0x0d6e('0x15')][_0x41b7bb[_0x0d6e('0x32')]][_0x0d6e('0x32')]][_0x0d6e('0x43')];this['channels'][this['blindTransfers'][_0x41b7bb[_0x0d6e('0x32')]][_0x0d6e('0x32')]][_0x0d6e('0x48')]=this[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]][_0x0d6e('0x48')];this[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]]=this[_0x0d6e('0x13')][this['blindTransfers'][_0x41b7bb['linkedid']][_0x0d6e('0x32')]];this[_0x0d6e('0x90')](this[_0x0d6e('0x15')][_0x41b7bb['linkedid']][_0x0d6e('0x32')]);}else if(this[_0x0d6e('0x13')][this[_0x0d6e('0x15')][_0x41b7bb[_0x0d6e('0x32')]]['uniqueid']]){this[_0x0d6e('0x13')][this[_0x0d6e('0x15')][_0x41b7bb[_0x0d6e('0x32')]][_0x0d6e('0x2d')]][_0x0d6e('0x2d')]=[this['channels'][this[_0x0d6e('0x15')][_0x41b7bb[_0x0d6e('0x32')]][_0x0d6e('0x2d')]][_0x0d6e('0x32')],this[_0x0d6e('0x13')][this[_0x0d6e('0x15')][_0x41b7bb[_0x0d6e('0x32')]][_0x0d6e('0x2d')]][_0x0d6e('0x32')]=this[_0x0d6e('0x13')][this['blindTransfers'][_0x41b7bb[_0x0d6e('0x32')]][_0x0d6e('0x2d')]][_0x0d6e('0x2d')]][0x0];this[_0x0d6e('0x13')][this[_0x0d6e('0x15')][_0x41b7bb[_0x0d6e('0x32')]]['uniqueid']]['answered']=this[_0x0d6e('0x13')][_0x41b7bb['uniqueid']]['answered'];this[_0x0d6e('0x13')][this[_0x0d6e('0x15')][_0x41b7bb[_0x0d6e('0x32')]][_0x0d6e('0x2d')]][_0x0d6e('0x61')]=this[_0x0d6e('0x13')][_0x41b7bb['uniqueid']][_0x0d6e('0x61')];this[_0x0d6e('0x13')][this['blindTransfers'][_0x41b7bb[_0x0d6e('0x32')]]['uniqueid']][_0x0d6e('0x67')]=this[_0x0d6e('0x13')][this[_0x0d6e('0x15')][_0x41b7bb[_0x0d6e('0x32')]][_0x0d6e('0x2d')]][_0x0d6e('0x43')];this[_0x0d6e('0x13')][this[_0x0d6e('0x15')][_0x41b7bb['linkedid']][_0x0d6e('0x2d')]]['disposition']=this[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]][_0x0d6e('0x48')];this[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]]=this[_0x0d6e('0x13')][this[_0x0d6e('0x15')][_0x41b7bb['linkedid']][_0x0d6e('0x2d')]];this[_0x0d6e('0x90')](this['blindTransfers'][_0x41b7bb[_0x0d6e('0x32')]][_0x0d6e('0x2d')]);}}if(this['channels'][_0x41b7bb[_0x0d6e('0x2d')]]){logger['info']('[%s][voiceCallReport][hangup]\x20reason:%s',_0x41b7bb[_0x0d6e('0x2d')],_0x41b7bb[_0x0d6e('0x91')]);var _0x59bd04=moment();this[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]][_0x0d6e('0x92')]=_0x59bd04[_0x0d6e('0x3b')](_0x0d6e('0x47'));this[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]]['duration']=_0x59bd04['diff'](this[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]]['starttime'],'seconds');if(this[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]][_0x0d6e('0x60')]){this[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]][_0x0d6e('0x93')]=_0x59bd04[_0x0d6e('0x62')](this[_0x0d6e('0x13')][_0x41b7bb['uniqueid']][_0x0d6e('0x61')],_0x0d6e('0x54'));this[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]][_0x0d6e('0x94')]=this[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]]['duration']-this[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]][_0x0d6e('0x93')];}if(_0x41b7bb[_0x0d6e('0x36')]===_0x0d6e('0x68')){if(this[_0x0d6e('0x14')][_0x41b7bb[_0x0d6e('0x43')]['split']('-')[0x0]]){this[_0x0d6e('0x14')][_0x41b7bb['channel'][_0x0d6e('0x5a')]('-')[0x0]]=_[_0x0d6e('0x95')](this[_0x0d6e('0x14')][_0x41b7bb[_0x0d6e('0x43')][_0x0d6e('0x5a')]('-')[0x0]],[_0x0d6e('0x39')]);logger['debug'](_0x0d6e('0x96'),_0x41b7bb[_0x0d6e('0x2d')],util['inspect']({'id':this[_0x0d6e('0x14')][_0x41b7bb[_0x0d6e('0x43')][_0x0d6e('0x5a')]('-')[0x0]]['id'],'destaccountcode':this[_0x0d6e('0x14')][_0x41b7bb[_0x0d6e('0x43')][_0x0d6e('0x5a')]('-')[0x0]][_0x0d6e('0x3f')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x0d6e('0x3b')](_0x0d6e('0x3c'),this[_0x0d6e('0x14')][_0x41b7bb[_0x0d6e('0x43')][_0x0d6e('0x5a')]('-')[0x0]][_0x0d6e('0x3d')]),_0x0d6e('0x97'),{'id':this[_0x0d6e('0x14')][_0x41b7bb[_0x0d6e('0x43')][_0x0d6e('0x5a')]('-')[0x0]]['id'],'destaccountcode':this[_0x0d6e('0x14')][_0x41b7bb['channel']['split']('-')[0x0]][_0x0d6e('0x3f')]});for(var _0x33ceb0=0x0;_0x33ceb0<Object[_0x0d6e('0x35')](this[_0x0d6e('0x14')])[_0x0d6e('0x98')];_0x33ceb0++){var _0x1c3802=Object[_0x0d6e('0x35')](this[_0x0d6e('0x14')])[_0x33ceb0];var _0x376a83=this[_0x0d6e('0x14')][_0x1c3802];if(_0x376a83[_0x0d6e('0x3f')]===Number(this['channels'][_0x41b7bb[_0x0d6e('0x2d')]][_0x0d6e('0x3a')])){this['emit'](util[_0x0d6e('0x3b')](_0x0d6e('0x3c'),_0x376a83['name']),_0x0d6e('0x97'),{'id':_0x376a83['id'],'destaccountcode':_0x376a83[_0x0d6e('0x3f')],'transfer':this[_0x0d6e('0x13')][_0x41b7bb['uniqueid']]['transferType']});break;}}}}var _0x56f374=this;Promise[_0x0d6e('0x99')]()[_0x0d6e('0x9a')](function(){var _0x45d521=_0x56f374['channels'][_0x41b7bb[_0x0d6e('0x2d')]];if(typeof _0x45d521[_0x0d6e('0x9b')]===_0x0d6e('0x9c')){return;}if(_0x45d521[_0x0d6e('0x9d')]===!![]){return;}if(_['isEmpty'](_0x45d521[_0x0d6e('0x73')])){return;}return RpcSetting['getSettings']()[_0x0d6e('0x9a')](function(_0x267e05){if(!_0x267e05[_0x0d6e('0x9e')])return;return Promise['resolve']()[_0x0d6e('0x9a')](function(){return ami[_0x0d6e('0x9f')]({'action':'StopMixMonitor','channel':_0x45d521[_0x0d6e('0x43')]})[_0x0d6e('0xa0')](function(){});})[_0x0d6e('0x9a')](function(){return ami['Action']({'action':_0x0d6e('0xa1'),'channel':_0x45d521[_0x0d6e('0x67')]})[_0x0d6e('0xa0')](function(){})[_0x0d6e('0xa2')](function(){var _0x3764f1=_0x56f374[_0x0d6e('0x14')][_0x45d521[_0x0d6e('0x67')][_0x0d6e('0x5a')]('-')[0x0]];if(!_0x3764f1)return;io[_0x0d6e('0x2c')](_0x0d6e('0xa3'),{'agentId':_0x3764f1['id'],'uniqueid':_0x45d521[_0x0d6e('0x2d')]});});});});})[_0x0d6e('0x9a')](function(){if(_0x41b7bb[_0x0d6e('0xa4')]===_0x0d6e('0xa5')){_0x56f374['blindTransfers'][_0x41b7bb[_0x0d6e('0x2d')]]=_0x41b7bb;}else{if(_0x56f374[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]]&&_0x56f374[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]][_0x0d6e('0x5c')]===_0x0d6e('0xa6')&&_0x56f374[_0x0d6e('0x15')][_0x41b7bb[_0x0d6e('0x2d')]]){_0x56f374[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]][_0x0d6e('0x2d')]=[_0x56f374[_0x0d6e('0x13')][_0x41b7bb['uniqueid']]['linkedid'],_0x56f374[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]]['linkedid']=_0x56f374[_0x0d6e('0x13')][_0x41b7bb['uniqueid']][_0x0d6e('0x2d')]][0x0];delete _0x56f374[_0x0d6e('0x15')][_0x41b7bb[_0x0d6e('0x2d')]];}}logger[_0x0d6e('0x30')](_0x0d6e('0xa7'),_0x41b7bb[_0x0d6e('0x2d')],util[_0x0d6e('0x41')](_0x56f374[_0x0d6e('0x13')][_0x41b7bb['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x0d6e('0x2c')](_0x0d6e('0xa8'),_0x56f374[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]]);delete _0x56f374[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]];});}}}catch(_0x1542d1){logger[_0x0d6e('0x27')](_0x0d6e('0xa9'),_0x41b7bb['uniqueid'],util[_0x0d6e('0x41')](_0x1542d1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0d6e('0x29')]['syncAttendedTransfer']=function(_0x40f858){try{if(this[_0x0d6e('0x2a')](_0x40f858)){logger[_0x0d6e('0x25')](_0x0d6e('0xaa'),_0x40f858[_0x0d6e('0x2d')],_0x40f858['origtransferercalleridnum'],_0x40f858['transfertargetcalleridnum']);logger[_0x0d6e('0x30')]('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x40f858[_0x0d6e('0x2d')],util[_0x0d6e('0x41')](_0x40f858,{'showHidden':![],'depth':null}));var _0x5bc8b5;if(this[_0x0d6e('0x13')][_0x40f858[_0x0d6e('0xab')]]){this[_0x0d6e('0x13')][_0x40f858[_0x0d6e('0xab')]][_0x0d6e('0xac')]=_0x40f858[_0x0d6e('0xad')];this[_0x0d6e('0x13')][_0x40f858['transfereeuniqueid']]['transferconnectedlinenum']=_0x40f858[_0x0d6e('0xae')];if(this[_0x0d6e('0x13')][_0x40f858['secondtransfereruniqueid']]){_0x5bc8b5=this[_0x0d6e('0x13')][_0x40f858[_0x0d6e('0xaf')]];this[_0x0d6e('0x13')][_0x40f858[_0x0d6e('0xaf')]]=this[_0x0d6e('0x13')][_0x40f858[_0x0d6e('0xab')]];this['channels'][_0x40f858[_0x0d6e('0xab')]]=_0x5bc8b5;}this[_0x0d6e('0x13')][_0x40f858[_0x0d6e('0xaf')]]['transferType']=_0x0d6e('0xb0');}else if(this[_0x0d6e('0x13')][_0x40f858['transfertargetuniqueid']]){this[_0x0d6e('0x13')][_0x40f858[_0x0d6e('0xb1')]][_0x0d6e('0xac')]=_0x40f858['origtransferercalleridnum'];this[_0x0d6e('0x13')][_0x40f858[_0x0d6e('0xb1')]][_0x0d6e('0xb2')]=_0x40f858['transfertargetcalleridnum'];if(this[_0x0d6e('0x13')][_0x40f858[_0x0d6e('0xb3')]]){_0x5bc8b5=this[_0x0d6e('0x13')][_0x40f858[_0x0d6e('0xb3')]];this[_0x0d6e('0x13')][_0x40f858[_0x0d6e('0xb3')]]=this[_0x0d6e('0x13')][_0x40f858[_0x0d6e('0xb1')]];this['channels'][_0x40f858[_0x0d6e('0xb1')]]=_0x5bc8b5;}this[_0x0d6e('0x13')][_0x40f858[_0x0d6e('0xb1')]][_0x0d6e('0x9b')]='ATTENDED';}if((this['channels'][_0x40f858['origtransfereruniqueid']]||this['channels'][_0x40f858['origtransfererlinkedid']])&&this[_0x0d6e('0x13')][_0x40f858[_0x0d6e('0xaf')]]){var _0x4ae601=_[_0x0d6e('0xb4')]([this[_0x0d6e('0x13')][_0x40f858[_0x0d6e('0xb3')]],this[_0x0d6e('0x13')][_0x40f858[_0x0d6e('0xb5')]],this[_0x0d6e('0x13')][_0x40f858[_0x0d6e('0xaf')]]],function(_0x578ec4){return _0x578ec4&&_0x578ec4[_0x0d6e('0x5c')]===_0x0d6e('0xa6')&&_0x578ec4[_0x0d6e('0xb6')];});if(_0x4ae601){if(this['channels'][_0x40f858['origtransfereruniqueid']])this[_0x0d6e('0x13')][_0x40f858['origtransfereruniqueid']][_0x0d6e('0x9b')]=_0x0d6e('0xb0');if(this[_0x0d6e('0x13')][_0x40f858[_0x0d6e('0xb5')]])this[_0x0d6e('0x13')][_0x40f858[_0x0d6e('0xb5')]][_0x0d6e('0x9b')]=_0x0d6e('0xb0');this[_0x0d6e('0x13')][_0x40f858[_0x0d6e('0xaf')]][_0x0d6e('0x9b')]='ATTENDED';}else{if(this[_0x0d6e('0x13')][_0x40f858['transfereeuniqueid']]){this[_0x0d6e('0x13')][_0x40f858['secondtransfereruniqueid']][_0x0d6e('0x9d')]=!![];}if(this[_0x0d6e('0x13')][_0x40f858[_0x0d6e('0xb1')]]){this[_0x0d6e('0x13')][_0x40f858[_0x0d6e('0xb1')]][_0x0d6e('0x9d')]=!![];}}}}}catch(_0x3f81d5){logger[_0x0d6e('0x27')](_0x0d6e('0xb7'),_0x40f858['uniqueid'],util[_0x0d6e('0x41')](_0x3f81d5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0d6e('0x29')][_0x0d6e('0xb8')]=function(_0x1ee7f6){try{if(this[_0x0d6e('0x2a')](_0x1ee7f6)){logger[_0x0d6e('0x25')](_0x0d6e('0xb9'),_0x1ee7f6[_0x0d6e('0x2d')],_0x1ee7f6[_0x0d6e('0xba')],_0x1ee7f6['extension']);logger[_0x0d6e('0x30')](_0x0d6e('0xbb'),_0x1ee7f6[_0x0d6e('0x2d')],util[_0x0d6e('0x41')](_0x1ee7f6,{'showHidden':![],'depth':null}));if(this['channels'][_0x1ee7f6[_0x0d6e('0xab')]]){this[_0x0d6e('0x13')][_0x1ee7f6[_0x0d6e('0xab')]]['transfercalleridnum']=_0x1ee7f6[_0x0d6e('0xba')];this[_0x0d6e('0x13')][_0x1ee7f6[_0x0d6e('0xab')]][_0x0d6e('0xb2')]=_0x1ee7f6[_0x0d6e('0xbc')];this[_0x0d6e('0x13')][_0x1ee7f6[_0x0d6e('0xab')]][_0x0d6e('0x9b')]=_0x0d6e('0xbd');this[_0x0d6e('0x1e')]({'event':_0x0d6e('0xa5'),'uniqueid':_0x1ee7f6[_0x0d6e('0xab')],'linkedid':_0x1ee7f6[_0x0d6e('0xbe')],'context':_0x1ee7f6['context'],'channel':_0x1ee7f6['transfererchannel']});}else{this[_0x0d6e('0x13')][_0x1ee7f6[_0x0d6e('0xbe')]]['transferType']='BLIND';this[_0x0d6e('0x1e')]({'event':_0x0d6e('0xa5'),'uniqueid':_0x1ee7f6[_0x0d6e('0xbe')],'linkedid':_0x1ee7f6[_0x0d6e('0xab')],'context':_0x1ee7f6[_0x0d6e('0x36')],'channel':_0x1ee7f6[_0x0d6e('0xbf')]});}}}catch(_0x8f44f0){logger['error'](_0x0d6e('0xc0'),_0x1ee7f6[_0x0d6e('0x2d')],util[_0x0d6e('0x41')](_0x8f44f0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0d6e('0x29')][_0x0d6e('0xc1')]=function(_0xfd7576){try{if(this[_0x0d6e('0x2a')](_0xfd7576)){logger[_0x0d6e('0x30')](_0x0d6e('0xc2'),_0xfd7576[_0x0d6e('0x2d')],util['inspect'](_0xfd7576,{'showHidden':![],'depth':null}));if(this[_0x0d6e('0x13')][_0xfd7576[_0x0d6e('0x2d')]]){if(!_[_0x0d6e('0x5d')](this[_0x0d6e('0x13')][_0xfd7576[_0x0d6e('0x2d')]][_0x0d6e('0x61')])){this[_0x0d6e('0x13')][_0xfd7576[_0x0d6e('0x2d')]][_0x0d6e('0xc3')]=moment()[_0x0d6e('0x3b')](_0x0d6e('0x47'));logger[_0x0d6e('0x25')](_0x0d6e('0xc4'),_0xfd7576[_0x0d6e('0x2d')],this[_0x0d6e('0x13')][_0xfd7576[_0x0d6e('0x2d')]][_0x0d6e('0xc3')]);}}}}catch(_0x44e4df){logger[_0x0d6e('0x27')](_0x0d6e('0xc5'),_0xfd7576[_0x0d6e('0x2d')],util['inspect'](_0x44e4df,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0d6e('0x29')][_0x0d6e('0xc6')]=function(_0x98155d){try{if(this[_0x0d6e('0x2a')](_0x98155d)){logger['debug'](_0x0d6e('0xc7'),_0x98155d[_0x0d6e('0x2d')],util['inspect'](_0x98155d,{'showHidden':![],'depth':null}));if(this[_0x0d6e('0x13')][_0x98155d[_0x0d6e('0x2d')]]){if(!_[_0x0d6e('0x5d')](this[_0x0d6e('0x13')][_0x98155d[_0x0d6e('0x2d')]][_0x0d6e('0xc3')])){this[_0x0d6e('0x13')][_0x98155d[_0x0d6e('0x2d')]]['mohtime']+=moment()['milliseconds'](0x0)[_0x0d6e('0x62')](this[_0x0d6e('0x13')][_0x98155d[_0x0d6e('0x2d')]][_0x0d6e('0xc3')],_0x0d6e('0x54'));logger[_0x0d6e('0x25')](_0x0d6e('0xc8'),_0x98155d[_0x0d6e('0x2d')],this['channels'][_0x98155d['uniqueid']][_0x0d6e('0xc9')]);delete this[_0x0d6e('0x13')][_0x98155d[_0x0d6e('0x2d')]]['mohstarttime'];}}}}catch(_0x27d63f){logger[_0x0d6e('0x27')](_0x0d6e('0xca'),_0x98155d[_0x0d6e('0x2d')],util[_0x0d6e('0x41')](_0x27d63f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0d6e('0x29')][_0x0d6e('0x90')]=function(_0x57577a,_0x2a34da=0x2710){if(this[_0x0d6e('0x13')][_0x57577a]){setTimeout(()=>{delete this[_0x0d6e('0x13')][_0x57577a];},_0x2a34da);}};module[_0x0d6e('0xcb')]=VoiceCallReport;