Built motion from commit da617fac.|2.6.6
[motion2.git] / server / services / ami / report / voiceCallReport.js
index 48fff1a..a3b8a92 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2cef=['name','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','toLowerCase','applicationdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','seconds','includes','lastapplication','startsWith','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','debug','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinenum','destinationchannel','toNumber','membername','UserId','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','isNil','push','rec','[%s][voiceCallReport][varset]\x20event:','variable','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','mixmonitor_filename','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcallid','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','destconnectedlinenum','event','BlindTransfer','blindTransfers','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../model/channel','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','set','queue','dial','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','syncNewCallerId','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','linkedid','pick','keys','[%s][voiceCallReport][newchannel]\x20event:','channel','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','format','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','merge','from-sip','split','exten','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s'];(function(_0xb26065,_0x36df08){var _0x974dce=function(_0x1b5ace){while(--_0x1b5ace){_0xb26065['push'](_0xb26065['shift']());}};_0x974dce(++_0x36df08);}(_0x2cef,0x12b));var _0xf2ce=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x2cef[_0x54d4a8];return _0x3b321b;};'use strict';var BPromise=require(_0xf2ce('0x0'));var _=require(_0xf2ce('0x1'));var moment=require('moment');var util=require(_0xf2ce('0x2'));var path=require(_0xf2ce('0x3'));var Redis=require(_0xf2ce('0x4'));var config=require(_0xf2ce('0x5'));var logger=require(_0xf2ce('0x6'))(_0xf2ce('0x7'));var ami=require('../ami');var Channel=require(_0xf2ce('0x8'));var statusDesc=['unknown',_0xf2ce('0x9'),_0xf2ce('0xa'),_0xf2ce('0xb'),_0xf2ce('0xc'),_0xf2ce('0xd'),_0xf2ce('0xe'),_0xf2ce('0xf'),'onhold'];var applications=[_0xf2ce('0x10'),_0xf2ce('0x11'),'agi',_0xf2ce('0x12'),'playback',_0xf2ce('0x13')];var dispositions=[_0xf2ce('0x14'),_0xf2ce('0x15'),_0xf2ce('0x15'),_0xf2ce('0x14'),_0xf2ce('0x14'),_0xf2ce('0x14'),_0xf2ce('0x16'),_0xf2ce('0x17'),_0xf2ce('0x15'),_0xf2ce('0x15'),_0xf2ce('0x15')];var actions={};config[_0xf2ce('0x18')]=_[_0xf2ce('0x19')](config[_0xf2ce('0x18')],{'host':_0xf2ce('0x1a'),'port':0x18eb});var io=require(_0xf2ce('0x1b'))(new Redis(config[_0xf2ce('0x18')]));function VoiceCallReport(_0x371bfa){this[_0xf2ce('0x1c')]=_0x371bfa[_0xf2ce('0x1c')];this[_0xf2ce('0x1d')]=_0x371bfa[_0xf2ce('0x1d')];this['blindTransfers']={};ami['on'](_0xf2ce('0x1e'),this[_0xf2ce('0x1f')]['bind'](this));ami['on']('newexten',this[_0xf2ce('0x1f')][_0xf2ce('0x20')](this));ami['on']('newchannel',this[_0xf2ce('0x21')][_0xf2ce('0x20')](this));ami['on'](_0xf2ce('0x22'),this[_0xf2ce('0x23')][_0xf2ce('0x20')](this));ami['on'](_0xf2ce('0x24'),this[_0xf2ce('0x25')][_0xf2ce('0x20')](this));ami['on'](_0xf2ce('0x26'),this[_0xf2ce('0x27')]['bind'](this));ami['on']('newcallerid',this['syncNewCallerId'][_0xf2ce('0x20')](this));ami['on'](_0xf2ce('0x28'),this[_0xf2ce('0x29')][_0xf2ce('0x20')](this));ami['on'](_0xf2ce('0x2a'),this[_0xf2ce('0x2b')][_0xf2ce('0x20')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0xf2ce('0x20')](this));ami['on'](_0xf2ce('0x2c'),this[_0xf2ce('0x2d')][_0xf2ce('0x20')](this));try{logger[_0xf2ce('0x2e')](_0xf2ce('0x2f'));ami['actionCoreShowChannels']();}catch(_0x5569b2){logger[_0xf2ce('0x30')](_0xf2ce('0x31'),util[_0xf2ce('0x32')](_0x5569b2,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xf2ce('0x33')][_0xf2ce('0x34')]=function(_0x436cbc){return _0x436cbc!==null&&!_[_0xf2ce('0x35')](_0x436cbc);};VoiceCallReport[_0xf2ce('0x33')][_0xf2ce('0x36')]=function(_0x366c95,_0x1c0db6,_0x2bfc56){io['to'](_0x366c95)[_0xf2ce('0x36')](_0x1c0db6,_0x2bfc56);};VoiceCallReport['prototype'][_0xf2ce('0x37')]=function(_0x56d288){try{if(this['isNotNull'](_0x56d288)){logger['info'](_0xf2ce('0x38'),_0x56d288[_0xf2ce('0x39')],_0x56d288['calleridname'],_0x56d288[_0xf2ce('0x3a')]);logger['debug']('[%s][voiceCallReport][newcallerid]\x20event:',_0x56d288[_0xf2ce('0x39')],util['inspect'](_0x56d288,{'showHidden':![],'depth':null}));if(_0x56d288[_0xf2ce('0x39')]===_0x56d288[_0xf2ce('0x3b')]){if(!_['isUndefined'](this[_0xf2ce('0x1c')][_0x56d288[_0xf2ce('0x39')]])){_['merge'](this['channels'][_0x56d288[_0xf2ce('0x39')]],_[_0xf2ce('0x3c')](_0x56d288,_[_0xf2ce('0x3d')](this[_0xf2ce('0x1c')][_0x56d288[_0xf2ce('0x39')]])));}}}}catch(_0x22ad5a){logger[_0xf2ce('0x30')]('[%s][voiceCallReport][newcallerid]',_0x56d288[_0xf2ce('0x39')],util[_0xf2ce('0x32')](_0x22ad5a,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xf2ce('0x21')]=function(_0x55d98c){try{if(this['isNotNull'](_0x55d98c)){logger['debug'](_0xf2ce('0x3e'),_0x55d98c[_0xf2ce('0x39')],util[_0xf2ce('0x32')](_0x55d98c,{'showHidden':![],'depth':null}));if(_0x55d98c[_0xf2ce('0x39')]===_0x55d98c['linkedid']&&_0x55d98c[_0xf2ce('0x3f')]!='OutgoingSpoolFailed'){if(_[_0xf2ce('0x35')](this['channels'][_0x55d98c[_0xf2ce('0x39')]])){logger[_0xf2ce('0x2e')](_0xf2ce('0x40'),_0x55d98c[_0xf2ce('0x39')],_0x55d98c[_0xf2ce('0x41')],_0x55d98c['exten']);this['channels'][_0x55d98c['uniqueid']]=new Channel();this[_0xf2ce('0x1c')][_0x55d98c[_0xf2ce('0x39')]]['starttime']=moment()[_0xf2ce('0x42')](_0xf2ce('0x43'));this[_0xf2ce('0x1c')][_0x55d98c['uniqueid']][_0xf2ce('0x44')]=dispositions[_['toNumber'](_0x55d98c[_0xf2ce('0x45')])];_[_0xf2ce('0x46')](this[_0xf2ce('0x1c')][_0x55d98c['uniqueid']],_[_0xf2ce('0x3c')](_0x55d98c,_['keys'](this[_0xf2ce('0x1c')][_0x55d98c[_0xf2ce('0x39')]])));if(_0x55d98c[_0xf2ce('0x41')]===_0xf2ce('0x47')){if(this[_0xf2ce('0x1d')][_0x55d98c['channel'][_0xf2ce('0x48')]('-')[0x0]]){this[_0xf2ce('0x1d')][_0x55d98c[_0xf2ce('0x3f')][_0xf2ce('0x48')]('-')[0x0]]['destconnectedlinenum']=_0x55d98c[_0xf2ce('0x49')];logger['debug'](_0xf2ce('0x4a'),_0x55d98c[_0xf2ce('0x39')],util[_0xf2ce('0x32')]({'destaccountcode':this[_0xf2ce('0x1d')][_0x55d98c['channel']['split']('-')[0x0]][_0xf2ce('0x4b')],'destconnectedlinenum':_0x55d98c[_0xf2ce('0x49')]},{'showHidden':![],'depth':null}));this[_0xf2ce('0x36')](util[_0xf2ce('0x42')](_0xf2ce('0x4c'),this[_0xf2ce('0x1d')][_0x55d98c[_0xf2ce('0x3f')]['split']('-')[0x0]][_0xf2ce('0x4d')]),_0xf2ce('0x4e'),{'destaccountcode':this[_0xf2ce('0x1d')][_0x55d98c[_0xf2ce('0x3f')][_0xf2ce('0x48')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x55d98c[_0xf2ce('0x49')]});}}}}}}catch(_0x4674aa){logger[_0xf2ce('0x30')](_0xf2ce('0x4f'),_0x55d98c['uniqueid'],util[_0xf2ce('0x32')](_0x4674aa,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf2ce('0x33')]['syncNewExten']=function(_0x50d640){try{if(this[_0xf2ce('0x34')](_0x50d640)){logger['debug'](_0xf2ce('0x50'),_0x50d640[_0xf2ce('0x39')],util[_0xf2ce('0x32')](_0x50d640,{'showHidden':![],'depth':null}));if(_0x50d640['uniqueid']===_0x50d640[_0xf2ce('0x3b')]&&_0x50d640[_0xf2ce('0x49')]!='h'&&_0x50d640[_0xf2ce('0x3f')]!=_0xf2ce('0x51')){_0x50d640[_0xf2ce('0x52')]=_0x50d640['application'][_0xf2ce('0x53')]();_0x50d640[_0xf2ce('0x54')]=(_0x50d640['appdata']||_0x50d640[_0xf2ce('0x54')])[_0xf2ce('0x53')]();logger[_0xf2ce('0x2e')](_0xf2ce('0x55'),_0x50d640[_0xf2ce('0x39')],_0x50d640[_0xf2ce('0x52')],_0x50d640[_0xf2ce('0x54')]);if(_[_0xf2ce('0x35')](this['channels'][_0x50d640[_0xf2ce('0x39')]])){this[_0xf2ce('0x1c')][_0x50d640['uniqueid']]=new Channel();this[_0xf2ce('0x1c')][_0x50d640['uniqueid']][_0xf2ce('0x56')]=_0x50d640[_0xf2ce('0x57')]?moment()['subtract'](moment[_0xf2ce('0x57')](_0x50d640[_0xf2ce('0x57')])['seconds'](),_0xf2ce('0x58'))['format'](_0xf2ce('0x43')):moment()[_0xf2ce('0x42')](_0xf2ce('0x43'));this[_0xf2ce('0x1c')][_0x50d640['uniqueid']]['disposition']='NO\x20ANSWER';}_[_0xf2ce('0x46')](this[_0xf2ce('0x1c')][_0x50d640['uniqueid']],_[_0xf2ce('0x3c')](_0x50d640,_[_0xf2ce('0x3d')](this[_0xf2ce('0x1c')][_0x50d640[_0xf2ce('0x39')]])));if(_[_0xf2ce('0x59')](applications,_0x50d640['application'])){this[_0xf2ce('0x1c')][_0x50d640['uniqueid']][_0xf2ce('0x5a')]=_0x50d640[_0xf2ce('0x52')];this[_0xf2ce('0x1c')][_0x50d640[_0xf2ce('0x39')]]['lastdata']=_0x50d640['applicationdata'];if(_0x50d640[_0xf2ce('0x52')]===_0xf2ce('0x10')&&_[_0xf2ce('0x5b')](_0x50d640[_0xf2ce('0x54')],_0xf2ce('0x5c'))){var _0x591da1=_0x50d640[_0xf2ce('0x54')]['split']('=');var _0x40ce20=_0x591da1[0x0][_0xf2ce('0x5d')](/cdr\((.*)\)/);if(_0x40ce20){this[_0xf2ce('0x1c')][_0x50d640['uniqueid']][_0x40ce20[0x1]]=_0x591da1[0x1];}}else if(_0x50d640[_0xf2ce('0x52')]===_0xf2ce('0x11')){this[_0xf2ce('0x1c')][_0x50d640['uniqueid']][_0xf2ce('0x11')]=_0x50d640[_0xf2ce('0x54')][_0xf2ce('0x48')](',')[0x0];}}}}}catch(_0x40b6a1){logger[_0xf2ce('0x30')](_0xf2ce('0x5e'),_0x50d640['uniqueid'],util[_0xf2ce('0x32')](_0x40b6a1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf2ce('0x33')][_0xf2ce('0x23')]=function(_0x5a9ad2){try{if(this[_0xf2ce('0x34')](_0x5a9ad2)){logger[_0xf2ce('0x2e')](_0xf2ce('0x5f'),_0x5a9ad2['uniqueid'],_0x5a9ad2[_0xf2ce('0x3b')],_0x5a9ad2[_0xf2ce('0x60')],_0x5a9ad2[_0xf2ce('0x3a')]);logger[_0xf2ce('0x61')]('[%s][voiceCallReport][newstate]\x20event:',_0x5a9ad2[_0xf2ce('0x39')],util[_0xf2ce('0x32')](_0x5a9ad2,{'showHidden':![],'depth':null}));if(_0x5a9ad2[_0xf2ce('0x39')]!==_0x5a9ad2['linkedid']){if(this[_0xf2ce('0x1c')][_0x5a9ad2['linkedid']]){if(_0x5a9ad2['channelstate']==='6'){if(!this['channels'][_0x5a9ad2['linkedid']][_0xf2ce('0x62')]){var _0x51b8ec=moment();this['channels'][_0x5a9ad2[_0xf2ce('0x3b')]]['answered']=!![];this['channels'][_0x5a9ad2[_0xf2ce('0x3b')]][_0xf2ce('0x63')]=_0x51b8ec[_0xf2ce('0x42')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xf2ce('0x1c')][_0x5a9ad2[_0xf2ce('0x3b')]]['starttime']){this[_0xf2ce('0x1c')][_0x5a9ad2['linkedid']][_0xf2ce('0x64')]=_0x51b8ec[_0xf2ce('0x65')](this[_0xf2ce('0x1c')][_0x5a9ad2[_0xf2ce('0x3b')]]['starttime'],_0xf2ce('0x58'));}}this[_0xf2ce('0x1c')][_0x5a9ad2[_0xf2ce('0x3b')]][_0xf2ce('0x3b')]=_0x5a9ad2['uniqueid'];if(_0x5a9ad2['calleridnum']!==_0xf2ce('0x66')){this[_0xf2ce('0x1c')][_0x5a9ad2[_0xf2ce('0x3b')]][_0xf2ce('0x67')]=_0x5a9ad2['calleridnum'];}this[_0xf2ce('0x1c')][_0x5a9ad2[_0xf2ce('0x3b')]]['connectedlinename']=_0x5a9ad2[_0xf2ce('0x60')];this[_0xf2ce('0x1c')][_0x5a9ad2[_0xf2ce('0x3b')]][_0xf2ce('0x68')]=_0x5a9ad2[_0xf2ce('0x3f')];this['channels'][_0x5a9ad2[_0xf2ce('0x3b')]]['disposition']=dispositions[_[_0xf2ce('0x69')](_0x5a9ad2['channelstate'])];if(this[_0xf2ce('0x1d')][_0x5a9ad2[_0xf2ce('0x3f')][_0xf2ce('0x48')]('-')[0x0]]){this['channels'][_0x5a9ad2[_0xf2ce('0x3b')]]['UserId']=this[_0xf2ce('0x1d')][_0x5a9ad2[_0xf2ce('0x3f')][_0xf2ce('0x48')]('-')[0x0]]['id'];this[_0xf2ce('0x1c')][_0x5a9ad2[_0xf2ce('0x3b')]][_0xf2ce('0x6a')]=this[_0xf2ce('0x1d')][_0x5a9ad2[_0xf2ce('0x3f')][_0xf2ce('0x48')]('-')[0x0]]['name'];}}}}else{if(this[_0xf2ce('0x1c')][_0x5a9ad2[_0xf2ce('0x39')]]){if(_0x5a9ad2[_0xf2ce('0x45')]==='6'){if(this[_0xf2ce('0x1d')][_0x5a9ad2[_0xf2ce('0x3f')][_0xf2ce('0x48')]('-')[0x0]]){this[_0xf2ce('0x1c')][_0x5a9ad2[_0xf2ce('0x39')]][_0xf2ce('0x6b')]=this[_0xf2ce('0x1d')][_0x5a9ad2[_0xf2ce('0x3f')][_0xf2ce('0x48')]('-')[0x0]]['id'];this[_0xf2ce('0x1c')][_0x5a9ad2[_0xf2ce('0x39')]][_0xf2ce('0x6a')]=this['agents'][_0x5a9ad2['channel'][_0xf2ce('0x48')]('-')[0x0]][_0xf2ce('0x4d')];}}}}}}catch(_0x479eb1){logger[_0xf2ce('0x30')](_0xf2ce('0x6c'),_0x5a9ad2[_0xf2ce('0x39')],util[_0xf2ce('0x32')](_0x479eb1,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xf2ce('0x6d')]=function(_0x3d2c15,_0x5d5350){try{if(this[_0xf2ce('0x1c')][_0x3d2c15]){logger[_0xf2ce('0x2e')](_0xf2ce('0x6e'),_0x3d2c15,_0x5d5350);this[_0xf2ce('0x1c')][_0x3d2c15]['monitor']=!![];if(_[_0xf2ce('0x6f')](_0x5d5350,_0xf2ce('0x70'))){_0x5d5350=_0x5d5350[_0xf2ce('0x71')]('.wav49',_0xf2ce('0x72'));}this[_0xf2ce('0x1c')][_0x3d2c15][_0xf2ce('0x73')]=_0x5d5350;var _0x43c9fe=_[_0xf2ce('0x74')](this[_0xf2ce('0x1c')][_0x3d2c15][_0xf2ce('0x75')],{'filename':_0x5d5350});if(_[_0xf2ce('0x76')](_0x43c9fe)){this[_0xf2ce('0x1c')][_0x3d2c15][_0xf2ce('0x75')][_0xf2ce('0x77')]({'filename':_0x5d5350,'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0xf2ce('0x78')});}}}catch(_0x402b85){logger[_0xf2ce('0x30')]('[%s][voiceCallReport][mixMonitorFilename]',_0x3d2c15,util['inspect'](_0x402b85,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf2ce('0x33')]['syncVarSet']=function(_0x22f3e7){try{if(this[_0xf2ce('0x34')](_0x22f3e7)){logger[_0xf2ce('0x61')](_0xf2ce('0x79'),_0x22f3e7['uniqueid'],util['inspect'](_0x22f3e7,{'showHidden':![],'depth':null}));if(this[_0xf2ce('0x1c')][_0x22f3e7['uniqueid']]&&_0x22f3e7[_0xf2ce('0x3f')]!=_0xf2ce('0x51')){if(this[_0xf2ce('0x34')](_0x22f3e7['variable'])){if(this['isNotNull'](_0x22f3e7[_0xf2ce('0x7a')]['mixmonitor_filename'])){logger[_0xf2ce('0x2e')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x22f3e7['uniqueid'],_0x22f3e7[_0xf2ce('0x7b')]);this['syncMixMonitorFilename'](_0x22f3e7[_0xf2ce('0x39')],_0x22f3e7[_0xf2ce('0x7b')]);}else if(this[_0xf2ce('0x34')](_0x22f3e7[_0xf2ce('0x7a')][_0xf2ce('0x7c')])){logger[_0xf2ce('0x2e')](_0xf2ce('0x7d'),_0x22f3e7['uniqueid'],_0x22f3e7[_0xf2ce('0x7b')]);this['channels'][_0x22f3e7[_0xf2ce('0x39')]]['calleridnum']=_0x22f3e7[_0xf2ce('0x7b')];}else if(this[_0xf2ce('0x34')](_0x22f3e7['variable']['xmd-callerid'])){logger[_0xf2ce('0x2e')](_0xf2ce('0x7e'),_0x22f3e7[_0xf2ce('0x39')],_0x22f3e7['value']);this[_0xf2ce('0x1c')][_0x22f3e7[_0xf2ce('0x39')]]['callerid']=_0x22f3e7[_0xf2ce('0x7b')];}else if(this[_0xf2ce('0x34')](_0x22f3e7[_0xf2ce('0x7a')][_0xf2ce('0x7f')])){logger['info'](_0xf2ce('0x80'),_0x22f3e7[_0xf2ce('0x39')],_0x22f3e7[_0xf2ce('0x7b')]);this[_0xf2ce('0x1c')][_0x22f3e7[_0xf2ce('0x39')]][_0xf2ce('0x81')]=_0x22f3e7['value'];}else if(this[_0xf2ce('0x34')](_0x22f3e7[_0xf2ce('0x7a')][_0xf2ce('0x82')])){logger[_0xf2ce('0x2e')](_0xf2ce('0x83'),_0x22f3e7[_0xf2ce('0x39')],_0x22f3e7[_0xf2ce('0x7b')][_0xf2ce('0x48')](',')[0x0]);this['channels'][_0x22f3e7[_0xf2ce('0x39')]][_0xf2ce('0x11')]=_0x22f3e7[_0xf2ce('0x7b')][_0xf2ce('0x48')](',')[0x0];}else if(this['isNotNull'](_0x22f3e7[_0xf2ce('0x7a')][_0xf2ce('0x84')])){logger['info'](_0xf2ce('0x85'),_0x22f3e7[_0xf2ce('0x39')],_0x22f3e7[_0xf2ce('0x7b')]);this[_0xf2ce('0x1c')][_0x22f3e7[_0xf2ce('0x39')]][_0xf2ce('0x86')]=_0x22f3e7[_0xf2ce('0x7b')];}else if(this['isNotNull'](_0x22f3e7[_0xf2ce('0x7a')][_0xf2ce('0x87')])){logger['info'](_0xf2ce('0x88'),_0x22f3e7[_0xf2ce('0x39')],_0x22f3e7[_0xf2ce('0x7b')]);this[_0xf2ce('0x1c')][_0x22f3e7[_0xf2ce('0x39')]][_0xf2ce('0x89')]=_0x22f3e7[_0xf2ce('0x7b')];}else if(this['isNotNull'](_0x22f3e7[_0xf2ce('0x7a')][_0xf2ce('0x8a')])){logger[_0xf2ce('0x2e')](_0xf2ce('0x8b'),_0x22f3e7['uniqueid'],_0x22f3e7[_0xf2ce('0x7b')]);this[_0xf2ce('0x1c')][_0x22f3e7[_0xf2ce('0x39')]][_0xf2ce('0x8c')]=_0x22f3e7['value'];}else if(this[_0xf2ce('0x34')](_0x22f3e7[_0xf2ce('0x7a')][_0xf2ce('0x8d')])){logger[_0xf2ce('0x2e')](_0xf2ce('0x8e'),_0x22f3e7[_0xf2ce('0x39')],_0x22f3e7['value']);this['channels'][_0x22f3e7[_0xf2ce('0x39')]][_0xf2ce('0x11')]=_0x22f3e7[_0xf2ce('0x7b')];}else if(this[_0xf2ce('0x34')](_0x22f3e7[_0xf2ce('0x7a')]['sipcallid'])){logger[_0xf2ce('0x2e')](_0xf2ce('0x8f'),_0x22f3e7[_0xf2ce('0x39')],_0x22f3e7['value']);this[_0xf2ce('0x1c')][_0x22f3e7[_0xf2ce('0x39')]][_0xf2ce('0x90')]=_0x22f3e7[_0xf2ce('0x7b')];}}}else if(this['isNotNull'](_0x22f3e7[_0xf2ce('0x7a')][_0xf2ce('0x91')])){if(_0x22f3e7[_0xf2ce('0x7b')]){var _0x302718=path[_0xf2ce('0x92')](_0x22f3e7['value'])[_0xf2ce('0x4d')];logger[_0xf2ce('0x2e')](_0xf2ce('0x93'),_0x302718,_0x22f3e7[_0xf2ce('0x7b')]);this[_0xf2ce('0x6d')](_0x302718,_0x22f3e7[_0xf2ce('0x7b')]);}}else if(this[_0xf2ce('0x1c')][_0x22f3e7[_0xf2ce('0x3b')]]){if(this[_0xf2ce('0x34')](_0x22f3e7['variable'])){if(this[_0xf2ce('0x34')](_0x22f3e7['variable'][_0xf2ce('0x94')])){logger[_0xf2ce('0x2e')](_0xf2ce('0x8f'),_0x22f3e7[_0xf2ce('0x3b')],_0x22f3e7[_0xf2ce('0x7b')]);this['channels'][_0x22f3e7[_0xf2ce('0x3b')]][_0xf2ce('0x95')]=_0x22f3e7[_0xf2ce('0x7b')];}}}}}catch(_0x4f67cc){logger[_0xf2ce('0x30')](_0xf2ce('0x96'),_0x22f3e7[_0xf2ce('0x39')],util[_0xf2ce('0x32')](_0x4f67cc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf2ce('0x33')]['syncHangup']=function(_0x24ec38){try{if(this[_0xf2ce('0x34')](_0x24ec38)){logger[_0xf2ce('0x61')]('[%s][voiceCallReport][hangup]\x20event:',_0x24ec38['uniqueid'],util[_0xf2ce('0x32')](_0x24ec38,{'showHidden':![],'depth':null}));if(this['channels'][_0x24ec38[_0xf2ce('0x39')]]){logger[_0xf2ce('0x2e')](_0xf2ce('0x97'),_0x24ec38['uniqueid'],_0x24ec38[_0xf2ce('0x98')]);var _0x430b5c=moment();this['channels'][_0x24ec38[_0xf2ce('0x39')]][_0xf2ce('0x99')]=_0x430b5c[_0xf2ce('0x42')](_0xf2ce('0x43'));this['channels'][_0x24ec38[_0xf2ce('0x39')]]['duration']=_0x430b5c[_0xf2ce('0x65')](this[_0xf2ce('0x1c')][_0x24ec38['uniqueid']]['starttime'],_0xf2ce('0x58'));if(this[_0xf2ce('0x1c')][_0x24ec38['uniqueid']][_0xf2ce('0x62')]){this[_0xf2ce('0x1c')][_0x24ec38[_0xf2ce('0x39')]][_0xf2ce('0x9a')]=_0x430b5c['diff'](this[_0xf2ce('0x1c')][_0x24ec38[_0xf2ce('0x39')]][_0xf2ce('0x63')],_0xf2ce('0x58'));this['channels'][_0x24ec38[_0xf2ce('0x39')]][_0xf2ce('0x64')]=this[_0xf2ce('0x1c')][_0x24ec38[_0xf2ce('0x39')]][_0xf2ce('0x57')]-this['channels'][_0x24ec38[_0xf2ce('0x39')]]['billableseconds'];}if(_0x24ec38[_0xf2ce('0x41')]===_0xf2ce('0x47')){if(this[_0xf2ce('0x1d')][_0x24ec38[_0xf2ce('0x3f')][_0xf2ce('0x48')]('-')[0x0]]){this[_0xf2ce('0x1d')][_0x24ec38['channel'][_0xf2ce('0x48')]('-')[0x0]]=_['omit'](this[_0xf2ce('0x1d')][_0x24ec38[_0xf2ce('0x3f')]['split']('-')[0x0]],[_0xf2ce('0x9b')]);logger[_0xf2ce('0x61')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x24ec38[_0xf2ce('0x39')],util[_0xf2ce('0x32')]({'destaccountcode':this[_0xf2ce('0x1d')][_0x24ec38[_0xf2ce('0x3f')][_0xf2ce('0x48')]('-')[0x0]][_0xf2ce('0x4b')]},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xf2ce('0x4c'),this[_0xf2ce('0x1d')][_0x24ec38[_0xf2ce('0x3f')][_0xf2ce('0x48')]('-')[0x0]]['name']),'user:agentcomplete',{'destaccountcode':this[_0xf2ce('0x1d')][_0x24ec38[_0xf2ce('0x3f')][_0xf2ce('0x48')]('-')[0x0]][_0xf2ce('0x4b')]});}}if(_0x24ec38[_0xf2ce('0x9c')]===_0xf2ce('0x9d')){this[_0xf2ce('0x9e')][_0x24ec38[_0xf2ce('0x39')]]=this['channels'][_0x24ec38[_0xf2ce('0x39')]];}else{if(this[_0xf2ce('0x1c')][_0x24ec38['uniqueid']]['type']===_0xf2ce('0x9f')&&this[_0xf2ce('0x9e')][_0x24ec38['uniqueid']]){this['channels'][_0x24ec38[_0xf2ce('0x39')]][_0xf2ce('0x39')]=[this[_0xf2ce('0x1c')][_0x24ec38[_0xf2ce('0x39')]][_0xf2ce('0x3b')],this[_0xf2ce('0x1c')][_0x24ec38[_0xf2ce('0x39')]]['linkedid']=this['channels'][_0x24ec38[_0xf2ce('0x39')]][_0xf2ce('0x39')]][0x0];delete this[_0xf2ce('0x9e')][_0x24ec38['uniqueid']];}}logger[_0xf2ce('0x61')](_0xf2ce('0xa0'),_0x24ec38['uniqueid'],util['inspect'](this[_0xf2ce('0x1c')][_0x24ec38[_0xf2ce('0x39')]],{'showHidden':![],'depth':null}));ami[_0xf2ce('0x36')](_0xf2ce('0xa1'),this[_0xf2ce('0x1c')][_0x24ec38[_0xf2ce('0x39')]]);delete this[_0xf2ce('0x1c')][_0x24ec38[_0xf2ce('0x39')]];}}}catch(_0x422af6){logger['error'](_0xf2ce('0xa2'),_0x24ec38[_0xf2ce('0x39')],util[_0xf2ce('0x32')](_0x422af6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf2ce('0x33')][_0xf2ce('0x29')]=function(_0xf34a51){try{if(this[_0xf2ce('0x34')](_0xf34a51)){logger[_0xf2ce('0x2e')](_0xf2ce('0xa3'),_0xf34a51[_0xf2ce('0x39')],_0xf34a51[_0xf2ce('0xa4')],_0xf34a51['transfertargetcalleridnum']);logger[_0xf2ce('0x61')]('[%s][voiceCallReport][attendedtransfer]\x20event:',_0xf34a51[_0xf2ce('0x39')],util[_0xf2ce('0x32')](_0xf34a51,{'showHidden':![],'depth':null}));if(this[_0xf2ce('0x1c')][_0xf34a51[_0xf2ce('0xa5')]]){this[_0xf2ce('0x1c')][_0xf34a51[_0xf2ce('0xa5')]][_0xf2ce('0xa6')]=_0xf34a51[_0xf2ce('0xa4')];this[_0xf2ce('0x1c')][_0xf34a51[_0xf2ce('0xa5')]][_0xf2ce('0xa7')]=_0xf34a51[_0xf2ce('0xa8')];if(this[_0xf2ce('0x1c')][_0xf34a51[_0xf2ce('0xa9')]]){var _0x49613=this[_0xf2ce('0x1c')][_0xf34a51[_0xf2ce('0xa9')]];this[_0xf2ce('0x1c')][_0xf34a51[_0xf2ce('0xa9')]]=this['channels'][_0xf34a51['transfereeuniqueid']];this[_0xf2ce('0x1c')][_0xf34a51[_0xf2ce('0xa5')]]=_0x49613;}}else if(this['channels'][_0xf34a51[_0xf2ce('0xaa')]]){this[_0xf2ce('0x1c')][_0xf34a51[_0xf2ce('0xaa')]][_0xf2ce('0xa6')]=_0xf34a51[_0xf2ce('0xa4')];this['channels'][_0xf34a51[_0xf2ce('0xaa')]][_0xf2ce('0xa7')]=_0xf34a51[_0xf2ce('0xa8')];if(this[_0xf2ce('0x1c')][_0xf34a51[_0xf2ce('0xab')]]){var _0x49613=this['channels'][_0xf34a51[_0xf2ce('0xab')]];this['channels'][_0xf34a51[_0xf2ce('0xab')]]=this['channels'][_0xf34a51[_0xf2ce('0xaa')]];this[_0xf2ce('0x1c')][_0xf34a51['transfertargetuniqueid']]=_0x49613;}}}}catch(_0x4f0c24){logger[_0xf2ce('0x30')](_0xf2ce('0xac'),_0xf34a51['uniqueid'],util[_0xf2ce('0x32')](_0x4f0c24,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf2ce('0x33')]['syncBlindTransfer']=function(_0xaa4bcd){try{if(this[_0xf2ce('0x34')](_0xaa4bcd)){logger[_0xf2ce('0x2e')](_0xf2ce('0xad'),_0xaa4bcd[_0xf2ce('0x39')],_0xaa4bcd['transfereecalleridnum'],_0xaa4bcd[_0xf2ce('0xae')]);logger[_0xf2ce('0x61')](_0xf2ce('0xaf'),_0xaa4bcd['uniqueid'],util[_0xf2ce('0x32')](_0xaa4bcd,{'showHidden':![],'depth':null}));if(this[_0xf2ce('0x1c')][_0xaa4bcd[_0xf2ce('0xa5')]]){this[_0xf2ce('0x1c')][_0xaa4bcd[_0xf2ce('0xa5')]]['transfercalleridnum']=_0xaa4bcd['transfereecalleridnum'];this[_0xf2ce('0x1c')][_0xaa4bcd['transfereeuniqueid']][_0xf2ce('0xa7')]=_0xaa4bcd[_0xf2ce('0xae')];this[_0xf2ce('0x27')]({'event':_0xf2ce('0x9d'),'uniqueid':_0xaa4bcd[_0xf2ce('0xa5')],'context':_0xaa4bcd['context'],'channel':_0xaa4bcd[_0xf2ce('0xb0')]});}}}catch(_0x1a5b56){logger[_0xf2ce('0x30')](_0xf2ce('0xb1'),_0xaa4bcd[_0xf2ce('0x39')],util['inspect'](_0x1a5b56,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf2ce('0x33')]['syncMusicOnHoldStart']=function(_0x17b10e){try{if(this[_0xf2ce('0x34')](_0x17b10e)){logger['debug'](_0xf2ce('0xb2'),_0x17b10e[_0xf2ce('0x39')],util[_0xf2ce('0x32')](_0x17b10e,{'showHidden':![],'depth':null}));if(this[_0xf2ce('0x1c')][_0x17b10e[_0xf2ce('0x39')]]){if(!_['isNil'](this[_0xf2ce('0x1c')][_0x17b10e['uniqueid']][_0xf2ce('0x63')])){this['channels'][_0x17b10e['uniqueid']][_0xf2ce('0xb3')]=moment()[_0xf2ce('0x42')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xf2ce('0x2e')](_0xf2ce('0xb4'),_0x17b10e[_0xf2ce('0x39')],this['channels'][_0x17b10e[_0xf2ce('0x39')]]['mohstarttime']);}}}}catch(_0x100cb7){logger[_0xf2ce('0x30')](_0xf2ce('0xb5'),_0x17b10e[_0xf2ce('0x39')],util[_0xf2ce('0x32')](_0x100cb7,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xf2ce('0x2d')]=function(_0x820053){try{if(this[_0xf2ce('0x34')](_0x820053)){logger['debug'](_0xf2ce('0xb6'),_0x820053[_0xf2ce('0x39')],util[_0xf2ce('0x32')](_0x820053,{'showHidden':![],'depth':null}));if(this[_0xf2ce('0x1c')][_0x820053[_0xf2ce('0x39')]]){if(!_['isNil'](this[_0xf2ce('0x1c')][_0x820053[_0xf2ce('0x39')]][_0xf2ce('0xb3')])){this[_0xf2ce('0x1c')][_0x820053['uniqueid']][_0xf2ce('0xb7')]+=moment()[_0xf2ce('0xb8')](0x0)[_0xf2ce('0x65')](this['channels'][_0x820053[_0xf2ce('0x39')]]['mohstarttime'],_0xf2ce('0x58'));logger[_0xf2ce('0x2e')](_0xf2ce('0xb9'),_0x820053['uniqueid'],this[_0xf2ce('0x1c')][_0x820053[_0xf2ce('0x39')]][_0xf2ce('0xb7')]);delete this[_0xf2ce('0x1c')][_0x820053['uniqueid']][_0xf2ce('0xb3')];}}}}catch(_0x1c655f){logger[_0xf2ce('0x30')](_0xf2ce('0xba'),_0x820053[_0xf2ce('0x39')],util['inspect'](_0x1c655f,{'showHidden':![],'depth':null}));}};module[_0xf2ce('0xbb')]=VoiceCallReport;
\ No newline at end of file
+var _0x341f=['toLowerCase','applicationdata','appdata','startsWith','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','includes','lastapplication','lastdata','cdr(','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','channelstate','answered','holdtime','diff','connectedlinename','destinationchannel','UserId','membername','answertime','seconds','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','monitorFilename','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcallid','sipcalllinkedid','syncHangup','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','billableseconds','omit','user:agentcomplete','length','transferType','undefined','isEmpty','getSettings','then','resolve','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','outbound','syncAttendedTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','origtransfererlinkedid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','../rpc/setting','set','queue','dial','playback','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','syncNewExten','bind','newexten','newchannel','syncNewChannel','syncNewState','varset','syncVarSet','newcallerid','syncNewCallerId','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','linkedid','merge','pick','keys','context','from-sip','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','emit','user:%s','name','user:agentconnect','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','[%s][voiceCallReport][newchannel]','OutgoingSpoolFailed','application'];(function(_0x4ff1a8,_0xbb3134){var _0x5b5582=function(_0x5a760f){while(--_0x5a760f){_0x4ff1a8['push'](_0x4ff1a8['shift']());}};_0x5b5582(++_0xbb3134);}(_0x341f,0x1f3));var _0xf341=function(_0x633cf6,_0x38ef87){_0x633cf6=_0x633cf6-0x0;var _0x27ea7d=_0x341f[_0x633cf6];return _0x27ea7d;};'use strict';var _=require(_0xf341('0x0'));var moment=require(_0xf341('0x1'));var util=require(_0xf341('0x2'));var path=require('path');var Redis=require(_0xf341('0x3'));var config=require(_0xf341('0x4'));var logger=require(_0xf341('0x5'))('ami');var ami=require('../ami');var Channel=require('../model/channel');var RpcSetting=require(_0xf341('0x6'));var applications=[_0xf341('0x7'),_0xf341('0x8'),'agi',_0xf341('0x9'),_0xf341('0xa'),_0xf341('0xb')];var dispositions=[_0xf341('0xc'),'FAILED',_0xf341('0xd'),'NO\x20ANSWER',_0xf341('0xc'),_0xf341('0xc'),'ANSWERED',_0xf341('0xe'),_0xf341('0xd'),_0xf341('0xd'),_0xf341('0xd')];config[_0xf341('0xf')]=_[_0xf341('0x10')](config[_0xf341('0xf')],{'host':_0xf341('0x11'),'port':0x18eb});var io=require(_0xf341('0x12'))(new Redis(config['redis']));function VoiceCallReport(_0x183c2f){this['channels']=_0x183c2f[_0xf341('0x13')];this['agents']=_0x183c2f[_0xf341('0x14')];this[_0xf341('0x15')]={};ami['on']('coreshowchannel',this[_0xf341('0x16')][_0xf341('0x17')](this));ami['on'](_0xf341('0x18'),this[_0xf341('0x16')][_0xf341('0x17')](this));ami['on'](_0xf341('0x19'),this[_0xf341('0x1a')][_0xf341('0x17')](this));ami['on']('newstate',this[_0xf341('0x1b')]['bind'](this));ami['on'](_0xf341('0x1c'),this[_0xf341('0x1d')][_0xf341('0x17')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0xf341('0x1e'),this[_0xf341('0x1f')][_0xf341('0x17')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0xf341('0x20'),this[_0xf341('0x21')][_0xf341('0x17')](this));ami['on'](_0xf341('0x22'),this['syncMusicOnHoldStart'][_0xf341('0x17')](this));ami['on']('musiconholdstop',this[_0xf341('0x23')][_0xf341('0x17')](this));try{logger[_0xf341('0x24')](_0xf341('0x25'));ami[_0xf341('0x26')]();}catch(_0x597354){logger[_0xf341('0x27')](_0xf341('0x28'),util[_0xf341('0x29')](_0x597354,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xf341('0x2a')][_0xf341('0x2b')]=function(_0x243690){return _0x243690!==null&&!_[_0xf341('0x2c')](_0x243690);};VoiceCallReport['prototype']['emit']=function(_0x5cd0e2,_0x34fa89,_0x1c08a6){io['to'](_0x5cd0e2)['emit'](_0x34fa89,_0x1c08a6);};VoiceCallReport[_0xf341('0x2a')][_0xf341('0x1f')]=function(_0x23d8dd){try{if(this[_0xf341('0x2b')](_0x23d8dd)){logger[_0xf341('0x24')](_0xf341('0x2d'),_0x23d8dd['uniqueid'],_0x23d8dd[_0xf341('0x2e')],_0x23d8dd[_0xf341('0x2f')]);logger[_0xf341('0x30')](_0xf341('0x31'),_0x23d8dd[_0xf341('0x32')],util[_0xf341('0x29')](_0x23d8dd,{'showHidden':![],'depth':null}));if(_0x23d8dd[_0xf341('0x32')]===_0x23d8dd[_0xf341('0x33')]){if(!_[_0xf341('0x2c')](this['channels'][_0x23d8dd[_0xf341('0x32')]])){_[_0xf341('0x34')](this[_0xf341('0x13')][_0x23d8dd[_0xf341('0x32')]],_[_0xf341('0x35')](_0x23d8dd,_[_0xf341('0x36')](this[_0xf341('0x13')][_0x23d8dd[_0xf341('0x32')]])));}}if(_0x23d8dd[_0xf341('0x37')]===_0xf341('0x38')){if(this[_0xf341('0x14')][_0x23d8dd[_0xf341('0x39')][_0xf341('0x3a')]('-')[0x0]]){if(_0x23d8dd[_0xf341('0x3b')]==_0xf341('0x3c')){this[_0xf341('0x14')][_0x23d8dd[_0xf341('0x39')][_0xf341('0x3a')]('-')[0x0]][_0xf341('0x3d')]=_0x23d8dd[_0xf341('0x3e')];this[_0xf341('0x3f')](util['format'](_0xf341('0x40'),this['agents'][_0x23d8dd[_0xf341('0x39')]['split']('-')[0x0]][_0xf341('0x41')]),_0xf341('0x42'),{'destaccountcode':this[_0xf341('0x14')][_0x23d8dd[_0xf341('0x39')][_0xf341('0x3a')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x23d8dd['connectedlinenum']});}}}}}catch(_0x3a77e4){logger[_0xf341('0x27')](_0xf341('0x43'),_0x23d8dd[_0xf341('0x32')],util[_0xf341('0x29')](_0x3a77e4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf341('0x2a')][_0xf341('0x1a')]=function(_0x10277e){try{if(this[_0xf341('0x2b')](_0x10277e)){logger[_0xf341('0x30')](_0xf341('0x44'),_0x10277e[_0xf341('0x32')],util[_0xf341('0x29')](_0x10277e,{'showHidden':![],'depth':null}));if(this[_0xf341('0x13')][_0x10277e[_0xf341('0x32')]])return;if(_0x10277e[_0xf341('0x39')]==='OutgoingSpoolFailed')return;if(_0x10277e['uniqueid']!==_0x10277e[_0xf341('0x33')]&&!this[_0xf341('0x15')][_0x10277e['linkedid']])return;logger['info'](_0xf341('0x45'),_0x10277e[_0xf341('0x32')],_0x10277e[_0xf341('0x37')],_0x10277e[_0xf341('0x3b')]);this[_0xf341('0x13')][_0x10277e['uniqueid']]=new Channel();this['channels'][_0x10277e[_0xf341('0x32')]][_0xf341('0x46')]=moment()[_0xf341('0x47')](_0xf341('0x48'));this['channels'][_0x10277e[_0xf341('0x32')]][_0xf341('0x49')]=dispositions[_[_0xf341('0x4a')](_0x10277e['channelstate'])];_[_0xf341('0x34')](this[_0xf341('0x13')][_0x10277e[_0xf341('0x32')]],_[_0xf341('0x35')](_0x10277e,_[_0xf341('0x36')](this['channels'][_0x10277e[_0xf341('0x32')]])));if(_0x10277e[_0xf341('0x37')]===_0xf341('0x38')){if(this[_0xf341('0x14')][_0x10277e['channel']['split']('-')[0x0]]){if(_[_0xf341('0x2c')](this['agents'][_0x10277e[_0xf341('0x39')][_0xf341('0x3a')]('-')[0x0]]['destconnectedlinenum'])){this['agents'][_0x10277e[_0xf341('0x39')][_0xf341('0x3a')]('-')[0x0]][_0xf341('0x3d')]=_0x10277e[_0xf341('0x3b')];logger[_0xf341('0x30')](_0xf341('0x4b'),_0x10277e[_0xf341('0x32')],util[_0xf341('0x29')]({'id':this['agents'][_0x10277e[_0xf341('0x39')][_0xf341('0x3a')]('-')[0x0]]['id'],'destaccountcode':this[_0xf341('0x14')][_0x10277e['channel']['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x10277e[_0xf341('0x3b')]},{'showHidden':![],'depth':null}));this[_0xf341('0x3f')](util[_0xf341('0x47')](_0xf341('0x40'),this[_0xf341('0x14')][_0x10277e[_0xf341('0x39')][_0xf341('0x3a')]('-')[0x0]]['name']),_0xf341('0x42'),{'id':this['agents'][_0x10277e[_0xf341('0x39')][_0xf341('0x3a')]('-')[0x0]]['id'],'destaccountcode':this[_0xf341('0x14')][_0x10277e[_0xf341('0x39')][_0xf341('0x3a')]('-')[0x0]][_0xf341('0x4c')],'destconnectedlinenum':_0x10277e[_0xf341('0x3b')]});}}}}}catch(_0x126f58){logger[_0xf341('0x27')](_0xf341('0x4d'),_0x10277e['uniqueid'],util[_0xf341('0x29')](_0x126f58,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xf341('0x16')]=function(_0x3ef384){try{if(this[_0xf341('0x2b')](_0x3ef384)){logger[_0xf341('0x30')]('[%s][voiceCallReport][newexten]\x20event:',_0x3ef384[_0xf341('0x32')],util[_0xf341('0x29')](_0x3ef384,{'showHidden':![],'depth':null}));if(_0x3ef384[_0xf341('0x39')]===_0xf341('0x4e')||_0x3ef384[_0xf341('0x3b')]==='h')return;if(_0x3ef384[_0xf341('0x32')]===_0x3ef384[_0xf341('0x33')]||this[_0xf341('0x15')][_0x3ef384[_0xf341('0x33')]]){_0x3ef384['application']=_0x3ef384[_0xf341('0x4f')][_0xf341('0x50')]();_0x3ef384[_0xf341('0x51')]=_0x3ef384[_0xf341('0x52')]||_0x3ef384[_0xf341('0x51')];if(_0x3ef384[_0xf341('0x52')]&&!_0x3ef384[_0xf341('0x52')][_0xf341('0x53')](_0xf341('0x54'))&&_0x3ef384[_0xf341('0x4f')]!==_0xf341('0x8')){_0x3ef384['applicationdata']=_0x3ef384[_0xf341('0x51')][_0xf341('0x50')]();}logger[_0xf341('0x24')](_0xf341('0x55'),_0x3ef384[_0xf341('0x32')],_0x3ef384[_0xf341('0x4f')],_0x3ef384[_0xf341('0x51')]);if(_['isUndefined'](this[_0xf341('0x13')][_0x3ef384[_0xf341('0x32')]])){this[_0xf341('0x13')][_0x3ef384[_0xf341('0x32')]]=new Channel();this[_0xf341('0x13')][_0x3ef384[_0xf341('0x32')]][_0xf341('0x46')]=_0x3ef384['duration']?moment()['subtract'](moment[_0xf341('0x56')](_0x3ef384[_0xf341('0x56')])['seconds'](),'seconds')[_0xf341('0x47')](_0xf341('0x48')):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xf341('0x13')][_0x3ef384['uniqueid']][_0xf341('0x49')]=_0xf341('0xc');}_[_0xf341('0x34')](this[_0xf341('0x13')][_0x3ef384[_0xf341('0x32')]],_[_0xf341('0x35')](_0x3ef384,_['keys'](this[_0xf341('0x13')][_0x3ef384[_0xf341('0x32')]])));if(_[_0xf341('0x57')](applications,_0x3ef384['application'])){this[_0xf341('0x13')][_0x3ef384[_0xf341('0x32')]][_0xf341('0x58')]=_0x3ef384[_0xf341('0x4f')];this[_0xf341('0x13')][_0x3ef384[_0xf341('0x32')]][_0xf341('0x59')]=_0x3ef384[_0xf341('0x51')];if(_0x3ef384['application']===_0xf341('0x7')&&_[_0xf341('0x53')](_0x3ef384[_0xf341('0x51')][_0xf341('0x50')](),_0xf341('0x5a'))){var _0x59d25d=_0x3ef384[_0xf341('0x51')][_0xf341('0x3a')]('=');var _0x48f295=_0x59d25d[0x0]['toLowerCase']()['match'](/cdr\((.*)\)/);if(_0x48f295){if(_0x48f295[0x1]==='type'&&!_[_0xf341('0x5b')](this[_0xf341('0x13')][_0x3ef384[_0xf341('0x32')]][_0x48f295[0x1]]))return;this['channels'][_0x3ef384[_0xf341('0x32')]][_0x48f295[0x1]]=_0x59d25d[0x1];}}else if(_0x3ef384[_0xf341('0x4f')]===_0xf341('0x8')){this[_0xf341('0x13')][_0x3ef384[_0xf341('0x32')]][_0xf341('0x8')]=_0x3ef384[_0xf341('0x51')]['split'](',')[0x0];}}}}}catch(_0xee375b){logger[_0xf341('0x27')](_0xf341('0x5c'),_0x3ef384[_0xf341('0x32')],util[_0xf341('0x29')](_0xee375b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xf341('0x1b')]=function(_0x278531){try{if(this[_0xf341('0x2b')](_0x278531)){logger['info'](_0xf341('0x5d'),_0x278531['uniqueid'],_0x278531[_0xf341('0x33')],_0x278531[_0xf341('0x2e')],_0x278531['calleridnum']);logger[_0xf341('0x30')](_0xf341('0x5e'),_0x278531[_0xf341('0x32')],util['inspect'](_0x278531,{'showHidden':![],'depth':null}));if(_0x278531[_0xf341('0x5f')]!=='6')return;if(_0x278531[_0xf341('0x32')]!==_0x278531['linkedid']){var _0x12a780=moment();if(this['channels'][_0x278531['linkedid']]){if(!this[_0xf341('0x13')][_0x278531[_0xf341('0x33')]][_0xf341('0x60')]){this['channels'][_0x278531[_0xf341('0x33')]]['answered']=!![];this[_0xf341('0x13')][_0x278531['linkedid']]['answertime']=_0x12a780['format']('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xf341('0x13')][_0x278531['linkedid']]['starttime']){this[_0xf341('0x13')][_0x278531[_0xf341('0x33')]][_0xf341('0x61')]=_0x12a780[_0xf341('0x62')](this['channels'][_0x278531[_0xf341('0x33')]]['starttime'],'seconds');}}this[_0xf341('0x13')][_0x278531[_0xf341('0x33')]][_0xf341('0x33')]=_0x278531[_0xf341('0x32')];if(_0x278531['calleridnum']!=='xcally-motion-preview'){this[_0xf341('0x13')][_0x278531['linkedid']][_0xf341('0x3e')]=_0x278531[_0xf341('0x2f')];}this[_0xf341('0x13')][_0x278531['linkedid']][_0xf341('0x63')]=_0x278531[_0xf341('0x2e')];this[_0xf341('0x13')][_0x278531['linkedid']][_0xf341('0x64')]=_0x278531[_0xf341('0x39')];this[_0xf341('0x13')][_0x278531[_0xf341('0x33')]][_0xf341('0x49')]=dispositions[_['toNumber'](_0x278531[_0xf341('0x5f')])];if(this[_0xf341('0x14')][_0x278531['channel'][_0xf341('0x3a')]('-')[0x0]]){this[_0xf341('0x13')][_0x278531[_0xf341('0x33')]][_0xf341('0x65')]=this[_0xf341('0x14')][_0x278531[_0xf341('0x39')][_0xf341('0x3a')]('-')[0x0]]['id'];this[_0xf341('0x13')][_0x278531['linkedid']][_0xf341('0x66')]=this[_0xf341('0x14')][_0x278531[_0xf341('0x39')][_0xf341('0x3a')]('-')[0x0]]['name'];}}if(this['channels'][_0x278531[_0xf341('0x32')]]){if(!this[_0xf341('0x13')][_0x278531[_0xf341('0x32')]][_0xf341('0x60')]){this[_0xf341('0x13')][_0x278531[_0xf341('0x32')]]['answered']=!![];this[_0xf341('0x13')][_0x278531[_0xf341('0x32')]][_0xf341('0x67')]=_0x12a780[_0xf341('0x47')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xf341('0x13')][_0x278531[_0xf341('0x32')]][_0xf341('0x46')]){this[_0xf341('0x13')][_0x278531[_0xf341('0x32')]][_0xf341('0x61')]=_0x12a780[_0xf341('0x62')](this[_0xf341('0x13')][_0x278531[_0xf341('0x32')]][_0xf341('0x46')],_0xf341('0x68'));}}if(_0x278531['calleridnum']!==_0xf341('0x3c')){this[_0xf341('0x13')][_0x278531[_0xf341('0x32')]][_0xf341('0x3e')]=_0x278531['calleridnum'];}this[_0xf341('0x13')][_0x278531[_0xf341('0x32')]][_0xf341('0x63')]=_0x278531[_0xf341('0x2e')];this[_0xf341('0x13')][_0x278531[_0xf341('0x32')]][_0xf341('0x64')]=_0x278531[_0xf341('0x39')];this[_0xf341('0x13')][_0x278531[_0xf341('0x32')]][_0xf341('0x49')]=dispositions[_[_0xf341('0x4a')](_0x278531['channelstate'])];}}else{if(this[_0xf341('0x13')][_0x278531['uniqueid']]){if(this[_0xf341('0x14')][_0x278531[_0xf341('0x39')][_0xf341('0x3a')]('-')[0x0]]){this[_0xf341('0x13')][_0x278531[_0xf341('0x32')]][_0xf341('0x65')]=this[_0xf341('0x14')][_0x278531['channel'][_0xf341('0x3a')]('-')[0x0]]['id'];this[_0xf341('0x13')][_0x278531[_0xf341('0x32')]]['membername']=this[_0xf341('0x14')][_0x278531['channel'][_0xf341('0x3a')]('-')[0x0]][_0xf341('0x41')];}}}if(_0x278531[_0xf341('0x37')]===_0xf341('0x38')){if(this[_0xf341('0x14')][_0x278531['channel'][_0xf341('0x3a')]('-')[0x0]]){this[_0xf341('0x14')][_0x278531[_0xf341('0x39')][_0xf341('0x3a')]('-')[0x0]]['destconnectedlinenum']=_0x278531[_0xf341('0x3b')];var _0x18f248,_0x4acda9;if(this['channels'][_0x278531[_0xf341('0x32')]]){_0x18f248=this[_0xf341('0x13')][_0x278531[_0xf341('0x32')]]['routealias'];_0x4acda9=this[_0xf341('0x13')][_0x278531[_0xf341('0x32')]][_0xf341('0x8')];}else if(this['channels'][_0x278531[_0xf341('0x33')]]){_0x18f248=this[_0xf341('0x13')][_0x278531[_0xf341('0x33')]][_0xf341('0x69')];_0x4acda9=this['channels'][_0x278531['linkedid']][_0xf341('0x8')];}this['agents'][_0x278531[_0xf341('0x39')][_0xf341('0x3a')]('-')[0x0]][_0xf341('0x8')]=_0x4acda9;this[_0xf341('0x14')][_0x278531[_0xf341('0x39')][_0xf341('0x3a')]('-')[0x0]][_0xf341('0x69')]=_0x18f248;logger['debug'](_0xf341('0x6a'),_0x278531['uniqueid'],util['inspect']({'id':this['agents'][_0x278531['channel'][_0xf341('0x3a')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x278531[_0xf341('0x39')][_0xf341('0x3a')]('-')[0x0]][_0xf341('0x4c')],'destconnectedlinenum':_0x278531[_0xf341('0x3b')],'routealias':_0x18f248,'queue':_0x4acda9||undefined},{'showHidden':![],'depth':null}));this[_0xf341('0x3f')](util[_0xf341('0x47')](_0xf341('0x40'),this['agents'][_0x278531[_0xf341('0x39')][_0xf341('0x3a')]('-')[0x0]][_0xf341('0x41')]),_0xf341('0x42'),{'id':this[_0xf341('0x14')][_0x278531[_0xf341('0x39')]['split']('-')[0x0]]['id'],'agentconnected':!![],'destaccountcode':this[_0xf341('0x14')][_0x278531['channel'][_0xf341('0x3a')]('-')[0x0]][_0xf341('0x4c')],'destconnectedlinenum':_0x278531[_0xf341('0x3b')],'routealias':_0x18f248,'queue':_0x4acda9||undefined});}}}}catch(_0x5efaf8){logger[_0xf341('0x27')](_0xf341('0x6b'),_0x278531[_0xf341('0x32')],util[_0xf341('0x29')](_0x5efaf8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf341('0x2a')][_0xf341('0x6c')]=function(_0x4585a2,_0x4c2d8a){try{if(this[_0xf341('0x13')][_0x4585a2]){logger[_0xf341('0x24')](_0xf341('0x6d'),_0x4585a2,_0x4c2d8a);this[_0xf341('0x13')][_0x4585a2][_0xf341('0x6e')]=!![];if(_[_0xf341('0x6f')](_0x4c2d8a,_0xf341('0x70'))){_0x4c2d8a=_0x4c2d8a['replace'](_0xf341('0x70'),'.WAV');}this[_0xf341('0x13')][_0x4585a2][_0xf341('0x71')]=_0x4c2d8a;var _0x4dcc49=_['find'](this['channels'][_0x4585a2][_0xf341('0x72')],{'filename':_0x4c2d8a});if(_[_0xf341('0x5b')](_0x4dcc49)){this[_0xf341('0x13')][_0x4585a2][_0xf341('0x72')][_0xf341('0x73')]({'filename':_0x4c2d8a,'createdAt':moment()[_0xf341('0x47')](_0xf341('0x48')),'mixmonitorid':'','status':_0xf341('0x74')});}}}catch(_0x5a5688){logger[_0xf341('0x27')](_0xf341('0x75'),_0x4585a2,util[_0xf341('0x29')](_0x5a5688,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf341('0x2a')][_0xf341('0x1d')]=function(_0x7921ed){try{if(this[_0xf341('0x2b')](_0x7921ed)){logger[_0xf341('0x30')](_0xf341('0x76'),_0x7921ed[_0xf341('0x32')],util[_0xf341('0x29')](_0x7921ed,{'showHidden':![],'depth':null}));if(this[_0xf341('0x13')][_0x7921ed['uniqueid']]&&_0x7921ed[_0xf341('0x39')]!=_0xf341('0x4e')){if(this[_0xf341('0x2b')](_0x7921ed[_0xf341('0x77')])){if(this[_0xf341('0x2b')](_0x7921ed[_0xf341('0x77')][_0xf341('0x78')])){logger[_0xf341('0x24')](_0xf341('0x79'),_0x7921ed[_0xf341('0x32')],_0x7921ed[_0xf341('0x7a')]);this[_0xf341('0x6c')](_0x7921ed['uniqueid'],_0x7921ed[_0xf341('0x7a')]);}else if(this[_0xf341('0x2b')](_0x7921ed[_0xf341('0x77')]['xmd-phone'])){logger[_0xf341('0x24')](_0xf341('0x7b'),_0x7921ed[_0xf341('0x32')],_0x7921ed['value']);this[_0xf341('0x13')][_0x7921ed['uniqueid']][_0xf341('0x2f')]=_0x7921ed[_0xf341('0x7a')];}else if(this[_0xf341('0x2b')](_0x7921ed[_0xf341('0x77')][_0xf341('0x7c')])){logger[_0xf341('0x24')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x7921ed[_0xf341('0x32')],_0x7921ed[_0xf341('0x7a')]);this['channels'][_0x7921ed[_0xf341('0x32')]][_0xf341('0x7d')]=_0x7921ed[_0xf341('0x7a')];}else if(this['isNotNull'](_0x7921ed[_0xf341('0x77')][_0xf341('0x7e')])){logger[_0xf341('0x24')](_0xf341('0x7f'),_0x7921ed[_0xf341('0x32')],_0x7921ed[_0xf341('0x7a')]);this[_0xf341('0x13')][_0x7921ed[_0xf341('0x32')]][_0xf341('0x80')]=_0x7921ed[_0xf341('0x7a')];}else if(this[_0xf341('0x2b')](_0x7921ed['variable']['xmd-queue'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x7921ed['uniqueid'],_0x7921ed[_0xf341('0x7a')][_0xf341('0x3a')](',')[0x0]);this['channels'][_0x7921ed[_0xf341('0x32')]]['queue']=_0x7921ed[_0xf341('0x7a')][_0xf341('0x3a')](',')[0x0];}else if(this[_0xf341('0x2b')](_0x7921ed[_0xf341('0x77')][_0xf341('0x81')])){logger[_0xf341('0x24')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x7921ed[_0xf341('0x32')],_0x7921ed[_0xf341('0x7a')]);this[_0xf341('0x13')][_0x7921ed['uniqueid']][_0xf341('0x82')]=_0x7921ed[_0xf341('0x7a')];}else if(this['isNotNull'](_0x7921ed[_0xf341('0x77')][_0xf341('0x83')])){logger['info'](_0xf341('0x84'),_0x7921ed[_0xf341('0x32')],_0x7921ed[_0xf341('0x7a')]);this[_0xf341('0x13')][_0x7921ed[_0xf341('0x32')]][_0xf341('0x85')]=_0x7921ed[_0xf341('0x7a')];}else if(this[_0xf341('0x2b')](_0x7921ed[_0xf341('0x77')][_0xf341('0x86')])){logger[_0xf341('0x24')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x7921ed[_0xf341('0x32')],_0x7921ed[_0xf341('0x7a')]);this[_0xf341('0x13')][_0x7921ed[_0xf341('0x32')]][_0xf341('0x87')]=_0x7921ed['value'];}else if(this[_0xf341('0x2b')](_0x7921ed[_0xf341('0x77')][_0xf341('0x88')])){logger[_0xf341('0x24')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x7921ed[_0xf341('0x32')],_0x7921ed[_0xf341('0x7a')]);this[_0xf341('0x13')][_0x7921ed['uniqueid']]['queue']=_0x7921ed[_0xf341('0x7a')];}else if(this[_0xf341('0x2b')](_0x7921ed[_0xf341('0x77')]['sipcallid'])){logger[_0xf341('0x24')](_0xf341('0x89'),_0x7921ed[_0xf341('0x32')],_0x7921ed[_0xf341('0x7a')]);this[_0xf341('0x13')][_0x7921ed[_0xf341('0x32')]][_0xf341('0x8a')]=_0x7921ed[_0xf341('0x7a')];}}}else if(this[_0xf341('0x2b')](_0x7921ed[_0xf341('0x77')][_0xf341('0x78')])){if(_0x7921ed[_0xf341('0x7a')]){var _0x38c671=path[_0xf341('0x8b')](_0x7921ed['value'])[_0xf341('0x41')];logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x38c671,_0x7921ed[_0xf341('0x7a')]);this['syncMixMonitorFilename'](_0x38c671,_0x7921ed[_0xf341('0x7a')]);}}else if(this[_0xf341('0x13')][_0x7921ed[_0xf341('0x33')]]){if(this[_0xf341('0x2b')](_0x7921ed[_0xf341('0x77')])){if(this[_0xf341('0x2b')](_0x7921ed[_0xf341('0x77')][_0xf341('0x8c')])){logger[_0xf341('0x24')](_0xf341('0x89'),_0x7921ed[_0xf341('0x33')],_0x7921ed[_0xf341('0x7a')]);this[_0xf341('0x13')][_0x7921ed[_0xf341('0x33')]][_0xf341('0x8d')]=_0x7921ed[_0xf341('0x7a')];}}}}}catch(_0x1dff5d){logger[_0xf341('0x27')]('[%s][voiceCallReport][varset]',_0x7921ed[_0xf341('0x32')],util[_0xf341('0x29')](_0x1dff5d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf341('0x2a')][_0xf341('0x8e')]=function(_0x20faf5){try{if(this[_0xf341('0x2b')](_0x20faf5)){logger[_0xf341('0x30')]('[%s][voiceCallReport][hangup]\x20event:',_0x20faf5[_0xf341('0x32')],util[_0xf341('0x29')](_0x20faf5,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x20faf5[_0xf341('0x33')]]){if(this[_0xf341('0x13')][this['blindTransfers'][_0x20faf5['linkedid']][_0xf341('0x33')]]){this[_0xf341('0x13')][this[_0xf341('0x15')][_0x20faf5['linkedid']][_0xf341('0x33')]][_0xf341('0x32')]=_0x20faf5['uniqueid'];this[_0xf341('0x13')][this[_0xf341('0x15')][_0x20faf5[_0xf341('0x33')]]['linkedid']][_0xf341('0x60')]=this['channels'][_0x20faf5[_0xf341('0x32')]][_0xf341('0x60')];this[_0xf341('0x13')][this[_0xf341('0x15')][_0x20faf5[_0xf341('0x33')]][_0xf341('0x33')]][_0xf341('0x67')]=this['channels'][_0x20faf5['uniqueid']][_0xf341('0x67')];this[_0xf341('0x13')][this[_0xf341('0x15')][_0x20faf5['linkedid']][_0xf341('0x33')]][_0xf341('0x64')]=this[_0xf341('0x13')][this['blindTransfers'][_0x20faf5[_0xf341('0x33')]][_0xf341('0x33')]][_0xf341('0x39')];this[_0xf341('0x13')][this['blindTransfers'][_0x20faf5[_0xf341('0x33')]][_0xf341('0x33')]][_0xf341('0x49')]=this[_0xf341('0x13')][_0x20faf5['uniqueid']][_0xf341('0x49')];this[_0xf341('0x13')][_0x20faf5[_0xf341('0x32')]]=this['channels'][this[_0xf341('0x15')][_0x20faf5[_0xf341('0x33')]][_0xf341('0x33')]];delete this[_0xf341('0x13')][this[_0xf341('0x15')][_0x20faf5[_0xf341('0x33')]][_0xf341('0x33')]];}else if(this[_0xf341('0x13')][this[_0xf341('0x15')][_0x20faf5[_0xf341('0x33')]][_0xf341('0x32')]]){this[_0xf341('0x13')][this['blindTransfers'][_0x20faf5[_0xf341('0x33')]][_0xf341('0x32')]][_0xf341('0x32')]=[this[_0xf341('0x13')][this[_0xf341('0x15')][_0x20faf5[_0xf341('0x33')]][_0xf341('0x32')]][_0xf341('0x33')],this[_0xf341('0x13')][this[_0xf341('0x15')][_0x20faf5[_0xf341('0x33')]][_0xf341('0x32')]][_0xf341('0x33')]=this['channels'][this[_0xf341('0x15')][_0x20faf5[_0xf341('0x33')]][_0xf341('0x32')]][_0xf341('0x32')]][0x0];this[_0xf341('0x13')][this[_0xf341('0x15')][_0x20faf5[_0xf341('0x33')]][_0xf341('0x32')]]['answered']=this[_0xf341('0x13')][_0x20faf5['uniqueid']]['answered'];this[_0xf341('0x13')][this[_0xf341('0x15')][_0x20faf5['linkedid']][_0xf341('0x32')]][_0xf341('0x67')]=this[_0xf341('0x13')][_0x20faf5[_0xf341('0x32')]][_0xf341('0x67')];this['channels'][this['blindTransfers'][_0x20faf5[_0xf341('0x33')]]['uniqueid']][_0xf341('0x64')]=this['channels'][this['blindTransfers'][_0x20faf5[_0xf341('0x33')]][_0xf341('0x32')]][_0xf341('0x39')];this['channels'][this['blindTransfers'][_0x20faf5[_0xf341('0x33')]]['uniqueid']]['disposition']=this[_0xf341('0x13')][_0x20faf5[_0xf341('0x32')]]['disposition'];this[_0xf341('0x13')][_0x20faf5[_0xf341('0x32')]]=this[_0xf341('0x13')][this['blindTransfers'][_0x20faf5[_0xf341('0x33')]][_0xf341('0x32')]];delete this[_0xf341('0x13')][this['blindTransfers'][_0x20faf5[_0xf341('0x33')]][_0xf341('0x32')]];}}if(this[_0xf341('0x13')][_0x20faf5[_0xf341('0x32')]]){logger[_0xf341('0x24')](_0xf341('0x8f'),_0x20faf5[_0xf341('0x32')],_0x20faf5['cause-txt']);var _0x4bbb8c=moment();this[_0xf341('0x13')][_0x20faf5[_0xf341('0x32')]][_0xf341('0x90')]=_0x4bbb8c[_0xf341('0x47')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xf341('0x13')][_0x20faf5[_0xf341('0x32')]][_0xf341('0x56')]=_0x4bbb8c[_0xf341('0x62')](this[_0xf341('0x13')][_0x20faf5['uniqueid']][_0xf341('0x46')],_0xf341('0x68'));if(this['channels'][_0x20faf5[_0xf341('0x32')]][_0xf341('0x60')]){this[_0xf341('0x13')][_0x20faf5[_0xf341('0x32')]]['billableseconds']=_0x4bbb8c['diff'](this[_0xf341('0x13')][_0x20faf5[_0xf341('0x32')]][_0xf341('0x67')],_0xf341('0x68'));this[_0xf341('0x13')][_0x20faf5[_0xf341('0x32')]][_0xf341('0x61')]=this[_0xf341('0x13')][_0x20faf5[_0xf341('0x32')]][_0xf341('0x56')]-this[_0xf341('0x13')][_0x20faf5[_0xf341('0x32')]][_0xf341('0x91')];}if(_0x20faf5['context']==='from-sip'){if(this['agents'][_0x20faf5[_0xf341('0x39')][_0xf341('0x3a')]('-')[0x0]]){this[_0xf341('0x14')][_0x20faf5['channel'][_0xf341('0x3a')]('-')[0x0]]=_[_0xf341('0x92')](this[_0xf341('0x14')][_0x20faf5[_0xf341('0x39')][_0xf341('0x3a')]('-')[0x0]],[_0xf341('0x3d')]);logger['debug']('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x20faf5[_0xf341('0x32')],util[_0xf341('0x29')]({'id':this['agents'][_0x20faf5[_0xf341('0x39')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0xf341('0x14')][_0x20faf5[_0xf341('0x39')]['split']('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this['emit'](util[_0xf341('0x47')](_0xf341('0x40'),this[_0xf341('0x14')][_0x20faf5[_0xf341('0x39')]['split']('-')[0x0]]['name']),_0xf341('0x93'),{'id':this[_0xf341('0x14')][_0x20faf5['channel']['split']('-')[0x0]]['id'],'destaccountcode':this[_0xf341('0x14')][_0x20faf5[_0xf341('0x39')]['split']('-')[0x0]][_0xf341('0x4c')]});for(var _0x2015e0=0x0;_0x2015e0<Object['keys'](this['agents'])[_0xf341('0x94')];_0x2015e0++){var _0x5a6a2c=Object['keys'](this['agents'])[_0x2015e0];var _0x50b257=this[_0xf341('0x14')][_0x5a6a2c];if(_0x50b257[_0xf341('0x4c')]===Number(_0x20faf5[_0xf341('0x3e')])){this[_0xf341('0x3f')](util[_0xf341('0x47')](_0xf341('0x40'),_0x50b257[_0xf341('0x41')]),'user:agentcomplete',{'id':_0x50b257['id'],'destaccountcode':_0x50b257[_0xf341('0x4c')],'transfer':this[_0xf341('0x13')][_0x20faf5['uniqueid']][_0xf341('0x95')]});break;}}}}var _0x32fa44=this;Promise['resolve']()['then'](function(){var _0x4b5ec=_0x32fa44[_0xf341('0x13')][_0x20faf5[_0xf341('0x32')]];if(typeof _0x4b5ec['transferType']===_0xf341('0x96'))return;if(_[_0xf341('0x97')](_0x4b5ec[_0xf341('0x72')]))return;return RpcSetting[_0xf341('0x98')]()[_0xf341('0x99')](function(_0x159e17){if(!_0x159e17['stopRecordingOnTransfer'])return;return Promise[_0xf341('0x9a')]()[_0xf341('0x99')](function(){return ami[_0xf341('0x9b')]({'action':_0xf341('0x9c'),'channel':_0x4b5ec['channel']})[_0xf341('0x9d')](function(){});})[_0xf341('0x99')](function(){return ami[_0xf341('0x9b')]({'action':_0xf341('0x9c'),'channel':_0x4b5ec[_0xf341('0x64')]})['catch'](function(){})[_0xf341('0x9e')](function(){var _0x1e94d0=_0x32fa44[_0xf341('0x14')][_0x4b5ec[_0xf341('0x64')]['split']('-')[0x0]];if(!_0x1e94d0)return;io['emit'](_0xf341('0x9f'),{'agentId':_0x1e94d0['id'],'uniqueid':_0x4b5ec['uniqueid']});});});});})['then'](function(){if(_0x20faf5[_0xf341('0xa0')]===_0xf341('0xa1')){_0x32fa44[_0xf341('0x15')][_0x20faf5['uniqueid']]=_0x20faf5;}else{if(_0x32fa44[_0xf341('0x13')][_0x20faf5[_0xf341('0x32')]]['type']===_0xf341('0xa2')&&_0x32fa44[_0xf341('0x15')][_0x20faf5['uniqueid']]){_0x32fa44[_0xf341('0x13')][_0x20faf5[_0xf341('0x32')]]['uniqueid']=[_0x32fa44[_0xf341('0x13')][_0x20faf5['uniqueid']][_0xf341('0x33')],_0x32fa44[_0xf341('0x13')][_0x20faf5[_0xf341('0x32')]][_0xf341('0x33')]=_0x32fa44['channels'][_0x20faf5[_0xf341('0x32')]][_0xf341('0x32')]][0x0];delete _0x32fa44[_0xf341('0x15')][_0x20faf5[_0xf341('0x32')]];}}logger[_0xf341('0x30')]('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x20faf5['uniqueid'],util[_0xf341('0x29')](_0x32fa44[_0xf341('0x13')][_0x20faf5['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xf341('0x3f')]('custom:voiceCallReport',_0x32fa44[_0xf341('0x13')][_0x20faf5[_0xf341('0x32')]]);delete _0x32fa44[_0xf341('0x13')][_0x20faf5[_0xf341('0x32')]];});}}}catch(_0x1a5ee3){logger[_0xf341('0x27')]('[%s][voiceCallReport][hangup]',_0x20faf5[_0xf341('0x32')],util[_0xf341('0x29')](_0x1a5ee3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf341('0x2a')][_0xf341('0xa3')]=function(_0x18be64){try{if(this[_0xf341('0x2b')](_0x18be64)){logger[_0xf341('0x24')](_0xf341('0xa4'),_0x18be64['uniqueid'],_0x18be64[_0xf341('0xa5')],_0x18be64[_0xf341('0xa6')]);logger[_0xf341('0x30')](_0xf341('0xa7'),_0x18be64[_0xf341('0x32')],util[_0xf341('0x29')](_0x18be64,{'showHidden':![],'depth':null}));var _0x68895a;if(this['channels'][_0x18be64[_0xf341('0xa8')]]){this['channels'][_0x18be64['transfereeuniqueid']][_0xf341('0xa9')]=_0x18be64['origtransferercalleridnum'];this[_0xf341('0x13')][_0x18be64[_0xf341('0xa8')]]['transferconnectedlinenum']=_0x18be64[_0xf341('0xa6')];if(this[_0xf341('0x13')][_0x18be64[_0xf341('0xaa')]]){_0x68895a=this['channels'][_0x18be64['secondtransfereruniqueid']];this[_0xf341('0x13')][_0x18be64[_0xf341('0xaa')]]=this[_0xf341('0x13')][_0x18be64[_0xf341('0xa8')]];this[_0xf341('0x13')][_0x18be64['transfereeuniqueid']]=_0x68895a;}this[_0xf341('0x13')][_0x18be64['secondtransfereruniqueid']][_0xf341('0x95')]=_0xf341('0xab');}else if(this[_0xf341('0x13')][_0x18be64[_0xf341('0xac')]]){this[_0xf341('0x13')][_0x18be64[_0xf341('0xac')]][_0xf341('0xa9')]=_0x18be64['origtransferercalleridnum'];this[_0xf341('0x13')][_0x18be64['transfertargetuniqueid']][_0xf341('0xad')]=_0x18be64['transfertargetcalleridnum'];if(this[_0xf341('0x13')][_0x18be64[_0xf341('0xae')]]){_0x68895a=this[_0xf341('0x13')][_0x18be64['origtransfereruniqueid']];this[_0xf341('0x13')][_0x18be64[_0xf341('0xae')]]=this[_0xf341('0x13')][_0x18be64[_0xf341('0xac')]];this[_0xf341('0x13')][_0x18be64[_0xf341('0xac')]]=_0x68895a;}this[_0xf341('0x13')][_0x18be64[_0xf341('0xac')]][_0xf341('0x95')]='ATTENDED';}if((this[_0xf341('0x13')][_0x18be64[_0xf341('0xae')]]||this[_0xf341('0x13')][_0x18be64[_0xf341('0xaf')]])&&this[_0xf341('0x13')][_0x18be64[_0xf341('0xaa')]]){var _0x14261b=_['some']([this['channels'][_0x18be64[_0xf341('0xae')]],this[_0xf341('0x13')][_0x18be64[_0xf341('0xaf')]],this[_0xf341('0x13')][_0x18be64[_0xf341('0xaa')]]],function(_0x1798c5){return _0x1798c5&&_0x1798c5['type']==='outbound'&&_0x1798c5['routeid'];});if(_0x14261b){if(this[_0xf341('0x13')][_0x18be64[_0xf341('0xae')]])this[_0xf341('0x13')][_0x18be64[_0xf341('0xae')]][_0xf341('0x95')]='ATTENDED';if(this[_0xf341('0x13')][_0x18be64['origtransfererlinkedid']])this[_0xf341('0x13')][_0x18be64[_0xf341('0xaf')]][_0xf341('0x95')]='ATTENDED';this[_0xf341('0x13')][_0x18be64[_0xf341('0xaa')]]['transferType']=_0xf341('0xab');}}}}catch(_0x11d4a3){logger[_0xf341('0x27')](_0xf341('0xb0'),_0x18be64[_0xf341('0x32')],util[_0xf341('0x29')](_0x11d4a3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf341('0x2a')][_0xf341('0x21')]=function(_0xbc3809){try{if(this[_0xf341('0x2b')](_0xbc3809)){logger[_0xf341('0x24')](_0xf341('0xb1'),_0xbc3809[_0xf341('0x32')],_0xbc3809[_0xf341('0xb2')],_0xbc3809[_0xf341('0xb3')]);logger[_0xf341('0x30')](_0xf341('0xb4'),_0xbc3809[_0xf341('0x32')],util[_0xf341('0x29')](_0xbc3809,{'showHidden':![],'depth':null}));if(this['channels'][_0xbc3809['transfereeuniqueid']]){this['channels'][_0xbc3809[_0xf341('0xa8')]][_0xf341('0xa9')]=_0xbc3809[_0xf341('0xb2')];this[_0xf341('0x13')][_0xbc3809[_0xf341('0xa8')]][_0xf341('0xad')]=_0xbc3809[_0xf341('0xb3')];this[_0xf341('0x13')][_0xbc3809[_0xf341('0xa8')]][_0xf341('0x95')]=_0xf341('0xb5');this['syncHangup']({'event':_0xf341('0xa1'),'uniqueid':_0xbc3809[_0xf341('0xa8')],'linkedid':_0xbc3809[_0xf341('0xb6')],'context':_0xbc3809['context'],'channel':_0xbc3809[_0xf341('0xb7')]});}else{this[_0xf341('0x13')][_0xbc3809['transfereruniqueid']]['transferType']='BLIND';this[_0xf341('0x8e')]({'event':_0xf341('0xa1'),'uniqueid':_0xbc3809[_0xf341('0xb6')],'linkedid':_0xbc3809[_0xf341('0xa8')],'context':_0xbc3809[_0xf341('0x37')],'channel':_0xbc3809[_0xf341('0xb7')]});}}}catch(_0x9bcb10){logger[_0xf341('0x27')](_0xf341('0xb8'),_0xbc3809[_0xf341('0x32')],util[_0xf341('0x29')](_0x9bcb10,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf341('0x2a')][_0xf341('0xb9')]=function(_0x23103){try{if(this[_0xf341('0x2b')](_0x23103)){logger[_0xf341('0x30')](_0xf341('0xba'),_0x23103[_0xf341('0x32')],util['inspect'](_0x23103,{'showHidden':![],'depth':null}));if(this[_0xf341('0x13')][_0x23103[_0xf341('0x32')]]){if(!_[_0xf341('0x5b')](this[_0xf341('0x13')][_0x23103[_0xf341('0x32')]][_0xf341('0x67')])){this[_0xf341('0x13')][_0x23103[_0xf341('0x32')]][_0xf341('0xbb')]=moment()['format'](_0xf341('0x48'));logger[_0xf341('0x24')](_0xf341('0xbc'),_0x23103['uniqueid'],this[_0xf341('0x13')][_0x23103[_0xf341('0x32')]][_0xf341('0xbb')]);}}}}catch(_0x152434){logger[_0xf341('0x27')](_0xf341('0xbd'),_0x23103[_0xf341('0x32')],util[_0xf341('0x29')](_0x152434,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf341('0x2a')]['syncMusicOnHoldStop']=function(_0x258de8){try{if(this['isNotNull'](_0x258de8)){logger['debug']('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x258de8['uniqueid'],util['inspect'](_0x258de8,{'showHidden':![],'depth':null}));if(this['channels'][_0x258de8[_0xf341('0x32')]]){if(!_[_0xf341('0x5b')](this['channels'][_0x258de8[_0xf341('0x32')]][_0xf341('0xbb')])){this[_0xf341('0x13')][_0x258de8[_0xf341('0x32')]][_0xf341('0xbe')]+=moment()[_0xf341('0xbf')](0x0)[_0xf341('0x62')](this[_0xf341('0x13')][_0x258de8[_0xf341('0x32')]][_0xf341('0xbb')],_0xf341('0x68'));logger[_0xf341('0x24')](_0xf341('0xc0'),_0x258de8[_0xf341('0x32')],this[_0xf341('0x13')][_0x258de8['uniqueid']][_0xf341('0xbe')]);delete this[_0xf341('0x13')][_0x258de8['uniqueid']][_0xf341('0xbb')];}}}}catch(_0x153c21){logger[_0xf341('0x27')]('[%s][voiceCallReport][musiconholdstop]',_0x258de8[_0xf341('0x32')],util[_0xf341('0x29')](_0x153c21,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport;
\ No newline at end of file