55fa6f38756eddb1af7df69091f611a15eba945a
[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 _0xa9af=['lastapplication','lastdata','set','startsWith','cdr(','match','type','isNil','[%s][voiceCallReport][newexten]','calleridname','answered','holdtime','diff','connectedlinename','destinationchannel','UserId','membername','answertime','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','.WAV','monitors','push','rec','[%s][voiceCallReport][varset]\x20event:','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','xmd-callerid','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','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','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','from-sip','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','then','transferType','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','some','routeid','origtransfererlinkedid','transferToInternal','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfererchannel','transfereruniqueid','BlindTransfer','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','exports','lodash','moment','util','path','ioredis','../../../config/environment','ami','../ami','../model/channel','queue','agi','dial','playback','voicemail','NO\x20ANSWER','ANSWERED','BUSY','FAILED','redis','defaults','socket.io-emitter','channels','blindTransfers','coreshowchannel','newexten','syncNewExten','syncNewChannel','bind','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','info','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','isNotNull','isUndefined','prototype','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','debug','linkedid','merge','pick','keys','channel','split','xcally-motion-preview','destconnectedlinenum','connectedlinenum','name','user:agentconnect','[%s][voiceCallReport][newchannel]\x20event:','inspect','OutgoingSpoolFailed','exten','format','disposition','toNumber','channelstate','context','agents','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','subtract','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','includes'];(function(_0x18de22,_0x483879){var _0x3eb6e4=function(_0x32c41d){while(--_0x32c41d){_0x18de22['push'](_0x18de22['shift']());}};_0x3eb6e4(++_0x483879);}(_0xa9af,0x70));var _0xfa9a=function(_0x192103,_0x1715dd){_0x192103=_0x192103-0x0;var _0x58bb34=_0xa9af[_0x192103];return _0x58bb34;};'use strict';var _=require(_0xfa9a('0x0'));var moment=require(_0xfa9a('0x1'));var util=require(_0xfa9a('0x2'));var path=require(_0xfa9a('0x3'));var Redis=require(_0xfa9a('0x4'));var config=require(_0xfa9a('0x5'));var logger=require('../../../config/logger')(_0xfa9a('0x6'));var ami=require(_0xfa9a('0x7'));var Channel=require(_0xfa9a('0x8'));var RpcSetting=require('../rpc/setting');var applications=['set',_0xfa9a('0x9'),_0xfa9a('0xa'),_0xfa9a('0xb'),_0xfa9a('0xc'),_0xfa9a('0xd')];var dispositions=[_0xfa9a('0xe'),'FAILED','FAILED',_0xfa9a('0xe'),_0xfa9a('0xe'),_0xfa9a('0xe'),_0xfa9a('0xf'),_0xfa9a('0x10'),'FAILED','FAILED',_0xfa9a('0x11')];config[_0xfa9a('0x12')]=_[_0xfa9a('0x13')](config[_0xfa9a('0x12')],{'host':'localhost','port':0x18eb});var io=require(_0xfa9a('0x14'))(new Redis(config[_0xfa9a('0x12')]));function VoiceCallReport(_0x1e4fe5){this[_0xfa9a('0x15')]=_0x1e4fe5[_0xfa9a('0x15')];this['agents']=_0x1e4fe5['agents'];this[_0xfa9a('0x16')]={};ami['on'](_0xfa9a('0x17'),this['syncNewExten']['bind'](this));ami['on'](_0xfa9a('0x18'),this[_0xfa9a('0x19')]['bind'](this));ami['on']('newchannel',this[_0xfa9a('0x1a')][_0xfa9a('0x1b')](this));ami['on'](_0xfa9a('0x1c'),this[_0xfa9a('0x1d')][_0xfa9a('0x1b')](this));ami['on'](_0xfa9a('0x1e'),this[_0xfa9a('0x1f')][_0xfa9a('0x1b')](this));ami['on'](_0xfa9a('0x20'),this[_0xfa9a('0x21')]['bind'](this));ami['on'](_0xfa9a('0x22'),this[_0xfa9a('0x23')][_0xfa9a('0x1b')](this));ami['on'](_0xfa9a('0x24'),this[_0xfa9a('0x25')]['bind'](this));ami['on'](_0xfa9a('0x26'),this[_0xfa9a('0x27')][_0xfa9a('0x1b')](this));ami['on'](_0xfa9a('0x28'),this['syncMusicOnHoldStart'][_0xfa9a('0x1b')](this));ami['on'](_0xfa9a('0x29'),this[_0xfa9a('0x2a')][_0xfa9a('0x1b')](this));try{logger[_0xfa9a('0x2b')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0xfa9a('0x2c')]();}catch(_0x3b5b61){logger[_0xfa9a('0x2d')](_0xfa9a('0x2e'),util['inspect'](_0x3b5b61,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0xfa9a('0x2f')]=function(_0xe6a4dd){return _0xe6a4dd!==null&&!_[_0xfa9a('0x30')](_0xe6a4dd);};VoiceCallReport[_0xfa9a('0x31')][_0xfa9a('0x32')]=function(_0x10e92a,_0x3816b2,_0x4c9d83){io['to'](_0x10e92a)[_0xfa9a('0x32')](_0x3816b2,_0x4c9d83);};VoiceCallReport['prototype'][_0xfa9a('0x23')]=function(_0x479062){try{if(this['isNotNull'](_0x479062)){logger['info'](_0xfa9a('0x33'),_0x479062[_0xfa9a('0x34')],_0x479062['calleridname'],_0x479062[_0xfa9a('0x35')]);logger[_0xfa9a('0x36')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x479062[_0xfa9a('0x34')],util['inspect'](_0x479062,{'showHidden':![],'depth':null}));if(_0x479062[_0xfa9a('0x34')]===_0x479062[_0xfa9a('0x37')]){if(!_[_0xfa9a('0x30')](this[_0xfa9a('0x15')][_0x479062[_0xfa9a('0x34')]])){_[_0xfa9a('0x38')](this[_0xfa9a('0x15')][_0x479062[_0xfa9a('0x34')]],_[_0xfa9a('0x39')](_0x479062,_[_0xfa9a('0x3a')](this[_0xfa9a('0x15')][_0x479062['uniqueid']])));}}if(_0x479062['context']==='from-sip'){var _0x5994aa=this['agents'][_0x479062[_0xfa9a('0x3b')][_0xfa9a('0x3c')]('-')[0x0]];if(_0x5994aa){if(_0x479062['exten']==_0xfa9a('0x3d')){_0x5994aa[_0xfa9a('0x3e')]=_0x479062[_0xfa9a('0x3f')];this['emit'](util['format']('user:%s',_0x5994aa[_0xfa9a('0x40')]),_0xfa9a('0x41'),{'id':_0x5994aa['id'],'destaccountcode':_0x5994aa['accountcode'],'destconnectedlinenum':_0x479062[_0xfa9a('0x3f')]});}}}}}catch(_0x406a9c){logger['error']('[%s][voiceCallReport][newcallerid]',_0x479062[_0xfa9a('0x34')],util['inspect'](_0x406a9c,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xfa9a('0x1a')]=function(_0x4ab77f){try{if(this[_0xfa9a('0x2f')](_0x4ab77f)){logger[_0xfa9a('0x36')](_0xfa9a('0x42'),_0x4ab77f[_0xfa9a('0x34')],util[_0xfa9a('0x43')](_0x4ab77f,{'showHidden':![],'depth':null}));if(this[_0xfa9a('0x15')][_0x4ab77f[_0xfa9a('0x34')]]){return;}if(_0x4ab77f[_0xfa9a('0x3b')]===_0xfa9a('0x44')){return;}if(_0x4ab77f[_0xfa9a('0x34')]!==_0x4ab77f[_0xfa9a('0x37')]&&!this['blindTransfers'][_0x4ab77f[_0xfa9a('0x37')]]){return;}logger[_0xfa9a('0x2b')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x4ab77f[_0xfa9a('0x34')],_0x4ab77f['context'],_0x4ab77f[_0xfa9a('0x45')]);this['channels'][_0x4ab77f[_0xfa9a('0x34')]]=new Channel();this[_0xfa9a('0x15')][_0x4ab77f[_0xfa9a('0x34')]]['starttime']=moment()[_0xfa9a('0x46')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xfa9a('0x15')][_0x4ab77f['uniqueid']][_0xfa9a('0x47')]=dispositions[_[_0xfa9a('0x48')](_0x4ab77f[_0xfa9a('0x49')])];_[_0xfa9a('0x38')](this[_0xfa9a('0x15')][_0x4ab77f[_0xfa9a('0x34')]],_[_0xfa9a('0x39')](_0x4ab77f,_[_0xfa9a('0x3a')](this['channels'][_0x4ab77f[_0xfa9a('0x34')]])));if(_0x4ab77f[_0xfa9a('0x4a')]==='from-sip'){var _0x1e47b5=this[_0xfa9a('0x4b')][_0x4ab77f[_0xfa9a('0x3b')][_0xfa9a('0x3c')]('-')[0x0]];if(_0x1e47b5&&typeof _0x1e47b5[_0xfa9a('0x3e')]===_0xfa9a('0x4c')){_0x1e47b5[_0xfa9a('0x3e')]=_0x4ab77f[_0xfa9a('0x45')];logger['debug'](_0xfa9a('0x4d'),_0x4ab77f[_0xfa9a('0x34')],util[_0xfa9a('0x43')]({'id':_0x1e47b5['id'],'destaccountcode':_0x1e47b5[_0xfa9a('0x4e')],'destconnectedlinenum':_0x4ab77f[_0xfa9a('0x45')]},{'showHidden':![],'depth':null}));this['emit'](util[_0xfa9a('0x46')](_0xfa9a('0x4f'),_0x1e47b5[_0xfa9a('0x40')]),_0xfa9a('0x41'),{'id':_0x1e47b5['id'],'destaccountcode':_0x1e47b5[_0xfa9a('0x4e')],'destconnectedlinenum':_0x4ab77f[_0xfa9a('0x45')]});}}}}catch(_0x46975a){logger[_0xfa9a('0x2d')](_0xfa9a('0x50'),_0x4ab77f['uniqueid'],util[_0xfa9a('0x43')](_0x46975a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfa9a('0x31')]['syncNewExten']=function(_0x1b56e1){try{if(this[_0xfa9a('0x2f')](_0x1b56e1)){logger['debug'](_0xfa9a('0x51'),_0x1b56e1[_0xfa9a('0x34')],util[_0xfa9a('0x43')](_0x1b56e1,{'showHidden':![],'depth':null}));if(_0x1b56e1[_0xfa9a('0x3b')]===_0xfa9a('0x44')||_0x1b56e1[_0xfa9a('0x45')]==='h')return;if(_0x1b56e1['uniqueid']===_0x1b56e1['linkedid']||this['blindTransfers'][_0x1b56e1[_0xfa9a('0x37')]]){_0x1b56e1['application']=_0x1b56e1[_0xfa9a('0x52')]?_0x1b56e1[_0xfa9a('0x52')][_0xfa9a('0x53')]():undefined;_0x1b56e1[_0xfa9a('0x54')]=_0x1b56e1[_0xfa9a('0x55')]||_0x1b56e1[_0xfa9a('0x54')];if(_0x1b56e1['appdata']&&_0x1b56e1['application']!==_0xfa9a('0x9')){_0x1b56e1['applicationdata']=_0x1b56e1['applicationdata'][_0xfa9a('0x53')]();}logger[_0xfa9a('0x2b')](_0xfa9a('0x56'),_0x1b56e1[_0xfa9a('0x34')],_0x1b56e1['application'],_0x1b56e1[_0xfa9a('0x54')]);if(_[_0xfa9a('0x30')](this[_0xfa9a('0x15')][_0x1b56e1['uniqueid']])){this[_0xfa9a('0x15')][_0x1b56e1['uniqueid']]=new Channel();this[_0xfa9a('0x15')][_0x1b56e1[_0xfa9a('0x34')]][_0xfa9a('0x57')]=_0x1b56e1['duration']?moment()[_0xfa9a('0x58')](moment[_0xfa9a('0x59')](_0x1b56e1[_0xfa9a('0x59')])[_0xfa9a('0x5a')](),_0xfa9a('0x5a'))[_0xfa9a('0x46')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0xfa9a('0x46')](_0xfa9a('0x5b'));this[_0xfa9a('0x15')][_0x1b56e1[_0xfa9a('0x34')]][_0xfa9a('0x47')]=_0xfa9a('0xe');}_[_0xfa9a('0x38')](this[_0xfa9a('0x15')][_0x1b56e1[_0xfa9a('0x34')]],_['pick'](_0x1b56e1,_[_0xfa9a('0x3a')](this['channels'][_0x1b56e1['uniqueid']])));if(_[_0xfa9a('0x5c')](applications,_0x1b56e1['application'])){this[_0xfa9a('0x15')][_0x1b56e1[_0xfa9a('0x34')]][_0xfa9a('0x5d')]=_0x1b56e1[_0xfa9a('0x52')];this['channels'][_0x1b56e1['uniqueid']][_0xfa9a('0x5e')]=_0x1b56e1['applicationdata'];if(_0x1b56e1[_0xfa9a('0x52')]===_0xfa9a('0x5f')&&_[_0xfa9a('0x60')](_0x1b56e1[_0xfa9a('0x54')]['toLowerCase'](),_0xfa9a('0x61'))){var _0x506f19=_0x1b56e1[_0xfa9a('0x54')][_0xfa9a('0x3c')]('=');var _0x291347=_0x506f19[0x0][_0xfa9a('0x53')]()[_0xfa9a('0x62')](/cdr\((.*)\)/);if(_0x291347){if(_0x291347[0x1]===_0xfa9a('0x63')&&!_[_0xfa9a('0x64')](this[_0xfa9a('0x15')][_0x1b56e1[_0xfa9a('0x34')]][_0x291347[0x1]]))return;this[_0xfa9a('0x15')][_0x1b56e1[_0xfa9a('0x34')]][_0x291347[0x1]]=_0x506f19[0x1];}}else if(_0x1b56e1[_0xfa9a('0x52')]===_0xfa9a('0x9')){this[_0xfa9a('0x15')][_0x1b56e1[_0xfa9a('0x34')]][_0xfa9a('0x9')]=_0x1b56e1[_0xfa9a('0x54')]['split'](',')[0x0];}}}}}catch(_0x2153be){logger[_0xfa9a('0x2d')](_0xfa9a('0x65'),_0x1b56e1[_0xfa9a('0x34')],util[_0xfa9a('0x43')](_0x2153be,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfa9a('0x31')][_0xfa9a('0x1d')]=function(_0x4acda6){try{if(this[_0xfa9a('0x2f')](_0x4acda6)){logger[_0xfa9a('0x2b')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x4acda6[_0xfa9a('0x34')],_0x4acda6[_0xfa9a('0x37')],_0x4acda6[_0xfa9a('0x66')],_0x4acda6[_0xfa9a('0x35')]);logger[_0xfa9a('0x36')]('[%s][voiceCallReport][newstate]\x20event:',_0x4acda6['uniqueid'],util[_0xfa9a('0x43')](_0x4acda6,{'showHidden':![],'depth':null}));if(_0x4acda6[_0xfa9a('0x49')]!=='6')return;var _0x3d2f66=this[_0xfa9a('0x4b')][_0x4acda6[_0xfa9a('0x3b')][_0xfa9a('0x3c')]('-')[0x0]];if(_0x4acda6[_0xfa9a('0x34')]!==_0x4acda6[_0xfa9a('0x37')]){var _0x3c8bf4=moment();if(this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x37')]]){if(!this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x37')]][_0xfa9a('0x67')]){this['channels'][_0x4acda6[_0xfa9a('0x37')]][_0xfa9a('0x67')]=!![];this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x37')]]['answertime']=_0x3c8bf4[_0xfa9a('0x46')](_0xfa9a('0x5b'));if(this['channels'][_0x4acda6[_0xfa9a('0x37')]][_0xfa9a('0x57')]){this[_0xfa9a('0x15')][_0x4acda6['linkedid']][_0xfa9a('0x68')]=_0x3c8bf4[_0xfa9a('0x69')](this[_0xfa9a('0x15')][_0x4acda6['linkedid']][_0xfa9a('0x57')],'seconds');}}this[_0xfa9a('0x15')][_0x4acda6['linkedid']][_0xfa9a('0x37')]=_0x4acda6['uniqueid'];if(_0x4acda6['calleridnum']!=='xcally-motion-preview'){this[_0xfa9a('0x15')][_0x4acda6['linkedid']][_0xfa9a('0x3f')]=_0x4acda6[_0xfa9a('0x35')];}this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x37')]][_0xfa9a('0x6a')]=_0x4acda6['calleridname'];this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x37')]][_0xfa9a('0x6b')]=_0x4acda6[_0xfa9a('0x3b')];this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x37')]][_0xfa9a('0x47')]=dispositions[_['toNumber'](_0x4acda6[_0xfa9a('0x49')])];if(_0x3d2f66){this[_0xfa9a('0x15')][_0x4acda6['linkedid']][_0xfa9a('0x6c')]=_0x3d2f66['id'];this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x37')]][_0xfa9a('0x6d')]=_0x3d2f66[_0xfa9a('0x40')];}}if(this['channels'][_0x4acda6['uniqueid']]){if(!this['channels'][_0x4acda6['uniqueid']]['answered']){this['channels'][_0x4acda6[_0xfa9a('0x34')]][_0xfa9a('0x67')]=!![];this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x34')]][_0xfa9a('0x6e')]=_0x3c8bf4['format']('YYYY-MM-DD\x20HH:mm:ss');if(this['channels'][_0x4acda6['uniqueid']][_0xfa9a('0x57')]){this['channels'][_0x4acda6[_0xfa9a('0x34')]]['holdtime']=_0x3c8bf4['diff'](this[_0xfa9a('0x15')][_0x4acda6['uniqueid']][_0xfa9a('0x57')],'seconds');}}if(_0x4acda6[_0xfa9a('0x35')]!=='xcally-motion-preview'){this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x34')]][_0xfa9a('0x3f')]=_0x4acda6[_0xfa9a('0x35')];}this['channels'][_0x4acda6[_0xfa9a('0x34')]][_0xfa9a('0x6a')]=_0x4acda6[_0xfa9a('0x66')];this['channels'][_0x4acda6['uniqueid']][_0xfa9a('0x6b')]=_0x4acda6[_0xfa9a('0x3b')];this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x34')]]['disposition']=dispositions[_[_0xfa9a('0x48')](_0x4acda6[_0xfa9a('0x49')])];}}else{if(this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x34')]]){if(_0x3d2f66){this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x34')]]['UserId']=_0x3d2f66['id'];this['channels'][_0x4acda6[_0xfa9a('0x34')]]['membername']=_0x3d2f66['name'];}}}if(_0x4acda6[_0xfa9a('0x4a')]==='from-sip'){if(_0x3d2f66){_0x3d2f66[_0xfa9a('0x3e')]=_0x4acda6[_0xfa9a('0x45')];var _0x4a73da;if(this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x34')]]){_0x4a73da=this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x34')]][_0xfa9a('0x9')];}else if(this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x37')]]){_0x4a73da=this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x37')]][_0xfa9a('0x9')];}_0x3d2f66[_0xfa9a('0x9')]=_0x4a73da;var _0xc2afe1={'id':_0x3d2f66['id'],'name':_0x3d2f66[_0xfa9a('0x40')],'agentconnected':!![],'destaccountcode':_0x3d2f66['accountcode'],'destconnectedlinenum':_0x4acda6['exten'],'queue':_0x4a73da||undefined,'uniqueid':_0x4acda6['linkedid']};logger[_0xfa9a('0x36')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x4acda6[_0xfa9a('0x34')],util[_0xfa9a('0x43')](_0xc2afe1,{'showHidden':![],'depth':null}));this[_0xfa9a('0x32')](util[_0xfa9a('0x46')]('user:%s',_0x3d2f66['name']),'user:agentconnect',_0xc2afe1);}}}}catch(_0x3fffc4){logger['error'](_0xfa9a('0x6f'),_0x4acda6[_0xfa9a('0x34')],util[_0xfa9a('0x43')](_0x3fffc4,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xfa9a('0x70')]=function(_0x1abd2a,_0xba2140){try{if(this[_0xfa9a('0x15')][_0x1abd2a]){logger[_0xfa9a('0x2b')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x1abd2a,_0xba2140);this['channels'][_0x1abd2a][_0xfa9a('0x71')]=!![];if(_[_0xfa9a('0x72')](_0xba2140,_0xfa9a('0x73'))){_0xba2140=_0xba2140[_0xfa9a('0x74')]('.wav49',_0xfa9a('0x75'));}this[_0xfa9a('0x15')][_0x1abd2a]['monitorFilename']=_0xba2140;var _0x1a0196=_['find'](this[_0xfa9a('0x15')][_0x1abd2a]['monitors'],{'filename':_0xba2140});if(_[_0xfa9a('0x64')](_0x1a0196)){this[_0xfa9a('0x15')][_0x1abd2a][_0xfa9a('0x76')][_0xfa9a('0x77')]({'filename':_0xba2140,'createdAt':moment()['format'](_0xfa9a('0x5b')),'mixmonitorid':'','status':_0xfa9a('0x78')});}}}catch(_0x460c06){logger['error']('[%s][voiceCallReport][mixMonitorFilename]',_0x1abd2a,util['inspect'](_0x460c06,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfa9a('0x31')][_0xfa9a('0x1f')]=function(_0x34b25c){try{if(this['isNotNull'](_0x34b25c)){logger[_0xfa9a('0x36')](_0xfa9a('0x79'),_0x34b25c[_0xfa9a('0x34')],util['inspect'](_0x34b25c,{'showHidden':![],'depth':null}));if(this['channels'][_0x34b25c[_0xfa9a('0x34')]]&&_0x34b25c[_0xfa9a('0x3b')]!=_0xfa9a('0x44')){if(this['isNotNull'](_0x34b25c[_0xfa9a('0x7a')])){if(this[_0xfa9a('0x2f')](_0x34b25c[_0xfa9a('0x7a')]['mixmonitor_filename'])){logger[_0xfa9a('0x2b')](_0xfa9a('0x7b'),_0x34b25c[_0xfa9a('0x34')],_0x34b25c[_0xfa9a('0x7c')]);this[_0xfa9a('0x70')](_0x34b25c[_0xfa9a('0x34')],_0x34b25c[_0xfa9a('0x7c')]);}else if(this[_0xfa9a('0x2f')](_0x34b25c[_0xfa9a('0x7a')][_0xfa9a('0x7d')])){logger[_0xfa9a('0x2b')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x34b25c[_0xfa9a('0x34')],_0x34b25c[_0xfa9a('0x7c')]);this['channels'][_0x34b25c[_0xfa9a('0x34')]][_0xfa9a('0x35')]=_0x34b25c['value'];}else if(this[_0xfa9a('0x2f')](_0x34b25c[_0xfa9a('0x7a')][_0xfa9a('0x7e')])){logger[_0xfa9a('0x2b')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x34b25c[_0xfa9a('0x34')],_0x34b25c['value']);this[_0xfa9a('0x15')][_0x34b25c[_0xfa9a('0x34')]][_0xfa9a('0x7f')]=_0x34b25c['value'];}else if(this[_0xfa9a('0x2f')](_0x34b25c[_0xfa9a('0x7a')][_0xfa9a('0x80')])){logger['info'](_0xfa9a('0x81'),_0x34b25c['uniqueid'],_0x34b25c['value']);this[_0xfa9a('0x15')][_0x34b25c['uniqueid']][_0xfa9a('0x63')]=_0x34b25c[_0xfa9a('0x7c')];}else if(this['isNotNull'](_0x34b25c[_0xfa9a('0x7a')][_0xfa9a('0x82')])){logger[_0xfa9a('0x2b')](_0xfa9a('0x83'),_0x34b25c['uniqueid'],_0x34b25c[_0xfa9a('0x7c')][_0xfa9a('0x3c')](',')[0x0]);this['channels'][_0x34b25c[_0xfa9a('0x34')]][_0xfa9a('0x9')]=_0x34b25c['value'][_0xfa9a('0x3c')](',')[0x0];}else if(this[_0xfa9a('0x2f')](_0x34b25c['variable'][_0xfa9a('0x84')])){logger[_0xfa9a('0x2b')](_0xfa9a('0x85'),_0x34b25c[_0xfa9a('0x34')],_0x34b25c['value']);this[_0xfa9a('0x15')][_0x34b25c[_0xfa9a('0x34')]][_0xfa9a('0x86')]=_0x34b25c[_0xfa9a('0x7c')];}else if(this['isNotNull'](_0x34b25c[_0xfa9a('0x7a')][_0xfa9a('0x87')])){logger['info'](_0xfa9a('0x88'),_0x34b25c[_0xfa9a('0x34')],_0x34b25c[_0xfa9a('0x7c')]);this[_0xfa9a('0x15')][_0x34b25c['uniqueid']][_0xfa9a('0x89')]=_0x34b25c[_0xfa9a('0x7c')];}else if(this[_0xfa9a('0x2f')](_0x34b25c['variable'][_0xfa9a('0x8a')])){logger[_0xfa9a('0x2b')](_0xfa9a('0x8b'),_0x34b25c['uniqueid'],_0x34b25c['value']);this[_0xfa9a('0x15')][_0x34b25c[_0xfa9a('0x34')]][_0xfa9a('0x8c')]=_0x34b25c[_0xfa9a('0x7c')];}else if(this[_0xfa9a('0x2f')](_0x34b25c[_0xfa9a('0x7a')][_0xfa9a('0x8d')])){logger[_0xfa9a('0x2b')](_0xfa9a('0x8e'),_0x34b25c['uniqueid'],_0x34b25c['value']);this['channels'][_0x34b25c[_0xfa9a('0x34')]][_0xfa9a('0x9')]=_0x34b25c['value'];}else if(this[_0xfa9a('0x2f')](_0x34b25c['variable'][_0xfa9a('0x8f')])){logger[_0xfa9a('0x2b')](_0xfa9a('0x90'),_0x34b25c[_0xfa9a('0x34')],_0x34b25c[_0xfa9a('0x7c')]);this[_0xfa9a('0x15')][_0x34b25c['uniqueid']][_0xfa9a('0x91')]=_0x34b25c[_0xfa9a('0x7c')];}}}else if(this['isNotNull'](_0x34b25c['variable']['mixmonitor_filename'])){if(_0x34b25c[_0xfa9a('0x7c')]){var _0x59842d=path[_0xfa9a('0x92')](_0x34b25c[_0xfa9a('0x7c')])[_0xfa9a('0x40')];logger[_0xfa9a('0x2b')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x59842d,_0x34b25c[_0xfa9a('0x7c')]);this[_0xfa9a('0x70')](_0x59842d,_0x34b25c[_0xfa9a('0x7c')]);}}else if(this['channels'][_0x34b25c[_0xfa9a('0x37')]]){if(this[_0xfa9a('0x2f')](_0x34b25c['variable'])){if(this[_0xfa9a('0x2f')](_0x34b25c[_0xfa9a('0x7a')][_0xfa9a('0x8f')])){logger[_0xfa9a('0x2b')](_0xfa9a('0x90'),_0x34b25c[_0xfa9a('0x37')],_0x34b25c['value']);this[_0xfa9a('0x15')][_0x34b25c['linkedid']][_0xfa9a('0x93')]=_0x34b25c[_0xfa9a('0x7c')];}}}}}catch(_0x2e656c){logger[_0xfa9a('0x2d')](_0xfa9a('0x94'),_0x34b25c['uniqueid'],util['inspect'](_0x2e656c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfa9a('0x31')]['syncHangup']=function(_0x47e1fd){try{if(this[_0xfa9a('0x2f')](_0x47e1fd)){logger[_0xfa9a('0x36')](_0xfa9a('0x95'),_0x47e1fd[_0xfa9a('0x34')],util[_0xfa9a('0x43')](_0x47e1fd,{'showHidden':![],'depth':null}));if(this[_0xfa9a('0x16')][_0x47e1fd['linkedid']]){if(this[_0xfa9a('0x15')][this['blindTransfers'][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x37')]]){this[_0xfa9a('0x15')][this[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x37')]][_0xfa9a('0x34')]=_0x47e1fd[_0xfa9a('0x34')];this[_0xfa9a('0x15')][this[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x37')]]['linkedid']]['answered']=this[_0xfa9a('0x15')][_0x47e1fd[_0xfa9a('0x34')]]['answered'];this[_0xfa9a('0x15')][this[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x37')]][_0xfa9a('0x6e')]=this[_0xfa9a('0x15')][_0x47e1fd[_0xfa9a('0x34')]][_0xfa9a('0x6e')];this['channels'][this[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x37')]][_0xfa9a('0x6b')]=this['channels'][this[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x37')]]['linkedid']]['channel'];this['channels'][this[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x37')]][_0xfa9a('0x47')]=this['channels'][_0x47e1fd['uniqueid']]['disposition'];this['channels'][_0x47e1fd[_0xfa9a('0x34')]]=this[_0xfa9a('0x15')][this['blindTransfers'][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x37')]];this[_0xfa9a('0x96')](this[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x37')]]['linkedid']);}else if(this[_0xfa9a('0x15')][this[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x34')]]){this[_0xfa9a('0x15')][this[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x34')]]['uniqueid']=[this['channels'][this['blindTransfers'][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x34')]]['linkedid'],this[_0xfa9a('0x15')][this['blindTransfers'][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x34')]][_0xfa9a('0x37')]=this[_0xfa9a('0x15')][this['blindTransfers'][_0x47e1fd['linkedid']][_0xfa9a('0x34')]]['uniqueid']][0x0];this['channels'][this[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x37')]]['uniqueid']][_0xfa9a('0x67')]=this[_0xfa9a('0x15')][_0x47e1fd['uniqueid']][_0xfa9a('0x67')];this[_0xfa9a('0x15')][this['blindTransfers'][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x34')]][_0xfa9a('0x6e')]=this[_0xfa9a('0x15')][_0x47e1fd['uniqueid']]['answertime'];this[_0xfa9a('0x15')][this[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x34')]][_0xfa9a('0x6b')]=this[_0xfa9a('0x15')][this[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x34')]][_0xfa9a('0x3b')];this[_0xfa9a('0x15')][this[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x34')]][_0xfa9a('0x47')]=this[_0xfa9a('0x15')][_0x47e1fd[_0xfa9a('0x34')]][_0xfa9a('0x47')];this[_0xfa9a('0x15')][_0x47e1fd[_0xfa9a('0x34')]]=this[_0xfa9a('0x15')][this[_0xfa9a('0x16')][_0x47e1fd['linkedid']][_0xfa9a('0x34')]];this[_0xfa9a('0x96')](this[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x34')]);}}if(this[_0xfa9a('0x15')][_0x47e1fd[_0xfa9a('0x34')]]){logger['info'](_0xfa9a('0x97'),_0x47e1fd[_0xfa9a('0x34')],_0x47e1fd[_0xfa9a('0x98')]);var _0x551fc5=moment();this['channels'][_0x47e1fd[_0xfa9a('0x34')]]['endtime']=_0x551fc5[_0xfa9a('0x46')](_0xfa9a('0x5b'));this[_0xfa9a('0x15')][_0x47e1fd[_0xfa9a('0x34')]][_0xfa9a('0x59')]=_0x551fc5[_0xfa9a('0x69')](this['channels'][_0x47e1fd[_0xfa9a('0x34')]][_0xfa9a('0x57')],_0xfa9a('0x5a'));if(this['channels'][_0x47e1fd[_0xfa9a('0x34')]]['answered']){this[_0xfa9a('0x15')][_0x47e1fd[_0xfa9a('0x34')]]['billableseconds']=_0x551fc5[_0xfa9a('0x69')](this[_0xfa9a('0x15')][_0x47e1fd[_0xfa9a('0x34')]][_0xfa9a('0x6e')],_0xfa9a('0x5a'));this[_0xfa9a('0x15')][_0x47e1fd['uniqueid']]['holdtime']=this[_0xfa9a('0x15')][_0x47e1fd[_0xfa9a('0x34')]]['duration']-this[_0xfa9a('0x15')][_0x47e1fd[_0xfa9a('0x34')]]['billableseconds'];}if(_0x47e1fd[_0xfa9a('0x4a')]===_0xfa9a('0x99')){if(this[_0xfa9a('0x4b')][_0x47e1fd[_0xfa9a('0x3b')][_0xfa9a('0x3c')]('-')[0x0]]){this['agents'][_0x47e1fd[_0xfa9a('0x3b')][_0xfa9a('0x3c')]('-')[0x0]]=_[_0xfa9a('0x9a')](this[_0xfa9a('0x4b')][_0x47e1fd[_0xfa9a('0x3b')][_0xfa9a('0x3c')]('-')[0x0]],['destconnectedlinenum']);logger['debug'](_0xfa9a('0x9b'),_0x47e1fd[_0xfa9a('0x34')],util[_0xfa9a('0x43')]({'id':this['agents'][_0x47e1fd['channel'][_0xfa9a('0x3c')]('-')[0x0]]['id'],'destaccountcode':this[_0xfa9a('0x4b')][_0x47e1fd[_0xfa9a('0x3b')][_0xfa9a('0x3c')]('-')[0x0]][_0xfa9a('0x4e')]},{'showHidden':![],'depth':null}));this[_0xfa9a('0x32')](util[_0xfa9a('0x46')](_0xfa9a('0x4f'),this[_0xfa9a('0x4b')][_0x47e1fd[_0xfa9a('0x3b')][_0xfa9a('0x3c')]('-')[0x0]][_0xfa9a('0x40')]),_0xfa9a('0x9c'),{'id':this[_0xfa9a('0x4b')][_0x47e1fd['channel'][_0xfa9a('0x3c')]('-')[0x0]]['id'],'destaccountcode':this[_0xfa9a('0x4b')][_0x47e1fd['channel'][_0xfa9a('0x3c')]('-')[0x0]]['accountcode']});for(var _0x5c0458=0x0;_0x5c0458<Object['keys'](this[_0xfa9a('0x4b')])['length'];_0x5c0458++){var _0x9d9073=Object[_0xfa9a('0x3a')](this[_0xfa9a('0x4b')])[_0x5c0458];var _0x5178e9=this[_0xfa9a('0x4b')][_0x9d9073];if(_0x5178e9[_0xfa9a('0x4e')]===Number(this[_0xfa9a('0x15')][_0x47e1fd[_0xfa9a('0x34')]][_0xfa9a('0x3f')])){this['emit'](util[_0xfa9a('0x46')]('user:%s',_0x5178e9[_0xfa9a('0x40')]),_0xfa9a('0x9c'),{'id':_0x5178e9['id'],'destaccountcode':_0x5178e9[_0xfa9a('0x4e')],'transfer':this['channels'][_0x47e1fd[_0xfa9a('0x34')]]['transferType']});break;}}}}var _0x527c0d=this;Promise[_0xfa9a('0x9d')]()[_0xfa9a('0x9e')](function(){var _0x1ced66=_0x527c0d[_0xfa9a('0x15')][_0x47e1fd['uniqueid']];if(typeof _0x1ced66[_0xfa9a('0x9f')]===_0xfa9a('0x4c')){return;}if(_0x1ced66['transferToInternal']===!![]){return;}if(_[_0xfa9a('0xa0')](_0x1ced66[_0xfa9a('0x76')])){return;}return RpcSetting[_0xfa9a('0xa1')]()[_0xfa9a('0x9e')](function(_0x445287){if(!_0x445287[_0xfa9a('0xa2')])return;return Promise[_0xfa9a('0x9d')]()['then'](function(){return ami[_0xfa9a('0xa3')]({'action':_0xfa9a('0xa4'),'channel':_0x1ced66[_0xfa9a('0x3b')]})[_0xfa9a('0xa5')](function(){});})[_0xfa9a('0x9e')](function(){return ami['Action']({'action':_0xfa9a('0xa4'),'channel':_0x1ced66[_0xfa9a('0x6b')]})[_0xfa9a('0xa5')](function(){})[_0xfa9a('0xa6')](function(){var _0x1a5711=_0x527c0d['agents'][_0x1ced66[_0xfa9a('0x6b')][_0xfa9a('0x3c')]('-')[0x0]];if(!_0x1a5711)return;io[_0xfa9a('0x32')](_0xfa9a('0xa7'),{'agentId':_0x1a5711['id'],'uniqueid':_0x1ced66[_0xfa9a('0x34')]});});});});})[_0xfa9a('0x9e')](function(){if(_0x47e1fd[_0xfa9a('0xa8')]==='BlindTransfer'){_0x527c0d['blindTransfers'][_0x47e1fd[_0xfa9a('0x34')]]=_0x47e1fd;}else{if(_0x527c0d[_0xfa9a('0x15')][_0x47e1fd['uniqueid']]&&_0x527c0d[_0xfa9a('0x15')][_0x47e1fd['uniqueid']][_0xfa9a('0x63')]===_0xfa9a('0xa9')&&_0x527c0d[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x34')]]){_0x527c0d[_0xfa9a('0x15')][_0x47e1fd['uniqueid']][_0xfa9a('0x34')]=[_0x527c0d['channels'][_0x47e1fd[_0xfa9a('0x34')]]['linkedid'],_0x527c0d[_0xfa9a('0x15')][_0x47e1fd[_0xfa9a('0x34')]][_0xfa9a('0x37')]=_0x527c0d[_0xfa9a('0x15')][_0x47e1fd[_0xfa9a('0x34')]]['uniqueid']][0x0];delete _0x527c0d[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x34')]];}}logger[_0xfa9a('0x36')](_0xfa9a('0xaa'),_0x47e1fd[_0xfa9a('0x34')],util[_0xfa9a('0x43')](_0x527c0d[_0xfa9a('0x15')][_0x47e1fd[_0xfa9a('0x34')]],{'showHidden':![],'depth':null}));ami[_0xfa9a('0x32')](_0xfa9a('0xab'),_0x527c0d[_0xfa9a('0x15')][_0x47e1fd[_0xfa9a('0x34')]]);delete _0x527c0d[_0xfa9a('0x15')][_0x47e1fd[_0xfa9a('0x34')]];});}}}catch(_0x36d896){logger[_0xfa9a('0x2d')](_0xfa9a('0xac'),_0x47e1fd[_0xfa9a('0x34')],util[_0xfa9a('0x43')](_0x36d896,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfa9a('0x31')][_0xfa9a('0x25')]=function(_0x5e272b){try{if(this[_0xfa9a('0x2f')](_0x5e272b)){logger['info'](_0xfa9a('0xad'),_0x5e272b['uniqueid'],_0x5e272b['origtransferercalleridnum'],_0x5e272b[_0xfa9a('0xae')]);logger[_0xfa9a('0x36')]('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x5e272b[_0xfa9a('0x34')],util[_0xfa9a('0x43')](_0x5e272b,{'showHidden':![],'depth':null}));var _0x54ab17;if(this['channels'][_0x5e272b['transfereeuniqueid']]){this['channels'][_0x5e272b[_0xfa9a('0xaf')]][_0xfa9a('0xb0')]=_0x5e272b[_0xfa9a('0xb1')];this[_0xfa9a('0x15')][_0x5e272b[_0xfa9a('0xaf')]][_0xfa9a('0xb2')]=_0x5e272b[_0xfa9a('0xae')];if(this[_0xfa9a('0x15')][_0x5e272b['secondtransfereruniqueid']]){_0x54ab17=this[_0xfa9a('0x15')][_0x5e272b[_0xfa9a('0xb3')]];this['channels'][_0x5e272b[_0xfa9a('0xb3')]]=this[_0xfa9a('0x15')][_0x5e272b[_0xfa9a('0xaf')]];this[_0xfa9a('0x15')][_0x5e272b['transfereeuniqueid']]=_0x54ab17;}this['channels'][_0x5e272b[_0xfa9a('0xb3')]][_0xfa9a('0x9f')]=_0xfa9a('0xb4');}else if(this[_0xfa9a('0x15')][_0x5e272b[_0xfa9a('0xb5')]]){this['channels'][_0x5e272b[_0xfa9a('0xb5')]]['transfercalleridnum']=_0x5e272b[_0xfa9a('0xb1')];this[_0xfa9a('0x15')][_0x5e272b[_0xfa9a('0xb5')]][_0xfa9a('0xb2')]=_0x5e272b[_0xfa9a('0xae')];if(this[_0xfa9a('0x15')][_0x5e272b[_0xfa9a('0xb6')]]){_0x54ab17=this[_0xfa9a('0x15')][_0x5e272b[_0xfa9a('0xb6')]];this['channels'][_0x5e272b[_0xfa9a('0xb6')]]=this[_0xfa9a('0x15')][_0x5e272b[_0xfa9a('0xb5')]];this['channels'][_0x5e272b['transfertargetuniqueid']]=_0x54ab17;}this[_0xfa9a('0x15')][_0x5e272b['transfertargetuniqueid']]['transferType']='ATTENDED';}if((this[_0xfa9a('0x15')][_0x5e272b[_0xfa9a('0xb6')]]||this[_0xfa9a('0x15')][_0x5e272b['origtransfererlinkedid']])&&this[_0xfa9a('0x15')][_0x5e272b['secondtransfereruniqueid']]){var _0x2bef9b=_[_0xfa9a('0xb7')]([this['channels'][_0x5e272b[_0xfa9a('0xb6')]],this[_0xfa9a('0x15')][_0x5e272b['origtransfererlinkedid']],this[_0xfa9a('0x15')][_0x5e272b[_0xfa9a('0xb3')]]],function(_0x38971b){return _0x38971b&&_0x38971b[_0xfa9a('0x63')]===_0xfa9a('0xa9')&&_0x38971b[_0xfa9a('0xb8')];});if(_0x2bef9b){if(this[_0xfa9a('0x15')][_0x5e272b[_0xfa9a('0xb6')]])this['channels'][_0x5e272b[_0xfa9a('0xb6')]][_0xfa9a('0x9f')]=_0xfa9a('0xb4');if(this[_0xfa9a('0x15')][_0x5e272b[_0xfa9a('0xb9')]])this[_0xfa9a('0x15')][_0x5e272b['origtransfererlinkedid']][_0xfa9a('0x9f')]=_0xfa9a('0xb4');this[_0xfa9a('0x15')][_0x5e272b[_0xfa9a('0xb3')]]['transferType']=_0xfa9a('0xb4');}else{if(this['channels'][_0x5e272b[_0xfa9a('0xaf')]]){this[_0xfa9a('0x15')][_0x5e272b[_0xfa9a('0xb3')]][_0xfa9a('0xba')]=!![];}if(this[_0xfa9a('0x15')][_0x5e272b[_0xfa9a('0xb5')]]){this[_0xfa9a('0x15')][_0x5e272b[_0xfa9a('0xb5')]][_0xfa9a('0xba')]=!![];}}}}}catch(_0x21a451){logger['error'](_0xfa9a('0xbb'),_0x5e272b['uniqueid'],util['inspect'](_0x21a451,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfa9a('0x31')][_0xfa9a('0x27')]=function(_0x2d7d6f){try{if(this['isNotNull'](_0x2d7d6f)){logger[_0xfa9a('0x2b')](_0xfa9a('0xbc'),_0x2d7d6f[_0xfa9a('0x34')],_0x2d7d6f[_0xfa9a('0xbd')],_0x2d7d6f[_0xfa9a('0xbe')]);logger[_0xfa9a('0x36')](_0xfa9a('0xbf'),_0x2d7d6f[_0xfa9a('0x34')],util[_0xfa9a('0x43')](_0x2d7d6f,{'showHidden':![],'depth':null}));if(this['channels'][_0x2d7d6f['transfereeuniqueid']]){this['channels'][_0x2d7d6f[_0xfa9a('0xaf')]][_0xfa9a('0xb0')]=_0x2d7d6f[_0xfa9a('0xbd')];this['channels'][_0x2d7d6f[_0xfa9a('0xaf')]][_0xfa9a('0xb2')]=_0x2d7d6f['extension'];this[_0xfa9a('0x15')][_0x2d7d6f[_0xfa9a('0xaf')]][_0xfa9a('0x9f')]=_0xfa9a('0xc0');this[_0xfa9a('0x21')]({'event':'BlindTransfer','uniqueid':_0x2d7d6f[_0xfa9a('0xaf')],'linkedid':_0x2d7d6f['transfereruniqueid'],'context':_0x2d7d6f[_0xfa9a('0x4a')],'channel':_0x2d7d6f[_0xfa9a('0xc1')]});}else{this[_0xfa9a('0x15')][_0x2d7d6f[_0xfa9a('0xc2')]][_0xfa9a('0x9f')]='BLIND';this[_0xfa9a('0x21')]({'event':_0xfa9a('0xc3'),'uniqueid':_0x2d7d6f[_0xfa9a('0xc2')],'linkedid':_0x2d7d6f[_0xfa9a('0xaf')],'context':_0x2d7d6f[_0xfa9a('0x4a')],'channel':_0x2d7d6f[_0xfa9a('0xc1')]});}}}catch(_0x1aa181){logger['error']('[%s][voiceCallReport][blindtransfer]',_0x2d7d6f[_0xfa9a('0x34')],util[_0xfa9a('0x43')](_0x1aa181,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfa9a('0x31')][_0xfa9a('0xc4')]=function(_0x294d0e){try{if(this[_0xfa9a('0x2f')](_0x294d0e)){logger['debug'](_0xfa9a('0xc5'),_0x294d0e[_0xfa9a('0x34')],util[_0xfa9a('0x43')](_0x294d0e,{'showHidden':![],'depth':null}));if(this[_0xfa9a('0x15')][_0x294d0e[_0xfa9a('0x34')]]){if(!_[_0xfa9a('0x64')](this[_0xfa9a('0x15')][_0x294d0e[_0xfa9a('0x34')]][_0xfa9a('0x6e')])){this['channels'][_0x294d0e['uniqueid']][_0xfa9a('0xc6')]=moment()[_0xfa9a('0x46')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xfa9a('0x2b')](_0xfa9a('0xc7'),_0x294d0e[_0xfa9a('0x34')],this[_0xfa9a('0x15')][_0x294d0e[_0xfa9a('0x34')]][_0xfa9a('0xc6')]);}}}}catch(_0x2b87c9){logger[_0xfa9a('0x2d')](_0xfa9a('0xc8'),_0x294d0e[_0xfa9a('0x34')],util[_0xfa9a('0x43')](_0x2b87c9,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStop']=function(_0x33813a){try{if(this['isNotNull'](_0x33813a)){logger['debug'](_0xfa9a('0xc9'),_0x33813a[_0xfa9a('0x34')],util[_0xfa9a('0x43')](_0x33813a,{'showHidden':![],'depth':null}));if(this[_0xfa9a('0x15')][_0x33813a[_0xfa9a('0x34')]]){if(!_[_0xfa9a('0x64')](this[_0xfa9a('0x15')][_0x33813a[_0xfa9a('0x34')]][_0xfa9a('0xc6')])){this[_0xfa9a('0x15')][_0x33813a['uniqueid']][_0xfa9a('0xca')]+=moment()[_0xfa9a('0xcb')](0x0)[_0xfa9a('0x69')](this[_0xfa9a('0x15')][_0x33813a['uniqueid']][_0xfa9a('0xc6')],'seconds');logger[_0xfa9a('0x2b')]('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x33813a['uniqueid'],this[_0xfa9a('0x15')][_0x33813a[_0xfa9a('0x34')]][_0xfa9a('0xca')]);delete this[_0xfa9a('0x15')][_0x33813a[_0xfa9a('0x34')]]['mohstarttime'];}}}}catch(_0x1f9293){logger[_0xfa9a('0x2d')]('[%s][voiceCallReport][musiconholdstop]',_0x33813a['uniqueid'],util[_0xfa9a('0x43')](_0x1f9293,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['deleteChannelAfterTimeout']=function(_0x1e3839,_0x3410a4=0x2710){if(this[_0xfa9a('0x15')][_0x1e3839]){setTimeout(()=>{delete this[_0xfa9a('0x15')][_0x1e3839];},_0x3410a4);}};module[_0xfa9a('0xcc')]=VoiceCallReport;