Built motion from commit (unavailable).|2.5.31
[motion2.git] / server / services / ami / report / voiceCallReport.js
index c387ed5..71591e8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb2e5=['match','queue','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','starttime','diff','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','UserId','membername','name','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','.wav49','replace','monitorFilename','find','monitors','isNil','rec','[%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','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','billableseconds','omit','event','BlindTransfer','type','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','origtransfereruniqueid','transfertargetuniqueid','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','extension','context','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','ioredis','../../../config/logger','ami','../ami','not_inuse','inuse','invalid','ringing','onhold','set','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','newexten','bind','newchannel','syncNewChannel','newstate','syncNewState','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','info','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','keys','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','exten','disposition','channelstate','merge','from-sip','split','destconnectedlinenum','user:%s','accountcode','[%s][voiceCallReport][newchannel]','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','seconds','format','YYYY-MM-DD\x20HH:mm:ss','pick','includes','lastapplication','lastdata','cdr('];(function(_0x27ea3b,_0x463e96){var _0xbaada3=function(_0x1b6cf3){while(--_0x1b6cf3){_0x27ea3b['push'](_0x27ea3b['shift']());}};_0xbaada3(++_0x463e96);}(_0xb2e5,0x1bd));var _0x5b2e=function(_0x19e3eb,_0x5c7c6a){_0x19e3eb=_0x19e3eb-0x0;var _0x3e06ea=_0xb2e5[_0x19e3eb];return _0x3e06ea;};'use strict';var BPromise=require('bluebird');var _=require(_0x5b2e('0x0'));var moment=require(_0x5b2e('0x1'));var util=require(_0x5b2e('0x2'));var path=require(_0x5b2e('0x3'));var Redis=require(_0x5b2e('0x4'));var config=require('../../../config/environment');var logger=require(_0x5b2e('0x5'))(_0x5b2e('0x6'));var ami=require(_0x5b2e('0x7'));var Channel=require('../model/channel');var statusDesc=['unknown',_0x5b2e('0x8'),_0x5b2e('0x9'),'busy',_0x5b2e('0xa'),'unavailable',_0x5b2e('0xb'),'ringinuse',_0x5b2e('0xc')];var applications=[_0x5b2e('0xd'),'queue','agi','dial',_0x5b2e('0xe'),_0x5b2e('0xf')];var dispositions=['NO\x20ANSWER','FAILED',_0x5b2e('0x10'),'NO\x20ANSWER',_0x5b2e('0x11'),_0x5b2e('0x11'),_0x5b2e('0x12'),_0x5b2e('0x13'),'FAILED','FAILED',_0x5b2e('0x10')];var actions={};config[_0x5b2e('0x14')]=_[_0x5b2e('0x15')](config[_0x5b2e('0x14')],{'host':_0x5b2e('0x16'),'port':0x18eb});var io=require(_0x5b2e('0x17'))(new Redis(config[_0x5b2e('0x14')]));function VoiceCallReport(_0x27843b){this['channels']=_0x27843b[_0x5b2e('0x18')];this['agents']=_0x27843b[_0x5b2e('0x19')];this[_0x5b2e('0x1a')]={};ami['on'](_0x5b2e('0x1b'),this[_0x5b2e('0x1c')]['bind'](this));ami['on'](_0x5b2e('0x1d'),this['syncNewExten'][_0x5b2e('0x1e')](this));ami['on'](_0x5b2e('0x1f'),this[_0x5b2e('0x20')][_0x5b2e('0x1e')](this));ami['on'](_0x5b2e('0x21'),this[_0x5b2e('0x22')][_0x5b2e('0x1e')](this));ami['on']('varset',this[_0x5b2e('0x23')]['bind'](this));ami['on'](_0x5b2e('0x24'),this[_0x5b2e('0x25')][_0x5b2e('0x1e')](this));ami['on'](_0x5b2e('0x26'),this[_0x5b2e('0x27')][_0x5b2e('0x1e')](this));ami['on'](_0x5b2e('0x28'),this[_0x5b2e('0x29')][_0x5b2e('0x1e')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x5b2e('0x1e')](this));ami['on'](_0x5b2e('0x2a'),this[_0x5b2e('0x2b')][_0x5b2e('0x1e')](this));ami['on']('musiconholdstop',this[_0x5b2e('0x2c')][_0x5b2e('0x1e')](this));try{logger[_0x5b2e('0x2d')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0x5b2e('0x2e')]();}catch(_0x44632e){logger[_0x5b2e('0x2f')](_0x5b2e('0x30'),util[_0x5b2e('0x31')](_0x44632e,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x5b2e('0x32')][_0x5b2e('0x33')]=function(_0x42042e){return _0x42042e!==null&&!_[_0x5b2e('0x34')](_0x42042e);};VoiceCallReport[_0x5b2e('0x32')][_0x5b2e('0x35')]=function(_0x4aa197,_0x539266,_0x1e80bc){io['to'](_0x4aa197)[_0x5b2e('0x35')](_0x539266,_0x1e80bc);};VoiceCallReport[_0x5b2e('0x32')][_0x5b2e('0x27')]=function(_0x37a554){try{if(this[_0x5b2e('0x33')](_0x37a554)){logger['info'](_0x5b2e('0x36'),_0x37a554[_0x5b2e('0x37')],_0x37a554[_0x5b2e('0x38')],_0x37a554[_0x5b2e('0x39')]);logger[_0x5b2e('0x3a')](_0x5b2e('0x3b'),_0x37a554[_0x5b2e('0x37')],util[_0x5b2e('0x31')](_0x37a554,{'showHidden':![],'depth':null}));if(_0x37a554[_0x5b2e('0x37')]===_0x37a554[_0x5b2e('0x3c')]){if(!_[_0x5b2e('0x34')](this[_0x5b2e('0x18')][_0x37a554[_0x5b2e('0x37')]])){_['merge'](this['channels'][_0x37a554['uniqueid']],_['pick'](_0x37a554,_[_0x5b2e('0x3d')](this['channels'][_0x37a554[_0x5b2e('0x37')]])));}}}}catch(_0x5575e8){logger[_0x5b2e('0x2f')](_0x5b2e('0x3e'),_0x37a554[_0x5b2e('0x37')],util[_0x5b2e('0x31')](_0x5575e8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5b2e('0x32')][_0x5b2e('0x20')]=function(_0x3f29e6){try{if(this[_0x5b2e('0x33')](_0x3f29e6)){logger[_0x5b2e('0x3a')](_0x5b2e('0x3f'),_0x3f29e6['uniqueid'],util[_0x5b2e('0x31')](_0x3f29e6,{'showHidden':![],'depth':null}));if(_0x3f29e6['uniqueid']===_0x3f29e6[_0x5b2e('0x3c')]&&_0x3f29e6[_0x5b2e('0x40')]!=_0x5b2e('0x41')){if(_['isUndefined'](this[_0x5b2e('0x18')][_0x3f29e6[_0x5b2e('0x37')]])){logger[_0x5b2e('0x2d')](_0x5b2e('0x42'),_0x3f29e6[_0x5b2e('0x37')],_0x3f29e6['context'],_0x3f29e6[_0x5b2e('0x43')]);this[_0x5b2e('0x18')][_0x3f29e6[_0x5b2e('0x37')]]=new Channel();this[_0x5b2e('0x18')][_0x3f29e6[_0x5b2e('0x37')]]['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x5b2e('0x18')][_0x3f29e6[_0x5b2e('0x37')]][_0x5b2e('0x44')]=dispositions[_['toNumber'](_0x3f29e6[_0x5b2e('0x45')])];_[_0x5b2e('0x46')](this[_0x5b2e('0x18')][_0x3f29e6['uniqueid']],_['pick'](_0x3f29e6,_[_0x5b2e('0x3d')](this[_0x5b2e('0x18')][_0x3f29e6[_0x5b2e('0x37')]])));if(_0x3f29e6['context']===_0x5b2e('0x47')){if(this['agents'][_0x3f29e6[_0x5b2e('0x40')][_0x5b2e('0x48')]('-')[0x0]]){this[_0x5b2e('0x19')][_0x3f29e6[_0x5b2e('0x40')]['split']('-')[0x0]][_0x5b2e('0x49')]=_0x3f29e6['exten'];logger[_0x5b2e('0x3a')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x3f29e6[_0x5b2e('0x37')],util[_0x5b2e('0x31')]({'destaccountcode':this[_0x5b2e('0x19')][_0x3f29e6[_0x5b2e('0x40')][_0x5b2e('0x48')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x3f29e6[_0x5b2e('0x43')]},{'showHidden':![],'depth':null}));this[_0x5b2e('0x35')](util['format'](_0x5b2e('0x4a'),this[_0x5b2e('0x19')][_0x3f29e6[_0x5b2e('0x40')][_0x5b2e('0x48')]('-')[0x0]]['name']),'user:agentconnect',{'destaccountcode':this['agents'][_0x3f29e6[_0x5b2e('0x40')][_0x5b2e('0x48')]('-')[0x0]][_0x5b2e('0x4b')],'destconnectedlinenum':_0x3f29e6[_0x5b2e('0x43')]});}}}}}}catch(_0x5798ed){logger['error'](_0x5b2e('0x4c'),_0x3f29e6[_0x5b2e('0x37')],util['inspect'](_0x5798ed,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5b2e('0x32')][_0x5b2e('0x1c')]=function(_0x42be69){try{if(this[_0x5b2e('0x33')](_0x42be69)){logger[_0x5b2e('0x3a')]('[%s][voiceCallReport][newexten]\x20event:',_0x42be69[_0x5b2e('0x37')],util[_0x5b2e('0x31')](_0x42be69,{'showHidden':![],'depth':null}));if(_0x42be69[_0x5b2e('0x37')]===_0x42be69['linkedid']&&_0x42be69['exten']!='h'&&_0x42be69['channel']!=_0x5b2e('0x41')){_0x42be69[_0x5b2e('0x4d')]=_0x42be69[_0x5b2e('0x4d')][_0x5b2e('0x4e')]();_0x42be69[_0x5b2e('0x4f')]=(_0x42be69[_0x5b2e('0x50')]||_0x42be69[_0x5b2e('0x4f')])[_0x5b2e('0x4e')]();logger['info'](_0x5b2e('0x51'),_0x42be69[_0x5b2e('0x37')],_0x42be69[_0x5b2e('0x4d')],_0x42be69['applicationdata']);if(_['isUndefined'](this['channels'][_0x42be69[_0x5b2e('0x37')]])){this[_0x5b2e('0x18')][_0x42be69[_0x5b2e('0x37')]]=new Channel();this['channels'][_0x42be69[_0x5b2e('0x37')]]['starttime']=_0x42be69['duration']?moment()[_0x5b2e('0x52')](moment['duration'](_0x42be69[_0x5b2e('0x53')])[_0x5b2e('0x54')](),_0x5b2e('0x54'))[_0x5b2e('0x55')](_0x5b2e('0x56')):moment()['format'](_0x5b2e('0x56'));this[_0x5b2e('0x18')][_0x42be69[_0x5b2e('0x37')]]['disposition']=_0x5b2e('0x11');}_[_0x5b2e('0x46')](this[_0x5b2e('0x18')][_0x42be69['uniqueid']],_[_0x5b2e('0x57')](_0x42be69,_[_0x5b2e('0x3d')](this['channels'][_0x42be69['uniqueid']])));if(_[_0x5b2e('0x58')](applications,_0x42be69['application'])){this[_0x5b2e('0x18')][_0x42be69[_0x5b2e('0x37')]][_0x5b2e('0x59')]=_0x42be69['application'];this[_0x5b2e('0x18')][_0x42be69['uniqueid']][_0x5b2e('0x5a')]=_0x42be69[_0x5b2e('0x4f')];if(_0x42be69[_0x5b2e('0x4d')]==='set'&&_['startsWith'](_0x42be69['applicationdata'],_0x5b2e('0x5b'))){var _0x2529e2=_0x42be69['applicationdata']['split']('=');var _0x5c33c5=_0x2529e2[0x0][_0x5b2e('0x5c')](/cdr\((.*)\)/);if(_0x5c33c5){this[_0x5b2e('0x18')][_0x42be69[_0x5b2e('0x37')]][_0x5c33c5[0x1]]=_0x2529e2[0x1];}}else if(_0x42be69['application']===_0x5b2e('0x5d')){this[_0x5b2e('0x18')][_0x42be69['uniqueid']][_0x5b2e('0x5d')]=_0x42be69[_0x5b2e('0x4f')][_0x5b2e('0x48')](',')[0x0];}}}}}catch(_0xdb8678){logger['error'](_0x5b2e('0x5e'),_0x42be69[_0x5b2e('0x37')],util['inspect'](_0xdb8678,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x5b2e('0x22')]=function(_0x5b30c4){try{if(this['isNotNull'](_0x5b30c4)){logger[_0x5b2e('0x2d')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x5b30c4[_0x5b2e('0x37')],_0x5b30c4['linkedid'],_0x5b30c4[_0x5b2e('0x38')],_0x5b30c4['calleridnum']);logger[_0x5b2e('0x3a')](_0x5b2e('0x5f'),_0x5b30c4[_0x5b2e('0x37')],util[_0x5b2e('0x31')](_0x5b30c4,{'showHidden':![],'depth':null}));if(_0x5b30c4[_0x5b2e('0x37')]!==_0x5b30c4['linkedid']){if(this[_0x5b2e('0x18')][_0x5b30c4[_0x5b2e('0x3c')]]){if(_0x5b30c4[_0x5b2e('0x45')]==='6'){if(!this[_0x5b2e('0x18')][_0x5b30c4[_0x5b2e('0x3c')]]['answered']){var _0xd2a3ac=moment();this[_0x5b2e('0x18')][_0x5b30c4['linkedid']][_0x5b2e('0x60')]=!![];this[_0x5b2e('0x18')][_0x5b30c4[_0x5b2e('0x3c')]][_0x5b2e('0x61')]=_0xd2a3ac[_0x5b2e('0x55')](_0x5b2e('0x56'));if(this['channels'][_0x5b30c4[_0x5b2e('0x3c')]][_0x5b2e('0x62')]){this[_0x5b2e('0x18')][_0x5b30c4[_0x5b2e('0x3c')]]['holdtime']=_0xd2a3ac[_0x5b2e('0x63')](this[_0x5b2e('0x18')][_0x5b30c4['linkedid']][_0x5b2e('0x62')],'seconds');}}this[_0x5b2e('0x18')][_0x5b30c4[_0x5b2e('0x3c')]][_0x5b2e('0x3c')]=_0x5b30c4[_0x5b2e('0x37')];if(_0x5b30c4[_0x5b2e('0x39')]!==_0x5b2e('0x64')){this[_0x5b2e('0x18')][_0x5b30c4[_0x5b2e('0x3c')]][_0x5b2e('0x65')]=_0x5b30c4['calleridnum'];}this['channels'][_0x5b30c4['linkedid']][_0x5b2e('0x66')]=_0x5b30c4['calleridname'];this[_0x5b2e('0x18')][_0x5b30c4['linkedid']][_0x5b2e('0x67')]=_0x5b30c4['channel'];this[_0x5b2e('0x18')][_0x5b30c4['linkedid']]['disposition']=dispositions[_['toNumber'](_0x5b30c4[_0x5b2e('0x45')])];if(this['agents'][_0x5b30c4[_0x5b2e('0x40')]['split']('-')[0x0]]){this['channels'][_0x5b30c4['linkedid']][_0x5b2e('0x68')]=this[_0x5b2e('0x19')][_0x5b30c4['channel'][_0x5b2e('0x48')]('-')[0x0]]['id'];this[_0x5b2e('0x18')][_0x5b30c4[_0x5b2e('0x3c')]][_0x5b2e('0x69')]=this['agents'][_0x5b30c4[_0x5b2e('0x40')][_0x5b2e('0x48')]('-')[0x0]][_0x5b2e('0x6a')];}}}}else{if(this[_0x5b2e('0x18')][_0x5b30c4[_0x5b2e('0x37')]]){if(_0x5b30c4[_0x5b2e('0x45')]==='6'){if(this[_0x5b2e('0x19')][_0x5b30c4[_0x5b2e('0x40')]['split']('-')[0x0]]){this[_0x5b2e('0x18')][_0x5b30c4['uniqueid']][_0x5b2e('0x68')]=this[_0x5b2e('0x19')][_0x5b30c4[_0x5b2e('0x40')][_0x5b2e('0x48')]('-')[0x0]]['id'];this[_0x5b2e('0x18')][_0x5b30c4[_0x5b2e('0x37')]][_0x5b2e('0x69')]=this['agents'][_0x5b30c4[_0x5b2e('0x40')][_0x5b2e('0x48')]('-')[0x0]][_0x5b2e('0x6a')];}}}}}}catch(_0x1c29fc){logger[_0x5b2e('0x2f')](_0x5b2e('0x6b'),_0x5b30c4[_0x5b2e('0x37')],util['inspect'](_0x1c29fc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5b2e('0x32')][_0x5b2e('0x6c')]=function(_0x3adba4,_0x2287e5){try{if(this[_0x5b2e('0x18')][_0x3adba4]){logger[_0x5b2e('0x2d')](_0x5b2e('0x6d'),_0x3adba4,_0x2287e5);this[_0x5b2e('0x18')][_0x3adba4]['monitor']=!![];if(_['endsWith'](_0x2287e5,_0x5b2e('0x6e'))){_0x2287e5=_0x2287e5[_0x5b2e('0x6f')](_0x5b2e('0x6e'),'.WAV');}this['channels'][_0x3adba4][_0x5b2e('0x70')]=_0x2287e5;var _0x317199=_[_0x5b2e('0x71')](this[_0x5b2e('0x18')][_0x3adba4][_0x5b2e('0x72')],{'filename':_0x2287e5});if(_[_0x5b2e('0x73')](_0x317199)){this['channels'][_0x3adba4][_0x5b2e('0x72')]['push']({'filename':_0x2287e5,'createdAt':moment()['format'](_0x5b2e('0x56')),'mixmonitorid':'','status':_0x5b2e('0x74')});}}}catch(_0x307d24){logger[_0x5b2e('0x2f')](_0x5b2e('0x75'),_0x3adba4,util[_0x5b2e('0x31')](_0x307d24,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncVarSet']=function(_0x5c234b){try{if(this[_0x5b2e('0x33')](_0x5c234b)){logger[_0x5b2e('0x3a')](_0x5b2e('0x76'),_0x5c234b['uniqueid'],util[_0x5b2e('0x31')](_0x5c234b,{'showHidden':![],'depth':null}));if(this[_0x5b2e('0x18')][_0x5c234b['uniqueid']]&&_0x5c234b['channel']!='OutgoingSpoolFailed'){if(this[_0x5b2e('0x33')](_0x5c234b[_0x5b2e('0x77')])){if(this['isNotNull'](_0x5c234b[_0x5b2e('0x77')][_0x5b2e('0x78')])){logger[_0x5b2e('0x2d')](_0x5b2e('0x79'),_0x5c234b[_0x5b2e('0x37')],_0x5c234b[_0x5b2e('0x7a')]);this[_0x5b2e('0x6c')](_0x5c234b['uniqueid'],_0x5c234b[_0x5b2e('0x7a')]);}else if(this[_0x5b2e('0x33')](_0x5c234b[_0x5b2e('0x77')][_0x5b2e('0x7b')])){logger[_0x5b2e('0x2d')](_0x5b2e('0x7c'),_0x5c234b[_0x5b2e('0x37')],_0x5c234b[_0x5b2e('0x7a')]);this[_0x5b2e('0x18')][_0x5c234b['uniqueid']]['calleridnum']=_0x5c234b['value'];}else if(this[_0x5b2e('0x33')](_0x5c234b[_0x5b2e('0x77')][_0x5b2e('0x7d')])){logger[_0x5b2e('0x2d')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x5c234b['uniqueid'],_0x5c234b[_0x5b2e('0x7a')]);this[_0x5b2e('0x18')][_0x5c234b['uniqueid']][_0x5b2e('0x7e')]=_0x5c234b['value'];}else if(this[_0x5b2e('0x33')](_0x5c234b[_0x5b2e('0x77')][_0x5b2e('0x7f')])){logger[_0x5b2e('0x2d')](_0x5b2e('0x80'),_0x5c234b[_0x5b2e('0x37')],_0x5c234b[_0x5b2e('0x7a')]);this['channels'][_0x5c234b[_0x5b2e('0x37')]]['type']=_0x5c234b[_0x5b2e('0x7a')];}else if(this[_0x5b2e('0x33')](_0x5c234b[_0x5b2e('0x77')][_0x5b2e('0x81')])){logger[_0x5b2e('0x2d')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x5c234b[_0x5b2e('0x37')],_0x5c234b[_0x5b2e('0x7a')]['split'](',')[0x0]);this['channels'][_0x5c234b['uniqueid']][_0x5b2e('0x5d')]=_0x5c234b[_0x5b2e('0x7a')][_0x5b2e('0x48')](',')[0x0];}else if(this[_0x5b2e('0x33')](_0x5c234b[_0x5b2e('0x77')][_0x5b2e('0x82')])){logger[_0x5b2e('0x2d')](_0x5b2e('0x83'),_0x5c234b[_0x5b2e('0x37')],_0x5c234b[_0x5b2e('0x7a')]);this[_0x5b2e('0x18')][_0x5c234b[_0x5b2e('0x37')]][_0x5b2e('0x84')]=_0x5c234b[_0x5b2e('0x7a')];}else if(this['isNotNull'](_0x5c234b[_0x5b2e('0x77')][_0x5b2e('0x85')])){logger[_0x5b2e('0x2d')](_0x5b2e('0x86'),_0x5c234b['uniqueid'],_0x5c234b[_0x5b2e('0x7a')]);this['channels'][_0x5c234b[_0x5b2e('0x37')]][_0x5b2e('0x87')]=_0x5c234b[_0x5b2e('0x7a')];}else if(this['isNotNull'](_0x5c234b[_0x5b2e('0x77')][_0x5b2e('0x88')])){logger['info'](_0x5b2e('0x89'),_0x5c234b['uniqueid'],_0x5c234b[_0x5b2e('0x7a')]);this[_0x5b2e('0x18')][_0x5c234b[_0x5b2e('0x37')]]['calleridpreview']=_0x5c234b[_0x5b2e('0x7a')];}else if(this['isNotNull'](_0x5c234b[_0x5b2e('0x77')]['xmcs-queue'])){logger[_0x5b2e('0x2d')](_0x5b2e('0x8a'),_0x5c234b['uniqueid'],_0x5c234b[_0x5b2e('0x7a')]);this[_0x5b2e('0x18')][_0x5c234b[_0x5b2e('0x37')]][_0x5b2e('0x5d')]=_0x5c234b['value'];}else if(this['isNotNull'](_0x5c234b['variable'][_0x5b2e('0x8b')])){logger[_0x5b2e('0x2d')](_0x5b2e('0x8c'),_0x5c234b[_0x5b2e('0x37')],_0x5c234b[_0x5b2e('0x7a')]);this[_0x5b2e('0x18')][_0x5c234b[_0x5b2e('0x37')]][_0x5b2e('0x8d')]=_0x5c234b['value'];}}}else if(this[_0x5b2e('0x33')](_0x5c234b[_0x5b2e('0x77')]['mixmonitor_filename'])){if(_0x5c234b[_0x5b2e('0x7a')]){var _0x2f748c=path['parse'](_0x5c234b[_0x5b2e('0x7a')])[_0x5b2e('0x6a')];logger[_0x5b2e('0x2d')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x2f748c,_0x5c234b['value']);this[_0x5b2e('0x6c')](_0x2f748c,_0x5c234b[_0x5b2e('0x7a')]);}}else if(this[_0x5b2e('0x18')][_0x5c234b[_0x5b2e('0x3c')]]){if(this[_0x5b2e('0x33')](_0x5c234b['variable'])){if(this['isNotNull'](_0x5c234b[_0x5b2e('0x77')][_0x5b2e('0x8b')])){logger[_0x5b2e('0x2d')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x5c234b[_0x5b2e('0x3c')],_0x5c234b[_0x5b2e('0x7a')]);this[_0x5b2e('0x18')][_0x5c234b[_0x5b2e('0x3c')]][_0x5b2e('0x8e')]=_0x5c234b['value'];}}}}}catch(_0x6e4539){logger[_0x5b2e('0x2f')](_0x5b2e('0x8f'),_0x5c234b[_0x5b2e('0x37')],util[_0x5b2e('0x31')](_0x6e4539,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5b2e('0x32')][_0x5b2e('0x25')]=function(_0x3ffc84){try{if(this['isNotNull'](_0x3ffc84)){logger['debug']('[%s][voiceCallReport][hangup]\x20event:',_0x3ffc84[_0x5b2e('0x37')],util[_0x5b2e('0x31')](_0x3ffc84,{'showHidden':![],'depth':null}));if(this[_0x5b2e('0x18')][_0x3ffc84[_0x5b2e('0x37')]]){logger[_0x5b2e('0x2d')](_0x5b2e('0x90'),_0x3ffc84[_0x5b2e('0x37')],_0x3ffc84[_0x5b2e('0x91')]);var _0xbb72c0=moment();this[_0x5b2e('0x18')][_0x3ffc84[_0x5b2e('0x37')]]['endtime']=_0xbb72c0['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x5b2e('0x18')][_0x3ffc84[_0x5b2e('0x37')]]['duration']=_0xbb72c0['diff'](this[_0x5b2e('0x18')][_0x3ffc84[_0x5b2e('0x37')]][_0x5b2e('0x62')],_0x5b2e('0x54'));if(this[_0x5b2e('0x18')][_0x3ffc84['uniqueid']][_0x5b2e('0x60')]){this['channels'][_0x3ffc84[_0x5b2e('0x37')]][_0x5b2e('0x92')]=_0xbb72c0[_0x5b2e('0x63')](this['channels'][_0x3ffc84['uniqueid']][_0x5b2e('0x61')],_0x5b2e('0x54'));this[_0x5b2e('0x18')][_0x3ffc84[_0x5b2e('0x37')]]['holdtime']=this['channels'][_0x3ffc84[_0x5b2e('0x37')]][_0x5b2e('0x53')]-this[_0x5b2e('0x18')][_0x3ffc84[_0x5b2e('0x37')]][_0x5b2e('0x92')];}if(_0x3ffc84['context']===_0x5b2e('0x47')){if(this['agents'][_0x3ffc84['channel']['split']('-')[0x0]]){this[_0x5b2e('0x19')][_0x3ffc84[_0x5b2e('0x40')]['split']('-')[0x0]]=_[_0x5b2e('0x93')](this[_0x5b2e('0x19')][_0x3ffc84['channel'][_0x5b2e('0x48')]('-')[0x0]],[_0x5b2e('0x49')]);logger[_0x5b2e('0x3a')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x3ffc84['uniqueid'],util[_0x5b2e('0x31')]({'destaccountcode':this[_0x5b2e('0x19')][_0x3ffc84[_0x5b2e('0x40')][_0x5b2e('0x48')]('-')[0x0]][_0x5b2e('0x4b')]},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x5b2e('0x4a'),this[_0x5b2e('0x19')][_0x3ffc84[_0x5b2e('0x40')][_0x5b2e('0x48')]('-')[0x0]][_0x5b2e('0x6a')]),'user:agentcomplete',{'destaccountcode':this[_0x5b2e('0x19')][_0x3ffc84[_0x5b2e('0x40')]['split']('-')[0x0]][_0x5b2e('0x4b')]});}}if(_0x3ffc84[_0x5b2e('0x94')]===_0x5b2e('0x95')){this[_0x5b2e('0x1a')][_0x3ffc84['uniqueid']]=this[_0x5b2e('0x18')][_0x3ffc84[_0x5b2e('0x37')]];}else{if(this[_0x5b2e('0x18')][_0x3ffc84[_0x5b2e('0x37')]][_0x5b2e('0x96')]===_0x5b2e('0x97')&&this[_0x5b2e('0x1a')][_0x3ffc84[_0x5b2e('0x37')]]){this[_0x5b2e('0x18')][_0x3ffc84[_0x5b2e('0x37')]][_0x5b2e('0x37')]=[this['channels'][_0x3ffc84[_0x5b2e('0x37')]][_0x5b2e('0x3c')],this[_0x5b2e('0x18')][_0x3ffc84[_0x5b2e('0x37')]]['linkedid']=this[_0x5b2e('0x18')][_0x3ffc84[_0x5b2e('0x37')]][_0x5b2e('0x37')]][0x0];delete this['blindTransfers'][_0x3ffc84[_0x5b2e('0x37')]];}}logger['debug'](_0x5b2e('0x98'),_0x3ffc84[_0x5b2e('0x37')],util[_0x5b2e('0x31')](this[_0x5b2e('0x18')][_0x3ffc84['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x5b2e('0x99'),this[_0x5b2e('0x18')][_0x3ffc84[_0x5b2e('0x37')]]);delete this[_0x5b2e('0x18')][_0x3ffc84[_0x5b2e('0x37')]];}}}catch(_0x32e5d0){logger[_0x5b2e('0x2f')](_0x5b2e('0x9a'),_0x3ffc84[_0x5b2e('0x37')],util[_0x5b2e('0x31')](_0x32e5d0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5b2e('0x32')]['syncAttendedTransfer']=function(_0x5f3ee1){try{if(this['isNotNull'](_0x5f3ee1)){logger['info'](_0x5b2e('0x9b'),_0x5f3ee1[_0x5b2e('0x37')],_0x5f3ee1[_0x5b2e('0x9c')],_0x5f3ee1[_0x5b2e('0x9d')]);logger['debug'](_0x5b2e('0x9e'),_0x5f3ee1['uniqueid'],util[_0x5b2e('0x31')](_0x5f3ee1,{'showHidden':![],'depth':null}));if(this['channels'][_0x5f3ee1[_0x5b2e('0x9f')]]){this['channels'][_0x5f3ee1[_0x5b2e('0x9f')]][_0x5b2e('0xa0')]=_0x5f3ee1[_0x5b2e('0x9c')];this[_0x5b2e('0x18')][_0x5f3ee1[_0x5b2e('0x9f')]]['transferconnectedlinenum']=_0x5f3ee1['transfertargetcalleridnum'];if(this[_0x5b2e('0x18')][_0x5f3ee1['secondtransfereruniqueid']]){var _0x40385d=this[_0x5b2e('0x18')][_0x5f3ee1['secondtransfereruniqueid']];this[_0x5b2e('0x18')][_0x5f3ee1['secondtransfereruniqueid']]=this[_0x5b2e('0x18')][_0x5f3ee1[_0x5b2e('0x9f')]];this[_0x5b2e('0x18')][_0x5f3ee1[_0x5b2e('0x9f')]]=_0x40385d;}}else if(this[_0x5b2e('0x18')][_0x5f3ee1['transfertargetuniqueid']]){this['channels'][_0x5f3ee1['transfertargetuniqueid']]['transfercalleridnum']=_0x5f3ee1[_0x5b2e('0x9c')];this['channels'][_0x5f3ee1['transfertargetuniqueid']][_0x5b2e('0xa1')]=_0x5f3ee1[_0x5b2e('0x9d')];if(this['channels'][_0x5f3ee1[_0x5b2e('0xa2')]]){var _0x40385d=this[_0x5b2e('0x18')][_0x5f3ee1['origtransfereruniqueid']];this[_0x5b2e('0x18')][_0x5f3ee1['origtransfereruniqueid']]=this['channels'][_0x5f3ee1[_0x5b2e('0xa3')]];this[_0x5b2e('0x18')][_0x5f3ee1[_0x5b2e('0xa3')]]=_0x40385d;}}}}catch(_0x5bb1b8){logger['error']('[%s][voiceCallReport][attendedtransfer]',_0x5f3ee1['uniqueid'],util[_0x5b2e('0x31')](_0x5bb1b8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5b2e('0x32')][_0x5b2e('0xa4')]=function(_0x1955c3){try{if(this['isNotNull'](_0x1955c3)){logger[_0x5b2e('0x2d')](_0x5b2e('0xa5'),_0x1955c3[_0x5b2e('0x37')],_0x1955c3[_0x5b2e('0xa6')],_0x1955c3['extension']);logger['debug'](_0x5b2e('0xa7'),_0x1955c3[_0x5b2e('0x37')],util[_0x5b2e('0x31')](_0x1955c3,{'showHidden':![],'depth':null}));if(this['channels'][_0x1955c3[_0x5b2e('0x9f')]]){this['channels'][_0x1955c3[_0x5b2e('0x9f')]][_0x5b2e('0xa0')]=_0x1955c3[_0x5b2e('0xa6')];this['channels'][_0x1955c3[_0x5b2e('0x9f')]][_0x5b2e('0xa1')]=_0x1955c3[_0x5b2e('0xa8')];this['syncHangup']({'event':'BlindTransfer','uniqueid':_0x1955c3[_0x5b2e('0x9f')],'context':_0x1955c3[_0x5b2e('0xa9')],'channel':_0x1955c3['transfererchannel']});}}}catch(_0x4dfb14){logger[_0x5b2e('0x2f')](_0x5b2e('0xaa'),_0x1955c3[_0x5b2e('0x37')],util[_0x5b2e('0x31')](_0x4dfb14,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5b2e('0x32')][_0x5b2e('0x2b')]=function(_0x5b64c1){try{if(this[_0x5b2e('0x33')](_0x5b64c1)){logger[_0x5b2e('0x3a')](_0x5b2e('0xab'),_0x5b64c1['uniqueid'],util[_0x5b2e('0x31')](_0x5b64c1,{'showHidden':![],'depth':null}));if(this[_0x5b2e('0x18')][_0x5b64c1[_0x5b2e('0x37')]]){if(!_[_0x5b2e('0x73')](this['channels'][_0x5b64c1[_0x5b2e('0x37')]]['answertime'])){this['channels'][_0x5b64c1[_0x5b2e('0x37')]][_0x5b2e('0xac')]=moment()[_0x5b2e('0x55')]('YYYY-MM-DD\x20HH:mm:ss');logger['info'](_0x5b2e('0xad'),_0x5b64c1[_0x5b2e('0x37')],this[_0x5b2e('0x18')][_0x5b64c1[_0x5b2e('0x37')]][_0x5b2e('0xac')]);}}}}catch(_0x312c0a){logger[_0x5b2e('0x2f')](_0x5b2e('0xae'),_0x5b64c1[_0x5b2e('0x37')],util[_0x5b2e('0x31')](_0x312c0a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5b2e('0x32')]['syncMusicOnHoldStop']=function(_0x58b0f2){try{if(this[_0x5b2e('0x33')](_0x58b0f2)){logger[_0x5b2e('0x3a')](_0x5b2e('0xaf'),_0x58b0f2[_0x5b2e('0x37')],util[_0x5b2e('0x31')](_0x58b0f2,{'showHidden':![],'depth':null}));if(this[_0x5b2e('0x18')][_0x58b0f2['uniqueid']]){if(!_['isNil'](this[_0x5b2e('0x18')][_0x58b0f2[_0x5b2e('0x37')]][_0x5b2e('0xac')])){this[_0x5b2e('0x18')][_0x58b0f2[_0x5b2e('0x37')]]['mohtime']+=moment()['milliseconds'](0x0)[_0x5b2e('0x63')](this[_0x5b2e('0x18')][_0x58b0f2[_0x5b2e('0x37')]][_0x5b2e('0xac')],_0x5b2e('0x54'));logger[_0x5b2e('0x2d')](_0x5b2e('0xb0'),_0x58b0f2[_0x5b2e('0x37')],this[_0x5b2e('0x18')][_0x58b0f2['uniqueid']]['mohtime']);delete this[_0x5b2e('0x18')][_0x58b0f2[_0x5b2e('0x37')]][_0x5b2e('0xac')];}}}}catch(_0x44f594){logger[_0x5b2e('0x2f')](_0x5b2e('0xb1'),_0x58b0f2[_0x5b2e('0x37')],util[_0x5b2e('0x31')](_0x44f594,{'showHidden':![],'depth':null}));}};module[_0x5b2e('0xb2')]=VoiceCallReport;
\ No newline at end of file
+var _0x6aa9=['holdtime','diff','connectedlinenum','connectedlinename','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','.WAV','find','isNil','monitors','push','rec','[%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','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','parse','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','cause-txt','endtime','billableseconds','omit','destconnectedlinenum','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','emit','resolve','then','transferType','undefined','isEmpty','getSettings','Action','StopMixMonitor','catch','finally','destinationchannel','webbar:stopmonitors','event','outbound','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransferercalleridnum','origtransfereruniqueid','origtransfererlinkedid','some','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','unknown','inuse','busy','unavailable','ringing','ringinuse','onhold','set','queue','agi','dial','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','redis','localhost','socket.io-emitter','agents','blindTransfers','syncNewExten','newexten','newchannel','syncNewChannel','newstate','syncNewState','bind','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','isNotNull','isUndefined','prototype','syncNewCallerId','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','inspect','linkedid','channels','pick','keys','[%s][voiceCallReport][newcallerid]','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','starttime','format','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','from-sip','split','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','merge','includes','lastdata','startsWith','cdr(','[%s][voiceCallReport][newexten]','answered','answertime'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0x6aa9,0x66));var _0x96aa=function(_0x1721be,_0x4e2a86){_0x1721be=_0x1721be-0x0;var _0xf9507a=_0x6aa9[_0x1721be];return _0xf9507a;};'use strict';var BPromise=require(_0x96aa('0x0'));var _=require(_0x96aa('0x1'));var moment=require(_0x96aa('0x2'));var util=require(_0x96aa('0x3'));var path=require(_0x96aa('0x4'));var Redis=require(_0x96aa('0x5'));var config=require(_0x96aa('0x6'));var logger=require(_0x96aa('0x7'))(_0x96aa('0x8'));var ami=require(_0x96aa('0x9'));var Channel=require(_0x96aa('0xa'));var RpcSetting=require(_0x96aa('0xb'));var statusDesc=[_0x96aa('0xc'),'not_inuse',_0x96aa('0xd'),_0x96aa('0xe'),'invalid',_0x96aa('0xf'),_0x96aa('0x10'),_0x96aa('0x11'),_0x96aa('0x12')];var applications=[_0x96aa('0x13'),_0x96aa('0x14'),_0x96aa('0x15'),_0x96aa('0x16'),'playback','voicemail'];var dispositions=[_0x96aa('0x17'),'FAILED',_0x96aa('0x18'),'NO\x20ANSWER',_0x96aa('0x17'),_0x96aa('0x17'),_0x96aa('0x19'),_0x96aa('0x1a'),_0x96aa('0x18'),_0x96aa('0x18'),_0x96aa('0x18')];var actions={};config['redis']=_[_0x96aa('0x1b')](config[_0x96aa('0x1c')],{'host':_0x96aa('0x1d'),'port':0x18eb});var io=require(_0x96aa('0x1e'))(new Redis(config[_0x96aa('0x1c')]));function VoiceCallReport(_0x1ccb83){this['channels']=_0x1ccb83['channels'];this[_0x96aa('0x1f')]=_0x1ccb83['agents'];this[_0x96aa('0x20')]={};ami['on']('coreshowchannel',this[_0x96aa('0x21')]['bind'](this));ami['on'](_0x96aa('0x22'),this['syncNewExten']['bind'](this));ami['on'](_0x96aa('0x23'),this[_0x96aa('0x24')]['bind'](this));ami['on'](_0x96aa('0x25'),this[_0x96aa('0x26')][_0x96aa('0x27')](this));ami['on'](_0x96aa('0x28'),this[_0x96aa('0x29')][_0x96aa('0x27')](this));ami['on'](_0x96aa('0x2a'),this[_0x96aa('0x2b')][_0x96aa('0x27')](this));ami['on']('newcallerid',this['syncNewCallerId']['bind'](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x96aa('0x27')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x96aa('0x27')](this));ami['on'](_0x96aa('0x2c'),this[_0x96aa('0x2d')][_0x96aa('0x27')](this));ami['on'](_0x96aa('0x2e'),this['syncMusicOnHoldStop']['bind'](this));try{logger[_0x96aa('0x2f')](_0x96aa('0x30'));ami[_0x96aa('0x31')]();}catch(_0x4349b0){logger[_0x96aa('0x32')](_0x96aa('0x33'),util['inspect'](_0x4349b0,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0x96aa('0x34')]=function(_0x342537){return _0x342537!==null&&!_[_0x96aa('0x35')](_0x342537);};VoiceCallReport['prototype']['emit']=function(_0x386017,_0x121297,_0x2abe4f){io['to'](_0x386017)['emit'](_0x121297,_0x2abe4f);};VoiceCallReport[_0x96aa('0x36')][_0x96aa('0x37')]=function(_0x2b983c){try{if(this[_0x96aa('0x34')](_0x2b983c)){logger['info']('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x2b983c['uniqueid'],_0x2b983c[_0x96aa('0x38')],_0x2b983c[_0x96aa('0x39')]);logger[_0x96aa('0x3a')](_0x96aa('0x3b'),_0x2b983c[_0x96aa('0x3c')],util[_0x96aa('0x3d')](_0x2b983c,{'showHidden':![],'depth':null}));if(_0x2b983c[_0x96aa('0x3c')]===_0x2b983c[_0x96aa('0x3e')]){if(!_[_0x96aa('0x35')](this['channels'][_0x2b983c[_0x96aa('0x3c')]])){_['merge'](this[_0x96aa('0x3f')][_0x2b983c['uniqueid']],_[_0x96aa('0x40')](_0x2b983c,_[_0x96aa('0x41')](this['channels'][_0x2b983c[_0x96aa('0x3c')]])));}}}}catch(_0x3d862e){logger[_0x96aa('0x32')](_0x96aa('0x42'),_0x2b983c[_0x96aa('0x3c')],util[_0x96aa('0x3d')](_0x3d862e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x96aa('0x36')][_0x96aa('0x24')]=function(_0x2d1936){try{if(this[_0x96aa('0x34')](_0x2d1936)){logger[_0x96aa('0x3a')]('[%s][voiceCallReport][newchannel]\x20event:',_0x2d1936['uniqueid'],util[_0x96aa('0x3d')](_0x2d1936,{'showHidden':![],'depth':null}));if(_0x2d1936[_0x96aa('0x3c')]===_0x2d1936[_0x96aa('0x3e')]&&_0x2d1936[_0x96aa('0x43')]!=_0x96aa('0x44')){if(_[_0x96aa('0x35')](this[_0x96aa('0x3f')][_0x2d1936[_0x96aa('0x3c')]])){logger['info'](_0x96aa('0x45'),_0x2d1936[_0x96aa('0x3c')],_0x2d1936[_0x96aa('0x46')],_0x2d1936[_0x96aa('0x47')]);this[_0x96aa('0x3f')][_0x2d1936[_0x96aa('0x3c')]]=new Channel();this[_0x96aa('0x3f')][_0x2d1936['uniqueid']][_0x96aa('0x48')]=moment()[_0x96aa('0x49')](_0x96aa('0x4a'));this[_0x96aa('0x3f')][_0x2d1936['uniqueid']]['disposition']=dispositions[_[_0x96aa('0x4b')](_0x2d1936[_0x96aa('0x4c')])];_['merge'](this[_0x96aa('0x3f')][_0x2d1936[_0x96aa('0x3c')]],_[_0x96aa('0x40')](_0x2d1936,_['keys'](this['channels'][_0x2d1936[_0x96aa('0x3c')]])));if(_0x2d1936['context']===_0x96aa('0x4d')){if(this['agents'][_0x2d1936[_0x96aa('0x43')][_0x96aa('0x4e')]('-')[0x0]]){this['agents'][_0x2d1936[_0x96aa('0x43')]['split']('-')[0x0]]['destconnectedlinenum']=_0x2d1936[_0x96aa('0x47')];logger['debug'](_0x96aa('0x4f'),_0x2d1936['uniqueid'],util['inspect']({'destaccountcode':this[_0x96aa('0x1f')][_0x2d1936[_0x96aa('0x43')][_0x96aa('0x4e')]('-')[0x0]][_0x96aa('0x50')],'destconnectedlinenum':_0x2d1936['exten']},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x96aa('0x51'),this['agents'][_0x2d1936[_0x96aa('0x43')][_0x96aa('0x4e')]('-')[0x0]][_0x96aa('0x52')]),_0x96aa('0x53'),{'destaccountcode':this[_0x96aa('0x1f')][_0x2d1936[_0x96aa('0x43')][_0x96aa('0x4e')]('-')[0x0]][_0x96aa('0x50')],'destconnectedlinenum':_0x2d1936[_0x96aa('0x47')]});}}}}}}catch(_0x3ca53a){logger[_0x96aa('0x32')](_0x96aa('0x54'),_0x2d1936[_0x96aa('0x3c')],util[_0x96aa('0x3d')](_0x3ca53a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x96aa('0x36')][_0x96aa('0x21')]=function(_0x3ed1f1){try{if(this[_0x96aa('0x34')](_0x3ed1f1)){logger[_0x96aa('0x3a')](_0x96aa('0x55'),_0x3ed1f1[_0x96aa('0x3c')],util[_0x96aa('0x3d')](_0x3ed1f1,{'showHidden':![],'depth':null}));if(_0x3ed1f1['uniqueid']===_0x3ed1f1['linkedid']&&_0x3ed1f1[_0x96aa('0x47')]!='h'&&_0x3ed1f1[_0x96aa('0x43')]!=_0x96aa('0x44')){_0x3ed1f1['application']=_0x3ed1f1[_0x96aa('0x56')][_0x96aa('0x57')]();_0x3ed1f1[_0x96aa('0x58')]=(_0x3ed1f1['appdata']||_0x3ed1f1[_0x96aa('0x58')])[_0x96aa('0x57')]();logger[_0x96aa('0x2f')](_0x96aa('0x59'),_0x3ed1f1[_0x96aa('0x3c')],_0x3ed1f1[_0x96aa('0x56')],_0x3ed1f1[_0x96aa('0x58')]);if(_[_0x96aa('0x35')](this[_0x96aa('0x3f')][_0x3ed1f1[_0x96aa('0x3c')]])){this[_0x96aa('0x3f')][_0x3ed1f1['uniqueid']]=new Channel();this[_0x96aa('0x3f')][_0x3ed1f1[_0x96aa('0x3c')]][_0x96aa('0x48')]=_0x3ed1f1[_0x96aa('0x5a')]?moment()['subtract'](moment[_0x96aa('0x5a')](_0x3ed1f1[_0x96aa('0x5a')])[_0x96aa('0x5b')](),'seconds')[_0x96aa('0x49')](_0x96aa('0x4a')):moment()['format'](_0x96aa('0x4a'));this[_0x96aa('0x3f')][_0x3ed1f1[_0x96aa('0x3c')]]['disposition']='NO\x20ANSWER';}_[_0x96aa('0x5c')](this[_0x96aa('0x3f')][_0x3ed1f1['uniqueid']],_[_0x96aa('0x40')](_0x3ed1f1,_['keys'](this[_0x96aa('0x3f')][_0x3ed1f1[_0x96aa('0x3c')]])));if(_[_0x96aa('0x5d')](applications,_0x3ed1f1[_0x96aa('0x56')])){this[_0x96aa('0x3f')][_0x3ed1f1['uniqueid']]['lastapplication']=_0x3ed1f1[_0x96aa('0x56')];this[_0x96aa('0x3f')][_0x3ed1f1[_0x96aa('0x3c')]][_0x96aa('0x5e')]=_0x3ed1f1[_0x96aa('0x58')];if(_0x3ed1f1[_0x96aa('0x56')]==='set'&&_[_0x96aa('0x5f')](_0x3ed1f1['applicationdata'],_0x96aa('0x60'))){var _0x56b962=_0x3ed1f1['applicationdata'][_0x96aa('0x4e')]('=');var _0x2d922b=_0x56b962[0x0]['match'](/cdr\((.*)\)/);if(_0x2d922b){this[_0x96aa('0x3f')][_0x3ed1f1[_0x96aa('0x3c')]][_0x2d922b[0x1]]=_0x56b962[0x1];}}else if(_0x3ed1f1[_0x96aa('0x56')]===_0x96aa('0x14')){this[_0x96aa('0x3f')][_0x3ed1f1[_0x96aa('0x3c')]]['queue']=_0x3ed1f1[_0x96aa('0x58')][_0x96aa('0x4e')](',')[0x0];}}}}}catch(_0x5a1ea8){logger[_0x96aa('0x32')](_0x96aa('0x61'),_0x3ed1f1['uniqueid'],util[_0x96aa('0x3d')](_0x5a1ea8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x96aa('0x36')][_0x96aa('0x26')]=function(_0x303f00){try{if(this['isNotNull'](_0x303f00)){logger[_0x96aa('0x2f')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x303f00[_0x96aa('0x3c')],_0x303f00['linkedid'],_0x303f00['calleridname'],_0x303f00[_0x96aa('0x39')]);logger[_0x96aa('0x3a')]('[%s][voiceCallReport][newstate]\x20event:',_0x303f00['uniqueid'],util['inspect'](_0x303f00,{'showHidden':![],'depth':null}));if(_0x303f00[_0x96aa('0x3c')]!==_0x303f00[_0x96aa('0x3e')]){if(this[_0x96aa('0x3f')][_0x303f00['linkedid']]){if(_0x303f00[_0x96aa('0x4c')]==='6'){if(!this[_0x96aa('0x3f')][_0x303f00[_0x96aa('0x3e')]][_0x96aa('0x62')]){var _0x15d30e=moment();this[_0x96aa('0x3f')][_0x303f00[_0x96aa('0x3e')]][_0x96aa('0x62')]=!![];this[_0x96aa('0x3f')][_0x303f00[_0x96aa('0x3e')]][_0x96aa('0x63')]=_0x15d30e[_0x96aa('0x49')](_0x96aa('0x4a'));if(this[_0x96aa('0x3f')][_0x303f00['linkedid']][_0x96aa('0x48')]){this['channels'][_0x303f00[_0x96aa('0x3e')]][_0x96aa('0x64')]=_0x15d30e[_0x96aa('0x65')](this[_0x96aa('0x3f')][_0x303f00[_0x96aa('0x3e')]]['starttime'],_0x96aa('0x5b'));}}this['channels'][_0x303f00['linkedid']]['linkedid']=_0x303f00[_0x96aa('0x3c')];if(_0x303f00['calleridnum']!=='xcally-motion-preview'){this[_0x96aa('0x3f')][_0x303f00[_0x96aa('0x3e')]][_0x96aa('0x66')]=_0x303f00[_0x96aa('0x39')];}this['channels'][_0x303f00[_0x96aa('0x3e')]][_0x96aa('0x67')]=_0x303f00[_0x96aa('0x38')];this['channels'][_0x303f00[_0x96aa('0x3e')]]['destinationchannel']=_0x303f00['channel'];this[_0x96aa('0x3f')][_0x303f00['linkedid']]['disposition']=dispositions[_[_0x96aa('0x4b')](_0x303f00['channelstate'])];if(this['agents'][_0x303f00[_0x96aa('0x43')][_0x96aa('0x4e')]('-')[0x0]]){this['channels'][_0x303f00['linkedid']][_0x96aa('0x68')]=this['agents'][_0x303f00[_0x96aa('0x43')][_0x96aa('0x4e')]('-')[0x0]]['id'];this['channels'][_0x303f00[_0x96aa('0x3e')]][_0x96aa('0x69')]=this[_0x96aa('0x1f')][_0x303f00[_0x96aa('0x43')]['split']('-')[0x0]]['name'];}}}}else{if(this[_0x96aa('0x3f')][_0x303f00['uniqueid']]){if(_0x303f00[_0x96aa('0x4c')]==='6'){if(this[_0x96aa('0x1f')][_0x303f00[_0x96aa('0x43')]['split']('-')[0x0]]){this[_0x96aa('0x3f')][_0x303f00[_0x96aa('0x3c')]][_0x96aa('0x68')]=this[_0x96aa('0x1f')][_0x303f00[_0x96aa('0x43')]['split']('-')[0x0]]['id'];this[_0x96aa('0x3f')][_0x303f00['uniqueid']][_0x96aa('0x69')]=this[_0x96aa('0x1f')][_0x303f00['channel'][_0x96aa('0x4e')]('-')[0x0]][_0x96aa('0x52')];}}}}}}catch(_0x22b3cd){logger['error'](_0x96aa('0x6a'),_0x303f00[_0x96aa('0x3c')],util[_0x96aa('0x3d')](_0x22b3cd,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x96aa('0x6b')]=function(_0x408f3f,_0x2c15ad){try{if(this['channels'][_0x408f3f]){logger[_0x96aa('0x2f')](_0x96aa('0x6c'),_0x408f3f,_0x2c15ad);this[_0x96aa('0x3f')][_0x408f3f][_0x96aa('0x6d')]=!![];if(_['endsWith'](_0x2c15ad,_0x96aa('0x6e'))){_0x2c15ad=_0x2c15ad['replace'](_0x96aa('0x6e'),_0x96aa('0x6f'));}this[_0x96aa('0x3f')][_0x408f3f]['monitorFilename']=_0x2c15ad;var _0x4ff92c=_[_0x96aa('0x70')](this['channels'][_0x408f3f]['monitors'],{'filename':_0x2c15ad});if(_[_0x96aa('0x71')](_0x4ff92c)){this[_0x96aa('0x3f')][_0x408f3f][_0x96aa('0x72')][_0x96aa('0x73')]({'filename':_0x2c15ad,'createdAt':moment()[_0x96aa('0x49')](_0x96aa('0x4a')),'mixmonitorid':'','status':_0x96aa('0x74')});}}}catch(_0x29eda9){logger[_0x96aa('0x32')](_0x96aa('0x75'),_0x408f3f,util[_0x96aa('0x3d')](_0x29eda9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x96aa('0x36')][_0x96aa('0x29')]=function(_0x1efd4f){try{if(this[_0x96aa('0x34')](_0x1efd4f)){logger['debug'](_0x96aa('0x76'),_0x1efd4f[_0x96aa('0x3c')],util[_0x96aa('0x3d')](_0x1efd4f,{'showHidden':![],'depth':null}));if(this[_0x96aa('0x3f')][_0x1efd4f[_0x96aa('0x3c')]]&&_0x1efd4f[_0x96aa('0x43')]!=_0x96aa('0x44')){if(this['isNotNull'](_0x1efd4f[_0x96aa('0x77')])){if(this['isNotNull'](_0x1efd4f[_0x96aa('0x77')][_0x96aa('0x78')])){logger[_0x96aa('0x2f')](_0x96aa('0x79'),_0x1efd4f[_0x96aa('0x3c')],_0x1efd4f[_0x96aa('0x7a')]);this[_0x96aa('0x6b')](_0x1efd4f[_0x96aa('0x3c')],_0x1efd4f[_0x96aa('0x7a')]);}else if(this[_0x96aa('0x34')](_0x1efd4f[_0x96aa('0x77')][_0x96aa('0x7b')])){logger['info'](_0x96aa('0x7c'),_0x1efd4f[_0x96aa('0x3c')],_0x1efd4f[_0x96aa('0x7a')]);this[_0x96aa('0x3f')][_0x1efd4f[_0x96aa('0x3c')]]['calleridnum']=_0x1efd4f[_0x96aa('0x7a')];}else if(this[_0x96aa('0x34')](_0x1efd4f[_0x96aa('0x77')][_0x96aa('0x7d')])){logger[_0x96aa('0x2f')](_0x96aa('0x7e'),_0x1efd4f[_0x96aa('0x3c')],_0x1efd4f[_0x96aa('0x7a')]);this[_0x96aa('0x3f')][_0x1efd4f[_0x96aa('0x3c')]][_0x96aa('0x7f')]=_0x1efd4f[_0x96aa('0x7a')];}else if(this[_0x96aa('0x34')](_0x1efd4f[_0x96aa('0x77')][_0x96aa('0x80')])){logger['info'](_0x96aa('0x81'),_0x1efd4f[_0x96aa('0x3c')],_0x1efd4f[_0x96aa('0x7a')]);this[_0x96aa('0x3f')][_0x1efd4f[_0x96aa('0x3c')]][_0x96aa('0x82')]=_0x1efd4f[_0x96aa('0x7a')];}else if(this[_0x96aa('0x34')](_0x1efd4f['variable'][_0x96aa('0x83')])){logger[_0x96aa('0x2f')](_0x96aa('0x84'),_0x1efd4f[_0x96aa('0x3c')],_0x1efd4f[_0x96aa('0x7a')]['split'](',')[0x0]);this['channels'][_0x1efd4f['uniqueid']]['queue']=_0x1efd4f[_0x96aa('0x7a')][_0x96aa('0x4e')](',')[0x0];}else if(this['isNotNull'](_0x1efd4f['variable'][_0x96aa('0x85')])){logger[_0x96aa('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x1efd4f['uniqueid'],_0x1efd4f[_0x96aa('0x7a')]);this[_0x96aa('0x3f')][_0x1efd4f[_0x96aa('0x3c')]][_0x96aa('0x86')]=_0x1efd4f[_0x96aa('0x7a')];}else if(this['isNotNull'](_0x1efd4f[_0x96aa('0x77')]['xmd-destination'])){logger['info'](_0x96aa('0x87'),_0x1efd4f[_0x96aa('0x3c')],_0x1efd4f[_0x96aa('0x7a')]);this['channels'][_0x1efd4f['uniqueid']][_0x96aa('0x88')]=_0x1efd4f[_0x96aa('0x7a')];}else if(this[_0x96aa('0x34')](_0x1efd4f[_0x96aa('0x77')][_0x96aa('0x89')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x1efd4f[_0x96aa('0x3c')],_0x1efd4f[_0x96aa('0x7a')]);this[_0x96aa('0x3f')][_0x1efd4f['uniqueid']]['calleridpreview']=_0x1efd4f[_0x96aa('0x7a')];}else if(this['isNotNull'](_0x1efd4f[_0x96aa('0x77')][_0x96aa('0x8a')])){logger['info'](_0x96aa('0x8b'),_0x1efd4f['uniqueid'],_0x1efd4f['value']);this['channels'][_0x1efd4f[_0x96aa('0x3c')]][_0x96aa('0x14')]=_0x1efd4f[_0x96aa('0x7a')];}else if(this[_0x96aa('0x34')](_0x1efd4f[_0x96aa('0x77')][_0x96aa('0x8c')])){logger[_0x96aa('0x2f')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x1efd4f[_0x96aa('0x3c')],_0x1efd4f['value']);this[_0x96aa('0x3f')][_0x1efd4f['uniqueid']]['sipcalluniqueid']=_0x1efd4f[_0x96aa('0x7a')];}}}else if(this[_0x96aa('0x34')](_0x1efd4f[_0x96aa('0x77')][_0x96aa('0x78')])){if(_0x1efd4f['value']){var _0x19bee0=path[_0x96aa('0x8d')](_0x1efd4f['value'])['name'];logger[_0x96aa('0x2f')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x19bee0,_0x1efd4f[_0x96aa('0x7a')]);this[_0x96aa('0x6b')](_0x19bee0,_0x1efd4f['value']);}}else if(this[_0x96aa('0x3f')][_0x1efd4f[_0x96aa('0x3e')]]){if(this[_0x96aa('0x34')](_0x1efd4f[_0x96aa('0x77')])){if(this[_0x96aa('0x34')](_0x1efd4f[_0x96aa('0x77')][_0x96aa('0x8c')])){logger[_0x96aa('0x2f')](_0x96aa('0x8e'),_0x1efd4f['linkedid'],_0x1efd4f[_0x96aa('0x7a')]);this['channels'][_0x1efd4f[_0x96aa('0x3e')]][_0x96aa('0x8f')]=_0x1efd4f[_0x96aa('0x7a')];}}}}}catch(_0x55b93f){logger['error'](_0x96aa('0x90'),_0x1efd4f['uniqueid'],util['inspect'](_0x55b93f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x96aa('0x2b')]=function(_0x416a58){try{if(this[_0x96aa('0x34')](_0x416a58)){logger[_0x96aa('0x3a')](_0x96aa('0x91'),_0x416a58['uniqueid'],util[_0x96aa('0x3d')](_0x416a58,{'showHidden':![],'depth':null}));if(this[_0x96aa('0x3f')][_0x416a58['uniqueid']]){logger[_0x96aa('0x2f')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x416a58[_0x96aa('0x3c')],_0x416a58[_0x96aa('0x92')]);var _0x354bc4=moment();this[_0x96aa('0x3f')][_0x416a58['uniqueid']][_0x96aa('0x93')]=_0x354bc4[_0x96aa('0x49')](_0x96aa('0x4a'));this[_0x96aa('0x3f')][_0x416a58[_0x96aa('0x3c')]][_0x96aa('0x5a')]=_0x354bc4[_0x96aa('0x65')](this[_0x96aa('0x3f')][_0x416a58[_0x96aa('0x3c')]][_0x96aa('0x48')],_0x96aa('0x5b'));if(this[_0x96aa('0x3f')][_0x416a58[_0x96aa('0x3c')]][_0x96aa('0x62')]){this[_0x96aa('0x3f')][_0x416a58['uniqueid']][_0x96aa('0x94')]=_0x354bc4['diff'](this['channels'][_0x416a58[_0x96aa('0x3c')]]['answertime'],'seconds');this['channels'][_0x416a58['uniqueid']][_0x96aa('0x64')]=this[_0x96aa('0x3f')][_0x416a58['uniqueid']][_0x96aa('0x5a')]-this[_0x96aa('0x3f')][_0x416a58[_0x96aa('0x3c')]][_0x96aa('0x94')];}if(_0x416a58[_0x96aa('0x46')]===_0x96aa('0x4d')){if(this['agents'][_0x416a58['channel'][_0x96aa('0x4e')]('-')[0x0]]){this['agents'][_0x416a58['channel']['split']('-')[0x0]]=_[_0x96aa('0x95')](this['agents'][_0x416a58[_0x96aa('0x43')][_0x96aa('0x4e')]('-')[0x0]],[_0x96aa('0x96')]);logger[_0x96aa('0x3a')](_0x96aa('0x97'),_0x416a58[_0x96aa('0x3c')],util['inspect']({'destaccountcode':this[_0x96aa('0x1f')][_0x416a58[_0x96aa('0x43')][_0x96aa('0x4e')]('-')[0x0]][_0x96aa('0x50')]},{'showHidden':![],'depth':null}));this[_0x96aa('0x98')](util[_0x96aa('0x49')](_0x96aa('0x51'),this[_0x96aa('0x1f')][_0x416a58[_0x96aa('0x43')][_0x96aa('0x4e')]('-')[0x0]]['name']),'user:agentcomplete',{'destaccountcode':this[_0x96aa('0x1f')][_0x416a58[_0x96aa('0x43')]['split']('-')[0x0]][_0x96aa('0x50')]});}}var _0x434b48=this;Promise[_0x96aa('0x99')]()[_0x96aa('0x9a')](function(){var _0xaf70f5=_0x434b48['channels'][_0x416a58['uniqueid']];if(typeof _0xaf70f5[_0x96aa('0x9b')]===_0x96aa('0x9c'))return;if(_[_0x96aa('0x9d')](_0xaf70f5[_0x96aa('0x72')]))return;return RpcSetting[_0x96aa('0x9e')]()[_0x96aa('0x9a')](function(_0x1cdf4c){if(!_0x1cdf4c['stopRecordingOnTransfer'])return;return Promise[_0x96aa('0x99')]()[_0x96aa('0x9a')](function(){return ami[_0x96aa('0x9f')]({'action':_0x96aa('0xa0'),'channel':_0xaf70f5['channel']})['catch'](function(){});})[_0x96aa('0x9a')](function(){return ami['Action']({'action':_0x96aa('0xa0'),'channel':_0xaf70f5['destinationchannel']})[_0x96aa('0xa1')](function(){})[_0x96aa('0xa2')](function(){var _0x4ec250=_0x434b48[_0x96aa('0x1f')][_0xaf70f5[_0x96aa('0xa3')][_0x96aa('0x4e')]('-')[0x0]];if(!_0x4ec250)return;io[_0x96aa('0x98')](_0x96aa('0xa4'),{'agentId':_0x4ec250['id'],'uniqueid':_0xaf70f5[_0x96aa('0x3c')]});});});});})[_0x96aa('0x9a')](function(){if(_0x416a58[_0x96aa('0xa5')]==='BlindTransfer'){_0x434b48['blindTransfers'][_0x416a58[_0x96aa('0x3c')]]=_0x434b48[_0x96aa('0x3f')][_0x416a58[_0x96aa('0x3c')]];}else{if(_0x434b48[_0x96aa('0x3f')][_0x416a58[_0x96aa('0x3c')]][_0x96aa('0x82')]===_0x96aa('0xa6')&&_0x434b48[_0x96aa('0x20')][_0x416a58['uniqueid']]){_0x434b48[_0x96aa('0x3f')][_0x416a58['uniqueid']]['uniqueid']=[_0x434b48[_0x96aa('0x3f')][_0x416a58['uniqueid']][_0x96aa('0x3e')],_0x434b48[_0x96aa('0x3f')][_0x416a58[_0x96aa('0x3c')]][_0x96aa('0x3e')]=_0x434b48[_0x96aa('0x3f')][_0x416a58['uniqueid']][_0x96aa('0x3c')]][0x0];delete _0x434b48[_0x96aa('0x20')][_0x416a58[_0x96aa('0x3c')]];}}logger[_0x96aa('0x3a')]('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x416a58[_0x96aa('0x3c')],util[_0x96aa('0x3d')](_0x434b48[_0x96aa('0x3f')][_0x416a58[_0x96aa('0x3c')]],{'showHidden':![],'depth':null}));ami['emit'](_0x96aa('0xa7'),_0x434b48[_0x96aa('0x3f')][_0x416a58[_0x96aa('0x3c')]]);delete _0x434b48[_0x96aa('0x3f')][_0x416a58[_0x96aa('0x3c')]];});}}}catch(_0x5b5d9d){logger[_0x96aa('0x32')](_0x96aa('0xa8'),_0x416a58[_0x96aa('0x3c')],util['inspect'](_0x5b5d9d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x96aa('0x36')]['syncAttendedTransfer']=function(_0x5a6a17){try{if(this[_0x96aa('0x34')](_0x5a6a17)){logger[_0x96aa('0x2f')](_0x96aa('0xa9'),_0x5a6a17['uniqueid'],_0x5a6a17['origtransferercalleridnum'],_0x5a6a17[_0x96aa('0xaa')]);logger[_0x96aa('0x3a')](_0x96aa('0xab'),_0x5a6a17[_0x96aa('0x3c')],util[_0x96aa('0x3d')](_0x5a6a17,{'showHidden':![],'depth':null}));if(this[_0x96aa('0x3f')][_0x5a6a17[_0x96aa('0xac')]]){this[_0x96aa('0x3f')][_0x5a6a17['transfereeuniqueid']][_0x96aa('0xad')]=_0x5a6a17['origtransferercalleridnum'];this[_0x96aa('0x3f')][_0x5a6a17[_0x96aa('0xac')]][_0x96aa('0xae')]=_0x5a6a17[_0x96aa('0xaa')];if(this['channels'][_0x5a6a17[_0x96aa('0xaf')]]){var _0x55bd00=this[_0x96aa('0x3f')][_0x5a6a17[_0x96aa('0xaf')]];this[_0x96aa('0x3f')][_0x5a6a17[_0x96aa('0xaf')]]=this['channels'][_0x5a6a17[_0x96aa('0xac')]];this['channels'][_0x5a6a17['transfereeuniqueid']]=_0x55bd00;}}else if(this[_0x96aa('0x3f')][_0x5a6a17['transfertargetuniqueid']]){this[_0x96aa('0x3f')][_0x5a6a17[_0x96aa('0xb0')]][_0x96aa('0xad')]=_0x5a6a17[_0x96aa('0xb1')];this[_0x96aa('0x3f')][_0x5a6a17[_0x96aa('0xb0')]][_0x96aa('0xae')]=_0x5a6a17['transfertargetcalleridnum'];if(this[_0x96aa('0x3f')][_0x5a6a17['origtransfereruniqueid']]){var _0x55bd00=this['channels'][_0x5a6a17[_0x96aa('0xb2')]];this[_0x96aa('0x3f')][_0x5a6a17[_0x96aa('0xb2')]]=this[_0x96aa('0x3f')][_0x5a6a17[_0x96aa('0xb0')]];this[_0x96aa('0x3f')][_0x5a6a17[_0x96aa('0xb0')]]=_0x55bd00;}}if((this[_0x96aa('0x3f')][_0x5a6a17[_0x96aa('0xb2')]]||this['channels'][_0x5a6a17[_0x96aa('0xb3')]])&&this[_0x96aa('0x3f')][_0x5a6a17[_0x96aa('0xaf')]]){var _0x370a98=_[_0x96aa('0xb4')]([this[_0x96aa('0x3f')][_0x5a6a17[_0x96aa('0xb2')]],this[_0x96aa('0x3f')][_0x5a6a17['origtransfererlinkedid']],this['channels'][_0x5a6a17[_0x96aa('0xaf')]]],function(_0x366c2){return _0x366c2&&_0x366c2[_0x96aa('0x82')]===_0x96aa('0xa6')&&_0x366c2[_0x96aa('0xb5')];});if(_0x370a98){if(this[_0x96aa('0x3f')][_0x5a6a17[_0x96aa('0xb2')]])this['channels'][_0x5a6a17['origtransfereruniqueid']][_0x96aa('0x9b')]=_0x96aa('0xb6');if(this[_0x96aa('0x3f')][_0x5a6a17[_0x96aa('0xb3')]])this[_0x96aa('0x3f')][_0x5a6a17[_0x96aa('0xb3')]]['transferType']=_0x96aa('0xb6');this[_0x96aa('0x3f')][_0x5a6a17[_0x96aa('0xaf')]]['transferType']='ATTENDED';}}}}catch(_0x1a4a88){logger[_0x96aa('0x32')](_0x96aa('0xb7'),_0x5a6a17['uniqueid'],util[_0x96aa('0x3d')](_0x1a4a88,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x96aa('0xb8')]=function(_0x1581d1){try{if(this[_0x96aa('0x34')](_0x1581d1)){logger[_0x96aa('0x2f')](_0x96aa('0xb9'),_0x1581d1['uniqueid'],_0x1581d1[_0x96aa('0xba')],_0x1581d1[_0x96aa('0xbb')]);logger[_0x96aa('0x3a')]('[%s][voiceCallReport][blindtransfer]\x20event:',_0x1581d1[_0x96aa('0x3c')],util['inspect'](_0x1581d1,{'showHidden':![],'depth':null}));if(this[_0x96aa('0x3f')][_0x1581d1[_0x96aa('0xac')]]){this['channels'][_0x1581d1[_0x96aa('0xac')]][_0x96aa('0xad')]=_0x1581d1[_0x96aa('0xba')];this[_0x96aa('0x3f')][_0x1581d1['transfereeuniqueid']][_0x96aa('0xae')]=_0x1581d1[_0x96aa('0xbb')];this[_0x96aa('0x3f')][_0x1581d1[_0x96aa('0xac')]]['transferType']=_0x96aa('0xbc');this[_0x96aa('0x2b')]({'event':'BlindTransfer','uniqueid':_0x1581d1['transfereeuniqueid'],'context':_0x1581d1[_0x96aa('0x46')],'channel':_0x1581d1[_0x96aa('0xbd')]});}else{this[_0x96aa('0x3f')][_0x1581d1[_0x96aa('0xbe')]]['transferType']=_0x96aa('0xbc');}}}catch(_0x2d1c98){logger[_0x96aa('0x32')](_0x96aa('0xbf'),_0x1581d1[_0x96aa('0x3c')],util['inspect'](_0x2d1c98,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x96aa('0x36')]['syncMusicOnHoldStart']=function(_0x2df9df){try{if(this[_0x96aa('0x34')](_0x2df9df)){logger[_0x96aa('0x3a')](_0x96aa('0xc0'),_0x2df9df['uniqueid'],util[_0x96aa('0x3d')](_0x2df9df,{'showHidden':![],'depth':null}));if(this[_0x96aa('0x3f')][_0x2df9df[_0x96aa('0x3c')]]){if(!_[_0x96aa('0x71')](this['channels'][_0x2df9df[_0x96aa('0x3c')]][_0x96aa('0x63')])){this[_0x96aa('0x3f')][_0x2df9df[_0x96aa('0x3c')]][_0x96aa('0xc1')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0x96aa('0x2f')](_0x96aa('0xc2'),_0x2df9df['uniqueid'],this[_0x96aa('0x3f')][_0x2df9df[_0x96aa('0x3c')]]['mohstarttime']);}}}}catch(_0x4c2082){logger[_0x96aa('0x32')](_0x96aa('0xc3'),_0x2df9df[_0x96aa('0x3c')],util[_0x96aa('0x3d')](_0x4c2082,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x96aa('0x36')][_0x96aa('0xc4')]=function(_0x12836e){try{if(this['isNotNull'](_0x12836e)){logger[_0x96aa('0x3a')](_0x96aa('0xc5'),_0x12836e[_0x96aa('0x3c')],util[_0x96aa('0x3d')](_0x12836e,{'showHidden':![],'depth':null}));if(this[_0x96aa('0x3f')][_0x12836e[_0x96aa('0x3c')]]){if(!_[_0x96aa('0x71')](this[_0x96aa('0x3f')][_0x12836e[_0x96aa('0x3c')]]['mohstarttime'])){this[_0x96aa('0x3f')][_0x12836e['uniqueid']]['mohtime']+=moment()[_0x96aa('0xc6')](0x0)[_0x96aa('0x65')](this['channels'][_0x12836e['uniqueid']]['mohstarttime'],_0x96aa('0x5b'));logger[_0x96aa('0x2f')](_0x96aa('0xc7'),_0x12836e[_0x96aa('0x3c')],this[_0x96aa('0x3f')][_0x12836e['uniqueid']]['mohtime']);delete this[_0x96aa('0x3f')][_0x12836e[_0x96aa('0x3c')]][_0x96aa('0xc1')];}}}}catch(_0x14c7ae){logger[_0x96aa('0x32')](_0x96aa('0xc8'),_0x12836e[_0x96aa('0x3c')],util[_0x96aa('0x3d')](_0x14c7ae,{'showHidden':![],'depth':null}));}};module[_0x96aa('0xc9')]=VoiceCallReport;
\ No newline at end of file