a7f16041eb8c9e26d325e3469205d27d85581ec5
[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 _0x3e74=['agents','blindTransfers','coreshowchannel','newexten','syncNewExten','bind','newchannel','newstate','syncNewState','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','inspect','linkedid','merge','pick','keys','context','from-sip','channel','split','xcally-motion-preview','format','user:%s','name','syncNewChannel','debug','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','exten','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','startsWith','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','includes','lastapplication','cdr(','match','type','isNil','[%s][voiceCallReport][newstate]\x20event:','diff','connectedlinename','destinationchannel','UserId','answered','membername','user:agentconnect','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','sipcalllinkedid','[%s][voiceCallReport][varset]','answertime','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','holdtime','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','connectedlinenum','user:agentcomplete','transferType','resolve','undefined','isEmpty','then','stopRecordingOnTransfer','StopMixMonitor','catch','Action','finally','webbar:stopmonitors','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','some','origtransfererlinkedid','routeid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','lodash','util','path','ioredis','ami','../model/channel','../rpc/setting','set','queue','agi','playback','voicemail','NO\x20ANSWER','FAILED','BUSY','defaults','redis','socket.io-emitter','channels'];(function(_0x64c6e3,_0x3b5371){var _0x69c52f=function(_0x573d04){while(--_0x573d04){_0x64c6e3['push'](_0x64c6e3['shift']());}};_0x69c52f(++_0x3b5371);}(_0x3e74,0x175));var _0x43e7=function(_0x2635b4,_0x2ac9c2){_0x2635b4=_0x2635b4-0x0;var _0x3adb39=_0x3e74[_0x2635b4];return _0x3adb39;};'use strict';var _=require(_0x43e7('0x0'));var moment=require('moment');var util=require(_0x43e7('0x1'));var path=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x43e7('0x4'));var ami=require('../ami');var Channel=require(_0x43e7('0x5'));var RpcSetting=require(_0x43e7('0x6'));var applications=[_0x43e7('0x7'),_0x43e7('0x8'),_0x43e7('0x9'),'dial',_0x43e7('0xa'),_0x43e7('0xb')];var dispositions=[_0x43e7('0xc'),_0x43e7('0xd'),_0x43e7('0xd'),'NO\x20ANSWER',_0x43e7('0xc'),'NO\x20ANSWER','ANSWERED',_0x43e7('0xe'),_0x43e7('0xd'),'FAILED',_0x43e7('0xd')];config['redis']=_[_0x43e7('0xf')](config[_0x43e7('0x10')],{'host':'localhost','port':0x18eb});var io=require(_0x43e7('0x11'))(new Redis(config[_0x43e7('0x10')]));function VoiceCallReport(_0x2718d3){this[_0x43e7('0x12')]=_0x2718d3['channels'];this['agents']=_0x2718d3[_0x43e7('0x13')];this[_0x43e7('0x14')]={};ami['on'](_0x43e7('0x15'),this['syncNewExten']['bind'](this));ami['on'](_0x43e7('0x16'),this[_0x43e7('0x17')][_0x43e7('0x18')](this));ami['on'](_0x43e7('0x19'),this['syncNewChannel']['bind'](this));ami['on'](_0x43e7('0x1a'),this[_0x43e7('0x1b')][_0x43e7('0x18')](this));ami['on']('varset',this['syncVarSet'][_0x43e7('0x18')](this));ami['on'](_0x43e7('0x1c'),this[_0x43e7('0x1d')][_0x43e7('0x18')](this));ami['on'](_0x43e7('0x1e'),this[_0x43e7('0x1f')][_0x43e7('0x18')](this));ami['on'](_0x43e7('0x20'),this[_0x43e7('0x21')][_0x43e7('0x18')](this));ami['on'](_0x43e7('0x22'),this[_0x43e7('0x23')]['bind'](this));ami['on'](_0x43e7('0x24'),this[_0x43e7('0x25')]['bind'](this));ami['on'](_0x43e7('0x26'),this[_0x43e7('0x27')][_0x43e7('0x18')](this));try{logger[_0x43e7('0x28')](_0x43e7('0x29'));ami[_0x43e7('0x2a')]();}catch(_0x54a9e7){logger[_0x43e7('0x2b')]('[voiceCallReport][coreshowchannels]',util['inspect'](_0x54a9e7,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x43e7('0x2c')][_0x43e7('0x2d')]=function(_0x4b2b9f){return _0x4b2b9f!==null&&!_[_0x43e7('0x2e')](_0x4b2b9f);};VoiceCallReport['prototype'][_0x43e7('0x2f')]=function(_0x5c5e67,_0x1af208,_0x1b5f50){io['to'](_0x5c5e67)[_0x43e7('0x2f')](_0x1af208,_0x1b5f50);};VoiceCallReport[_0x43e7('0x2c')]['syncNewCallerId']=function(_0x52b7b3){try{if(this[_0x43e7('0x2d')](_0x52b7b3)){logger['info'](_0x43e7('0x30'),_0x52b7b3[_0x43e7('0x31')],_0x52b7b3[_0x43e7('0x32')],_0x52b7b3[_0x43e7('0x33')]);logger['debug'](_0x43e7('0x34'),_0x52b7b3[_0x43e7('0x31')],util[_0x43e7('0x35')](_0x52b7b3,{'showHidden':![],'depth':null}));if(_0x52b7b3[_0x43e7('0x31')]===_0x52b7b3[_0x43e7('0x36')]){if(!_[_0x43e7('0x2e')](this[_0x43e7('0x12')][_0x52b7b3[_0x43e7('0x31')]])){_[_0x43e7('0x37')](this[_0x43e7('0x12')][_0x52b7b3[_0x43e7('0x31')]],_[_0x43e7('0x38')](_0x52b7b3,_[_0x43e7('0x39')](this[_0x43e7('0x12')][_0x52b7b3['uniqueid']])));}}if(_0x52b7b3[_0x43e7('0x3a')]===_0x43e7('0x3b')){if(this[_0x43e7('0x13')][_0x52b7b3[_0x43e7('0x3c')][_0x43e7('0x3d')]('-')[0x0]]){if(_0x52b7b3['exten']==_0x43e7('0x3e')){this[_0x43e7('0x13')][_0x52b7b3[_0x43e7('0x3c')][_0x43e7('0x3d')]('-')[0x0]]['destconnectedlinenum']=_0x52b7b3['connectedlinenum'];this['emit'](util[_0x43e7('0x3f')](_0x43e7('0x40'),this[_0x43e7('0x13')][_0x52b7b3[_0x43e7('0x3c')][_0x43e7('0x3d')]('-')[0x0]][_0x43e7('0x41')]),'user:agentconnect',{'destaccountcode':this['agents'][_0x52b7b3['channel']['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x52b7b3['connectedlinenum']});}}}}}catch(_0x5cb753){logger[_0x43e7('0x2b')]('[%s][voiceCallReport][newcallerid]',_0x52b7b3[_0x43e7('0x31')],util[_0x43e7('0x35')](_0x5cb753,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x43e7('0x2c')][_0x43e7('0x42')]=function(_0x40f72f){try{if(this[_0x43e7('0x2d')](_0x40f72f)){logger[_0x43e7('0x43')]('[%s][voiceCallReport][newchannel]\x20event:',_0x40f72f['uniqueid'],util['inspect'](_0x40f72f,{'showHidden':![],'depth':null}));if(this[_0x43e7('0x12')][_0x40f72f[_0x43e7('0x31')]])return;if(_0x40f72f[_0x43e7('0x3c')]===_0x43e7('0x44'))return;if(_0x40f72f[_0x43e7('0x31')]!==_0x40f72f[_0x43e7('0x36')]&&!this[_0x43e7('0x14')][_0x40f72f[_0x43e7('0x36')]])return;logger['info'](_0x43e7('0x45'),_0x40f72f[_0x43e7('0x31')],_0x40f72f['context'],_0x40f72f[_0x43e7('0x46')]);this['channels'][_0x40f72f[_0x43e7('0x31')]]=new Channel();this[_0x43e7('0x12')][_0x40f72f[_0x43e7('0x31')]][_0x43e7('0x47')]=moment()[_0x43e7('0x3f')](_0x43e7('0x48'));this['channels'][_0x40f72f['uniqueid']][_0x43e7('0x49')]=dispositions[_[_0x43e7('0x4a')](_0x40f72f[_0x43e7('0x4b')])];_[_0x43e7('0x37')](this[_0x43e7('0x12')][_0x40f72f['uniqueid']],_[_0x43e7('0x38')](_0x40f72f,_[_0x43e7('0x39')](this['channels'][_0x40f72f[_0x43e7('0x31')]])));if(_0x40f72f['context']===_0x43e7('0x3b')){if(this['agents'][_0x40f72f[_0x43e7('0x3c')][_0x43e7('0x3d')]('-')[0x0]]){if(_[_0x43e7('0x2e')](this[_0x43e7('0x13')][_0x40f72f['channel']['split']('-')[0x0]][_0x43e7('0x4c')])){this[_0x43e7('0x13')][_0x40f72f[_0x43e7('0x3c')][_0x43e7('0x3d')]('-')[0x0]]['destconnectedlinenum']=_0x40f72f['exten'];logger['debug'](_0x43e7('0x4d'),_0x40f72f['uniqueid'],util[_0x43e7('0x35')]({'id':this['agents'][_0x40f72f['channel'][_0x43e7('0x3d')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x40f72f[_0x43e7('0x3c')][_0x43e7('0x3d')]('-')[0x0]][_0x43e7('0x4e')],'destconnectedlinenum':_0x40f72f[_0x43e7('0x46')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x43e7('0x3f')](_0x43e7('0x40'),this[_0x43e7('0x13')][_0x40f72f[_0x43e7('0x3c')][_0x43e7('0x3d')]('-')[0x0]][_0x43e7('0x41')]),'user:agentconnect',{'id':this['agents'][_0x40f72f[_0x43e7('0x3c')][_0x43e7('0x3d')]('-')[0x0]]['id'],'destaccountcode':this[_0x43e7('0x13')][_0x40f72f['channel']['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x40f72f[_0x43e7('0x46')]});}}}}}catch(_0x42ed10){logger['error'](_0x43e7('0x4f'),_0x40f72f[_0x43e7('0x31')],util[_0x43e7('0x35')](_0x42ed10,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewExten']=function(_0x4ec263){try{if(this['isNotNull'](_0x4ec263)){logger[_0x43e7('0x43')](_0x43e7('0x50'),_0x4ec263['uniqueid'],util[_0x43e7('0x35')](_0x4ec263,{'showHidden':![],'depth':null}));if(_0x4ec263[_0x43e7('0x3c')]===_0x43e7('0x44')||_0x4ec263[_0x43e7('0x46')]==='h')return;if(_0x4ec263['uniqueid']===_0x4ec263[_0x43e7('0x36')]||this['blindTransfers'][_0x4ec263['linkedid']]){_0x4ec263[_0x43e7('0x51')]=_0x4ec263[_0x43e7('0x51')][_0x43e7('0x52')]();_0x4ec263[_0x43e7('0x53')]=_0x4ec263[_0x43e7('0x54')]||_0x4ec263[_0x43e7('0x53')];if(_0x4ec263[_0x43e7('0x54')]&&!_0x4ec263[_0x43e7('0x54')][_0x43e7('0x55')](_0x43e7('0x56'))&&_0x4ec263['application']!==_0x43e7('0x8')){_0x4ec263[_0x43e7('0x53')]=_0x4ec263['applicationdata'][_0x43e7('0x52')]();}logger['info'](_0x43e7('0x57'),_0x4ec263[_0x43e7('0x31')],_0x4ec263[_0x43e7('0x51')],_0x4ec263[_0x43e7('0x53')]);if(_[_0x43e7('0x2e')](this['channels'][_0x4ec263['uniqueid']])){this[_0x43e7('0x12')][_0x4ec263[_0x43e7('0x31')]]=new Channel();this[_0x43e7('0x12')][_0x4ec263[_0x43e7('0x31')]][_0x43e7('0x47')]=_0x4ec263[_0x43e7('0x58')]?moment()[_0x43e7('0x59')](moment[_0x43e7('0x58')](_0x4ec263[_0x43e7('0x58')])[_0x43e7('0x5a')](),_0x43e7('0x5a'))['format'](_0x43e7('0x48')):moment()[_0x43e7('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x43e7('0x12')][_0x4ec263[_0x43e7('0x31')]][_0x43e7('0x49')]='NO\x20ANSWER';}_['merge'](this[_0x43e7('0x12')][_0x4ec263[_0x43e7('0x31')]],_['pick'](_0x4ec263,_[_0x43e7('0x39')](this['channels'][_0x4ec263['uniqueid']])));if(_[_0x43e7('0x5b')](applications,_0x4ec263[_0x43e7('0x51')])){this[_0x43e7('0x12')][_0x4ec263[_0x43e7('0x31')]][_0x43e7('0x5c')]=_0x4ec263['application'];this[_0x43e7('0x12')][_0x4ec263[_0x43e7('0x31')]]['lastdata']=_0x4ec263[_0x43e7('0x53')];if(_0x4ec263[_0x43e7('0x51')]===_0x43e7('0x7')&&_['startsWith'](_0x4ec263['applicationdata']['toLowerCase'](),_0x43e7('0x5d'))){var _0x4058ce=_0x4ec263[_0x43e7('0x53')][_0x43e7('0x3d')]('=');var _0x52ea9c=_0x4058ce[0x0]['toLowerCase']()[_0x43e7('0x5e')](/cdr\((.*)\)/);if(_0x52ea9c){if(_0x52ea9c[0x1]===_0x43e7('0x5f')&&!_[_0x43e7('0x60')](this[_0x43e7('0x12')][_0x4ec263['uniqueid']][_0x52ea9c[0x1]]))return;this[_0x43e7('0x12')][_0x4ec263[_0x43e7('0x31')]][_0x52ea9c[0x1]]=_0x4058ce[0x1];}}else if(_0x4ec263[_0x43e7('0x51')]===_0x43e7('0x8')){this[_0x43e7('0x12')][_0x4ec263[_0x43e7('0x31')]][_0x43e7('0x8')]=_0x4ec263[_0x43e7('0x53')][_0x43e7('0x3d')](',')[0x0];}}}}}catch(_0x381208){logger[_0x43e7('0x2b')]('[%s][voiceCallReport][newexten]',_0x4ec263['uniqueid'],util[_0x43e7('0x35')](_0x381208,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewState']=function(_0x50edb2){try{if(this[_0x43e7('0x2d')](_0x50edb2)){logger[_0x43e7('0x28')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x50edb2[_0x43e7('0x31')],_0x50edb2[_0x43e7('0x36')],_0x50edb2[_0x43e7('0x32')],_0x50edb2['calleridnum']);logger[_0x43e7('0x43')](_0x43e7('0x61'),_0x50edb2[_0x43e7('0x31')],util[_0x43e7('0x35')](_0x50edb2,{'showHidden':![],'depth':null}));if(_0x50edb2[_0x43e7('0x4b')]!=='6')return;if(_0x50edb2[_0x43e7('0x31')]!==_0x50edb2[_0x43e7('0x36')]){var _0x515f01=moment();if(this[_0x43e7('0x12')][_0x50edb2[_0x43e7('0x36')]]){if(!this[_0x43e7('0x12')][_0x50edb2['linkedid']]['answered']){this[_0x43e7('0x12')][_0x50edb2['linkedid']]['answered']=!![];this[_0x43e7('0x12')][_0x50edb2[_0x43e7('0x36')]]['answertime']=_0x515f01[_0x43e7('0x3f')](_0x43e7('0x48'));if(this[_0x43e7('0x12')][_0x50edb2[_0x43e7('0x36')]][_0x43e7('0x47')]){this[_0x43e7('0x12')][_0x50edb2[_0x43e7('0x36')]]['holdtime']=_0x515f01[_0x43e7('0x62')](this[_0x43e7('0x12')][_0x50edb2['linkedid']][_0x43e7('0x47')],'seconds');}}this[_0x43e7('0x12')][_0x50edb2[_0x43e7('0x36')]][_0x43e7('0x36')]=_0x50edb2[_0x43e7('0x31')];if(_0x50edb2['calleridnum']!==_0x43e7('0x3e')){this[_0x43e7('0x12')][_0x50edb2[_0x43e7('0x36')]]['connectedlinenum']=_0x50edb2[_0x43e7('0x33')];}this[_0x43e7('0x12')][_0x50edb2[_0x43e7('0x36')]][_0x43e7('0x63')]=_0x50edb2[_0x43e7('0x32')];this['channels'][_0x50edb2[_0x43e7('0x36')]][_0x43e7('0x64')]=_0x50edb2[_0x43e7('0x3c')];this[_0x43e7('0x12')][_0x50edb2[_0x43e7('0x36')]][_0x43e7('0x49')]=dispositions[_[_0x43e7('0x4a')](_0x50edb2['channelstate'])];if(this['agents'][_0x50edb2[_0x43e7('0x3c')]['split']('-')[0x0]]){this['channels'][_0x50edb2['linkedid']][_0x43e7('0x65')]=this[_0x43e7('0x13')][_0x50edb2[_0x43e7('0x3c')][_0x43e7('0x3d')]('-')[0x0]]['id'];this[_0x43e7('0x12')][_0x50edb2[_0x43e7('0x36')]]['membername']=this[_0x43e7('0x13')][_0x50edb2[_0x43e7('0x3c')][_0x43e7('0x3d')]('-')[0x0]]['name'];}}if(this[_0x43e7('0x12')][_0x50edb2[_0x43e7('0x31')]]){if(!this[_0x43e7('0x12')][_0x50edb2[_0x43e7('0x31')]][_0x43e7('0x66')]){this[_0x43e7('0x12')][_0x50edb2[_0x43e7('0x31')]][_0x43e7('0x66')]=!![];this['channels'][_0x50edb2['uniqueid']]['answertime']=_0x515f01[_0x43e7('0x3f')](_0x43e7('0x48'));if(this['channels'][_0x50edb2[_0x43e7('0x31')]][_0x43e7('0x47')]){this[_0x43e7('0x12')][_0x50edb2[_0x43e7('0x31')]]['holdtime']=_0x515f01['diff'](this['channels'][_0x50edb2[_0x43e7('0x31')]][_0x43e7('0x47')],'seconds');}}if(_0x50edb2['calleridnum']!==_0x43e7('0x3e')){this[_0x43e7('0x12')][_0x50edb2[_0x43e7('0x31')]]['connectedlinenum']=_0x50edb2[_0x43e7('0x33')];}this[_0x43e7('0x12')][_0x50edb2[_0x43e7('0x31')]][_0x43e7('0x63')]=_0x50edb2['calleridname'];this[_0x43e7('0x12')][_0x50edb2['uniqueid']][_0x43e7('0x64')]=_0x50edb2[_0x43e7('0x3c')];this[_0x43e7('0x12')][_0x50edb2[_0x43e7('0x31')]][_0x43e7('0x49')]=dispositions[_[_0x43e7('0x4a')](_0x50edb2[_0x43e7('0x4b')])];}}else{if(this['channels'][_0x50edb2[_0x43e7('0x31')]]){if(this[_0x43e7('0x13')][_0x50edb2[_0x43e7('0x3c')][_0x43e7('0x3d')]('-')[0x0]]){this['channels'][_0x50edb2['uniqueid']]['UserId']=this[_0x43e7('0x13')][_0x50edb2['channel'][_0x43e7('0x3d')]('-')[0x0]]['id'];this[_0x43e7('0x12')][_0x50edb2[_0x43e7('0x31')]][_0x43e7('0x67')]=this[_0x43e7('0x13')][_0x50edb2[_0x43e7('0x3c')][_0x43e7('0x3d')]('-')[0x0]][_0x43e7('0x41')];}}}if(_0x50edb2[_0x43e7('0x3a')]===_0x43e7('0x3b')){if(this[_0x43e7('0x13')][_0x50edb2['channel'][_0x43e7('0x3d')]('-')[0x0]]){this[_0x43e7('0x13')][_0x50edb2[_0x43e7('0x3c')][_0x43e7('0x3d')]('-')[0x0]][_0x43e7('0x4c')]=_0x50edb2['exten'];var _0x5e04ec,_0x162a27;if(this[_0x43e7('0x12')][_0x50edb2['uniqueid']]){_0x5e04ec=this[_0x43e7('0x12')][_0x50edb2[_0x43e7('0x31')]]['routealias'];_0x162a27=this['channels'][_0x50edb2[_0x43e7('0x31')]][_0x43e7('0x8')];}else if(this[_0x43e7('0x12')][_0x50edb2[_0x43e7('0x36')]]){_0x5e04ec=this[_0x43e7('0x12')][_0x50edb2['linkedid']]['routealias'];_0x162a27=this[_0x43e7('0x12')][_0x50edb2[_0x43e7('0x36')]][_0x43e7('0x8')];}logger[_0x43e7('0x43')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x50edb2[_0x43e7('0x31')],util[_0x43e7('0x35')]({'id':this[_0x43e7('0x13')][_0x50edb2[_0x43e7('0x3c')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x43e7('0x13')][_0x50edb2[_0x43e7('0x3c')][_0x43e7('0x3d')]('-')[0x0]][_0x43e7('0x4e')],'destconnectedlinenum':_0x50edb2[_0x43e7('0x46')],'routealias':_0x5e04ec,'queue':_0x162a27||undefined},{'showHidden':![],'depth':null}));this['emit'](util[_0x43e7('0x3f')](_0x43e7('0x40'),this['agents'][_0x50edb2[_0x43e7('0x3c')][_0x43e7('0x3d')]('-')[0x0]][_0x43e7('0x41')]),_0x43e7('0x68'),{'id':this['agents'][_0x50edb2[_0x43e7('0x3c')]['split']('-')[0x0]]['id'],'agentconnected':!![],'destaccountcode':this[_0x43e7('0x13')][_0x50edb2[_0x43e7('0x3c')][_0x43e7('0x3d')]('-')[0x0]][_0x43e7('0x4e')],'destconnectedlinenum':_0x50edb2[_0x43e7('0x46')],'routealias':_0x5e04ec,'queue':_0x162a27||undefined});}}}}catch(_0x25bf03){logger[_0x43e7('0x2b')](_0x43e7('0x69'),_0x50edb2[_0x43e7('0x31')],util['inspect'](_0x25bf03,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x43e7('0x2c')][_0x43e7('0x6a')]=function(_0x376256,_0x438f41){try{if(this['channels'][_0x376256]){logger['info'](_0x43e7('0x6b'),_0x376256,_0x438f41);this[_0x43e7('0x12')][_0x376256][_0x43e7('0x6c')]=!![];if(_['endsWith'](_0x438f41,_0x43e7('0x6d'))){_0x438f41=_0x438f41['replace']('.wav49','.WAV');}this[_0x43e7('0x12')][_0x376256]['monitorFilename']=_0x438f41;var _0x28f15e=_[_0x43e7('0x6e')](this[_0x43e7('0x12')][_0x376256][_0x43e7('0x6f')],{'filename':_0x438f41});if(_[_0x43e7('0x60')](_0x28f15e)){this['channels'][_0x376256]['monitors'][_0x43e7('0x70')]({'filename':_0x438f41,'createdAt':moment()[_0x43e7('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x43e7('0x71')});}}}catch(_0x10fd28){logger[_0x43e7('0x2b')](_0x43e7('0x72'),_0x376256,util[_0x43e7('0x35')](_0x10fd28,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x43e7('0x2c')][_0x43e7('0x73')]=function(_0x32e698){try{if(this[_0x43e7('0x2d')](_0x32e698)){logger[_0x43e7('0x43')](_0x43e7('0x74'),_0x32e698[_0x43e7('0x31')],util[_0x43e7('0x35')](_0x32e698,{'showHidden':![],'depth':null}));if(this[_0x43e7('0x12')][_0x32e698[_0x43e7('0x31')]]&&_0x32e698[_0x43e7('0x3c')]!=_0x43e7('0x44')){if(this[_0x43e7('0x2d')](_0x32e698[_0x43e7('0x75')])){if(this[_0x43e7('0x2d')](_0x32e698[_0x43e7('0x75')][_0x43e7('0x76')])){logger['info'](_0x43e7('0x77'),_0x32e698[_0x43e7('0x31')],_0x32e698[_0x43e7('0x78')]);this[_0x43e7('0x6a')](_0x32e698['uniqueid'],_0x32e698[_0x43e7('0x78')]);}else if(this['isNotNull'](_0x32e698[_0x43e7('0x75')][_0x43e7('0x79')])){logger[_0x43e7('0x28')](_0x43e7('0x7a'),_0x32e698[_0x43e7('0x31')],_0x32e698[_0x43e7('0x78')]);this['channels'][_0x32e698[_0x43e7('0x31')]][_0x43e7('0x33')]=_0x32e698[_0x43e7('0x78')];}else if(this[_0x43e7('0x2d')](_0x32e698[_0x43e7('0x75')]['xmd-callerid'])){logger['info'](_0x43e7('0x7b'),_0x32e698['uniqueid'],_0x32e698[_0x43e7('0x78')]);this[_0x43e7('0x12')][_0x32e698[_0x43e7('0x31')]][_0x43e7('0x7c')]=_0x32e698['value'];}else if(this['isNotNull'](_0x32e698['variable'][_0x43e7('0x7d')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x32e698['uniqueid'],_0x32e698[_0x43e7('0x78')]);this[_0x43e7('0x12')][_0x32e698['uniqueid']][_0x43e7('0x5f')]=_0x32e698['value'];}else if(this[_0x43e7('0x2d')](_0x32e698[_0x43e7('0x75')][_0x43e7('0x7e')])){logger[_0x43e7('0x28')](_0x43e7('0x7f'),_0x32e698['uniqueid'],_0x32e698[_0x43e7('0x78')][_0x43e7('0x3d')](',')[0x0]);this[_0x43e7('0x12')][_0x32e698['uniqueid']]['queue']=_0x32e698[_0x43e7('0x78')][_0x43e7('0x3d')](',')[0x0];}else if(this[_0x43e7('0x2d')](_0x32e698[_0x43e7('0x75')]['xmd-originatecalleridnum'])){logger[_0x43e7('0x28')](_0x43e7('0x80'),_0x32e698[_0x43e7('0x31')],_0x32e698['value']);this[_0x43e7('0x12')][_0x32e698[_0x43e7('0x31')]][_0x43e7('0x81')]=_0x32e698[_0x43e7('0x78')];}else if(this['isNotNull'](_0x32e698[_0x43e7('0x75')]['xmd-destination'])){logger[_0x43e7('0x28')](_0x43e7('0x82'),_0x32e698['uniqueid'],_0x32e698['value']);this[_0x43e7('0x12')][_0x32e698[_0x43e7('0x31')]][_0x43e7('0x83')]=_0x32e698[_0x43e7('0x78')];}else if(this[_0x43e7('0x2d')](_0x32e698[_0x43e7('0x75')][_0x43e7('0x84')])){logger[_0x43e7('0x28')](_0x43e7('0x85'),_0x32e698[_0x43e7('0x31')],_0x32e698[_0x43e7('0x78')]);this['channels'][_0x32e698[_0x43e7('0x31')]]['calleridpreview']=_0x32e698[_0x43e7('0x78')];}else if(this[_0x43e7('0x2d')](_0x32e698[_0x43e7('0x75')]['xmcs-queue'])){logger[_0x43e7('0x28')](_0x43e7('0x86'),_0x32e698[_0x43e7('0x31')],_0x32e698[_0x43e7('0x78')]);this['channels'][_0x32e698[_0x43e7('0x31')]][_0x43e7('0x8')]=_0x32e698['value'];}else if(this['isNotNull'](_0x32e698['variable'][_0x43e7('0x87')])){logger[_0x43e7('0x28')](_0x43e7('0x88'),_0x32e698[_0x43e7('0x31')],_0x32e698[_0x43e7('0x78')]);this[_0x43e7('0x12')][_0x32e698[_0x43e7('0x31')]][_0x43e7('0x89')]=_0x32e698['value'];}}}else if(this[_0x43e7('0x2d')](_0x32e698[_0x43e7('0x75')][_0x43e7('0x76')])){if(_0x32e698[_0x43e7('0x78')]){var _0x4e4f4e=path['parse'](_0x32e698[_0x43e7('0x78')])[_0x43e7('0x41')];logger[_0x43e7('0x28')](_0x43e7('0x77'),_0x4e4f4e,_0x32e698['value']);this[_0x43e7('0x6a')](_0x4e4f4e,_0x32e698[_0x43e7('0x78')]);}}else if(this[_0x43e7('0x12')][_0x32e698[_0x43e7('0x36')]]){if(this[_0x43e7('0x2d')](_0x32e698[_0x43e7('0x75')])){if(this['isNotNull'](_0x32e698[_0x43e7('0x75')]['sipcallid'])){logger['info'](_0x43e7('0x88'),_0x32e698[_0x43e7('0x36')],_0x32e698['value']);this['channels'][_0x32e698[_0x43e7('0x36')]][_0x43e7('0x8a')]=_0x32e698['value'];}}}}}catch(_0x189c38){logger[_0x43e7('0x2b')](_0x43e7('0x8b'),_0x32e698[_0x43e7('0x31')],util['inspect'](_0x189c38,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x43e7('0x1d')]=function(_0x31354e){try{if(this[_0x43e7('0x2d')](_0x31354e)){logger['debug']('[%s][voiceCallReport][hangup]\x20event:',_0x31354e[_0x43e7('0x31')],util[_0x43e7('0x35')](_0x31354e,{'showHidden':![],'depth':null}));if(this[_0x43e7('0x14')][_0x31354e[_0x43e7('0x36')]]){if(this[_0x43e7('0x12')][this[_0x43e7('0x14')][_0x31354e[_0x43e7('0x36')]][_0x43e7('0x36')]]){this['channels'][this['blindTransfers'][_0x31354e['linkedid']][_0x43e7('0x36')]]['uniqueid']=_0x31354e[_0x43e7('0x31')];this[_0x43e7('0x12')][this[_0x43e7('0x14')][_0x31354e[_0x43e7('0x36')]][_0x43e7('0x36')]]['answered']=this[_0x43e7('0x12')][_0x31354e[_0x43e7('0x31')]][_0x43e7('0x66')];this[_0x43e7('0x12')][this['blindTransfers'][_0x31354e[_0x43e7('0x36')]][_0x43e7('0x36')]][_0x43e7('0x8c')]=this[_0x43e7('0x12')][_0x31354e[_0x43e7('0x31')]][_0x43e7('0x8c')];this[_0x43e7('0x12')][this['blindTransfers'][_0x31354e[_0x43e7('0x36')]][_0x43e7('0x36')]][_0x43e7('0x64')]=this[_0x43e7('0x12')][this[_0x43e7('0x14')][_0x31354e['linkedid']][_0x43e7('0x36')]][_0x43e7('0x3c')];this['channels'][this[_0x43e7('0x14')][_0x31354e[_0x43e7('0x36')]]['linkedid']][_0x43e7('0x49')]=this[_0x43e7('0x12')][_0x31354e[_0x43e7('0x31')]][_0x43e7('0x49')];this[_0x43e7('0x12')][_0x31354e['uniqueid']]=this[_0x43e7('0x12')][this[_0x43e7('0x14')][_0x31354e[_0x43e7('0x36')]]['linkedid']];delete this[_0x43e7('0x12')][this[_0x43e7('0x14')][_0x31354e['linkedid']][_0x43e7('0x36')]];}else if(this[_0x43e7('0x12')][this[_0x43e7('0x14')][_0x31354e[_0x43e7('0x36')]][_0x43e7('0x31')]]){this[_0x43e7('0x12')][this['blindTransfers'][_0x31354e[_0x43e7('0x36')]][_0x43e7('0x31')]][_0x43e7('0x31')]=[this['channels'][this[_0x43e7('0x14')][_0x31354e[_0x43e7('0x36')]][_0x43e7('0x31')]][_0x43e7('0x36')],this[_0x43e7('0x12')][this[_0x43e7('0x14')][_0x31354e[_0x43e7('0x36')]][_0x43e7('0x31')]][_0x43e7('0x36')]=this['channels'][this[_0x43e7('0x14')][_0x31354e[_0x43e7('0x36')]][_0x43e7('0x31')]][_0x43e7('0x31')]][0x0];this[_0x43e7('0x12')][this[_0x43e7('0x14')][_0x31354e[_0x43e7('0x36')]][_0x43e7('0x31')]]['answered']=this[_0x43e7('0x12')][_0x31354e[_0x43e7('0x31')]][_0x43e7('0x66')];this[_0x43e7('0x12')][this[_0x43e7('0x14')][_0x31354e['linkedid']][_0x43e7('0x31')]][_0x43e7('0x8c')]=this[_0x43e7('0x12')][_0x31354e[_0x43e7('0x31')]][_0x43e7('0x8c')];this['channels'][this[_0x43e7('0x14')][_0x31354e['linkedid']][_0x43e7('0x31')]][_0x43e7('0x64')]=this[_0x43e7('0x12')][this[_0x43e7('0x14')][_0x31354e['linkedid']][_0x43e7('0x31')]][_0x43e7('0x3c')];this[_0x43e7('0x12')][this[_0x43e7('0x14')][_0x31354e[_0x43e7('0x36')]][_0x43e7('0x31')]][_0x43e7('0x49')]=this[_0x43e7('0x12')][_0x31354e[_0x43e7('0x31')]][_0x43e7('0x49')];this[_0x43e7('0x12')][_0x31354e['uniqueid']]=this['channels'][this[_0x43e7('0x14')][_0x31354e['linkedid']]['uniqueid']];delete this[_0x43e7('0x12')][this[_0x43e7('0x14')][_0x31354e['linkedid']][_0x43e7('0x31')]];}}if(this['channels'][_0x31354e['uniqueid']]){logger['info'](_0x43e7('0x8d'),_0x31354e[_0x43e7('0x31')],_0x31354e[_0x43e7('0x8e')]);var _0xd6ebb0=moment();this[_0x43e7('0x12')][_0x31354e[_0x43e7('0x31')]][_0x43e7('0x8f')]=_0xd6ebb0[_0x43e7('0x3f')](_0x43e7('0x48'));this[_0x43e7('0x12')][_0x31354e[_0x43e7('0x31')]][_0x43e7('0x58')]=_0xd6ebb0[_0x43e7('0x62')](this[_0x43e7('0x12')][_0x31354e[_0x43e7('0x31')]][_0x43e7('0x47')],_0x43e7('0x5a'));if(this[_0x43e7('0x12')][_0x31354e[_0x43e7('0x31')]][_0x43e7('0x66')]){this['channels'][_0x31354e[_0x43e7('0x31')]][_0x43e7('0x90')]=_0xd6ebb0['diff'](this[_0x43e7('0x12')][_0x31354e[_0x43e7('0x31')]][_0x43e7('0x8c')],_0x43e7('0x5a'));this['channels'][_0x31354e[_0x43e7('0x31')]][_0x43e7('0x91')]=this['channels'][_0x31354e[_0x43e7('0x31')]][_0x43e7('0x58')]-this[_0x43e7('0x12')][_0x31354e['uniqueid']][_0x43e7('0x90')];}if(_0x31354e[_0x43e7('0x3a')]===_0x43e7('0x3b')){if(this[_0x43e7('0x13')][_0x31354e[_0x43e7('0x3c')]['split']('-')[0x0]]){this[_0x43e7('0x13')][_0x31354e[_0x43e7('0x3c')]['split']('-')[0x0]]=_[_0x43e7('0x92')](this['agents'][_0x31354e['channel']['split']('-')[0x0]],['destconnectedlinenum']);logger[_0x43e7('0x43')](_0x43e7('0x93'),_0x31354e[_0x43e7('0x31')],util[_0x43e7('0x35')]({'id':this['agents'][_0x31354e['channel'][_0x43e7('0x3d')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x31354e[_0x43e7('0x3c')]['split']('-')[0x0]][_0x43e7('0x4e')]},{'showHidden':![],'depth':null}));this['emit'](util['format']('user:%s',this['agents'][_0x31354e[_0x43e7('0x3c')][_0x43e7('0x3d')]('-')[0x0]][_0x43e7('0x41')]),'user:agentcomplete',{'id':this[_0x43e7('0x13')][_0x31354e[_0x43e7('0x3c')][_0x43e7('0x3d')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x31354e[_0x43e7('0x3c')][_0x43e7('0x3d')]('-')[0x0]][_0x43e7('0x4e')]});for(var _0x265125=0x0;_0x265125<Object['keys'](this[_0x43e7('0x13')])['length'];_0x265125++){var _0x15ce64=Object[_0x43e7('0x39')](this[_0x43e7('0x13')])[_0x265125];var _0x322c61=this[_0x43e7('0x13')][_0x15ce64];if(_0x322c61[_0x43e7('0x4e')]===Number(_0x31354e[_0x43e7('0x94')])){this['emit'](util[_0x43e7('0x3f')](_0x43e7('0x40'),_0x322c61['name']),_0x43e7('0x95'),{'id':_0x322c61['id'],'destaccountcode':_0x322c61[_0x43e7('0x4e')],'transfer':this[_0x43e7('0x12')][_0x31354e[_0x43e7('0x31')]][_0x43e7('0x96')]});break;}}}}var _0x4fd17e=this;Promise[_0x43e7('0x97')]()['then'](function(){var _0x3a2720=_0x4fd17e['channels'][_0x31354e[_0x43e7('0x31')]];if(typeof _0x3a2720[_0x43e7('0x96')]===_0x43e7('0x98'))return;if(_[_0x43e7('0x99')](_0x3a2720[_0x43e7('0x6f')]))return;return RpcSetting['getSettings']()[_0x43e7('0x9a')](function(_0x5d70ed){if(!_0x5d70ed[_0x43e7('0x9b')])return;return Promise[_0x43e7('0x97')]()[_0x43e7('0x9a')](function(){return ami['Action']({'action':_0x43e7('0x9c'),'channel':_0x3a2720[_0x43e7('0x3c')]})[_0x43e7('0x9d')](function(){});})[_0x43e7('0x9a')](function(){return ami[_0x43e7('0x9e')]({'action':'StopMixMonitor','channel':_0x3a2720[_0x43e7('0x64')]})['catch'](function(){})[_0x43e7('0x9f')](function(){var _0x395a2a=_0x4fd17e[_0x43e7('0x13')][_0x3a2720[_0x43e7('0x64')][_0x43e7('0x3d')]('-')[0x0]];if(!_0x395a2a)return;io[_0x43e7('0x2f')](_0x43e7('0xa0'),{'agentId':_0x395a2a['id'],'uniqueid':_0x3a2720['uniqueid']});});});});})[_0x43e7('0x9a')](function(){if(_0x31354e['event']===_0x43e7('0xa1')){_0x4fd17e[_0x43e7('0x14')][_0x31354e[_0x43e7('0x31')]]=_0x31354e;}else{if(_0x4fd17e[_0x43e7('0x12')][_0x31354e[_0x43e7('0x31')]][_0x43e7('0x5f')]===_0x43e7('0xa2')&&_0x4fd17e[_0x43e7('0x14')][_0x31354e[_0x43e7('0x31')]]){_0x4fd17e['channels'][_0x31354e[_0x43e7('0x31')]]['uniqueid']=[_0x4fd17e[_0x43e7('0x12')][_0x31354e[_0x43e7('0x31')]]['linkedid'],_0x4fd17e[_0x43e7('0x12')][_0x31354e[_0x43e7('0x31')]]['linkedid']=_0x4fd17e[_0x43e7('0x12')][_0x31354e[_0x43e7('0x31')]][_0x43e7('0x31')]][0x0];delete _0x4fd17e[_0x43e7('0x14')][_0x31354e[_0x43e7('0x31')]];}}logger[_0x43e7('0x43')](_0x43e7('0xa3'),_0x31354e[_0x43e7('0x31')],util['inspect'](_0x4fd17e[_0x43e7('0x12')][_0x31354e[_0x43e7('0x31')]],{'showHidden':![],'depth':null}));ami[_0x43e7('0x2f')]('custom:voiceCallReport',_0x4fd17e[_0x43e7('0x12')][_0x31354e[_0x43e7('0x31')]]);delete _0x4fd17e['channels'][_0x31354e[_0x43e7('0x31')]];});}}}catch(_0x1ed3a1){logger['error'](_0x43e7('0xa4'),_0x31354e[_0x43e7('0x31')],util[_0x43e7('0x35')](_0x1ed3a1,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x43e7('0x21')]=function(_0x36f744){try{if(this['isNotNull'](_0x36f744)){logger[_0x43e7('0x28')](_0x43e7('0xa5'),_0x36f744[_0x43e7('0x31')],_0x36f744[_0x43e7('0xa6')],_0x36f744['transfertargetcalleridnum']);logger['debug'](_0x43e7('0xa7'),_0x36f744[_0x43e7('0x31')],util[_0x43e7('0x35')](_0x36f744,{'showHidden':![],'depth':null}));var _0x3aaf1a;if(this['channels'][_0x36f744[_0x43e7('0xa8')]]){this[_0x43e7('0x12')][_0x36f744[_0x43e7('0xa8')]][_0x43e7('0xa9')]=_0x36f744['origtransferercalleridnum'];this[_0x43e7('0x12')][_0x36f744[_0x43e7('0xa8')]][_0x43e7('0xaa')]=_0x36f744[_0x43e7('0xab')];if(this[_0x43e7('0x12')][_0x36f744['secondtransfereruniqueid']]){_0x3aaf1a=this['channels'][_0x36f744['secondtransfereruniqueid']];this[_0x43e7('0x12')][_0x36f744[_0x43e7('0xac')]]=this[_0x43e7('0x12')][_0x36f744['transfereeuniqueid']];this[_0x43e7('0x12')][_0x36f744['transfereeuniqueid']]=_0x3aaf1a;}this[_0x43e7('0x12')][_0x36f744[_0x43e7('0xac')]][_0x43e7('0x96')]=_0x43e7('0xad');}else if(this[_0x43e7('0x12')][_0x36f744[_0x43e7('0xae')]]){this['channels'][_0x36f744[_0x43e7('0xae')]][_0x43e7('0xa9')]=_0x36f744[_0x43e7('0xa6')];this[_0x43e7('0x12')][_0x36f744[_0x43e7('0xae')]][_0x43e7('0xaa')]=_0x36f744[_0x43e7('0xab')];if(this[_0x43e7('0x12')][_0x36f744[_0x43e7('0xaf')]]){_0x3aaf1a=this[_0x43e7('0x12')][_0x36f744[_0x43e7('0xaf')]];this[_0x43e7('0x12')][_0x36f744[_0x43e7('0xaf')]]=this['channels'][_0x36f744[_0x43e7('0xae')]];this[_0x43e7('0x12')][_0x36f744['transfertargetuniqueid']]=_0x3aaf1a;}this[_0x43e7('0x12')][_0x36f744[_0x43e7('0xae')]]['transferType']=_0x43e7('0xad');}if((this[_0x43e7('0x12')][_0x36f744[_0x43e7('0xaf')]]||this['channels'][_0x36f744['origtransfererlinkedid']])&&this[_0x43e7('0x12')][_0x36f744[_0x43e7('0xac')]]){var _0x4c24cf=_[_0x43e7('0xb0')]([this[_0x43e7('0x12')][_0x36f744[_0x43e7('0xaf')]],this[_0x43e7('0x12')][_0x36f744[_0x43e7('0xb1')]],this['channels'][_0x36f744[_0x43e7('0xac')]]],function(_0x19b473){return _0x19b473&&_0x19b473[_0x43e7('0x5f')]===_0x43e7('0xa2')&&_0x19b473[_0x43e7('0xb2')];});if(_0x4c24cf){if(this[_0x43e7('0x12')][_0x36f744[_0x43e7('0xaf')]])this[_0x43e7('0x12')][_0x36f744[_0x43e7('0xaf')]][_0x43e7('0x96')]=_0x43e7('0xad');if(this[_0x43e7('0x12')][_0x36f744['origtransfererlinkedid']])this[_0x43e7('0x12')][_0x36f744[_0x43e7('0xb1')]][_0x43e7('0x96')]=_0x43e7('0xad');this[_0x43e7('0x12')][_0x36f744[_0x43e7('0xac')]]['transferType']=_0x43e7('0xad');}}}}catch(_0x55d37d){logger[_0x43e7('0x2b')](_0x43e7('0xb3'),_0x36f744[_0x43e7('0x31')],util['inspect'](_0x55d37d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x43e7('0x2c')][_0x43e7('0x23')]=function(_0x5a749e){try{if(this[_0x43e7('0x2d')](_0x5a749e)){logger['info'](_0x43e7('0xb4'),_0x5a749e[_0x43e7('0x31')],_0x5a749e[_0x43e7('0xb5')],_0x5a749e[_0x43e7('0xb6')]);logger['debug'](_0x43e7('0xb7'),_0x5a749e[_0x43e7('0x31')],util[_0x43e7('0x35')](_0x5a749e,{'showHidden':![],'depth':null}));if(this['channels'][_0x5a749e[_0x43e7('0xa8')]]){this[_0x43e7('0x12')][_0x5a749e[_0x43e7('0xa8')]][_0x43e7('0xa9')]=_0x5a749e[_0x43e7('0xb5')];this[_0x43e7('0x12')][_0x5a749e['transfereeuniqueid']][_0x43e7('0xaa')]=_0x5a749e['extension'];this[_0x43e7('0x12')][_0x5a749e[_0x43e7('0xa8')]]['transferType']=_0x43e7('0xb8');this[_0x43e7('0x1d')]({'event':'BlindTransfer','uniqueid':_0x5a749e[_0x43e7('0xa8')],'linkedid':_0x5a749e[_0x43e7('0xb9')],'context':_0x5a749e[_0x43e7('0x3a')],'channel':_0x5a749e[_0x43e7('0xba')]});}else{this['channels'][_0x5a749e['transfereruniqueid']][_0x43e7('0x96')]=_0x43e7('0xb8');this[_0x43e7('0x1d')]({'event':_0x43e7('0xa1'),'uniqueid':_0x5a749e[_0x43e7('0xb9')],'linkedid':_0x5a749e[_0x43e7('0xa8')],'context':_0x5a749e[_0x43e7('0x3a')],'channel':_0x5a749e[_0x43e7('0xba')]});}}}catch(_0x5e0d35){logger[_0x43e7('0x2b')](_0x43e7('0xbb'),_0x5a749e['uniqueid'],util[_0x43e7('0x35')](_0x5e0d35,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x43e7('0x2c')][_0x43e7('0x25')]=function(_0x1dfb3f){try{if(this[_0x43e7('0x2d')](_0x1dfb3f)){logger[_0x43e7('0x43')](_0x43e7('0xbc'),_0x1dfb3f['uniqueid'],util[_0x43e7('0x35')](_0x1dfb3f,{'showHidden':![],'depth':null}));if(this['channels'][_0x1dfb3f[_0x43e7('0x31')]]){if(!_[_0x43e7('0x60')](this['channels'][_0x1dfb3f[_0x43e7('0x31')]]['answertime'])){this[_0x43e7('0x12')][_0x1dfb3f[_0x43e7('0x31')]][_0x43e7('0xbd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0x43e7('0x28')](_0x43e7('0xbe'),_0x1dfb3f['uniqueid'],this[_0x43e7('0x12')][_0x1dfb3f[_0x43e7('0x31')]][_0x43e7('0xbd')]);}}}}catch(_0x4fec66){logger[_0x43e7('0x2b')](_0x43e7('0xbf'),_0x1dfb3f[_0x43e7('0x31')],util['inspect'](_0x4fec66,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x43e7('0x2c')][_0x43e7('0x27')]=function(_0x43abf4){try{if(this[_0x43e7('0x2d')](_0x43abf4)){logger[_0x43e7('0x43')](_0x43e7('0xc0'),_0x43abf4['uniqueid'],util[_0x43e7('0x35')](_0x43abf4,{'showHidden':![],'depth':null}));if(this[_0x43e7('0x12')][_0x43abf4[_0x43e7('0x31')]]){if(!_[_0x43e7('0x60')](this[_0x43e7('0x12')][_0x43abf4[_0x43e7('0x31')]][_0x43e7('0xbd')])){this[_0x43e7('0x12')][_0x43abf4[_0x43e7('0x31')]][_0x43e7('0xc1')]+=moment()[_0x43e7('0xc2')](0x0)[_0x43e7('0x62')](this['channels'][_0x43abf4['uniqueid']]['mohstarttime'],'seconds');logger[_0x43e7('0x28')](_0x43e7('0xc3'),_0x43abf4[_0x43e7('0x31')],this[_0x43e7('0x12')][_0x43abf4[_0x43e7('0x31')]][_0x43e7('0xc1')]);delete this['channels'][_0x43abf4['uniqueid']][_0x43e7('0xbd')];}}}}catch(_0x36dee9){logger['error']('[%s][voiceCallReport][musiconholdstop]',_0x43abf4[_0x43e7('0x31')],util[_0x43e7('0x35')](_0x36dee9,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport;