Built motion from commit 5b761a7b.|2.5.36
[motion2.git] / server / services / ami / report / voiceCallReport.js
index 18a9785..54f3dd5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe6e0=['outbound','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransferercalleridnum','transferconnectedlinenum','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','syncMusicOnHoldStop','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','../../../config/environment','../../../config/logger','../ami','unknown','not_inuse','inuse','invalid','unavailable','ringinuse','onhold','set','queue','agi','dial','playback','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','syncVarSet','hangup','syncHangup','syncNewCallerId','attendedtransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','info','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','inspect','uniqueid','linkedid','merge','pick','keys','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','split','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','name','user:agentconnect','accountcode','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','format','includes','cdr(','match','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinename','UserId','membername','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','.wav49','replace','.WAV','find','isNil','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','mixmonitor_filename','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:%s','user:agentcomplete','BlindTransfer'];(function(_0x49b076,_0x4fb74e){var _0xa3609=function(_0x474e71){while(--_0x474e71){_0x49b076['push'](_0x49b076['shift']());}};_0xa3609(++_0x4fb74e);}(_0xe6e0,0x17d));var _0x0e6e=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0xe6e0[_0x3826ad];return _0x17b900;};'use strict';var BPromise=require('bluebird');var _=require(_0x0e6e('0x0'));var moment=require(_0x0e6e('0x1'));var util=require(_0x0e6e('0x2'));var path=require('path');var Redis=require('ioredis');var config=require(_0x0e6e('0x3'));var logger=require(_0x0e6e('0x4'))('ami');var ami=require(_0x0e6e('0x5'));var Channel=require('../model/channel');var statusDesc=[_0x0e6e('0x6'),_0x0e6e('0x7'),_0x0e6e('0x8'),'busy',_0x0e6e('0x9'),_0x0e6e('0xa'),'ringing',_0x0e6e('0xb'),_0x0e6e('0xc')];var applications=[_0x0e6e('0xd'),_0x0e6e('0xe'),_0x0e6e('0xf'),_0x0e6e('0x10'),_0x0e6e('0x11'),'voicemail'];var dispositions=[_0x0e6e('0x12'),_0x0e6e('0x13'),_0x0e6e('0x13'),_0x0e6e('0x12'),'NO\x20ANSWER','NO\x20ANSWER',_0x0e6e('0x14'),_0x0e6e('0x15'),_0x0e6e('0x13'),_0x0e6e('0x13'),_0x0e6e('0x13')];var actions={};config[_0x0e6e('0x16')]=_[_0x0e6e('0x17')](config[_0x0e6e('0x16')],{'host':_0x0e6e('0x18'),'port':0x18eb});var io=require(_0x0e6e('0x19'))(new Redis(config['redis']));function VoiceCallReport(_0x216389){this[_0x0e6e('0x1a')]=_0x216389[_0x0e6e('0x1a')];this[_0x0e6e('0x1b')]=_0x216389[_0x0e6e('0x1b')];this[_0x0e6e('0x1c')]={};ami['on'](_0x0e6e('0x1d'),this[_0x0e6e('0x1e')][_0x0e6e('0x1f')](this));ami['on'](_0x0e6e('0x20'),this[_0x0e6e('0x1e')][_0x0e6e('0x1f')](this));ami['on'](_0x0e6e('0x21'),this[_0x0e6e('0x22')][_0x0e6e('0x1f')](this));ami['on']('newstate',this['syncNewState']['bind'](this));ami['on']('varset',this[_0x0e6e('0x23')]['bind'](this));ami['on'](_0x0e6e('0x24'),this[_0x0e6e('0x25')][_0x0e6e('0x1f')](this));ami['on']('newcallerid',this[_0x0e6e('0x26')][_0x0e6e('0x1f')](this));ami['on'](_0x0e6e('0x27'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0x0e6e('0x28'),this['syncBlindTransfer'][_0x0e6e('0x1f')](this));ami['on'](_0x0e6e('0x29'),this[_0x0e6e('0x2a')][_0x0e6e('0x1f')](this));ami['on'](_0x0e6e('0x2b'),this['syncMusicOnHoldStop'][_0x0e6e('0x1f')](this));try{logger[_0x0e6e('0x2c')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0x0e6e('0x2d')]();}catch(_0x5b7d61){logger[_0x0e6e('0x2e')](_0x0e6e('0x2f'),util['inspect'](_0x5b7d61,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x0e6e('0x30')][_0x0e6e('0x31')]=function(_0x2353f5){return _0x2353f5!==null&&!_[_0x0e6e('0x32')](_0x2353f5);};VoiceCallReport[_0x0e6e('0x30')][_0x0e6e('0x33')]=function(_0x34521a,_0x5a6378,_0x14b135){io['to'](_0x34521a)[_0x0e6e('0x33')](_0x5a6378,_0x14b135);};VoiceCallReport[_0x0e6e('0x30')][_0x0e6e('0x26')]=function(_0x5cb55d){try{if(this[_0x0e6e('0x31')](_0x5cb55d)){logger[_0x0e6e('0x2c')](_0x0e6e('0x34'),_0x5cb55d['uniqueid'],_0x5cb55d[_0x0e6e('0x35')],_0x5cb55d[_0x0e6e('0x36')]);logger[_0x0e6e('0x37')](_0x0e6e('0x38'),_0x5cb55d['uniqueid'],util[_0x0e6e('0x39')](_0x5cb55d,{'showHidden':![],'depth':null}));if(_0x5cb55d[_0x0e6e('0x3a')]===_0x5cb55d[_0x0e6e('0x3b')]){if(!_[_0x0e6e('0x32')](this[_0x0e6e('0x1a')][_0x5cb55d['uniqueid']])){_[_0x0e6e('0x3c')](this[_0x0e6e('0x1a')][_0x5cb55d[_0x0e6e('0x3a')]],_[_0x0e6e('0x3d')](_0x5cb55d,_[_0x0e6e('0x3e')](this[_0x0e6e('0x1a')][_0x5cb55d[_0x0e6e('0x3a')]])));}}}}catch(_0x357ddd){logger[_0x0e6e('0x2e')](_0x0e6e('0x3f'),_0x5cb55d['uniqueid'],util[_0x0e6e('0x39')](_0x357ddd,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0e6e('0x30')][_0x0e6e('0x22')]=function(_0x384435){try{if(this['isNotNull'](_0x384435)){logger['debug'](_0x0e6e('0x40'),_0x384435[_0x0e6e('0x3a')],util[_0x0e6e('0x39')](_0x384435,{'showHidden':![],'depth':null}));if(_0x384435['uniqueid']===_0x384435[_0x0e6e('0x3b')]&&_0x384435[_0x0e6e('0x41')]!=_0x0e6e('0x42')){if(_['isUndefined'](this[_0x0e6e('0x1a')][_0x384435['uniqueid']])){logger['info'](_0x0e6e('0x43'),_0x384435['uniqueid'],_0x384435[_0x0e6e('0x44')],_0x384435[_0x0e6e('0x45')]);this['channels'][_0x384435[_0x0e6e('0x3a')]]=new Channel();this[_0x0e6e('0x1a')][_0x384435[_0x0e6e('0x3a')]][_0x0e6e('0x46')]=moment()['format'](_0x0e6e('0x47'));this[_0x0e6e('0x1a')][_0x384435[_0x0e6e('0x3a')]][_0x0e6e('0x48')]=dispositions[_[_0x0e6e('0x49')](_0x384435[_0x0e6e('0x4a')])];_[_0x0e6e('0x3c')](this[_0x0e6e('0x1a')][_0x384435['uniqueid']],_[_0x0e6e('0x3d')](_0x384435,_['keys'](this[_0x0e6e('0x1a')][_0x384435[_0x0e6e('0x3a')]])));if(_0x384435[_0x0e6e('0x44')]==='from-sip'){if(this[_0x0e6e('0x1b')][_0x384435['channel'][_0x0e6e('0x4b')]('-')[0x0]]){this[_0x0e6e('0x1b')][_0x384435[_0x0e6e('0x41')][_0x0e6e('0x4b')]('-')[0x0]][_0x0e6e('0x4c')]=_0x384435[_0x0e6e('0x45')];logger['debug'](_0x0e6e('0x4d'),_0x384435[_0x0e6e('0x3a')],util[_0x0e6e('0x39')]({'destaccountcode':this[_0x0e6e('0x1b')][_0x384435[_0x0e6e('0x41')][_0x0e6e('0x4b')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x384435[_0x0e6e('0x45')]},{'showHidden':![],'depth':null}));this[_0x0e6e('0x33')](util['format']('user:%s',this['agents'][_0x384435[_0x0e6e('0x41')][_0x0e6e('0x4b')]('-')[0x0]][_0x0e6e('0x4e')]),_0x0e6e('0x4f'),{'destaccountcode':this[_0x0e6e('0x1b')][_0x384435[_0x0e6e('0x41')][_0x0e6e('0x4b')]('-')[0x0]][_0x0e6e('0x50')],'destconnectedlinenum':_0x384435[_0x0e6e('0x45')]});}}}}}}catch(_0x5e1658){logger[_0x0e6e('0x2e')](_0x0e6e('0x51'),_0x384435[_0x0e6e('0x3a')],util[_0x0e6e('0x39')](_0x5e1658,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0e6e('0x30')][_0x0e6e('0x1e')]=function(_0x4c85ae){try{if(this[_0x0e6e('0x31')](_0x4c85ae)){logger[_0x0e6e('0x37')](_0x0e6e('0x52'),_0x4c85ae[_0x0e6e('0x3a')],util['inspect'](_0x4c85ae,{'showHidden':![],'depth':null}));if(_0x4c85ae[_0x0e6e('0x3a')]===_0x4c85ae[_0x0e6e('0x3b')]&&_0x4c85ae[_0x0e6e('0x45')]!='h'&&_0x4c85ae[_0x0e6e('0x41')]!='OutgoingSpoolFailed'){_0x4c85ae[_0x0e6e('0x53')]=_0x4c85ae[_0x0e6e('0x53')][_0x0e6e('0x54')]();_0x4c85ae[_0x0e6e('0x55')]=(_0x4c85ae['appdata']||_0x4c85ae[_0x0e6e('0x55')])[_0x0e6e('0x54')]();logger[_0x0e6e('0x2c')](_0x0e6e('0x56'),_0x4c85ae[_0x0e6e('0x3a')],_0x4c85ae[_0x0e6e('0x53')],_0x4c85ae[_0x0e6e('0x55')]);if(_[_0x0e6e('0x32')](this['channels'][_0x4c85ae[_0x0e6e('0x3a')]])){this[_0x0e6e('0x1a')][_0x4c85ae[_0x0e6e('0x3a')]]=new Channel();this[_0x0e6e('0x1a')][_0x4c85ae[_0x0e6e('0x3a')]][_0x0e6e('0x46')]=_0x4c85ae['duration']?moment()['subtract'](moment[_0x0e6e('0x57')](_0x4c85ae['duration'])['seconds'](),_0x0e6e('0x58'))[_0x0e6e('0x59')](_0x0e6e('0x47')):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0e6e('0x1a')][_0x4c85ae[_0x0e6e('0x3a')]]['disposition']=_0x0e6e('0x12');}_[_0x0e6e('0x3c')](this['channels'][_0x4c85ae[_0x0e6e('0x3a')]],_[_0x0e6e('0x3d')](_0x4c85ae,_[_0x0e6e('0x3e')](this['channels'][_0x4c85ae[_0x0e6e('0x3a')]])));if(_[_0x0e6e('0x5a')](applications,_0x4c85ae['application'])){this['channels'][_0x4c85ae['uniqueid']]['lastapplication']=_0x4c85ae['application'];this[_0x0e6e('0x1a')][_0x4c85ae[_0x0e6e('0x3a')]]['lastdata']=_0x4c85ae[_0x0e6e('0x55')];if(_0x4c85ae[_0x0e6e('0x53')]===_0x0e6e('0xd')&&_['startsWith'](_0x4c85ae[_0x0e6e('0x55')],_0x0e6e('0x5b'))){var _0x2cf626=_0x4c85ae[_0x0e6e('0x55')][_0x0e6e('0x4b')]('=');var _0x116890=_0x2cf626[0x0][_0x0e6e('0x5c')](/cdr\((.*)\)/);if(_0x116890){this[_0x0e6e('0x1a')][_0x4c85ae[_0x0e6e('0x3a')]][_0x116890[0x1]]=_0x2cf626[0x1];}}else if(_0x4c85ae[_0x0e6e('0x53')]==='queue'){this[_0x0e6e('0x1a')][_0x4c85ae[_0x0e6e('0x3a')]][_0x0e6e('0xe')]=_0x4c85ae[_0x0e6e('0x55')][_0x0e6e('0x4b')](',')[0x0];}}}}}catch(_0x5d74a4){logger['error'](_0x0e6e('0x5d'),_0x4c85ae[_0x0e6e('0x3a')],util['inspect'](_0x5d74a4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0e6e('0x30')][_0x0e6e('0x5e')]=function(_0x49a6e0){try{if(this[_0x0e6e('0x31')](_0x49a6e0)){logger['info'](_0x0e6e('0x5f'),_0x49a6e0[_0x0e6e('0x3a')],_0x49a6e0['linkedid'],_0x49a6e0['calleridname'],_0x49a6e0[_0x0e6e('0x36')]);logger['debug'](_0x0e6e('0x60'),_0x49a6e0[_0x0e6e('0x3a')],util[_0x0e6e('0x39')](_0x49a6e0,{'showHidden':![],'depth':null}));if(_0x49a6e0['uniqueid']!==_0x49a6e0[_0x0e6e('0x3b')]){if(this[_0x0e6e('0x1a')][_0x49a6e0[_0x0e6e('0x3b')]]){if(_0x49a6e0[_0x0e6e('0x4a')]==='6'){if(!this[_0x0e6e('0x1a')][_0x49a6e0[_0x0e6e('0x3b')]][_0x0e6e('0x61')]){var _0x1b2aaa=moment();this['channels'][_0x49a6e0[_0x0e6e('0x3b')]]['answered']=!![];this[_0x0e6e('0x1a')][_0x49a6e0[_0x0e6e('0x3b')]][_0x0e6e('0x62')]=_0x1b2aaa[_0x0e6e('0x59')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x0e6e('0x1a')][_0x49a6e0[_0x0e6e('0x3b')]][_0x0e6e('0x46')]){this[_0x0e6e('0x1a')][_0x49a6e0[_0x0e6e('0x3b')]][_0x0e6e('0x63')]=_0x1b2aaa[_0x0e6e('0x64')](this[_0x0e6e('0x1a')][_0x49a6e0[_0x0e6e('0x3b')]]['starttime'],_0x0e6e('0x58'));}}this['channels'][_0x49a6e0[_0x0e6e('0x3b')]][_0x0e6e('0x3b')]=_0x49a6e0[_0x0e6e('0x3a')];if(_0x49a6e0[_0x0e6e('0x36')]!==_0x0e6e('0x65')){this['channels'][_0x49a6e0[_0x0e6e('0x3b')]]['connectedlinenum']=_0x49a6e0[_0x0e6e('0x36')];}this[_0x0e6e('0x1a')][_0x49a6e0[_0x0e6e('0x3b')]][_0x0e6e('0x66')]=_0x49a6e0[_0x0e6e('0x35')];this[_0x0e6e('0x1a')][_0x49a6e0[_0x0e6e('0x3b')]]['destinationchannel']=_0x49a6e0[_0x0e6e('0x41')];this[_0x0e6e('0x1a')][_0x49a6e0[_0x0e6e('0x3b')]]['disposition']=dispositions[_[_0x0e6e('0x49')](_0x49a6e0[_0x0e6e('0x4a')])];if(this[_0x0e6e('0x1b')][_0x49a6e0[_0x0e6e('0x41')]['split']('-')[0x0]]){this['channels'][_0x49a6e0['linkedid']][_0x0e6e('0x67')]=this[_0x0e6e('0x1b')][_0x49a6e0[_0x0e6e('0x41')][_0x0e6e('0x4b')]('-')[0x0]]['id'];this[_0x0e6e('0x1a')][_0x49a6e0[_0x0e6e('0x3b')]][_0x0e6e('0x68')]=this[_0x0e6e('0x1b')][_0x49a6e0['channel']['split']('-')[0x0]]['name'];}}}}else{if(this[_0x0e6e('0x1a')][_0x49a6e0[_0x0e6e('0x3a')]]){if(_0x49a6e0[_0x0e6e('0x4a')]==='6'){if(this[_0x0e6e('0x1b')][_0x49a6e0[_0x0e6e('0x41')][_0x0e6e('0x4b')]('-')[0x0]]){this[_0x0e6e('0x1a')][_0x49a6e0[_0x0e6e('0x3a')]][_0x0e6e('0x67')]=this['agents'][_0x49a6e0[_0x0e6e('0x41')]['split']('-')[0x0]]['id'];this[_0x0e6e('0x1a')][_0x49a6e0[_0x0e6e('0x3a')]][_0x0e6e('0x68')]=this[_0x0e6e('0x1b')][_0x49a6e0[_0x0e6e('0x41')][_0x0e6e('0x4b')]('-')[0x0]][_0x0e6e('0x4e')];}}}}}}catch(_0x4c4480){logger[_0x0e6e('0x2e')]('[%s][voiceCallReport][newstate]',_0x49a6e0['uniqueid'],util[_0x0e6e('0x39')](_0x4c4480,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0e6e('0x30')][_0x0e6e('0x69')]=function(_0x451f95,_0x2870d5){try{if(this[_0x0e6e('0x1a')][_0x451f95]){logger[_0x0e6e('0x2c')](_0x0e6e('0x6a'),_0x451f95,_0x2870d5);this['channels'][_0x451f95]['monitor']=!![];if(_[_0x0e6e('0x6b')](_0x2870d5,_0x0e6e('0x6c'))){_0x2870d5=_0x2870d5[_0x0e6e('0x6d')](_0x0e6e('0x6c'),_0x0e6e('0x6e'));}this[_0x0e6e('0x1a')][_0x451f95]['monitorFilename']=_0x2870d5;var _0x1382fb=_[_0x0e6e('0x6f')](this[_0x0e6e('0x1a')][_0x451f95]['monitors'],{'filename':_0x2870d5});if(_[_0x0e6e('0x70')](_0x1382fb)){this['channels'][_0x451f95][_0x0e6e('0x71')][_0x0e6e('0x72')]({'filename':_0x2870d5,'createdAt':moment()[_0x0e6e('0x59')](_0x0e6e('0x47')),'mixmonitorid':'','status':_0x0e6e('0x73')});}}}catch(_0x596f14){logger[_0x0e6e('0x2e')](_0x0e6e('0x74'),_0x451f95,util[_0x0e6e('0x39')](_0x596f14,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0e6e('0x30')][_0x0e6e('0x23')]=function(_0x1151aa){try{if(this['isNotNull'](_0x1151aa)){logger[_0x0e6e('0x37')](_0x0e6e('0x75'),_0x1151aa['uniqueid'],util[_0x0e6e('0x39')](_0x1151aa,{'showHidden':![],'depth':null}));if(this[_0x0e6e('0x1a')][_0x1151aa[_0x0e6e('0x3a')]]&&_0x1151aa[_0x0e6e('0x41')]!=_0x0e6e('0x42')){if(this[_0x0e6e('0x31')](_0x1151aa[_0x0e6e('0x76')])){if(this[_0x0e6e('0x31')](_0x1151aa[_0x0e6e('0x76')]['mixmonitor_filename'])){logger[_0x0e6e('0x2c')](_0x0e6e('0x77'),_0x1151aa[_0x0e6e('0x3a')],_0x1151aa[_0x0e6e('0x78')]);this[_0x0e6e('0x69')](_0x1151aa[_0x0e6e('0x3a')],_0x1151aa['value']);}else if(this['isNotNull'](_0x1151aa[_0x0e6e('0x76')]['xmd-phone'])){logger['info'](_0x0e6e('0x79'),_0x1151aa['uniqueid'],_0x1151aa['value']);this['channels'][_0x1151aa[_0x0e6e('0x3a')]]['calleridnum']=_0x1151aa['value'];}else if(this['isNotNull'](_0x1151aa[_0x0e6e('0x76')][_0x0e6e('0x7a')])){logger[_0x0e6e('0x2c')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x1151aa[_0x0e6e('0x3a')],_0x1151aa['value']);this[_0x0e6e('0x1a')][_0x1151aa[_0x0e6e('0x3a')]][_0x0e6e('0x7b')]=_0x1151aa['value'];}else if(this[_0x0e6e('0x31')](_0x1151aa[_0x0e6e('0x76')]['xmd-cdrtype'])){logger[_0x0e6e('0x2c')](_0x0e6e('0x7c'),_0x1151aa['uniqueid'],_0x1151aa[_0x0e6e('0x78')]);this[_0x0e6e('0x1a')][_0x1151aa[_0x0e6e('0x3a')]][_0x0e6e('0x7d')]=_0x1151aa['value'];}else if(this[_0x0e6e('0x31')](_0x1151aa[_0x0e6e('0x76')]['xmd-queue'])){logger[_0x0e6e('0x2c')](_0x0e6e('0x7e'),_0x1151aa[_0x0e6e('0x3a')],_0x1151aa[_0x0e6e('0x78')]['split'](',')[0x0]);this[_0x0e6e('0x1a')][_0x1151aa[_0x0e6e('0x3a')]][_0x0e6e('0xe')]=_0x1151aa[_0x0e6e('0x78')]['split'](',')[0x0];}else if(this['isNotNull'](_0x1151aa[_0x0e6e('0x76')]['xmd-originatecalleridnum'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x1151aa[_0x0e6e('0x3a')],_0x1151aa[_0x0e6e('0x78')]);this[_0x0e6e('0x1a')][_0x1151aa['uniqueid']][_0x0e6e('0x7f')]=_0x1151aa['value'];}else if(this['isNotNull'](_0x1151aa[_0x0e6e('0x76')][_0x0e6e('0x80')])){logger[_0x0e6e('0x2c')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x1151aa[_0x0e6e('0x3a')],_0x1151aa[_0x0e6e('0x78')]);this[_0x0e6e('0x1a')][_0x1151aa['uniqueid']][_0x0e6e('0x81')]=_0x1151aa[_0x0e6e('0x78')];}else if(this[_0x0e6e('0x31')](_0x1151aa[_0x0e6e('0x76')][_0x0e6e('0x82')])){logger[_0x0e6e('0x2c')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x1151aa[_0x0e6e('0x3a')],_0x1151aa[_0x0e6e('0x78')]);this[_0x0e6e('0x1a')][_0x1151aa[_0x0e6e('0x3a')]][_0x0e6e('0x83')]=_0x1151aa[_0x0e6e('0x78')];}else if(this[_0x0e6e('0x31')](_0x1151aa['variable']['xmcs-queue'])){logger[_0x0e6e('0x2c')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x1151aa['uniqueid'],_0x1151aa[_0x0e6e('0x78')]);this[_0x0e6e('0x1a')][_0x1151aa[_0x0e6e('0x3a')]][_0x0e6e('0xe')]=_0x1151aa[_0x0e6e('0x78')];}else if(this['isNotNull'](_0x1151aa[_0x0e6e('0x76')][_0x0e6e('0x84')])){logger[_0x0e6e('0x2c')](_0x0e6e('0x85'),_0x1151aa[_0x0e6e('0x3a')],_0x1151aa['value']);this[_0x0e6e('0x1a')][_0x1151aa[_0x0e6e('0x3a')]][_0x0e6e('0x86')]=_0x1151aa[_0x0e6e('0x78')];}}}else if(this[_0x0e6e('0x31')](_0x1151aa[_0x0e6e('0x76')][_0x0e6e('0x87')])){if(_0x1151aa[_0x0e6e('0x78')]){var _0x383d69=path['parse'](_0x1151aa[_0x0e6e('0x78')])['name'];logger['info'](_0x0e6e('0x77'),_0x383d69,_0x1151aa[_0x0e6e('0x78')]);this[_0x0e6e('0x69')](_0x383d69,_0x1151aa[_0x0e6e('0x78')]);}}else if(this[_0x0e6e('0x1a')][_0x1151aa['linkedid']]){if(this[_0x0e6e('0x31')](_0x1151aa['variable'])){if(this[_0x0e6e('0x31')](_0x1151aa[_0x0e6e('0x76')]['sipcallid'])){logger[_0x0e6e('0x2c')](_0x0e6e('0x85'),_0x1151aa[_0x0e6e('0x3b')],_0x1151aa[_0x0e6e('0x78')]);this[_0x0e6e('0x1a')][_0x1151aa[_0x0e6e('0x3b')]][_0x0e6e('0x88')]=_0x1151aa[_0x0e6e('0x78')];}}}}}catch(_0x5e8068){logger[_0x0e6e('0x2e')](_0x0e6e('0x89'),_0x1151aa[_0x0e6e('0x3a')],util['inspect'](_0x5e8068,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0e6e('0x30')]['syncHangup']=function(_0x40cc3f){try{if(this[_0x0e6e('0x31')](_0x40cc3f)){logger[_0x0e6e('0x37')]('[%s][voiceCallReport][hangup]\x20event:',_0x40cc3f[_0x0e6e('0x3a')],util[_0x0e6e('0x39')](_0x40cc3f,{'showHidden':![],'depth':null}));if(this[_0x0e6e('0x1a')][_0x40cc3f[_0x0e6e('0x3a')]]){logger[_0x0e6e('0x2c')](_0x0e6e('0x8a'),_0x40cc3f['uniqueid'],_0x40cc3f[_0x0e6e('0x8b')]);var _0x21ef50=moment();this['channels'][_0x40cc3f[_0x0e6e('0x3a')]][_0x0e6e('0x8c')]=_0x21ef50[_0x0e6e('0x59')](_0x0e6e('0x47'));this[_0x0e6e('0x1a')][_0x40cc3f[_0x0e6e('0x3a')]]['duration']=_0x21ef50['diff'](this[_0x0e6e('0x1a')][_0x40cc3f[_0x0e6e('0x3a')]]['starttime'],_0x0e6e('0x58'));if(this[_0x0e6e('0x1a')][_0x40cc3f[_0x0e6e('0x3a')]][_0x0e6e('0x61')]){this[_0x0e6e('0x1a')][_0x40cc3f[_0x0e6e('0x3a')]][_0x0e6e('0x8d')]=_0x21ef50['diff'](this[_0x0e6e('0x1a')][_0x40cc3f[_0x0e6e('0x3a')]][_0x0e6e('0x62')],_0x0e6e('0x58'));this[_0x0e6e('0x1a')][_0x40cc3f[_0x0e6e('0x3a')]][_0x0e6e('0x63')]=this['channels'][_0x40cc3f['uniqueid']][_0x0e6e('0x57')]-this[_0x0e6e('0x1a')][_0x40cc3f['uniqueid']]['billableseconds'];}if(_0x40cc3f['context']==='from-sip'){if(this[_0x0e6e('0x1b')][_0x40cc3f[_0x0e6e('0x41')]['split']('-')[0x0]]){this[_0x0e6e('0x1b')][_0x40cc3f['channel'][_0x0e6e('0x4b')]('-')[0x0]]=_[_0x0e6e('0x8e')](this[_0x0e6e('0x1b')][_0x40cc3f[_0x0e6e('0x41')][_0x0e6e('0x4b')]('-')[0x0]],[_0x0e6e('0x4c')]);logger[_0x0e6e('0x37')](_0x0e6e('0x8f'),_0x40cc3f[_0x0e6e('0x3a')],util[_0x0e6e('0x39')]({'destaccountcode':this[_0x0e6e('0x1b')][_0x40cc3f[_0x0e6e('0x41')][_0x0e6e('0x4b')]('-')[0x0]][_0x0e6e('0x50')]},{'showHidden':![],'depth':null}));this[_0x0e6e('0x33')](util['format'](_0x0e6e('0x90'),this[_0x0e6e('0x1b')][_0x40cc3f[_0x0e6e('0x41')][_0x0e6e('0x4b')]('-')[0x0]][_0x0e6e('0x4e')]),_0x0e6e('0x91'),{'destaccountcode':this[_0x0e6e('0x1b')][_0x40cc3f[_0x0e6e('0x41')][_0x0e6e('0x4b')]('-')[0x0]][_0x0e6e('0x50')]});}}if(_0x40cc3f['event']===_0x0e6e('0x92')){this[_0x0e6e('0x1c')][_0x40cc3f[_0x0e6e('0x3a')]]=this[_0x0e6e('0x1a')][_0x40cc3f[_0x0e6e('0x3a')]];}else{if(this[_0x0e6e('0x1a')][_0x40cc3f[_0x0e6e('0x3a')]][_0x0e6e('0x7d')]===_0x0e6e('0x93')&&this[_0x0e6e('0x1c')][_0x40cc3f[_0x0e6e('0x3a')]]){this[_0x0e6e('0x1a')][_0x40cc3f['uniqueid']][_0x0e6e('0x3a')]=[this[_0x0e6e('0x1a')][_0x40cc3f[_0x0e6e('0x3a')]][_0x0e6e('0x3b')],this['channels'][_0x40cc3f[_0x0e6e('0x3a')]][_0x0e6e('0x3b')]=this[_0x0e6e('0x1a')][_0x40cc3f[_0x0e6e('0x3a')]][_0x0e6e('0x3a')]][0x0];delete this[_0x0e6e('0x1c')][_0x40cc3f[_0x0e6e('0x3a')]];}}logger[_0x0e6e('0x37')]('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x40cc3f['uniqueid'],util[_0x0e6e('0x39')](this[_0x0e6e('0x1a')][_0x40cc3f[_0x0e6e('0x3a')]],{'showHidden':![],'depth':null}));ami[_0x0e6e('0x33')](_0x0e6e('0x94'),this[_0x0e6e('0x1a')][_0x40cc3f['uniqueid']]);delete this[_0x0e6e('0x1a')][_0x40cc3f[_0x0e6e('0x3a')]];}}}catch(_0x597f04){logger[_0x0e6e('0x2e')](_0x0e6e('0x95'),_0x40cc3f['uniqueid'],util['inspect'](_0x597f04,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncAttendedTransfer']=function(_0x503dd8){try{if(this['isNotNull'](_0x503dd8)){logger[_0x0e6e('0x2c')](_0x0e6e('0x96'),_0x503dd8[_0x0e6e('0x3a')],_0x503dd8['origtransferercalleridnum'],_0x503dd8[_0x0e6e('0x97')]);logger[_0x0e6e('0x37')](_0x0e6e('0x98'),_0x503dd8[_0x0e6e('0x3a')],util['inspect'](_0x503dd8,{'showHidden':![],'depth':null}));if(this[_0x0e6e('0x1a')][_0x503dd8[_0x0e6e('0x99')]]){this[_0x0e6e('0x1a')][_0x503dd8[_0x0e6e('0x99')]][_0x0e6e('0x9a')]=_0x503dd8['origtransferercalleridnum'];this[_0x0e6e('0x1a')][_0x503dd8[_0x0e6e('0x99')]]['transferconnectedlinenum']=_0x503dd8[_0x0e6e('0x97')];if(this[_0x0e6e('0x1a')][_0x503dd8[_0x0e6e('0x9b')]]){var _0xaa3ad8=this[_0x0e6e('0x1a')][_0x503dd8[_0x0e6e('0x9b')]];this[_0x0e6e('0x1a')][_0x503dd8[_0x0e6e('0x9b')]]=this[_0x0e6e('0x1a')][_0x503dd8[_0x0e6e('0x99')]];this[_0x0e6e('0x1a')][_0x503dd8[_0x0e6e('0x99')]]=_0xaa3ad8;}}else if(this[_0x0e6e('0x1a')][_0x503dd8[_0x0e6e('0x9c')]]){this['channels'][_0x503dd8['transfertargetuniqueid']][_0x0e6e('0x9a')]=_0x503dd8[_0x0e6e('0x9d')];this[_0x0e6e('0x1a')][_0x503dd8['transfertargetuniqueid']][_0x0e6e('0x9e')]=_0x503dd8[_0x0e6e('0x97')];if(this[_0x0e6e('0x1a')][_0x503dd8[_0x0e6e('0x9f')]]){var _0xaa3ad8=this[_0x0e6e('0x1a')][_0x503dd8[_0x0e6e('0x9f')]];this['channels'][_0x503dd8[_0x0e6e('0x9f')]]=this['channels'][_0x503dd8[_0x0e6e('0x9c')]];this[_0x0e6e('0x1a')][_0x503dd8[_0x0e6e('0x9c')]]=_0xaa3ad8;}}}}catch(_0x50097b){logger['error'](_0x0e6e('0xa0'),_0x503dd8[_0x0e6e('0x3a')],util['inspect'](_0x50097b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0e6e('0x30')][_0x0e6e('0xa1')]=function(_0x16c174){try{if(this[_0x0e6e('0x31')](_0x16c174)){logger[_0x0e6e('0x2c')](_0x0e6e('0xa2'),_0x16c174[_0x0e6e('0x3a')],_0x16c174[_0x0e6e('0xa3')],_0x16c174[_0x0e6e('0xa4')]);logger[_0x0e6e('0x37')](_0x0e6e('0xa5'),_0x16c174['uniqueid'],util[_0x0e6e('0x39')](_0x16c174,{'showHidden':![],'depth':null}));if(this[_0x0e6e('0x1a')][_0x16c174[_0x0e6e('0x99')]]){this[_0x0e6e('0x1a')][_0x16c174['transfereeuniqueid']][_0x0e6e('0x9a')]=_0x16c174[_0x0e6e('0xa3')];this[_0x0e6e('0x1a')][_0x16c174[_0x0e6e('0x99')]]['transferconnectedlinenum']=_0x16c174[_0x0e6e('0xa4')];this[_0x0e6e('0x25')]({'event':'BlindTransfer','uniqueid':_0x16c174[_0x0e6e('0x99')],'context':_0x16c174[_0x0e6e('0x44')],'channel':_0x16c174[_0x0e6e('0xa6')]});}}}catch(_0x29eff4){logger[_0x0e6e('0x2e')](_0x0e6e('0xa7'),_0x16c174[_0x0e6e('0x3a')],util[_0x0e6e('0x39')](_0x29eff4,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0e6e('0x2a')]=function(_0x13a28e){try{if(this[_0x0e6e('0x31')](_0x13a28e)){logger['debug'](_0x0e6e('0xa8'),_0x13a28e[_0x0e6e('0x3a')],util['inspect'](_0x13a28e,{'showHidden':![],'depth':null}));if(this[_0x0e6e('0x1a')][_0x13a28e[_0x0e6e('0x3a')]]){if(!_[_0x0e6e('0x70')](this[_0x0e6e('0x1a')][_0x13a28e['uniqueid']][_0x0e6e('0x62')])){this[_0x0e6e('0x1a')][_0x13a28e[_0x0e6e('0x3a')]][_0x0e6e('0xa9')]=moment()[_0x0e6e('0x59')](_0x0e6e('0x47'));logger['info'](_0x0e6e('0xaa'),_0x13a28e[_0x0e6e('0x3a')],this[_0x0e6e('0x1a')][_0x13a28e[_0x0e6e('0x3a')]][_0x0e6e('0xa9')]);}}}}catch(_0x4ed21f){logger[_0x0e6e('0x2e')]('[%s][voiceCallReport][musiconholdstart]',_0x13a28e[_0x0e6e('0x3a')],util[_0x0e6e('0x39')](_0x4ed21f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0e6e('0x30')][_0x0e6e('0xab')]=function(_0x1cfbb9){try{if(this[_0x0e6e('0x31')](_0x1cfbb9)){logger[_0x0e6e('0x37')]('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x1cfbb9['uniqueid'],util[_0x0e6e('0x39')](_0x1cfbb9,{'showHidden':![],'depth':null}));if(this['channels'][_0x1cfbb9[_0x0e6e('0x3a')]]){if(!_['isNil'](this[_0x0e6e('0x1a')][_0x1cfbb9[_0x0e6e('0x3a')]][_0x0e6e('0xa9')])){this[_0x0e6e('0x1a')][_0x1cfbb9[_0x0e6e('0x3a')]][_0x0e6e('0xac')]+=moment()['milliseconds'](0x0)[_0x0e6e('0x64')](this[_0x0e6e('0x1a')][_0x1cfbb9[_0x0e6e('0x3a')]]['mohstarttime'],_0x0e6e('0x58'));logger['info'](_0x0e6e('0xad'),_0x1cfbb9[_0x0e6e('0x3a')],this['channels'][_0x1cfbb9[_0x0e6e('0x3a')]][_0x0e6e('0xac')]);delete this[_0x0e6e('0x1a')][_0x1cfbb9[_0x0e6e('0x3a')]][_0x0e6e('0xa9')];}}}}catch(_0xc18c67){logger[_0x0e6e('0x2e')](_0x0e6e('0xae'),_0x1cfbb9[_0x0e6e('0x3a')],util[_0x0e6e('0x39')](_0xc18c67,{'showHidden':![],'depth':null}));}};module[_0x0e6e('0xaf')]=VoiceCallReport;
\ No newline at end of file
+var _0x800f=['transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','extension','BLIND','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','isNil','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','[%s][voiceCallReport][musiconholdstop]','lodash','util','path','ioredis','../../../config/environment','ami','../ami','../model/channel','set','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','socket.io-emitter','channels','agents','blindTransfers','syncNewExten','newexten','bind','newchannel','newstate','syncNewState','syncVarSet','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','blindtransfer','syncMusicOnHoldStart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isUndefined','syncNewCallerId','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','merge','pick','keys','from-sip','channel','split','exten','xcally-motion-preview','emit','format','user:%s','name','user:agentconnect','connectedlinenum','[%s][voiceCallReport][newcallerid]','syncNewChannel','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','[%s][voiceCallReport][newexten]\x20event:','linkedid','toLowerCase','applicationdata','appdata','startsWith','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','application','subtract','duration','seconds','lastapplication','lastdata','cdr(','match','queue','[%s][voiceCallReport][newexten]','answered','diff','toNumber','UserId','membername','routealias','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','replace','.WAV','monitorFilename','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','answertime','holdtime','billableseconds','context','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','undefined','getSettings','stopRecordingOnTransfer','resolve','then','Action','StopMixMonitor','catch','destinationchannel','webbar:stopmonitors','BlindTransfer','outbound','custom:voiceCallReport','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','type','ATTENDED','syncBlindTransfer'];(function(_0xf738ad,_0x5e1d7f){var _0x598570=function(_0x35088e){while(--_0x35088e){_0xf738ad['push'](_0xf738ad['shift']());}};_0x598570(++_0x5e1d7f);}(_0x800f,0x18c));var _0xf800=function(_0x361dda,_0x38b470){_0x361dda=_0x361dda-0x0;var _0x2c73c7=_0x800f[_0x361dda];return _0x2c73c7;};'use strict';var _=require(_0xf800('0x0'));var moment=require('moment');var util=require(_0xf800('0x1'));var path=require(_0xf800('0x2'));var Redis=require(_0xf800('0x3'));var config=require(_0xf800('0x4'));var logger=require('../../../config/logger')(_0xf800('0x5'));var ami=require(_0xf800('0x6'));var Channel=require(_0xf800('0x7'));var RpcSetting=require('../rpc/setting');var applications=[_0xf800('0x8'),'queue',_0xf800('0x9'),_0xf800('0xa'),_0xf800('0xb'),_0xf800('0xc')];var dispositions=[_0xf800('0xd'),_0xf800('0xe'),'FAILED',_0xf800('0xd'),_0xf800('0xd'),_0xf800('0xd'),_0xf800('0xf'),_0xf800('0x10'),'FAILED',_0xf800('0xe'),_0xf800('0xe')];config[_0xf800('0x11')]=_[_0xf800('0x12')](config[_0xf800('0x11')],{'host':'localhost','port':0x18eb});var io=require(_0xf800('0x13'))(new Redis(config[_0xf800('0x11')]));function VoiceCallReport(_0x44bb29){this[_0xf800('0x14')]=_0x44bb29[_0xf800('0x14')];this[_0xf800('0x15')]=_0x44bb29[_0xf800('0x15')];this[_0xf800('0x16')]={};ami['on']('coreshowchannel',this[_0xf800('0x17')]['bind'](this));ami['on'](_0xf800('0x18'),this['syncNewExten'][_0xf800('0x19')](this));ami['on'](_0xf800('0x1a'),this['syncNewChannel'][_0xf800('0x19')](this));ami['on'](_0xf800('0x1b'),this[_0xf800('0x1c')][_0xf800('0x19')](this));ami['on']('varset',this[_0xf800('0x1d')][_0xf800('0x19')](this));ami['on']('hangup',this[_0xf800('0x1e')]['bind'](this));ami['on'](_0xf800('0x1f'),this['syncNewCallerId'][_0xf800('0x19')](this));ami['on'](_0xf800('0x20'),this[_0xf800('0x21')][_0xf800('0x19')](this));ami['on'](_0xf800('0x22'),this['syncBlindTransfer']['bind'](this));ami['on']('musiconholdstart',this[_0xf800('0x23')][_0xf800('0x19')](this));ami['on'](_0xf800('0x24'),this['syncMusicOnHoldStop'][_0xf800('0x19')](this));try{logger[_0xf800('0x25')](_0xf800('0x26'));ami[_0xf800('0x27')]();}catch(_0x437f91){logger[_0xf800('0x28')](_0xf800('0x29'),util[_0xf800('0x2a')](_0x437f91,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xf800('0x2b')]['isNotNull']=function(_0x2c51eb){return _0x2c51eb!==null&&!_[_0xf800('0x2c')](_0x2c51eb);};VoiceCallReport[_0xf800('0x2b')]['emit']=function(_0xf4fed1,_0x3fdcca,_0x4a328e){io['to'](_0xf4fed1)['emit'](_0x3fdcca,_0x4a328e);};VoiceCallReport['prototype'][_0xf800('0x2d')]=function(_0x4ab1df){try{if(this[_0xf800('0x2e')](_0x4ab1df)){logger[_0xf800('0x25')](_0xf800('0x2f'),_0x4ab1df[_0xf800('0x30')],_0x4ab1df[_0xf800('0x31')],_0x4ab1df[_0xf800('0x32')]);logger[_0xf800('0x33')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x4ab1df[_0xf800('0x30')],util[_0xf800('0x2a')](_0x4ab1df,{'showHidden':![],'depth':null}));if(_0x4ab1df[_0xf800('0x30')]===_0x4ab1df['linkedid']){if(!_['isUndefined'](this[_0xf800('0x14')][_0x4ab1df['uniqueid']])){_[_0xf800('0x34')](this['channels'][_0x4ab1df[_0xf800('0x30')]],_[_0xf800('0x35')](_0x4ab1df,_[_0xf800('0x36')](this[_0xf800('0x14')][_0x4ab1df['uniqueid']])));}}if(_0x4ab1df['context']===_0xf800('0x37')){if(this['agents'][_0x4ab1df[_0xf800('0x38')][_0xf800('0x39')]('-')[0x0]]){if(_0x4ab1df[_0xf800('0x3a')]==_0xf800('0x3b')){this['agents'][_0x4ab1df['channel'][_0xf800('0x39')]('-')[0x0]]['destconnectedlinenum']=_0x4ab1df['connectedlinenum'];this[_0xf800('0x3c')](util[_0xf800('0x3d')](_0xf800('0x3e'),this[_0xf800('0x15')][_0x4ab1df[_0xf800('0x38')][_0xf800('0x39')]('-')[0x0]][_0xf800('0x3f')]),_0xf800('0x40'),{'destaccountcode':this[_0xf800('0x15')][_0x4ab1df[_0xf800('0x38')][_0xf800('0x39')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x4ab1df[_0xf800('0x41')]});}}}}}catch(_0x471496){logger[_0xf800('0x28')](_0xf800('0x42'),_0x4ab1df['uniqueid'],util[_0xf800('0x2a')](_0x471496,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf800('0x2b')][_0xf800('0x43')]=function(_0x3e04b8){try{if(this[_0xf800('0x2e')](_0x3e04b8)){logger[_0xf800('0x33')](_0xf800('0x44'),_0x3e04b8[_0xf800('0x30')],util['inspect'](_0x3e04b8,{'showHidden':![],'depth':null}));if(_0x3e04b8[_0xf800('0x30')]===_0x3e04b8['linkedid']&&_0x3e04b8[_0xf800('0x38')]!=_0xf800('0x45')){if(_['isUndefined'](this[_0xf800('0x14')][_0x3e04b8[_0xf800('0x30')]])){logger[_0xf800('0x25')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x3e04b8[_0xf800('0x30')],_0x3e04b8['context'],_0x3e04b8[_0xf800('0x3a')]);this[_0xf800('0x14')][_0x3e04b8[_0xf800('0x30')]]=new Channel();this['channels'][_0x3e04b8[_0xf800('0x30')]][_0xf800('0x46')]=moment()[_0xf800('0x3d')](_0xf800('0x47'));this[_0xf800('0x14')][_0x3e04b8[_0xf800('0x30')]][_0xf800('0x48')]=dispositions[_['toNumber'](_0x3e04b8[_0xf800('0x49')])];_['merge'](this[_0xf800('0x14')][_0x3e04b8[_0xf800('0x30')]],_[_0xf800('0x35')](_0x3e04b8,_[_0xf800('0x36')](this[_0xf800('0x14')][_0x3e04b8[_0xf800('0x30')]])));if(_0x3e04b8['context']==='from-sip'){if(this[_0xf800('0x15')][_0x3e04b8[_0xf800('0x38')]['split']('-')[0x0]]){if(_[_0xf800('0x2c')](this[_0xf800('0x15')][_0x3e04b8[_0xf800('0x38')][_0xf800('0x39')]('-')[0x0]][_0xf800('0x4a')])){this[_0xf800('0x15')][_0x3e04b8[_0xf800('0x38')]['split']('-')[0x0]]['destconnectedlinenum']=_0x3e04b8[_0xf800('0x3a')];logger['debug'](_0xf800('0x4b'),_0x3e04b8['uniqueid'],util[_0xf800('0x2a')]({'id':this[_0xf800('0x15')][_0x3e04b8[_0xf800('0x38')][_0xf800('0x39')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x3e04b8['channel']['split']('-')[0x0]][_0xf800('0x4c')],'destconnectedlinenum':_0x3e04b8[_0xf800('0x3a')]},{'showHidden':![],'depth':null}));this[_0xf800('0x3c')](util['format']('user:%s',this[_0xf800('0x15')][_0x3e04b8['channel']['split']('-')[0x0]]['name']),_0xf800('0x40'),{'id':this[_0xf800('0x15')][_0x3e04b8[_0xf800('0x38')][_0xf800('0x39')]('-')[0x0]]['id'],'destaccountcode':this[_0xf800('0x15')][_0x3e04b8[_0xf800('0x38')][_0xf800('0x39')]('-')[0x0]][_0xf800('0x4c')],'destconnectedlinenum':_0x3e04b8['exten']});}}}}}}}catch(_0x2e6fd3){logger['error']('[%s][voiceCallReport][newchannel]',_0x3e04b8['uniqueid'],util[_0xf800('0x2a')](_0x2e6fd3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf800('0x2b')][_0xf800('0x17')]=function(_0x27d55b){try{if(this[_0xf800('0x2e')](_0x27d55b)){logger[_0xf800('0x33')](_0xf800('0x4d'),_0x27d55b[_0xf800('0x30')],util['inspect'](_0x27d55b,{'showHidden':![],'depth':null}));if(_0x27d55b['uniqueid']===_0x27d55b[_0xf800('0x4e')]&&_0x27d55b[_0xf800('0x3a')]!='h'&&_0x27d55b[_0xf800('0x38')]!=_0xf800('0x45')){_0x27d55b['application']=_0x27d55b['application'][_0xf800('0x4f')]();_0x27d55b[_0xf800('0x50')]=_0x27d55b[_0xf800('0x51')]&&_0x27d55b[_0xf800('0x51')][_0xf800('0x52')]('CDR(routeAlias)')?_0x27d55b[_0xf800('0x51')]:(_0x27d55b[_0xf800('0x51')]||_0x27d55b[_0xf800('0x50')])[_0xf800('0x4f')]();logger['info'](_0xf800('0x53'),_0x27d55b[_0xf800('0x30')],_0x27d55b[_0xf800('0x54')],_0x27d55b[_0xf800('0x50')]);if(_[_0xf800('0x2c')](this['channels'][_0x27d55b[_0xf800('0x30')]])){this[_0xf800('0x14')][_0x27d55b[_0xf800('0x30')]]=new Channel();this[_0xf800('0x14')][_0x27d55b['uniqueid']][_0xf800('0x46')]=_0x27d55b['duration']?moment()[_0xf800('0x55')](moment[_0xf800('0x56')](_0x27d55b['duration'])[_0xf800('0x57')](),_0xf800('0x57'))['format'](_0xf800('0x47')):moment()[_0xf800('0x3d')](_0xf800('0x47'));this[_0xf800('0x14')][_0x27d55b['uniqueid']][_0xf800('0x48')]='NO\x20ANSWER';}_[_0xf800('0x34')](this[_0xf800('0x14')][_0x27d55b[_0xf800('0x30')]],_[_0xf800('0x35')](_0x27d55b,_[_0xf800('0x36')](this[_0xf800('0x14')][_0x27d55b[_0xf800('0x30')]])));if(_['includes'](applications,_0x27d55b[_0xf800('0x54')])){this['channels'][_0x27d55b[_0xf800('0x30')]][_0xf800('0x58')]=_0x27d55b[_0xf800('0x54')];this[_0xf800('0x14')][_0x27d55b[_0xf800('0x30')]][_0xf800('0x59')]=_0x27d55b[_0xf800('0x50')];if(_0x27d55b[_0xf800('0x54')]===_0xf800('0x8')&&_[_0xf800('0x52')](_0x27d55b[_0xf800('0x50')][_0xf800('0x4f')](),_0xf800('0x5a'))){var _0x4356ba=_0x27d55b['applicationdata']['split']('=');var _0x17d274=_0x4356ba[0x0][_0xf800('0x4f')]()[_0xf800('0x5b')](/cdr\((.*)\)/);if(_0x17d274){this[_0xf800('0x14')][_0x27d55b[_0xf800('0x30')]][_0x17d274[0x1]]=_0x4356ba[0x1];}}else if(_0x27d55b[_0xf800('0x54')]===_0xf800('0x5c')){this[_0xf800('0x14')][_0x27d55b['uniqueid']]['queue']=_0x27d55b[_0xf800('0x50')][_0xf800('0x39')](',')[0x0];}}}}}catch(_0x1b6718){logger['error'](_0xf800('0x5d'),_0x27d55b[_0xf800('0x30')],util[_0xf800('0x2a')](_0x1b6718,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xf800('0x1c')]=function(_0x167a93){try{if(this[_0xf800('0x2e')](_0x167a93)){logger[_0xf800('0x25')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x167a93[_0xf800('0x30')],_0x167a93[_0xf800('0x4e')],_0x167a93[_0xf800('0x31')],_0x167a93[_0xf800('0x32')]);logger['debug']('[%s][voiceCallReport][newstate]\x20event:',_0x167a93[_0xf800('0x30')],util[_0xf800('0x2a')](_0x167a93,{'showHidden':![],'depth':null}));if(_0x167a93['uniqueid']!==_0x167a93[_0xf800('0x4e')]){if(this[_0xf800('0x14')][_0x167a93['linkedid']]){if(_0x167a93[_0xf800('0x49')]==='6'){if(!this[_0xf800('0x14')][_0x167a93[_0xf800('0x4e')]]['answered']){var _0x4381e6=moment();this['channels'][_0x167a93[_0xf800('0x4e')]][_0xf800('0x5e')]=!![];this[_0xf800('0x14')][_0x167a93['linkedid']]['answertime']=_0x4381e6[_0xf800('0x3d')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xf800('0x14')][_0x167a93[_0xf800('0x4e')]]['starttime']){this[_0xf800('0x14')][_0x167a93[_0xf800('0x4e')]]['holdtime']=_0x4381e6[_0xf800('0x5f')](this[_0xf800('0x14')][_0x167a93[_0xf800('0x4e')]][_0xf800('0x46')],_0xf800('0x57'));}}this['channels'][_0x167a93['linkedid']][_0xf800('0x4e')]=_0x167a93[_0xf800('0x30')];if(_0x167a93[_0xf800('0x32')]!==_0xf800('0x3b')){this['channels'][_0x167a93[_0xf800('0x4e')]][_0xf800('0x41')]=_0x167a93[_0xf800('0x32')];}this['channels'][_0x167a93['linkedid']]['connectedlinename']=_0x167a93[_0xf800('0x31')];this[_0xf800('0x14')][_0x167a93[_0xf800('0x4e')]]['destinationchannel']=_0x167a93[_0xf800('0x38')];this[_0xf800('0x14')][_0x167a93[_0xf800('0x4e')]][_0xf800('0x48')]=dispositions[_[_0xf800('0x60')](_0x167a93['channelstate'])];if(this[_0xf800('0x15')][_0x167a93[_0xf800('0x38')][_0xf800('0x39')]('-')[0x0]]){this[_0xf800('0x14')][_0x167a93[_0xf800('0x4e')]][_0xf800('0x61')]=this[_0xf800('0x15')][_0x167a93[_0xf800('0x38')][_0xf800('0x39')]('-')[0x0]]['id'];this[_0xf800('0x14')][_0x167a93['linkedid']][_0xf800('0x62')]=this[_0xf800('0x15')][_0x167a93[_0xf800('0x38')]['split']('-')[0x0]][_0xf800('0x3f')];}}}}else{if(this[_0xf800('0x14')][_0x167a93[_0xf800('0x30')]]){if(_0x167a93[_0xf800('0x49')]==='6'){if(this[_0xf800('0x15')][_0x167a93[_0xf800('0x38')][_0xf800('0x39')]('-')[0x0]]){this[_0xf800('0x14')][_0x167a93[_0xf800('0x30')]][_0xf800('0x61')]=this[_0xf800('0x15')][_0x167a93['channel'][_0xf800('0x39')]('-')[0x0]]['id'];this[_0xf800('0x14')][_0x167a93[_0xf800('0x30')]][_0xf800('0x62')]=this[_0xf800('0x15')][_0x167a93[_0xf800('0x38')][_0xf800('0x39')]('-')[0x0]][_0xf800('0x3f')];}}}}if(_0x167a93['channelstate']==='6'&&_0x167a93['context']==='from-sip'){if(this[_0xf800('0x15')][_0x167a93[_0xf800('0x38')][_0xf800('0x39')]('-')[0x0]]){this[_0xf800('0x15')][_0x167a93[_0xf800('0x38')]['split']('-')[0x0]][_0xf800('0x4a')]=_0x167a93['exten'];var _0x26945e,_0x26409c;if(this['channels'][_0x167a93['uniqueid']]){_0x26945e=this[_0xf800('0x14')][_0x167a93['uniqueid']][_0xf800('0x63')];_0x26409c=this[_0xf800('0x14')][_0x167a93[_0xf800('0x30')]][_0xf800('0x5c')];}else if(this[_0xf800('0x14')][_0x167a93[_0xf800('0x4e')]]){_0x26945e=this[_0xf800('0x14')][_0x167a93[_0xf800('0x4e')]][_0xf800('0x63')];_0x26409c=this[_0xf800('0x14')][_0x167a93['linkedid']][_0xf800('0x5c')];}logger[_0xf800('0x33')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x167a93[_0xf800('0x30')],util[_0xf800('0x2a')]({'id':this['agents'][_0x167a93[_0xf800('0x38')][_0xf800('0x39')]('-')[0x0]]['id'],'destaccountcode':this[_0xf800('0x15')][_0x167a93[_0xf800('0x38')][_0xf800('0x39')]('-')[0x0]][_0xf800('0x4c')],'destconnectedlinenum':_0x167a93['exten'],'routealias':_0x26945e,'queue':_0x26409c||undefined},{'showHidden':![],'depth':null}));this[_0xf800('0x3c')](util[_0xf800('0x3d')]('user:%s',this[_0xf800('0x15')][_0x167a93[_0xf800('0x38')][_0xf800('0x39')]('-')[0x0]]['name']),_0xf800('0x40'),{'id':this[_0xf800('0x15')][_0x167a93[_0xf800('0x38')][_0xf800('0x39')]('-')[0x0]]['id'],'agentconnected':!![],'destaccountcode':this[_0xf800('0x15')][_0x167a93[_0xf800('0x38')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x167a93[_0xf800('0x3a')],'routealias':_0x26945e,'queue':_0x26409c||undefined});}}}}catch(_0xd57b94){logger['error'](_0xf800('0x64'),_0x167a93[_0xf800('0x30')],util[_0xf800('0x2a')](_0xd57b94,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf800('0x2b')][_0xf800('0x65')]=function(_0x18ce21,_0x4fb3ce){try{if(this[_0xf800('0x14')][_0x18ce21]){logger['info'](_0xf800('0x66'),_0x18ce21,_0x4fb3ce);this['channels'][_0x18ce21][_0xf800('0x67')]=!![];if(_[_0xf800('0x68')](_0x4fb3ce,'.wav49')){_0x4fb3ce=_0x4fb3ce[_0xf800('0x69')]('.wav49',_0xf800('0x6a'));}this['channels'][_0x18ce21][_0xf800('0x6b')]=_0x4fb3ce;var _0x4dcf73=_['find'](this[_0xf800('0x14')][_0x18ce21][_0xf800('0x6c')],{'filename':_0x4fb3ce});if(_['isNil'](_0x4dcf73)){this['channels'][_0x18ce21][_0xf800('0x6c')][_0xf800('0x6d')]({'filename':_0x4fb3ce,'createdAt':moment()[_0xf800('0x3d')](_0xf800('0x47')),'mixmonitorid':'','status':_0xf800('0x6e')});}}}catch(_0x5a22f0){logger[_0xf800('0x28')](_0xf800('0x6f'),_0x18ce21,util[_0xf800('0x2a')](_0x5a22f0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf800('0x2b')]['syncVarSet']=function(_0x387939){try{if(this[_0xf800('0x2e')](_0x387939)){logger['debug'](_0xf800('0x70'),_0x387939['uniqueid'],util['inspect'](_0x387939,{'showHidden':![],'depth':null}));if(this[_0xf800('0x14')][_0x387939['uniqueid']]&&_0x387939['channel']!='OutgoingSpoolFailed'){if(this['isNotNull'](_0x387939['variable'])){if(this[_0xf800('0x2e')](_0x387939[_0xf800('0x71')][_0xf800('0x72')])){logger[_0xf800('0x25')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x387939[_0xf800('0x30')],_0x387939[_0xf800('0x73')]);this['syncMixMonitorFilename'](_0x387939[_0xf800('0x30')],_0x387939[_0xf800('0x73')]);}else if(this[_0xf800('0x2e')](_0x387939[_0xf800('0x71')][_0xf800('0x74')])){logger[_0xf800('0x25')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x387939[_0xf800('0x30')],_0x387939['value']);this[_0xf800('0x14')][_0x387939[_0xf800('0x30')]][_0xf800('0x32')]=_0x387939[_0xf800('0x73')];}else if(this[_0xf800('0x2e')](_0x387939['variable']['xmd-callerid'])){logger['info'](_0xf800('0x75'),_0x387939['uniqueid'],_0x387939[_0xf800('0x73')]);this[_0xf800('0x14')][_0x387939[_0xf800('0x30')]]['callerid']=_0x387939[_0xf800('0x73')];}else if(this['isNotNull'](_0x387939[_0xf800('0x71')][_0xf800('0x76')])){logger[_0xf800('0x25')](_0xf800('0x77'),_0x387939[_0xf800('0x30')],_0x387939[_0xf800('0x73')]);this['channels'][_0x387939[_0xf800('0x30')]]['type']=_0x387939['value'];}else if(this[_0xf800('0x2e')](_0x387939[_0xf800('0x71')]['xmd-queue'])){logger[_0xf800('0x25')](_0xf800('0x78'),_0x387939[_0xf800('0x30')],_0x387939[_0xf800('0x73')][_0xf800('0x39')](',')[0x0]);this[_0xf800('0x14')][_0x387939[_0xf800('0x30')]][_0xf800('0x5c')]=_0x387939['value'][_0xf800('0x39')](',')[0x0];}else if(this[_0xf800('0x2e')](_0x387939['variable'][_0xf800('0x79')])){logger['info'](_0xf800('0x7a'),_0x387939['uniqueid'],_0x387939[_0xf800('0x73')]);this[_0xf800('0x14')][_0x387939['uniqueid']][_0xf800('0x7b')]=_0x387939[_0xf800('0x73')];}else if(this[_0xf800('0x2e')](_0x387939[_0xf800('0x71')][_0xf800('0x7c')])){logger[_0xf800('0x25')](_0xf800('0x7d'),_0x387939[_0xf800('0x30')],_0x387939[_0xf800('0x73')]);this[_0xf800('0x14')][_0x387939['uniqueid']]['destination']=_0x387939[_0xf800('0x73')];}else if(this[_0xf800('0x2e')](_0x387939[_0xf800('0x71')]['xmd-callerid-preview'])){logger[_0xf800('0x25')](_0xf800('0x7e'),_0x387939[_0xf800('0x30')],_0x387939[_0xf800('0x73')]);this[_0xf800('0x14')][_0x387939[_0xf800('0x30')]][_0xf800('0x7f')]=_0x387939['value'];}else if(this[_0xf800('0x2e')](_0x387939[_0xf800('0x71')][_0xf800('0x80')])){logger['info'](_0xf800('0x81'),_0x387939[_0xf800('0x30')],_0x387939[_0xf800('0x73')]);this[_0xf800('0x14')][_0x387939['uniqueid']]['queue']=_0x387939[_0xf800('0x73')];}else if(this[_0xf800('0x2e')](_0x387939[_0xf800('0x71')][_0xf800('0x82')])){logger[_0xf800('0x25')](_0xf800('0x83'),_0x387939[_0xf800('0x30')],_0x387939[_0xf800('0x73')]);this['channels'][_0x387939[_0xf800('0x30')]][_0xf800('0x84')]=_0x387939['value'];}}}else if(this[_0xf800('0x2e')](_0x387939[_0xf800('0x71')][_0xf800('0x72')])){if(_0x387939[_0xf800('0x73')]){var _0x4d9cd9=path[_0xf800('0x85')](_0x387939[_0xf800('0x73')])[_0xf800('0x3f')];logger[_0xf800('0x25')](_0xf800('0x86'),_0x4d9cd9,_0x387939['value']);this[_0xf800('0x65')](_0x4d9cd9,_0x387939['value']);}}else if(this['channels'][_0x387939[_0xf800('0x4e')]]){if(this[_0xf800('0x2e')](_0x387939[_0xf800('0x71')])){if(this[_0xf800('0x2e')](_0x387939['variable'][_0xf800('0x82')])){logger[_0xf800('0x25')](_0xf800('0x83'),_0x387939[_0xf800('0x4e')],_0x387939[_0xf800('0x73')]);this[_0xf800('0x14')][_0x387939['linkedid']][_0xf800('0x87')]=_0x387939['value'];}}}}}catch(_0x43e48c){logger[_0xf800('0x28')](_0xf800('0x88'),_0x387939[_0xf800('0x30')],util[_0xf800('0x2a')](_0x43e48c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf800('0x2b')]['syncHangup']=function(_0x89b726){try{if(this['isNotNull'](_0x89b726)){logger[_0xf800('0x33')](_0xf800('0x89'),_0x89b726['uniqueid'],util[_0xf800('0x2a')](_0x89b726,{'showHidden':![],'depth':null}));if(this[_0xf800('0x14')][_0x89b726[_0xf800('0x30')]]){logger[_0xf800('0x25')](_0xf800('0x8a'),_0x89b726[_0xf800('0x30')],_0x89b726[_0xf800('0x8b')]);var _0x38616b=moment();this['channels'][_0x89b726[_0xf800('0x30')]][_0xf800('0x8c')]=_0x38616b[_0xf800('0x3d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xf800('0x14')][_0x89b726[_0xf800('0x30')]][_0xf800('0x56')]=_0x38616b[_0xf800('0x5f')](this[_0xf800('0x14')][_0x89b726[_0xf800('0x30')]][_0xf800('0x46')],_0xf800('0x57'));if(this['channels'][_0x89b726[_0xf800('0x30')]][_0xf800('0x5e')]){this['channels'][_0x89b726[_0xf800('0x30')]]['billableseconds']=_0x38616b['diff'](this[_0xf800('0x14')][_0x89b726[_0xf800('0x30')]][_0xf800('0x8d')],'seconds');this['channels'][_0x89b726[_0xf800('0x30')]][_0xf800('0x8e')]=this[_0xf800('0x14')][_0x89b726[_0xf800('0x30')]]['duration']-this[_0xf800('0x14')][_0x89b726['uniqueid']][_0xf800('0x8f')];}if(_0x89b726[_0xf800('0x90')]===_0xf800('0x37')){if(this[_0xf800('0x15')][_0x89b726['channel']['split']('-')[0x0]]){this['agents'][_0x89b726[_0xf800('0x38')][_0xf800('0x39')]('-')[0x0]]=_[_0xf800('0x91')](this[_0xf800('0x15')][_0x89b726[_0xf800('0x38')]['split']('-')[0x0]],[_0xf800('0x4a')]);logger['debug'](_0xf800('0x92'),_0x89b726['uniqueid'],util[_0xf800('0x2a')]({'id':this['agents'][_0x89b726['channel'][_0xf800('0x39')]('-')[0x0]]['id'],'destaccountcode':this[_0xf800('0x15')][_0x89b726[_0xf800('0x38')][_0xf800('0x39')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0xf800('0x3c')](util['format']('user:%s',this[_0xf800('0x15')][_0x89b726[_0xf800('0x38')][_0xf800('0x39')]('-')[0x0]][_0xf800('0x3f')]),_0xf800('0x93'),{'id':this[_0xf800('0x15')][_0x89b726['channel'][_0xf800('0x39')]('-')[0x0]]['id'],'destaccountcode':this[_0xf800('0x15')][_0x89b726[_0xf800('0x38')][_0xf800('0x39')]('-')[0x0]][_0xf800('0x4c')]});for(var _0x473231=0x0;_0x473231<Object[_0xf800('0x36')](this[_0xf800('0x15')])[_0xf800('0x94')];_0x473231++){var _0x17f152=Object[_0xf800('0x36')](this[_0xf800('0x15')])[_0x473231];var _0x5cd2ec=this['agents'][_0x17f152];if(_0x5cd2ec[_0xf800('0x4c')]===Number(_0x89b726['connectedlinenum'])){this[_0xf800('0x3c')](util['format'](_0xf800('0x3e'),_0x5cd2ec[_0xf800('0x3f')]),'user:agentcomplete',{'id':_0x5cd2ec['id'],'destaccountcode':_0x5cd2ec[_0xf800('0x4c')]});break;}}}}var _0x4f1755=this;Promise['resolve']()['then'](function(){var _0x1e8bd0=_0x4f1755[_0xf800('0x14')][_0x89b726[_0xf800('0x30')]];if(typeof _0x1e8bd0[_0xf800('0x95')]===_0xf800('0x96'))return;if(_['isEmpty'](_0x1e8bd0['monitors']))return;return RpcSetting[_0xf800('0x97')]()['then'](function(_0x19eb45){if(!_0x19eb45[_0xf800('0x98')])return;return Promise[_0xf800('0x99')]()[_0xf800('0x9a')](function(){return ami[_0xf800('0x9b')]({'action':_0xf800('0x9c'),'channel':_0x1e8bd0[_0xf800('0x38')]})[_0xf800('0x9d')](function(){});})['then'](function(){return ami[_0xf800('0x9b')]({'action':_0xf800('0x9c'),'channel':_0x1e8bd0[_0xf800('0x9e')]})[_0xf800('0x9d')](function(){})['finally'](function(){var _0xf55d5a=_0x4f1755['agents'][_0x1e8bd0[_0xf800('0x9e')][_0xf800('0x39')]('-')[0x0]];if(!_0xf55d5a)return;io[_0xf800('0x3c')](_0xf800('0x9f'),{'agentId':_0xf55d5a['id'],'uniqueid':_0x1e8bd0[_0xf800('0x30')]});});});});})['then'](function(){if(_0x89b726['event']===_0xf800('0xa0')){_0x4f1755[_0xf800('0x16')][_0x89b726[_0xf800('0x30')]]=_0x4f1755['channels'][_0x89b726[_0xf800('0x30')]];}else{if(_0x4f1755[_0xf800('0x14')][_0x89b726['uniqueid']]['type']===_0xf800('0xa1')&&_0x4f1755['blindTransfers'][_0x89b726['uniqueid']]){_0x4f1755[_0xf800('0x14')][_0x89b726[_0xf800('0x30')]][_0xf800('0x30')]=[_0x4f1755[_0xf800('0x14')][_0x89b726[_0xf800('0x30')]][_0xf800('0x4e')],_0x4f1755[_0xf800('0x14')][_0x89b726['uniqueid']][_0xf800('0x4e')]=_0x4f1755[_0xf800('0x14')][_0x89b726[_0xf800('0x30')]][_0xf800('0x30')]][0x0];delete _0x4f1755[_0xf800('0x16')][_0x89b726[_0xf800('0x30')]];}}logger[_0xf800('0x33')]('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x89b726[_0xf800('0x30')],util[_0xf800('0x2a')](_0x4f1755[_0xf800('0x14')][_0x89b726[_0xf800('0x30')]],{'showHidden':![],'depth':null}));ami[_0xf800('0x3c')](_0xf800('0xa2'),_0x4f1755['channels'][_0x89b726[_0xf800('0x30')]]);delete _0x4f1755[_0xf800('0x14')][_0x89b726[_0xf800('0x30')]];});}}}catch(_0x3461c6){logger[_0xf800('0x28')]('[%s][voiceCallReport][hangup]',_0x89b726[_0xf800('0x30')],util[_0xf800('0x2a')](_0x3461c6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf800('0x2b')][_0xf800('0x21')]=function(_0x343495){try{if(this[_0xf800('0x2e')](_0x343495)){logger[_0xf800('0x25')](_0xf800('0xa3'),_0x343495[_0xf800('0x30')],_0x343495[_0xf800('0xa4')],_0x343495[_0xf800('0xa5')]);logger[_0xf800('0x33')](_0xf800('0xa6'),_0x343495[_0xf800('0x30')],util[_0xf800('0x2a')](_0x343495,{'showHidden':![],'depth':null}));var _0x187807;if(this[_0xf800('0x14')][_0x343495[_0xf800('0xa7')]]){this[_0xf800('0x14')][_0x343495[_0xf800('0xa7')]][_0xf800('0xa8')]=_0x343495[_0xf800('0xa4')];this[_0xf800('0x14')][_0x343495[_0xf800('0xa7')]][_0xf800('0xa9')]=_0x343495[_0xf800('0xa5')];if(this[_0xf800('0x14')][_0x343495['secondtransfereruniqueid']]){_0x187807=this[_0xf800('0x14')][_0x343495[_0xf800('0xaa')]];this[_0xf800('0x14')][_0x343495['secondtransfereruniqueid']]=this['channels'][_0x343495[_0xf800('0xa7')]];this[_0xf800('0x14')][_0x343495['transfereeuniqueid']]=_0x187807;}}else if(this[_0xf800('0x14')][_0x343495['transfertargetuniqueid']]){this[_0xf800('0x14')][_0x343495[_0xf800('0xab')]][_0xf800('0xa8')]=_0x343495[_0xf800('0xa4')];this[_0xf800('0x14')][_0x343495[_0xf800('0xab')]][_0xf800('0xa9')]=_0x343495[_0xf800('0xa5')];if(this[_0xf800('0x14')][_0x343495[_0xf800('0xac')]]){_0x187807=this['channels'][_0x343495[_0xf800('0xac')]];this[_0xf800('0x14')][_0x343495[_0xf800('0xac')]]=this['channels'][_0x343495[_0xf800('0xab')]];this[_0xf800('0x14')][_0x343495['transfertargetuniqueid']]=_0x187807;}}if((this[_0xf800('0x14')][_0x343495[_0xf800('0xac')]]||this[_0xf800('0x14')][_0x343495[_0xf800('0xad')]])&&this['channels'][_0x343495[_0xf800('0xaa')]]){var _0xa63c39=_['some']([this[_0xf800('0x14')][_0x343495[_0xf800('0xac')]],this[_0xf800('0x14')][_0x343495[_0xf800('0xad')]],this[_0xf800('0x14')][_0x343495[_0xf800('0xaa')]]],function(_0x31015c){return _0x31015c&&_0x31015c[_0xf800('0xae')]===_0xf800('0xa1')&&_0x31015c['routeid'];});if(_0xa63c39){if(this[_0xf800('0x14')][_0x343495['origtransfereruniqueid']])this['channels'][_0x343495[_0xf800('0xac')]][_0xf800('0x95')]='ATTENDED';if(this[_0xf800('0x14')][_0x343495[_0xf800('0xad')]])this[_0xf800('0x14')][_0x343495['origtransfererlinkedid']]['transferType']='ATTENDED';this[_0xf800('0x14')][_0x343495[_0xf800('0xaa')]][_0xf800('0x95')]=_0xf800('0xaf');}}}}catch(_0x1e2836){logger['error']('[%s][voiceCallReport][attendedtransfer]',_0x343495[_0xf800('0x30')],util[_0xf800('0x2a')](_0x1e2836,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf800('0x2b')][_0xf800('0xb0')]=function(_0x5e0444){try{if(this[_0xf800('0x2e')](_0x5e0444)){logger[_0xf800('0x25')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x5e0444[_0xf800('0x30')],_0x5e0444[_0xf800('0xb1')],_0x5e0444['extension']);logger[_0xf800('0x33')](_0xf800('0xb2'),_0x5e0444[_0xf800('0x30')],util[_0xf800('0x2a')](_0x5e0444,{'showHidden':![],'depth':null}));if(this[_0xf800('0x14')][_0x5e0444[_0xf800('0xa7')]]){this[_0xf800('0x14')][_0x5e0444[_0xf800('0xa7')]][_0xf800('0xa8')]=_0x5e0444[_0xf800('0xb1')];this[_0xf800('0x14')][_0x5e0444[_0xf800('0xa7')]][_0xf800('0xa9')]=_0x5e0444[_0xf800('0xb3')];this[_0xf800('0x14')][_0x5e0444[_0xf800('0xa7')]][_0xf800('0x95')]=_0xf800('0xb4');this[_0xf800('0x1e')]({'event':'BlindTransfer','uniqueid':_0x5e0444[_0xf800('0xa7')],'context':_0x5e0444['context'],'channel':_0x5e0444['transfererchannel']});}else{this[_0xf800('0x14')][_0x5e0444[_0xf800('0xb5')]]['transferType']=_0xf800('0xb4');}}}catch(_0x23b44c){logger['error'](_0xf800('0xb6'),_0x5e0444[_0xf800('0x30')],util[_0xf800('0x2a')](_0x23b44c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf800('0x2b')]['syncMusicOnHoldStart']=function(_0x24cec3){try{if(this[_0xf800('0x2e')](_0x24cec3)){logger[_0xf800('0x33')](_0xf800('0xb7'),_0x24cec3[_0xf800('0x30')],util[_0xf800('0x2a')](_0x24cec3,{'showHidden':![],'depth':null}));if(this['channels'][_0x24cec3[_0xf800('0x30')]]){if(!_[_0xf800('0xb8')](this[_0xf800('0x14')][_0x24cec3[_0xf800('0x30')]][_0xf800('0x8d')])){this['channels'][_0x24cec3[_0xf800('0x30')]]['mohstarttime']=moment()[_0xf800('0x3d')](_0xf800('0x47'));logger[_0xf800('0x25')](_0xf800('0xb9'),_0x24cec3[_0xf800('0x30')],this['channels'][_0x24cec3[_0xf800('0x30')]][_0xf800('0xba')]);}}}}catch(_0x1062e6){logger[_0xf800('0x28')](_0xf800('0xbb'),_0x24cec3[_0xf800('0x30')],util[_0xf800('0x2a')](_0x1062e6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf800('0x2b')]['syncMusicOnHoldStop']=function(_0x2675a8){try{if(this[_0xf800('0x2e')](_0x2675a8)){logger['debug']('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x2675a8[_0xf800('0x30')],util[_0xf800('0x2a')](_0x2675a8,{'showHidden':![],'depth':null}));if(this[_0xf800('0x14')][_0x2675a8[_0xf800('0x30')]]){if(!_[_0xf800('0xb8')](this[_0xf800('0x14')][_0x2675a8[_0xf800('0x30')]][_0xf800('0xba')])){this[_0xf800('0x14')][_0x2675a8['uniqueid']]['mohtime']+=moment()['milliseconds'](0x0)[_0xf800('0x5f')](this[_0xf800('0x14')][_0x2675a8[_0xf800('0x30')]][_0xf800('0xba')],_0xf800('0x57'));logger[_0xf800('0x25')](_0xf800('0xbc'),_0x2675a8[_0xf800('0x30')],this[_0xf800('0x14')][_0x2675a8[_0xf800('0x30')]][_0xf800('0xbd')]);delete this[_0xf800('0x14')][_0x2675a8[_0xf800('0x30')]][_0xf800('0xba')];}}}}catch(_0x1bbedf){logger[_0xf800('0x28')](_0xf800('0xbe'),_0x2675a8[_0xf800('0x30')],util[_0xf800('0x2a')](_0x1bbedf,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport;
\ No newline at end of file