Built motion from commit 97153652.|2.6.26
[motion2.git] / server / services / ami / report / voiceCallReport.js
index 80c1760..e562465 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x542d=['isNil','answertime','mohstarttime','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','moment','path','ioredis','../../../config/environment','ami','../ami','../model/channel','unknown','not_inuse','inuse','busy','ringing','ringinuse','set','dial','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','newexten','syncNewExten','bind','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','emit','syncNewCallerId','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','isUndefined','merge','keys','[%s][voiceCallReport][newcallerid]','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','starttime','disposition','toNumber','pick','from-sip','split','destconnectedlinenum','exten','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','channel','accountcode','format','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','lastapplication','lastdata','match','queue','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','channelstate','answered','holdtime','diff','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','.WAV','monitorFilename','find','monitors','push','[%s][voiceCallReport][mixMonitorFilename]','[%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','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','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','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','sipcalluniqueid','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20event:'];(function(_0x4e581d,_0x10b8cd){var _0x3ef36e=function(_0x56ffb1){while(--_0x56ffb1){_0x4e581d['push'](_0x4e581d['shift']());}};_0x3ef36e(++_0x10b8cd);}(_0x542d,0xc5));var _0xd542=function(_0x3fb166,_0x4eb985){_0x3fb166=_0x3fb166-0x0;var _0x5e91be=_0x542d[_0x3fb166];return _0x5e91be;};'use strict';var BPromise=require(_0xd542('0x0'));var _=require(_0xd542('0x1'));var moment=require(_0xd542('0x2'));var util=require('util');var path=require(_0xd542('0x3'));var Redis=require(_0xd542('0x4'));var config=require(_0xd542('0x5'));var logger=require('../../../config/logger')(_0xd542('0x6'));var ami=require(_0xd542('0x7'));var Channel=require(_0xd542('0x8'));var statusDesc=[_0xd542('0x9'),_0xd542('0xa'),_0xd542('0xb'),_0xd542('0xc'),'invalid','unavailable',_0xd542('0xd'),_0xd542('0xe'),'onhold'];var applications=[_0xd542('0xf'),'queue','agi',_0xd542('0x10'),'playback','voicemail'];var dispositions=[_0xd542('0x11'),_0xd542('0x12'),_0xd542('0x12'),_0xd542('0x11'),_0xd542('0x11'),_0xd542('0x11'),_0xd542('0x13'),_0xd542('0x14'),_0xd542('0x12'),_0xd542('0x12'),'FAILED'];var actions={};config[_0xd542('0x15')]=_[_0xd542('0x16')](config[_0xd542('0x15')],{'host':_0xd542('0x17'),'port':0x18eb});var io=require(_0xd542('0x18'))(new Redis(config['redis']));function VoiceCallReport(_0xa8a2a8){this[_0xd542('0x19')]=_0xa8a2a8[_0xd542('0x19')];this[_0xd542('0x1a')]=_0xa8a2a8[_0xd542('0x1a')];this[_0xd542('0x1b')]={};ami['on'](_0xd542('0x1c'),this['syncNewExten']['bind'](this));ami['on'](_0xd542('0x1d'),this[_0xd542('0x1e')][_0xd542('0x1f')](this));ami['on'](_0xd542('0x20'),this[_0xd542('0x21')][_0xd542('0x1f')](this));ami['on'](_0xd542('0x22'),this[_0xd542('0x23')][_0xd542('0x1f')](this));ami['on'](_0xd542('0x24'),this[_0xd542('0x25')]['bind'](this));ami['on'](_0xd542('0x26'),this[_0xd542('0x27')][_0xd542('0x1f')](this));ami['on'](_0xd542('0x28'),this['syncNewCallerId'][_0xd542('0x1f')](this));ami['on'](_0xd542('0x29'),this[_0xd542('0x2a')][_0xd542('0x1f')](this));ami['on']('blindtransfer',this['syncBlindTransfer']['bind'](this));ami['on'](_0xd542('0x2b'),this[_0xd542('0x2c')]['bind'](this));ami['on'](_0xd542('0x2d'),this['syncMusicOnHoldStop'][_0xd542('0x1f')](this));try{logger[_0xd542('0x2e')](_0xd542('0x2f'));ami[_0xd542('0x30')]();}catch(_0x2d9105){logger[_0xd542('0x31')](_0xd542('0x32'),util[_0xd542('0x33')](_0x2d9105,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xd542('0x34')]['isNotNull']=function(_0x5aff4a){return _0x5aff4a!==null&&!_['isUndefined'](_0x5aff4a);};VoiceCallReport['prototype'][_0xd542('0x35')]=function(_0x1ffdde,_0x72736e,_0x3f63ff){io['to'](_0x1ffdde)[_0xd542('0x35')](_0x72736e,_0x3f63ff);};VoiceCallReport[_0xd542('0x34')][_0xd542('0x36')]=function(_0x5b865c){try{if(this[_0xd542('0x37')](_0x5b865c)){logger[_0xd542('0x2e')](_0xd542('0x38'),_0x5b865c[_0xd542('0x39')],_0x5b865c[_0xd542('0x3a')],_0x5b865c['calleridnum']);logger[_0xd542('0x3b')](_0xd542('0x3c'),_0x5b865c[_0xd542('0x39')],util[_0xd542('0x33')](_0x5b865c,{'showHidden':![],'depth':null}));if(_0x5b865c[_0xd542('0x39')]===_0x5b865c[_0xd542('0x3d')]){if(!_[_0xd542('0x3e')](this[_0xd542('0x19')][_0x5b865c[_0xd542('0x39')]])){_[_0xd542('0x3f')](this[_0xd542('0x19')][_0x5b865c[_0xd542('0x39')]],_['pick'](_0x5b865c,_[_0xd542('0x40')](this[_0xd542('0x19')][_0x5b865c[_0xd542('0x39')]])));}}}}catch(_0x1ae9d6){logger[_0xd542('0x31')](_0xd542('0x41'),_0x5b865c['uniqueid'],util[_0xd542('0x33')](_0x1ae9d6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd542('0x34')][_0xd542('0x21')]=function(_0x581c15){try{if(this[_0xd542('0x37')](_0x581c15)){logger[_0xd542('0x3b')]('[%s][voiceCallReport][newchannel]\x20event:',_0x581c15[_0xd542('0x39')],util[_0xd542('0x33')](_0x581c15,{'showHidden':![],'depth':null}));if(_0x581c15[_0xd542('0x39')]===_0x581c15[_0xd542('0x3d')]&&_0x581c15['channel']!=_0xd542('0x42')){if(_[_0xd542('0x3e')](this['channels'][_0x581c15['uniqueid']])){logger[_0xd542('0x2e')](_0xd542('0x43'),_0x581c15[_0xd542('0x39')],_0x581c15[_0xd542('0x44')],_0x581c15['exten']);this[_0xd542('0x19')][_0x581c15[_0xd542('0x39')]]=new Channel();this[_0xd542('0x19')][_0x581c15[_0xd542('0x39')]][_0xd542('0x45')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xd542('0x19')][_0x581c15['uniqueid']][_0xd542('0x46')]=dispositions[_[_0xd542('0x47')](_0x581c15['channelstate'])];_['merge'](this[_0xd542('0x19')][_0x581c15[_0xd542('0x39')]],_[_0xd542('0x48')](_0x581c15,_[_0xd542('0x40')](this[_0xd542('0x19')][_0x581c15['uniqueid']])));if(_0x581c15['context']===_0xd542('0x49')){if(this[_0xd542('0x1a')][_0x581c15['channel'][_0xd542('0x4a')]('-')[0x0]]){this[_0xd542('0x1a')][_0x581c15['channel'][_0xd542('0x4a')]('-')[0x0]][_0xd542('0x4b')]=_0x581c15[_0xd542('0x4c')];logger[_0xd542('0x3b')](_0xd542('0x4d'),_0x581c15[_0xd542('0x39')],util[_0xd542('0x33')]({'destaccountcode':this['agents'][_0x581c15[_0xd542('0x4e')][_0xd542('0x4a')]('-')[0x0]][_0xd542('0x4f')],'destconnectedlinenum':_0x581c15[_0xd542('0x4c')]},{'showHidden':![],'depth':null}));this[_0xd542('0x35')](util[_0xd542('0x50')](_0xd542('0x51'),this[_0xd542('0x1a')][_0x581c15[_0xd542('0x4e')][_0xd542('0x4a')]('-')[0x0]][_0xd542('0x52')]),_0xd542('0x53'),{'destaccountcode':this['agents'][_0x581c15[_0xd542('0x4e')][_0xd542('0x4a')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x581c15['exten']});}}}}}}catch(_0x4fdd1d){logger['error'](_0xd542('0x54'),_0x581c15[_0xd542('0x39')],util[_0xd542('0x33')](_0x4fdd1d,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xd542('0x1e')]=function(_0x45cc0c){try{if(this['isNotNull'](_0x45cc0c)){logger[_0xd542('0x3b')](_0xd542('0x55'),_0x45cc0c[_0xd542('0x39')],util[_0xd542('0x33')](_0x45cc0c,{'showHidden':![],'depth':null}));if(_0x45cc0c[_0xd542('0x39')]===_0x45cc0c['linkedid']&&_0x45cc0c['exten']!='h'&&_0x45cc0c['channel']!=_0xd542('0x42')){_0x45cc0c[_0xd542('0x56')]=_0x45cc0c[_0xd542('0x56')][_0xd542('0x57')]();_0x45cc0c[_0xd542('0x58')]=(_0x45cc0c['appdata']||_0x45cc0c[_0xd542('0x58')])[_0xd542('0x57')]();logger[_0xd542('0x2e')](_0xd542('0x59'),_0x45cc0c[_0xd542('0x39')],_0x45cc0c[_0xd542('0x56')],_0x45cc0c[_0xd542('0x58')]);if(_[_0xd542('0x3e')](this[_0xd542('0x19')][_0x45cc0c[_0xd542('0x39')]])){this[_0xd542('0x19')][_0x45cc0c['uniqueid']]=new Channel();this[_0xd542('0x19')][_0x45cc0c['uniqueid']][_0xd542('0x45')]=_0x45cc0c['duration']?moment()['subtract'](moment[_0xd542('0x5a')](_0x45cc0c[_0xd542('0x5a')])[_0xd542('0x5b')](),_0xd542('0x5b'))[_0xd542('0x50')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0xd542('0x50')](_0xd542('0x5c'));this[_0xd542('0x19')][_0x45cc0c[_0xd542('0x39')]][_0xd542('0x46')]=_0xd542('0x11');}_['merge'](this['channels'][_0x45cc0c[_0xd542('0x39')]],_[_0xd542('0x48')](_0x45cc0c,_[_0xd542('0x40')](this[_0xd542('0x19')][_0x45cc0c[_0xd542('0x39')]])));if(_['includes'](applications,_0x45cc0c[_0xd542('0x56')])){this['channels'][_0x45cc0c[_0xd542('0x39')]][_0xd542('0x5d')]=_0x45cc0c[_0xd542('0x56')];this[_0xd542('0x19')][_0x45cc0c[_0xd542('0x39')]][_0xd542('0x5e')]=_0x45cc0c[_0xd542('0x58')];if(_0x45cc0c[_0xd542('0x56')]===_0xd542('0xf')&&_['startsWith'](_0x45cc0c[_0xd542('0x58')],'cdr(')){var _0x29176a=_0x45cc0c[_0xd542('0x58')][_0xd542('0x4a')]('=');var _0x3a5302=_0x29176a[0x0][_0xd542('0x5f')](/cdr\((.*)\)/);if(_0x3a5302){this['channels'][_0x45cc0c[_0xd542('0x39')]][_0x3a5302[0x1]]=_0x29176a[0x1];}}else if(_0x45cc0c[_0xd542('0x56')]===_0xd542('0x60')){this['channels'][_0x45cc0c[_0xd542('0x39')]][_0xd542('0x60')]=_0x45cc0c[_0xd542('0x58')][_0xd542('0x4a')](',')[0x0];}}}}}catch(_0x55cf53){logger[_0xd542('0x31')]('[%s][voiceCallReport][newexten]',_0x45cc0c[_0xd542('0x39')],util[_0xd542('0x33')](_0x55cf53,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd542('0x34')][_0xd542('0x23')]=function(_0x4bb4a5){try{if(this[_0xd542('0x37')](_0x4bb4a5)){logger[_0xd542('0x2e')](_0xd542('0x61'),_0x4bb4a5[_0xd542('0x39')],_0x4bb4a5[_0xd542('0x3d')],_0x4bb4a5[_0xd542('0x3a')],_0x4bb4a5[_0xd542('0x62')]);logger[_0xd542('0x3b')](_0xd542('0x63'),_0x4bb4a5['uniqueid'],util[_0xd542('0x33')](_0x4bb4a5,{'showHidden':![],'depth':null}));if(_0x4bb4a5[_0xd542('0x39')]!==_0x4bb4a5[_0xd542('0x3d')]){if(this[_0xd542('0x19')][_0x4bb4a5[_0xd542('0x3d')]]){if(_0x4bb4a5[_0xd542('0x64')]==='6'){if(!this[_0xd542('0x19')][_0x4bb4a5['linkedid']][_0xd542('0x65')]){var _0x26054e=moment();this[_0xd542('0x19')][_0x4bb4a5[_0xd542('0x3d')]][_0xd542('0x65')]=!![];this['channels'][_0x4bb4a5['linkedid']]['answertime']=_0x26054e[_0xd542('0x50')](_0xd542('0x5c'));if(this[_0xd542('0x19')][_0x4bb4a5[_0xd542('0x3d')]][_0xd542('0x45')]){this[_0xd542('0x19')][_0x4bb4a5[_0xd542('0x3d')]][_0xd542('0x66')]=_0x26054e[_0xd542('0x67')](this[_0xd542('0x19')][_0x4bb4a5[_0xd542('0x3d')]][_0xd542('0x45')],_0xd542('0x5b'));}}this[_0xd542('0x19')][_0x4bb4a5[_0xd542('0x3d')]][_0xd542('0x3d')]=_0x4bb4a5['uniqueid'];if(_0x4bb4a5[_0xd542('0x62')]!==_0xd542('0x68')){this[_0xd542('0x19')][_0x4bb4a5[_0xd542('0x3d')]][_0xd542('0x69')]=_0x4bb4a5[_0xd542('0x62')];}this[_0xd542('0x19')][_0x4bb4a5[_0xd542('0x3d')]][_0xd542('0x6a')]=_0x4bb4a5[_0xd542('0x3a')];this['channels'][_0x4bb4a5[_0xd542('0x3d')]][_0xd542('0x6b')]=_0x4bb4a5[_0xd542('0x4e')];this[_0xd542('0x19')][_0x4bb4a5['linkedid']][_0xd542('0x46')]=dispositions[_['toNumber'](_0x4bb4a5[_0xd542('0x64')])];if(this[_0xd542('0x1a')][_0x4bb4a5[_0xd542('0x4e')][_0xd542('0x4a')]('-')[0x0]]){this[_0xd542('0x19')][_0x4bb4a5[_0xd542('0x3d')]]['UserId']=this['agents'][_0x4bb4a5[_0xd542('0x4e')]['split']('-')[0x0]]['id'];this[_0xd542('0x19')][_0x4bb4a5[_0xd542('0x3d')]]['membername']=this['agents'][_0x4bb4a5[_0xd542('0x4e')]['split']('-')[0x0]][_0xd542('0x52')];}}}}else{if(this[_0xd542('0x19')][_0x4bb4a5[_0xd542('0x39')]]){if(_0x4bb4a5[_0xd542('0x64')]==='6'){if(this[_0xd542('0x1a')][_0x4bb4a5[_0xd542('0x4e')][_0xd542('0x4a')]('-')[0x0]]){this[_0xd542('0x19')][_0x4bb4a5[_0xd542('0x39')]]['UserId']=this['agents'][_0x4bb4a5[_0xd542('0x4e')]['split']('-')[0x0]]['id'];this[_0xd542('0x19')][_0x4bb4a5['uniqueid']][_0xd542('0x6c')]=this[_0xd542('0x1a')][_0x4bb4a5[_0xd542('0x4e')][_0xd542('0x4a')]('-')[0x0]][_0xd542('0x52')];}}}}}}catch(_0x3115bb){logger[_0xd542('0x31')](_0xd542('0x6d'),_0x4bb4a5[_0xd542('0x39')],util['inspect'](_0x3115bb,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xd542('0x6e')]=function(_0x3b569a,_0x9ecc76){try{if(this[_0xd542('0x19')][_0x3b569a]){logger[_0xd542('0x2e')](_0xd542('0x6f'),_0x3b569a,_0x9ecc76);this[_0xd542('0x19')][_0x3b569a][_0xd542('0x70')]=!![];if(_[_0xd542('0x71')](_0x9ecc76,'.wav49')){_0x9ecc76=_0x9ecc76['replace'](_0xd542('0x72'),_0xd542('0x73'));}this[_0xd542('0x19')][_0x3b569a][_0xd542('0x74')]=_0x9ecc76;var _0x49e6eb=_[_0xd542('0x75')](this['channels'][_0x3b569a]['monitors'],{'filename':_0x9ecc76});if(_['isNil'](_0x49e6eb)){this[_0xd542('0x19')][_0x3b569a][_0xd542('0x76')][_0xd542('0x77')]({'filename':_0x9ecc76,'createdAt':moment()[_0xd542('0x50')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':'rec'});}}}catch(_0x3dcc9d){logger['error'](_0xd542('0x78'),_0x3b569a,util[_0xd542('0x33')](_0x3dcc9d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd542('0x34')]['syncVarSet']=function(_0x34d09a){try{if(this[_0xd542('0x37')](_0x34d09a)){logger['debug'](_0xd542('0x79'),_0x34d09a['uniqueid'],util['inspect'](_0x34d09a,{'showHidden':![],'depth':null}));if(this[_0xd542('0x19')][_0x34d09a[_0xd542('0x39')]]&&_0x34d09a[_0xd542('0x4e')]!='OutgoingSpoolFailed'){if(this[_0xd542('0x37')](_0x34d09a[_0xd542('0x7a')])){if(this[_0xd542('0x37')](_0x34d09a[_0xd542('0x7a')][_0xd542('0x7b')])){logger['info'](_0xd542('0x7c'),_0x34d09a[_0xd542('0x39')],_0x34d09a[_0xd542('0x7d')]);this[_0xd542('0x6e')](_0x34d09a[_0xd542('0x39')],_0x34d09a['value']);}else if(this[_0xd542('0x37')](_0x34d09a[_0xd542('0x7a')][_0xd542('0x7e')])){logger[_0xd542('0x2e')](_0xd542('0x7f'),_0x34d09a[_0xd542('0x39')],_0x34d09a[_0xd542('0x7d')]);this[_0xd542('0x19')][_0x34d09a[_0xd542('0x39')]][_0xd542('0x62')]=_0x34d09a[_0xd542('0x7d')];}else if(this[_0xd542('0x37')](_0x34d09a[_0xd542('0x7a')][_0xd542('0x80')])){logger[_0xd542('0x2e')](_0xd542('0x81'),_0x34d09a[_0xd542('0x39')],_0x34d09a['value']);this[_0xd542('0x19')][_0x34d09a['uniqueid']]['callerid']=_0x34d09a[_0xd542('0x7d')];}else if(this[_0xd542('0x37')](_0x34d09a[_0xd542('0x7a')][_0xd542('0x82')])){logger['info'](_0xd542('0x83'),_0x34d09a[_0xd542('0x39')],_0x34d09a['value']);this[_0xd542('0x19')][_0x34d09a[_0xd542('0x39')]][_0xd542('0x84')]=_0x34d09a[_0xd542('0x7d')];}else if(this[_0xd542('0x37')](_0x34d09a[_0xd542('0x7a')][_0xd542('0x85')])){logger[_0xd542('0x2e')](_0xd542('0x86'),_0x34d09a[_0xd542('0x39')],_0x34d09a[_0xd542('0x7d')][_0xd542('0x4a')](',')[0x0]);this[_0xd542('0x19')][_0x34d09a[_0xd542('0x39')]][_0xd542('0x60')]=_0x34d09a[_0xd542('0x7d')][_0xd542('0x4a')](',')[0x0];}else if(this[_0xd542('0x37')](_0x34d09a[_0xd542('0x7a')][_0xd542('0x87')])){logger['info'](_0xd542('0x88'),_0x34d09a['uniqueid'],_0x34d09a[_0xd542('0x7d')]);this[_0xd542('0x19')][_0x34d09a[_0xd542('0x39')]]['originatecalleridnum']=_0x34d09a['value'];}else if(this[_0xd542('0x37')](_0x34d09a['variable'][_0xd542('0x89')])){logger[_0xd542('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x34d09a[_0xd542('0x39')],_0x34d09a[_0xd542('0x7d')]);this[_0xd542('0x19')][_0x34d09a[_0xd542('0x39')]][_0xd542('0x8a')]=_0x34d09a[_0xd542('0x7d')];}else if(this['isNotNull'](_0x34d09a[_0xd542('0x7a')][_0xd542('0x8b')])){logger[_0xd542('0x2e')](_0xd542('0x8c'),_0x34d09a[_0xd542('0x39')],_0x34d09a['value']);this[_0xd542('0x19')][_0x34d09a['uniqueid']]['calleridpreview']=_0x34d09a['value'];}else if(this[_0xd542('0x37')](_0x34d09a[_0xd542('0x7a')][_0xd542('0x8d')])){logger['info'](_0xd542('0x8e'),_0x34d09a[_0xd542('0x39')],_0x34d09a[_0xd542('0x7d')]);this[_0xd542('0x19')][_0x34d09a['uniqueid']]['queue']=_0x34d09a['value'];}else if(this[_0xd542('0x37')](_0x34d09a[_0xd542('0x7a')][_0xd542('0x8f')])){logger[_0xd542('0x2e')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x34d09a[_0xd542('0x39')],_0x34d09a[_0xd542('0x7d')]);this['channels'][_0x34d09a[_0xd542('0x39')]][_0xd542('0x90')]=_0x34d09a['value'];}}}else if(this['isNotNull'](_0x34d09a[_0xd542('0x7a')][_0xd542('0x7b')])){if(_0x34d09a[_0xd542('0x7d')]){var _0x5a645c=path['parse'](_0x34d09a[_0xd542('0x7d')])[_0xd542('0x52')];logger[_0xd542('0x2e')](_0xd542('0x7c'),_0x5a645c,_0x34d09a[_0xd542('0x7d')]);this[_0xd542('0x6e')](_0x5a645c,_0x34d09a[_0xd542('0x7d')]);}}else if(this[_0xd542('0x19')][_0x34d09a[_0xd542('0x3d')]]){if(this[_0xd542('0x37')](_0x34d09a[_0xd542('0x7a')])){if(this[_0xd542('0x37')](_0x34d09a[_0xd542('0x7a')][_0xd542('0x8f')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x34d09a['linkedid'],_0x34d09a[_0xd542('0x7d')]);this['channels'][_0x34d09a[_0xd542('0x3d')]][_0xd542('0x91')]=_0x34d09a[_0xd542('0x7d')];}}}}}catch(_0x43565e){logger[_0xd542('0x31')]('[%s][voiceCallReport][varset]',_0x34d09a[_0xd542('0x39')],util[_0xd542('0x33')](_0x43565e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd542('0x34')][_0xd542('0x27')]=function(_0x402bc1){try{if(this[_0xd542('0x37')](_0x402bc1)){logger[_0xd542('0x3b')](_0xd542('0x92'),_0x402bc1[_0xd542('0x39')],util['inspect'](_0x402bc1,{'showHidden':![],'depth':null}));if(this[_0xd542('0x19')][_0x402bc1[_0xd542('0x39')]]){logger[_0xd542('0x2e')](_0xd542('0x93'),_0x402bc1[_0xd542('0x39')],_0x402bc1[_0xd542('0x94')]);var _0x4ca727=moment();this[_0xd542('0x19')][_0x402bc1['uniqueid']][_0xd542('0x95')]=_0x4ca727[_0xd542('0x50')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xd542('0x19')][_0x402bc1['uniqueid']][_0xd542('0x5a')]=_0x4ca727['diff'](this[_0xd542('0x19')][_0x402bc1['uniqueid']]['starttime'],_0xd542('0x5b'));if(this['channels'][_0x402bc1[_0xd542('0x39')]]['answered']){this[_0xd542('0x19')][_0x402bc1[_0xd542('0x39')]][_0xd542('0x96')]=_0x4ca727[_0xd542('0x67')](this[_0xd542('0x19')][_0x402bc1[_0xd542('0x39')]]['answertime'],_0xd542('0x5b'));this[_0xd542('0x19')][_0x402bc1['uniqueid']]['holdtime']=this[_0xd542('0x19')][_0x402bc1[_0xd542('0x39')]][_0xd542('0x5a')]-this[_0xd542('0x19')][_0x402bc1[_0xd542('0x39')]][_0xd542('0x96')];}if(_0x402bc1['context']===_0xd542('0x49')){if(this['agents'][_0x402bc1['channel'][_0xd542('0x4a')]('-')[0x0]]){this[_0xd542('0x1a')][_0x402bc1[_0xd542('0x4e')][_0xd542('0x4a')]('-')[0x0]]=_[_0xd542('0x97')](this[_0xd542('0x1a')][_0x402bc1[_0xd542('0x4e')]['split']('-')[0x0]],[_0xd542('0x4b')]);logger[_0xd542('0x3b')](_0xd542('0x98'),_0x402bc1[_0xd542('0x39')],util[_0xd542('0x33')]({'destaccountcode':this[_0xd542('0x1a')][_0x402bc1['channel']['split']('-')[0x0]][_0xd542('0x4f')]},{'showHidden':![],'depth':null}));this[_0xd542('0x35')](util[_0xd542('0x50')]('user:%s',this[_0xd542('0x1a')][_0x402bc1[_0xd542('0x4e')][_0xd542('0x4a')]('-')[0x0]][_0xd542('0x52')]),'user:agentcomplete',{'destaccountcode':this[_0xd542('0x1a')][_0x402bc1['channel']['split']('-')[0x0]][_0xd542('0x4f')]});}}if(_0x402bc1[_0xd542('0x99')]===_0xd542('0x9a')){this[_0xd542('0x1b')][_0x402bc1[_0xd542('0x39')]]=this[_0xd542('0x19')][_0x402bc1['uniqueid']];}else{if(this[_0xd542('0x19')][_0x402bc1[_0xd542('0x39')]][_0xd542('0x84')]===_0xd542('0x9b')&&this[_0xd542('0x1b')][_0x402bc1[_0xd542('0x39')]]){this[_0xd542('0x19')][_0x402bc1[_0xd542('0x39')]][_0xd542('0x39')]=[this['channels'][_0x402bc1['uniqueid']][_0xd542('0x3d')],this[_0xd542('0x19')][_0x402bc1[_0xd542('0x39')]]['linkedid']=this['channels'][_0x402bc1[_0xd542('0x39')]][_0xd542('0x39')]][0x0];delete this[_0xd542('0x1b')][_0x402bc1[_0xd542('0x39')]];}}logger['debug'](_0xd542('0x9c'),_0x402bc1[_0xd542('0x39')],util[_0xd542('0x33')](this[_0xd542('0x19')][_0x402bc1[_0xd542('0x39')]],{'showHidden':![],'depth':null}));ami[_0xd542('0x35')](_0xd542('0x9d'),this[_0xd542('0x19')][_0x402bc1[_0xd542('0x39')]]);delete this[_0xd542('0x19')][_0x402bc1['uniqueid']];}}}catch(_0x448486){logger[_0xd542('0x31')](_0xd542('0x9e'),_0x402bc1['uniqueid'],util['inspect'](_0x448486,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xd542('0x2a')]=function(_0x2257b3){try{if(this[_0xd542('0x37')](_0x2257b3)){logger[_0xd542('0x2e')](_0xd542('0x9f'),_0x2257b3['uniqueid'],_0x2257b3[_0xd542('0xa0')],_0x2257b3[_0xd542('0xa1')]);logger[_0xd542('0x3b')](_0xd542('0xa2'),_0x2257b3[_0xd542('0x39')],util['inspect'](_0x2257b3,{'showHidden':![],'depth':null}));if(this[_0xd542('0x19')][_0x2257b3['transfereeuniqueid']]){this[_0xd542('0x19')][_0x2257b3[_0xd542('0xa3')]][_0xd542('0xa4')]=_0x2257b3['origtransferercalleridnum'];this['channels'][_0x2257b3[_0xd542('0xa3')]][_0xd542('0xa5')]=_0x2257b3[_0xd542('0xa1')];if(this[_0xd542('0x19')][_0x2257b3[_0xd542('0xa6')]]){var _0x460f69=this['channels'][_0x2257b3['secondtransfereruniqueid']];this[_0xd542('0x19')][_0x2257b3[_0xd542('0xa6')]]=this[_0xd542('0x19')][_0x2257b3[_0xd542('0xa3')]];this['channels'][_0x2257b3[_0xd542('0xa3')]]=_0x460f69;}}else if(this['channels'][_0x2257b3[_0xd542('0xa7')]]){this[_0xd542('0x19')][_0x2257b3[_0xd542('0xa7')]]['transfercalleridnum']=_0x2257b3[_0xd542('0xa0')];this[_0xd542('0x19')][_0x2257b3['transfertargetuniqueid']][_0xd542('0xa5')]=_0x2257b3['transfertargetcalleridnum'];if(this['channels'][_0x2257b3['origtransfereruniqueid']]){var _0x460f69=this[_0xd542('0x19')][_0x2257b3[_0xd542('0xa8')]];this[_0xd542('0x19')][_0x2257b3['origtransfereruniqueid']]=this[_0xd542('0x19')][_0x2257b3['transfertargetuniqueid']];this[_0xd542('0x19')][_0x2257b3[_0xd542('0xa7')]]=_0x460f69;}}}}catch(_0x24a880){logger[_0xd542('0x31')]('[%s][voiceCallReport][attendedtransfer]',_0x2257b3[_0xd542('0x39')],util[_0xd542('0x33')](_0x24a880,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd542('0x34')][_0xd542('0xa9')]=function(_0x22480c){try{if(this[_0xd542('0x37')](_0x22480c)){logger[_0xd542('0x2e')](_0xd542('0xaa'),_0x22480c['uniqueid'],_0x22480c[_0xd542('0xab')],_0x22480c[_0xd542('0xac')]);logger[_0xd542('0x3b')](_0xd542('0xad'),_0x22480c[_0xd542('0x39')],util[_0xd542('0x33')](_0x22480c,{'showHidden':![],'depth':null}));if(this[_0xd542('0x19')][_0x22480c['transfereeuniqueid']]){this['channels'][_0x22480c[_0xd542('0xa3')]][_0xd542('0xa4')]=_0x22480c[_0xd542('0xab')];this['channels'][_0x22480c[_0xd542('0xa3')]][_0xd542('0xa5')]=_0x22480c[_0xd542('0xac')];this['syncHangup']({'event':_0xd542('0x9a'),'uniqueid':_0x22480c[_0xd542('0xa3')],'context':_0x22480c['context'],'channel':_0x22480c['transfererchannel']});}}}catch(_0x15d524){logger[_0xd542('0x31')]('[%s][voiceCallReport][blindtransfer]',_0x22480c[_0xd542('0x39')],util['inspect'](_0x15d524,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd542('0x34')][_0xd542('0x2c')]=function(_0x3e0640){try{if(this[_0xd542('0x37')](_0x3e0640)){logger[_0xd542('0x3b')](_0xd542('0xae'),_0x3e0640[_0xd542('0x39')],util[_0xd542('0x33')](_0x3e0640,{'showHidden':![],'depth':null}));if(this['channels'][_0x3e0640[_0xd542('0x39')]]){if(!_[_0xd542('0xaf')](this[_0xd542('0x19')][_0x3e0640[_0xd542('0x39')]][_0xd542('0xb0')])){this['channels'][_0x3e0640['uniqueid']][_0xd542('0xb1')]=moment()[_0xd542('0x50')](_0xd542('0x5c'));logger[_0xd542('0x2e')]('[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s',_0x3e0640[_0xd542('0x39')],this[_0xd542('0x19')][_0x3e0640['uniqueid']]['mohstarttime']);}}}}catch(_0x3c165b){logger[_0xd542('0x31')](_0xd542('0xb2'),_0x3e0640[_0xd542('0x39')],util[_0xd542('0x33')](_0x3c165b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd542('0x34')][_0xd542('0xb3')]=function(_0x1492d7){try{if(this[_0xd542('0x37')](_0x1492d7)){logger['debug'](_0xd542('0xb4'),_0x1492d7[_0xd542('0x39')],util[_0xd542('0x33')](_0x1492d7,{'showHidden':![],'depth':null}));if(this[_0xd542('0x19')][_0x1492d7[_0xd542('0x39')]]){if(!_[_0xd542('0xaf')](this[_0xd542('0x19')][_0x1492d7[_0xd542('0x39')]][_0xd542('0xb1')])){this['channels'][_0x1492d7[_0xd542('0x39')]][_0xd542('0xb5')]+=moment()[_0xd542('0xb6')](0x0)[_0xd542('0x67')](this[_0xd542('0x19')][_0x1492d7[_0xd542('0x39')]][_0xd542('0xb1')],_0xd542('0x5b'));logger[_0xd542('0x2e')](_0xd542('0xb7'),_0x1492d7['uniqueid'],this[_0xd542('0x19')][_0x1492d7['uniqueid']][_0xd542('0xb5')]);delete this[_0xd542('0x19')][_0x1492d7[_0xd542('0x39')]][_0xd542('0xb1')];}}}}catch(_0x225361){logger[_0xd542('0x31')](_0xd542('0xb8'),_0x1492d7['uniqueid'],util['inspect'](_0x225361,{'showHidden':![],'depth':null}));}};module[_0xd542('0xb9')]=VoiceCallReport;
\ No newline at end of file
+var _0x8903=['syncVarSet','hangup','syncHangup','syncNewCallerId','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','emit','uniqueid','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','isUndefined','merge','pick','context','from-sip','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','[%s][voiceCallReport][newcallerid]','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','disposition','toNumber','keys','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','name','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','startsWith','CDR(routeAlias)','duration','seconds','lastapplication','lastdata','cdr(','match','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','answered','answertime','YYYY-MM-DD\x20HH:mm:ss','holdtime','connectedlinename','destinationchannel','channelstate','UserId','membername','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','monitorFilename','find','monitors','rec','variable','mixmonitor_filename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','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','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','syncMixMonitorFilename','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','diff','billableseconds','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','resolve','then','transferType','transferToInternal','isEmpty','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','outbound','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','BLIND','BlindTransfer','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','[%s][voiceCallReport][musiconholdstop]','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../model/channel','set','queue','dial','voicemail','FAILED','NO\x20ANSWER','ANSWERED','redis','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','syncNewChannel','newstate','syncNewState','varset'];(function(_0x4ddc12,_0x1ec9b2){var _0x12a6ba=function(_0x3f3941){while(--_0x3f3941){_0x4ddc12['push'](_0x4ddc12['shift']());}};_0x12a6ba(++_0x1ec9b2);}(_0x8903,0xa7));var _0x3890=function(_0x1fc82b,_0x5150a6){_0x1fc82b=_0x1fc82b-0x0;var _0x4c6679=_0x8903[_0x1fc82b];return _0x4c6679;};'use strict';var _=require(_0x3890('0x0'));var moment=require(_0x3890('0x1'));var util=require(_0x3890('0x2'));var path=require(_0x3890('0x3'));var Redis=require(_0x3890('0x4'));var config=require(_0x3890('0x5'));var logger=require(_0x3890('0x6'))(_0x3890('0x7'));var ami=require('../ami');var Channel=require(_0x3890('0x8'));var RpcSetting=require('../rpc/setting');var applications=[_0x3890('0x9'),_0x3890('0xa'),'agi',_0x3890('0xb'),'playback',_0x3890('0xc')];var dispositions=['NO\x20ANSWER',_0x3890('0xd'),_0x3890('0xd'),_0x3890('0xe'),_0x3890('0xe'),_0x3890('0xe'),_0x3890('0xf'),'BUSY',_0x3890('0xd'),_0x3890('0xd'),_0x3890('0xd')];config[_0x3890('0x10')]=_['defaults'](config[_0x3890('0x10')],{'host':_0x3890('0x11'),'port':0x18eb});var io=require(_0x3890('0x12'))(new Redis(config[_0x3890('0x10')]));function VoiceCallReport(_0x4795e1){this[_0x3890('0x13')]=_0x4795e1[_0x3890('0x13')];this[_0x3890('0x14')]=_0x4795e1[_0x3890('0x14')];this[_0x3890('0x15')]={};ami['on'](_0x3890('0x16'),this[_0x3890('0x17')][_0x3890('0x18')](this));ami['on'](_0x3890('0x19'),this[_0x3890('0x17')]['bind'](this));ami['on']('newchannel',this[_0x3890('0x1a')]['bind'](this));ami['on'](_0x3890('0x1b'),this[_0x3890('0x1c')][_0x3890('0x18')](this));ami['on'](_0x3890('0x1d'),this[_0x3890('0x1e')]['bind'](this));ami['on'](_0x3890('0x1f'),this[_0x3890('0x20')]['bind'](this));ami['on']('newcallerid',this[_0x3890('0x21')][_0x3890('0x18')](this));ami['on']('attendedtransfer',this[_0x3890('0x22')]['bind'](this));ami['on'](_0x3890('0x23'),this[_0x3890('0x24')][_0x3890('0x18')](this));ami['on'](_0x3890('0x25'),this[_0x3890('0x26')][_0x3890('0x18')](this));ami['on'](_0x3890('0x27'),this[_0x3890('0x28')]['bind'](this));try{logger[_0x3890('0x29')](_0x3890('0x2a'));ami[_0x3890('0x2b')]();}catch(_0xcd837c){logger[_0x3890('0x2c')](_0x3890('0x2d'),util[_0x3890('0x2e')](_0xcd837c,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x3890('0x2f')][_0x3890('0x30')]=function(_0x502834){return _0x502834!==null&&!_['isUndefined'](_0x502834);};VoiceCallReport[_0x3890('0x2f')][_0x3890('0x31')]=function(_0x186a84,_0x41fef3,_0x4b7648){io['to'](_0x186a84)[_0x3890('0x31')](_0x41fef3,_0x4b7648);};VoiceCallReport[_0x3890('0x2f')][_0x3890('0x21')]=function(_0x58de6c){try{if(this[_0x3890('0x30')](_0x58de6c)){logger[_0x3890('0x29')]('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x58de6c[_0x3890('0x32')],_0x58de6c['calleridname'],_0x58de6c['calleridnum']);logger[_0x3890('0x33')](_0x3890('0x34'),_0x58de6c[_0x3890('0x32')],util[_0x3890('0x2e')](_0x58de6c,{'showHidden':![],'depth':null}));if(_0x58de6c[_0x3890('0x32')]===_0x58de6c[_0x3890('0x35')]){if(!_[_0x3890('0x36')](this[_0x3890('0x13')][_0x58de6c['uniqueid']])){_[_0x3890('0x37')](this[_0x3890('0x13')][_0x58de6c[_0x3890('0x32')]],_[_0x3890('0x38')](_0x58de6c,_['keys'](this['channels'][_0x58de6c[_0x3890('0x32')]])));}}if(_0x58de6c[_0x3890('0x39')]===_0x3890('0x3a')){var _0x4b87d5=this[_0x3890('0x14')][_0x58de6c[_0x3890('0x3b')][_0x3890('0x3c')]('-')[0x0]];if(_0x4b87d5){if(_0x58de6c[_0x3890('0x3d')]==_0x3890('0x3e')){_0x4b87d5[_0x3890('0x3f')]=_0x58de6c[_0x3890('0x40')];this[_0x3890('0x31')](util[_0x3890('0x41')](_0x3890('0x42'),_0x4b87d5['name']),'user:agentconnect',{'id':_0x4b87d5['id'],'destaccountcode':_0x4b87d5['accountcode'],'destconnectedlinenum':_0x58de6c['connectedlinenum']});}}}}}catch(_0x1b8968){logger[_0x3890('0x2c')](_0x3890('0x43'),_0x58de6c[_0x3890('0x32')],util[_0x3890('0x2e')](_0x1b8968,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3890('0x2f')]['syncNewChannel']=function(_0x2806f1){try{if(this[_0x3890('0x30')](_0x2806f1)){logger[_0x3890('0x33')]('[%s][voiceCallReport][newchannel]\x20event:',_0x2806f1[_0x3890('0x32')],util[_0x3890('0x2e')](_0x2806f1,{'showHidden':![],'depth':null}));if(this[_0x3890('0x13')][_0x2806f1['uniqueid']]){return;}if(_0x2806f1[_0x3890('0x3b')]===_0x3890('0x44')){return;}if(_0x2806f1[_0x3890('0x32')]!==_0x2806f1[_0x3890('0x35')]&&!this[_0x3890('0x15')][_0x2806f1[_0x3890('0x35')]]){return;}logger['info'](_0x3890('0x45'),_0x2806f1[_0x3890('0x32')],_0x2806f1[_0x3890('0x39')],_0x2806f1['exten']);this[_0x3890('0x13')][_0x2806f1[_0x3890('0x32')]]=new Channel();this[_0x3890('0x13')][_0x2806f1['uniqueid']][_0x3890('0x46')]=moment()[_0x3890('0x41')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x2806f1[_0x3890('0x32')]][_0x3890('0x47')]=dispositions[_[_0x3890('0x48')](_0x2806f1['channelstate'])];_[_0x3890('0x37')](this[_0x3890('0x13')][_0x2806f1['uniqueid']],_['pick'](_0x2806f1,_[_0x3890('0x49')](this[_0x3890('0x13')][_0x2806f1[_0x3890('0x32')]])));if(_0x2806f1[_0x3890('0x39')]===_0x3890('0x3a')){var _0x49eb59=this[_0x3890('0x14')][_0x2806f1['channel'][_0x3890('0x3c')]('-')[0x0]];if(_0x49eb59&&typeof _0x49eb59[_0x3890('0x3f')]===_0x3890('0x4a')){_0x49eb59[_0x3890('0x3f')]=_0x2806f1['exten'];logger['debug'](_0x3890('0x4b'),_0x2806f1['uniqueid'],util[_0x3890('0x2e')]({'id':_0x49eb59['id'],'destaccountcode':_0x49eb59[_0x3890('0x4c')],'destconnectedlinenum':_0x2806f1[_0x3890('0x3d')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x3890('0x41')](_0x3890('0x42'),_0x49eb59[_0x3890('0x4d')]),_0x3890('0x4e'),{'id':_0x49eb59['id'],'destaccountcode':_0x49eb59[_0x3890('0x4c')],'destconnectedlinenum':_0x2806f1[_0x3890('0x3d')]});}}}}catch(_0x55efb5){logger[_0x3890('0x2c')](_0x3890('0x4f'),_0x2806f1[_0x3890('0x32')],util[_0x3890('0x2e')](_0x55efb5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3890('0x2f')][_0x3890('0x17')]=function(_0x2a72c3){try{if(this[_0x3890('0x30')](_0x2a72c3)){logger[_0x3890('0x33')](_0x3890('0x50'),_0x2a72c3['uniqueid'],util[_0x3890('0x2e')](_0x2a72c3,{'showHidden':![],'depth':null}));if(_0x2a72c3[_0x3890('0x3b')]===_0x3890('0x44')||_0x2a72c3[_0x3890('0x3d')]==='h')return;if(_0x2a72c3[_0x3890('0x32')]===_0x2a72c3['linkedid']||this[_0x3890('0x15')][_0x2a72c3[_0x3890('0x35')]]){_0x2a72c3[_0x3890('0x51')]=_0x2a72c3[_0x3890('0x51')]?_0x2a72c3[_0x3890('0x51')][_0x3890('0x52')]():undefined;_0x2a72c3[_0x3890('0x53')]=_0x2a72c3[_0x3890('0x54')]||_0x2a72c3[_0x3890('0x53')];if(_0x2a72c3[_0x3890('0x54')]&&!_0x2a72c3[_0x3890('0x54')][_0x3890('0x55')](_0x3890('0x56'))&&_0x2a72c3[_0x3890('0x51')]!==_0x3890('0xa')){_0x2a72c3['applicationdata']=_0x2a72c3[_0x3890('0x53')]['toLowerCase']();}logger[_0x3890('0x29')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x2a72c3[_0x3890('0x32')],_0x2a72c3[_0x3890('0x51')],_0x2a72c3[_0x3890('0x53')]);if(_[_0x3890('0x36')](this[_0x3890('0x13')][_0x2a72c3[_0x3890('0x32')]])){this['channels'][_0x2a72c3[_0x3890('0x32')]]=new Channel();this[_0x3890('0x13')][_0x2a72c3['uniqueid']][_0x3890('0x46')]=_0x2a72c3[_0x3890('0x57')]?moment()['subtract'](moment['duration'](_0x2a72c3[_0x3890('0x57')])['seconds'](),_0x3890('0x58'))[_0x3890('0x41')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0x3890('0x41')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x2a72c3[_0x3890('0x32')]][_0x3890('0x47')]=_0x3890('0xe');}_['merge'](this[_0x3890('0x13')][_0x2a72c3[_0x3890('0x32')]],_[_0x3890('0x38')](_0x2a72c3,_['keys'](this[_0x3890('0x13')][_0x2a72c3[_0x3890('0x32')]])));if(_['includes'](applications,_0x2a72c3[_0x3890('0x51')])){this[_0x3890('0x13')][_0x2a72c3[_0x3890('0x32')]][_0x3890('0x59')]=_0x2a72c3['application'];this[_0x3890('0x13')][_0x2a72c3[_0x3890('0x32')]][_0x3890('0x5a')]=_0x2a72c3[_0x3890('0x53')];if(_0x2a72c3['application']===_0x3890('0x9')&&_[_0x3890('0x55')](_0x2a72c3[_0x3890('0x53')][_0x3890('0x52')](),_0x3890('0x5b'))){var _0x31e391=_0x2a72c3['applicationdata']['split']('=');var _0x389bd6=_0x31e391[0x0][_0x3890('0x52')]()[_0x3890('0x5c')](/cdr\((.*)\)/);if(_0x389bd6){if(_0x389bd6[0x1]===_0x3890('0x5d')&&!_[_0x3890('0x5e')](this[_0x3890('0x13')][_0x2a72c3['uniqueid']][_0x389bd6[0x1]]))return;this[_0x3890('0x13')][_0x2a72c3[_0x3890('0x32')]][_0x389bd6[0x1]]=_0x31e391[0x1];}}else if(_0x2a72c3[_0x3890('0x51')]===_0x3890('0xa')){this[_0x3890('0x13')][_0x2a72c3['uniqueid']]['queue']=_0x2a72c3[_0x3890('0x53')][_0x3890('0x3c')](',')[0x0];}}}}}catch(_0x53bc70){logger[_0x3890('0x2c')](_0x3890('0x5f'),_0x2a72c3[_0x3890('0x32')],util['inspect'](_0x53bc70,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3890('0x2f')][_0x3890('0x1c')]=function(_0x3a2428){try{if(this[_0x3890('0x30')](_0x3a2428)){logger[_0x3890('0x29')](_0x3890('0x60'),_0x3a2428[_0x3890('0x32')],_0x3a2428[_0x3890('0x35')],_0x3a2428[_0x3890('0x61')],_0x3a2428[_0x3890('0x62')]);logger['debug']('[%s][voiceCallReport][newstate]\x20event:',_0x3a2428[_0x3890('0x32')],util['inspect'](_0x3a2428,{'showHidden':![],'depth':null}));if(_0x3a2428['channelstate']!=='6')return;var _0x41b25e=this[_0x3890('0x14')][_0x3a2428[_0x3890('0x3b')][_0x3890('0x3c')]('-')[0x0]];if(_0x3a2428[_0x3890('0x32')]!==_0x3a2428[_0x3890('0x35')]){var _0x2207d2=moment();if(this['channels'][_0x3a2428[_0x3890('0x35')]]){if(!this['channels'][_0x3a2428['linkedid']][_0x3890('0x63')]){this[_0x3890('0x13')][_0x3a2428[_0x3890('0x35')]]['answered']=!![];this[_0x3890('0x13')][_0x3a2428['linkedid']][_0x3890('0x64')]=_0x2207d2[_0x3890('0x41')](_0x3890('0x65'));if(this[_0x3890('0x13')][_0x3a2428['linkedid']][_0x3890('0x46')]){this['channels'][_0x3a2428[_0x3890('0x35')]][_0x3890('0x66')]=_0x2207d2['diff'](this['channels'][_0x3a2428['linkedid']][_0x3890('0x46')],_0x3890('0x58'));}}this[_0x3890('0x13')][_0x3a2428[_0x3890('0x35')]][_0x3890('0x35')]=_0x3a2428[_0x3890('0x32')];if(_0x3a2428[_0x3890('0x62')]!==_0x3890('0x3e')){this['channels'][_0x3a2428['linkedid']]['connectedlinenum']=_0x3a2428[_0x3890('0x62')];}this['channels'][_0x3a2428['linkedid']][_0x3890('0x67')]=_0x3a2428[_0x3890('0x61')];this[_0x3890('0x13')][_0x3a2428['linkedid']][_0x3890('0x68')]=_0x3a2428[_0x3890('0x3b')];this['channels'][_0x3a2428[_0x3890('0x35')]]['disposition']=dispositions[_[_0x3890('0x48')](_0x3a2428[_0x3890('0x69')])];if(_0x41b25e){this[_0x3890('0x13')][_0x3a2428[_0x3890('0x35')]][_0x3890('0x6a')]=_0x41b25e['id'];this[_0x3890('0x13')][_0x3a2428[_0x3890('0x35')]][_0x3890('0x6b')]=_0x41b25e[_0x3890('0x4d')];}}if(this[_0x3890('0x13')][_0x3a2428[_0x3890('0x32')]]){if(!this[_0x3890('0x13')][_0x3a2428['uniqueid']][_0x3890('0x63')]){this['channels'][_0x3a2428[_0x3890('0x32')]][_0x3890('0x63')]=!![];this[_0x3890('0x13')][_0x3a2428[_0x3890('0x32')]]['answertime']=_0x2207d2[_0x3890('0x41')](_0x3890('0x65'));if(this[_0x3890('0x13')][_0x3a2428[_0x3890('0x32')]][_0x3890('0x46')]){this[_0x3890('0x13')][_0x3a2428[_0x3890('0x32')]]['holdtime']=_0x2207d2['diff'](this[_0x3890('0x13')][_0x3a2428[_0x3890('0x32')]][_0x3890('0x46')],_0x3890('0x58'));}}if(_0x3a2428[_0x3890('0x62')]!=='xcally-motion-preview'){this[_0x3890('0x13')][_0x3a2428['uniqueid']][_0x3890('0x40')]=_0x3a2428[_0x3890('0x62')];}this['channels'][_0x3a2428[_0x3890('0x32')]][_0x3890('0x67')]=_0x3a2428[_0x3890('0x61')];this[_0x3890('0x13')][_0x3a2428[_0x3890('0x32')]][_0x3890('0x68')]=_0x3a2428[_0x3890('0x3b')];this[_0x3890('0x13')][_0x3a2428[_0x3890('0x32')]][_0x3890('0x47')]=dispositions[_[_0x3890('0x48')](_0x3a2428[_0x3890('0x69')])];}}else{if(this[_0x3890('0x13')][_0x3a2428[_0x3890('0x32')]]){if(_0x41b25e){this['channels'][_0x3a2428[_0x3890('0x32')]][_0x3890('0x6a')]=_0x41b25e['id'];this['channels'][_0x3a2428[_0x3890('0x32')]][_0x3890('0x6b')]=_0x41b25e[_0x3890('0x4d')];}}}if(_0x3a2428['context']===_0x3890('0x3a')){if(_0x41b25e){_0x41b25e[_0x3890('0x3f')]=_0x3a2428[_0x3890('0x3d')];var _0x42c7ac,_0x3d9caf;if(this['channels'][_0x3a2428['uniqueid']]){_0x42c7ac=this[_0x3890('0x13')][_0x3a2428[_0x3890('0x32')]][_0x3890('0x6c')];_0x3d9caf=this['channels'][_0x3a2428[_0x3890('0x32')]][_0x3890('0xa')];}else if(this[_0x3890('0x13')][_0x3a2428['linkedid']]){_0x42c7ac=this[_0x3890('0x13')][_0x3a2428['linkedid']][_0x3890('0x6c')];_0x3d9caf=this[_0x3890('0x13')][_0x3a2428[_0x3890('0x35')]][_0x3890('0xa')];}_0x41b25e[_0x3890('0xa')]=_0x3d9caf;_0x41b25e['routealias']=_0x42c7ac;var _0x10ffe5={'id':_0x41b25e['id'],'name':_0x41b25e[_0x3890('0x4d')],'agentconnected':!![],'destaccountcode':_0x41b25e[_0x3890('0x4c')],'destconnectedlinenum':_0x3a2428['exten'],'queue':_0x3d9caf||undefined,'routealias':_0x42c7ac,'uniqueid':_0x3a2428[_0x3890('0x35')]};logger[_0x3890('0x33')](_0x3890('0x6d'),_0x3a2428[_0x3890('0x32')],util['inspect'](_0x10ffe5,{'showHidden':![],'depth':null}));this['emit'](util[_0x3890('0x41')]('user:%s',_0x41b25e['name']),_0x3890('0x4e'),_0x10ffe5);}}}}catch(_0x4a4ccf){logger[_0x3890('0x2c')](_0x3890('0x6e'),_0x3a2428[_0x3890('0x32')],util[_0x3890('0x2e')](_0x4a4ccf,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMixMonitorFilename']=function(_0x13f4e1,_0x281b17){try{if(this[_0x3890('0x13')][_0x13f4e1]){logger[_0x3890('0x29')](_0x3890('0x6f'),_0x13f4e1,_0x281b17);this[_0x3890('0x13')][_0x13f4e1][_0x3890('0x70')]=!![];if(_[_0x3890('0x71')](_0x281b17,_0x3890('0x72'))){_0x281b17=_0x281b17[_0x3890('0x73')](_0x3890('0x72'),'.WAV');}this[_0x3890('0x13')][_0x13f4e1][_0x3890('0x74')]=_0x281b17;var _0x1a736c=_[_0x3890('0x75')](this['channels'][_0x13f4e1][_0x3890('0x76')],{'filename':_0x281b17});if(_[_0x3890('0x5e')](_0x1a736c)){this[_0x3890('0x13')][_0x13f4e1][_0x3890('0x76')]['push']({'filename':_0x281b17,'createdAt':moment()['format'](_0x3890('0x65')),'mixmonitorid':'','status':_0x3890('0x77')});}}}catch(_0x5e53d5){logger['error']('[%s][voiceCallReport][mixMonitorFilename]',_0x13f4e1,util[_0x3890('0x2e')](_0x5e53d5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3890('0x2f')][_0x3890('0x1e')]=function(_0x4b8818){try{if(this[_0x3890('0x30')](_0x4b8818)){logger[_0x3890('0x33')]('[%s][voiceCallReport][varset]\x20event:',_0x4b8818[_0x3890('0x32')],util[_0x3890('0x2e')](_0x4b8818,{'showHidden':![],'depth':null}));if(this['channels'][_0x4b8818[_0x3890('0x32')]]&&_0x4b8818['channel']!='OutgoingSpoolFailed'){if(this[_0x3890('0x30')](_0x4b8818[_0x3890('0x78')])){if(this[_0x3890('0x30')](_0x4b8818[_0x3890('0x78')][_0x3890('0x79')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x4b8818[_0x3890('0x32')],_0x4b8818[_0x3890('0x7a')]);this['syncMixMonitorFilename'](_0x4b8818[_0x3890('0x32')],_0x4b8818[_0x3890('0x7a')]);}else if(this['isNotNull'](_0x4b8818[_0x3890('0x78')][_0x3890('0x7b')])){logger[_0x3890('0x29')](_0x3890('0x7c'),_0x4b8818[_0x3890('0x32')],_0x4b8818[_0x3890('0x7a')]);this[_0x3890('0x13')][_0x4b8818[_0x3890('0x32')]][_0x3890('0x62')]=_0x4b8818[_0x3890('0x7a')];}else if(this[_0x3890('0x30')](_0x4b8818[_0x3890('0x78')]['xmd-callerid'])){logger[_0x3890('0x29')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x4b8818[_0x3890('0x32')],_0x4b8818[_0x3890('0x7a')]);this[_0x3890('0x13')][_0x4b8818[_0x3890('0x32')]]['callerid']=_0x4b8818[_0x3890('0x7a')];}else if(this[_0x3890('0x30')](_0x4b8818[_0x3890('0x78')][_0x3890('0x7d')])){logger['info'](_0x3890('0x7e'),_0x4b8818[_0x3890('0x32')],_0x4b8818['value']);this[_0x3890('0x13')][_0x4b8818['uniqueid']][_0x3890('0x5d')]=_0x4b8818[_0x3890('0x7a')];}else if(this[_0x3890('0x30')](_0x4b8818[_0x3890('0x78')][_0x3890('0x7f')])){logger[_0x3890('0x29')](_0x3890('0x80'),_0x4b8818['uniqueid'],_0x4b8818[_0x3890('0x7a')][_0x3890('0x3c')](',')[0x0]);this['channels'][_0x4b8818[_0x3890('0x32')]]['queue']=_0x4b8818[_0x3890('0x7a')][_0x3890('0x3c')](',')[0x0];}else if(this['isNotNull'](_0x4b8818['variable'][_0x3890('0x81')])){logger[_0x3890('0x29')](_0x3890('0x82'),_0x4b8818['uniqueid'],_0x4b8818[_0x3890('0x7a')]);this[_0x3890('0x13')][_0x4b8818[_0x3890('0x32')]][_0x3890('0x83')]=_0x4b8818[_0x3890('0x7a')];}else if(this[_0x3890('0x30')](_0x4b8818[_0x3890('0x78')][_0x3890('0x84')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x4b8818[_0x3890('0x32')],_0x4b8818[_0x3890('0x7a')]);this[_0x3890('0x13')][_0x4b8818[_0x3890('0x32')]][_0x3890('0x85')]=_0x4b8818[_0x3890('0x7a')];}else if(this['isNotNull'](_0x4b8818[_0x3890('0x78')][_0x3890('0x86')])){logger[_0x3890('0x29')](_0x3890('0x87'),_0x4b8818[_0x3890('0x32')],_0x4b8818[_0x3890('0x7a')]);this[_0x3890('0x13')][_0x4b8818['uniqueid']]['calleridpreview']=_0x4b8818[_0x3890('0x7a')];}else if(this[_0x3890('0x30')](_0x4b8818[_0x3890('0x78')][_0x3890('0x88')])){logger['info'](_0x3890('0x89'),_0x4b8818[_0x3890('0x32')],_0x4b8818[_0x3890('0x7a')]);this['channels'][_0x4b8818['uniqueid']]['queue']=_0x4b8818[_0x3890('0x7a')];}else if(this['isNotNull'](_0x4b8818['variable'][_0x3890('0x8a')])){logger[_0x3890('0x29')](_0x3890('0x8b'),_0x4b8818[_0x3890('0x32')],_0x4b8818[_0x3890('0x7a')]);this['channels'][_0x4b8818[_0x3890('0x32')]][_0x3890('0x8c')]=_0x4b8818['value'];}}}else if(this[_0x3890('0x30')](_0x4b8818[_0x3890('0x78')][_0x3890('0x79')])){if(_0x4b8818[_0x3890('0x7a')]){var _0x483255=path[_0x3890('0x8d')](_0x4b8818[_0x3890('0x7a')])[_0x3890('0x4d')];logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x483255,_0x4b8818['value']);this[_0x3890('0x8e')](_0x483255,_0x4b8818[_0x3890('0x7a')]);}}else if(this[_0x3890('0x13')][_0x4b8818['linkedid']]){if(this[_0x3890('0x30')](_0x4b8818[_0x3890('0x78')])){if(this[_0x3890('0x30')](_0x4b8818['variable']['sipcallid'])){logger['info'](_0x3890('0x8b'),_0x4b8818[_0x3890('0x35')],_0x4b8818['value']);this['channels'][_0x4b8818[_0x3890('0x35')]]['sipcalllinkedid']=_0x4b8818[_0x3890('0x7a')];}}}}}catch(_0x492968){logger[_0x3890('0x2c')]('[%s][voiceCallReport][varset]',_0x4b8818[_0x3890('0x32')],util[_0x3890('0x2e')](_0x492968,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncHangup']=function(_0x65ac31){try{if(this[_0x3890('0x30')](_0x65ac31)){logger['debug'](_0x3890('0x8f'),_0x65ac31[_0x3890('0x32')],util[_0x3890('0x2e')](_0x65ac31,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x65ac31['linkedid']]){if(this[_0x3890('0x13')][this[_0x3890('0x15')][_0x65ac31[_0x3890('0x35')]]['linkedid']]){this[_0x3890('0x13')][this[_0x3890('0x15')][_0x65ac31['linkedid']][_0x3890('0x35')]][_0x3890('0x32')]=_0x65ac31[_0x3890('0x32')];this[_0x3890('0x13')][this[_0x3890('0x15')][_0x65ac31[_0x3890('0x35')]][_0x3890('0x35')]]['answered']=this[_0x3890('0x13')][_0x65ac31[_0x3890('0x32')]][_0x3890('0x63')];this[_0x3890('0x13')][this[_0x3890('0x15')][_0x65ac31['linkedid']][_0x3890('0x35')]][_0x3890('0x64')]=this[_0x3890('0x13')][_0x65ac31[_0x3890('0x32')]]['answertime'];this['channels'][this[_0x3890('0x15')][_0x65ac31[_0x3890('0x35')]]['linkedid']][_0x3890('0x68')]=this[_0x3890('0x13')][this[_0x3890('0x15')][_0x65ac31[_0x3890('0x35')]][_0x3890('0x35')]][_0x3890('0x3b')];this[_0x3890('0x13')][this[_0x3890('0x15')][_0x65ac31[_0x3890('0x35')]]['linkedid']]['disposition']=this[_0x3890('0x13')][_0x65ac31['uniqueid']]['disposition'];this['channels'][_0x65ac31[_0x3890('0x32')]]=this[_0x3890('0x13')][this['blindTransfers'][_0x65ac31[_0x3890('0x35')]]['linkedid']];delete this['channels'][this[_0x3890('0x15')][_0x65ac31[_0x3890('0x35')]][_0x3890('0x35')]];}else if(this[_0x3890('0x13')][this[_0x3890('0x15')][_0x65ac31[_0x3890('0x35')]][_0x3890('0x32')]]){this[_0x3890('0x13')][this['blindTransfers'][_0x65ac31[_0x3890('0x35')]][_0x3890('0x32')]][_0x3890('0x32')]=[this['channels'][this[_0x3890('0x15')][_0x65ac31['linkedid']]['uniqueid']][_0x3890('0x35')],this[_0x3890('0x13')][this[_0x3890('0x15')][_0x65ac31[_0x3890('0x35')]][_0x3890('0x32')]]['linkedid']=this[_0x3890('0x13')][this['blindTransfers'][_0x65ac31[_0x3890('0x35')]][_0x3890('0x32')]]['uniqueid']][0x0];this[_0x3890('0x13')][this[_0x3890('0x15')][_0x65ac31['linkedid']][_0x3890('0x32')]][_0x3890('0x63')]=this[_0x3890('0x13')][_0x65ac31[_0x3890('0x32')]]['answered'];this[_0x3890('0x13')][this['blindTransfers'][_0x65ac31[_0x3890('0x35')]][_0x3890('0x32')]][_0x3890('0x64')]=this['channels'][_0x65ac31['uniqueid']][_0x3890('0x64')];this[_0x3890('0x13')][this[_0x3890('0x15')][_0x65ac31['linkedid']][_0x3890('0x32')]][_0x3890('0x68')]=this[_0x3890('0x13')][this[_0x3890('0x15')][_0x65ac31[_0x3890('0x35')]][_0x3890('0x32')]][_0x3890('0x3b')];this['channels'][this['blindTransfers'][_0x65ac31[_0x3890('0x35')]][_0x3890('0x32')]]['disposition']=this[_0x3890('0x13')][_0x65ac31[_0x3890('0x32')]][_0x3890('0x47')];this[_0x3890('0x13')][_0x65ac31[_0x3890('0x32')]]=this[_0x3890('0x13')][this['blindTransfers'][_0x65ac31[_0x3890('0x35')]][_0x3890('0x32')]];delete this[_0x3890('0x13')][this[_0x3890('0x15')][_0x65ac31[_0x3890('0x35')]][_0x3890('0x32')]];}}if(this[_0x3890('0x13')][_0x65ac31[_0x3890('0x32')]]){logger[_0x3890('0x29')](_0x3890('0x90'),_0x65ac31[_0x3890('0x32')],_0x65ac31[_0x3890('0x91')]);var _0x26dc5b=moment();this['channels'][_0x65ac31[_0x3890('0x32')]][_0x3890('0x92')]=_0x26dc5b[_0x3890('0x41')](_0x3890('0x65'));this[_0x3890('0x13')][_0x65ac31['uniqueid']][_0x3890('0x57')]=_0x26dc5b[_0x3890('0x93')](this['channels'][_0x65ac31[_0x3890('0x32')]][_0x3890('0x46')],_0x3890('0x58'));if(this[_0x3890('0x13')][_0x65ac31[_0x3890('0x32')]][_0x3890('0x63')]){this[_0x3890('0x13')][_0x65ac31[_0x3890('0x32')]]['billableseconds']=_0x26dc5b['diff'](this[_0x3890('0x13')][_0x65ac31[_0x3890('0x32')]][_0x3890('0x64')],_0x3890('0x58'));this['channels'][_0x65ac31[_0x3890('0x32')]][_0x3890('0x66')]=this['channels'][_0x65ac31[_0x3890('0x32')]]['duration']-this[_0x3890('0x13')][_0x65ac31[_0x3890('0x32')]][_0x3890('0x94')];}if(_0x65ac31[_0x3890('0x39')]===_0x3890('0x3a')){if(this[_0x3890('0x14')][_0x65ac31[_0x3890('0x3b')]['split']('-')[0x0]]){this['agents'][_0x65ac31[_0x3890('0x3b')][_0x3890('0x3c')]('-')[0x0]]=_['omit'](this[_0x3890('0x14')][_0x65ac31['channel'][_0x3890('0x3c')]('-')[0x0]],['destconnectedlinenum']);logger['debug'](_0x3890('0x95'),_0x65ac31[_0x3890('0x32')],util[_0x3890('0x2e')]({'id':this[_0x3890('0x14')][_0x65ac31['channel']['split']('-')[0x0]]['id'],'destaccountcode':this[_0x3890('0x14')][_0x65ac31[_0x3890('0x3b')][_0x3890('0x3c')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x3890('0x42'),this[_0x3890('0x14')][_0x65ac31[_0x3890('0x3b')]['split']('-')[0x0]]['name']),_0x3890('0x96'),{'id':this['agents'][_0x65ac31[_0x3890('0x3b')][_0x3890('0x3c')]('-')[0x0]]['id'],'destaccountcode':this[_0x3890('0x14')][_0x65ac31[_0x3890('0x3b')][_0x3890('0x3c')]('-')[0x0]][_0x3890('0x4c')]});for(var _0x51078b=0x0;_0x51078b<Object[_0x3890('0x49')](this[_0x3890('0x14')])[_0x3890('0x97')];_0x51078b++){var _0x1605cc=Object[_0x3890('0x49')](this[_0x3890('0x14')])[_0x51078b];var _0x5964b2=this[_0x3890('0x14')][_0x1605cc];if(_0x5964b2[_0x3890('0x4c')]===Number(this[_0x3890('0x13')][_0x65ac31[_0x3890('0x32')]][_0x3890('0x40')])){this[_0x3890('0x31')](util[_0x3890('0x41')]('user:%s',_0x5964b2[_0x3890('0x4d')]),_0x3890('0x96'),{'id':_0x5964b2['id'],'destaccountcode':_0x5964b2['accountcode'],'transfer':this[_0x3890('0x13')][_0x65ac31[_0x3890('0x32')]]['transferType']});break;}}}}var _0x557efb=this;Promise[_0x3890('0x98')]()[_0x3890('0x99')](function(){var _0x48c034=_0x557efb['channels'][_0x65ac31[_0x3890('0x32')]];if(typeof _0x48c034[_0x3890('0x9a')]===_0x3890('0x4a')){return;}if(_0x48c034[_0x3890('0x9b')]===!![]){return;}if(_[_0x3890('0x9c')](_0x48c034[_0x3890('0x76')])){return;}return RpcSetting['getSettings']()[_0x3890('0x99')](function(_0x55a595){if(!_0x55a595[_0x3890('0x9d')])return;return Promise[_0x3890('0x98')]()[_0x3890('0x99')](function(){return ami[_0x3890('0x9e')]({'action':_0x3890('0x9f'),'channel':_0x48c034[_0x3890('0x3b')]})[_0x3890('0xa0')](function(){});})[_0x3890('0x99')](function(){return ami[_0x3890('0x9e')]({'action':_0x3890('0x9f'),'channel':_0x48c034[_0x3890('0x68')]})[_0x3890('0xa0')](function(){})[_0x3890('0xa1')](function(){var _0x1b7174=_0x557efb[_0x3890('0x14')][_0x48c034[_0x3890('0x68')][_0x3890('0x3c')]('-')[0x0]];if(!_0x1b7174)return;io[_0x3890('0x31')](_0x3890('0xa2'),{'agentId':_0x1b7174['id'],'uniqueid':_0x48c034[_0x3890('0x32')]});});});});})['then'](function(){if(_0x65ac31[_0x3890('0xa3')]==='BlindTransfer'){_0x557efb['blindTransfers'][_0x65ac31[_0x3890('0x32')]]=_0x65ac31;}else{if(_0x557efb[_0x3890('0x13')][_0x65ac31[_0x3890('0x32')]]&&_0x557efb[_0x3890('0x13')][_0x65ac31[_0x3890('0x32')]][_0x3890('0x5d')]==='outbound'&&_0x557efb[_0x3890('0x15')][_0x65ac31['uniqueid']]){_0x557efb[_0x3890('0x13')][_0x65ac31[_0x3890('0x32')]]['uniqueid']=[_0x557efb[_0x3890('0x13')][_0x65ac31['uniqueid']][_0x3890('0x35')],_0x557efb['channels'][_0x65ac31[_0x3890('0x32')]][_0x3890('0x35')]=_0x557efb[_0x3890('0x13')][_0x65ac31[_0x3890('0x32')]][_0x3890('0x32')]][0x0];delete _0x557efb['blindTransfers'][_0x65ac31['uniqueid']];}}logger[_0x3890('0x33')](_0x3890('0xa4'),_0x65ac31[_0x3890('0x32')],util[_0x3890('0x2e')](_0x557efb[_0x3890('0x13')][_0x65ac31[_0x3890('0x32')]],{'showHidden':![],'depth':null}));ami['emit'](_0x3890('0xa5'),_0x557efb[_0x3890('0x13')][_0x65ac31[_0x3890('0x32')]]);delete _0x557efb[_0x3890('0x13')][_0x65ac31[_0x3890('0x32')]];});}}}catch(_0x150b1e){logger['error'](_0x3890('0xa6'),_0x65ac31['uniqueid'],util[_0x3890('0x2e')](_0x150b1e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3890('0x2f')][_0x3890('0x22')]=function(_0x18b089){try{if(this[_0x3890('0x30')](_0x18b089)){logger[_0x3890('0x29')](_0x3890('0xa7'),_0x18b089['uniqueid'],_0x18b089[_0x3890('0xa8')],_0x18b089['transfertargetcalleridnum']);logger[_0x3890('0x33')](_0x3890('0xa9'),_0x18b089['uniqueid'],util[_0x3890('0x2e')](_0x18b089,{'showHidden':![],'depth':null}));var _0x14e3ec;if(this[_0x3890('0x13')][_0x18b089['transfereeuniqueid']]){this[_0x3890('0x13')][_0x18b089[_0x3890('0xaa')]][_0x3890('0xab')]=_0x18b089[_0x3890('0xa8')];this['channels'][_0x18b089[_0x3890('0xaa')]][_0x3890('0xac')]=_0x18b089[_0x3890('0xad')];if(this[_0x3890('0x13')][_0x18b089[_0x3890('0xae')]]){_0x14e3ec=this[_0x3890('0x13')][_0x18b089['secondtransfereruniqueid']];this[_0x3890('0x13')][_0x18b089[_0x3890('0xae')]]=this['channels'][_0x18b089['transfereeuniqueid']];this[_0x3890('0x13')][_0x18b089[_0x3890('0xaa')]]=_0x14e3ec;}this['channels'][_0x18b089[_0x3890('0xae')]][_0x3890('0x9a')]='ATTENDED';}else if(this['channels'][_0x18b089[_0x3890('0xaf')]]){this[_0x3890('0x13')][_0x18b089[_0x3890('0xaf')]]['transfercalleridnum']=_0x18b089[_0x3890('0xa8')];this['channels'][_0x18b089['transfertargetuniqueid']][_0x3890('0xac')]=_0x18b089[_0x3890('0xad')];if(this[_0x3890('0x13')][_0x18b089[_0x3890('0xb0')]]){_0x14e3ec=this[_0x3890('0x13')][_0x18b089[_0x3890('0xb0')]];this[_0x3890('0x13')][_0x18b089[_0x3890('0xb0')]]=this[_0x3890('0x13')][_0x18b089[_0x3890('0xaf')]];this[_0x3890('0x13')][_0x18b089[_0x3890('0xaf')]]=_0x14e3ec;}this[_0x3890('0x13')][_0x18b089['transfertargetuniqueid']][_0x3890('0x9a')]='ATTENDED';}if((this['channels'][_0x18b089[_0x3890('0xb0')]]||this['channels'][_0x18b089[_0x3890('0xb1')]])&&this[_0x3890('0x13')][_0x18b089['secondtransfereruniqueid']]){var _0x4ce0a8=_[_0x3890('0xb2')]([this[_0x3890('0x13')][_0x18b089[_0x3890('0xb0')]],this[_0x3890('0x13')][_0x18b089[_0x3890('0xb1')]],this[_0x3890('0x13')][_0x18b089[_0x3890('0xae')]]],function(_0x39a677){return _0x39a677&&_0x39a677[_0x3890('0x5d')]===_0x3890('0xb3')&&_0x39a677[_0x3890('0xb4')];});if(_0x4ce0a8){if(this[_0x3890('0x13')][_0x18b089[_0x3890('0xb0')]])this[_0x3890('0x13')][_0x18b089['origtransfereruniqueid']]['transferType']='ATTENDED';if(this['channels'][_0x18b089[_0x3890('0xb1')]])this[_0x3890('0x13')][_0x18b089[_0x3890('0xb1')]][_0x3890('0x9a')]=_0x3890('0xb5');this[_0x3890('0x13')][_0x18b089['secondtransfereruniqueid']][_0x3890('0x9a')]=_0x3890('0xb5');}else{if(this['channels'][_0x18b089[_0x3890('0xaa')]]){this[_0x3890('0x13')][_0x18b089[_0x3890('0xae')]][_0x3890('0x9b')]=!![];}if(this[_0x3890('0x13')][_0x18b089[_0x3890('0xaf')]]){this[_0x3890('0x13')][_0x18b089['transfertargetuniqueid']][_0x3890('0x9b')]=!![];}}}}}catch(_0x3a928e){logger[_0x3890('0x2c')](_0x3890('0xb6'),_0x18b089[_0x3890('0x32')],util[_0x3890('0x2e')](_0x3a928e,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x3890('0x24')]=function(_0x237330){try{if(this[_0x3890('0x30')](_0x237330)){logger[_0x3890('0x29')](_0x3890('0xb7'),_0x237330[_0x3890('0x32')],_0x237330[_0x3890('0xb8')],_0x237330['extension']);logger[_0x3890('0x33')]('[%s][voiceCallReport][blindtransfer]\x20event:',_0x237330[_0x3890('0x32')],util[_0x3890('0x2e')](_0x237330,{'showHidden':![],'depth':null}));if(this[_0x3890('0x13')][_0x237330[_0x3890('0xaa')]]){this[_0x3890('0x13')][_0x237330[_0x3890('0xaa')]][_0x3890('0xab')]=_0x237330['transfereecalleridnum'];this[_0x3890('0x13')][_0x237330[_0x3890('0xaa')]][_0x3890('0xac')]=_0x237330[_0x3890('0xb9')];this[_0x3890('0x13')][_0x237330['transfereeuniqueid']][_0x3890('0x9a')]=_0x3890('0xba');this['syncHangup']({'event':_0x3890('0xbb'),'uniqueid':_0x237330[_0x3890('0xaa')],'linkedid':_0x237330[_0x3890('0xbc')],'context':_0x237330[_0x3890('0x39')],'channel':_0x237330[_0x3890('0xbd')]});}else{this[_0x3890('0x13')][_0x237330[_0x3890('0xbc')]][_0x3890('0x9a')]=_0x3890('0xba');this[_0x3890('0x20')]({'event':_0x3890('0xbb'),'uniqueid':_0x237330[_0x3890('0xbc')],'linkedid':_0x237330[_0x3890('0xaa')],'context':_0x237330[_0x3890('0x39')],'channel':_0x237330[_0x3890('0xbd')]});}}}catch(_0x8f1d29){logger[_0x3890('0x2c')](_0x3890('0xbe'),_0x237330[_0x3890('0x32')],util[_0x3890('0x2e')](_0x8f1d29,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3890('0x2f')][_0x3890('0x26')]=function(_0x1b9723){try{if(this['isNotNull'](_0x1b9723)){logger['debug'](_0x3890('0xbf'),_0x1b9723[_0x3890('0x32')],util[_0x3890('0x2e')](_0x1b9723,{'showHidden':![],'depth':null}));if(this[_0x3890('0x13')][_0x1b9723[_0x3890('0x32')]]){if(!_[_0x3890('0x5e')](this[_0x3890('0x13')][_0x1b9723[_0x3890('0x32')]]['answertime'])){this[_0x3890('0x13')][_0x1b9723['uniqueid']][_0x3890('0xc0')]=moment()[_0x3890('0x41')](_0x3890('0x65'));logger[_0x3890('0x29')]('[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s',_0x1b9723[_0x3890('0x32')],this[_0x3890('0x13')][_0x1b9723['uniqueid']][_0x3890('0xc0')]);}}}}catch(_0x4a3d25){logger[_0x3890('0x2c')](_0x3890('0xc1'),_0x1b9723[_0x3890('0x32')],util['inspect'](_0x4a3d25,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3890('0x2f')]['syncMusicOnHoldStop']=function(_0x1a4431){try{if(this['isNotNull'](_0x1a4431)){logger[_0x3890('0x33')](_0x3890('0xc2'),_0x1a4431['uniqueid'],util[_0x3890('0x2e')](_0x1a4431,{'showHidden':![],'depth':null}));if(this[_0x3890('0x13')][_0x1a4431[_0x3890('0x32')]]){if(!_[_0x3890('0x5e')](this['channels'][_0x1a4431['uniqueid']][_0x3890('0xc0')])){this[_0x3890('0x13')][_0x1a4431[_0x3890('0x32')]]['mohtime']+=moment()[_0x3890('0xc3')](0x0)[_0x3890('0x93')](this['channels'][_0x1a4431['uniqueid']][_0x3890('0xc0')],_0x3890('0x58'));logger[_0x3890('0x29')]('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x1a4431[_0x3890('0x32')],this['channels'][_0x1a4431[_0x3890('0x32')]]['mohtime']);delete this[_0x3890('0x13')][_0x1a4431[_0x3890('0x32')]][_0x3890('0xc0')];}}}}catch(_0x1890f2){logger[_0x3890('0x2c')](_0x3890('0xc4'),_0x1a4431[_0x3890('0x32')],util['inspect'](_0x1890f2,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport;
\ No newline at end of file