Built motion from commit (unavailable).|2.5.30
[motion2.git] / server / services / ami / report / voiceCallReport.js
index b81c6ae..6e1d482 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdec1=['parse','sipcalllinkedid','[%s][voiceCallReport][varset]','syncHangup','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','diff','billableseconds','answertime','from-sip','omit','destconnectedlinenum','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','transferType','undefined','isEmpty','then','stopRecordingOnTransfer','resolve','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','some','origtransfererlinkedid','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','isNil','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','moment','util','path','../../../config/environment','../../../config/logger','ami','../model/channel','../rpc/setting','not_inuse','inuse','invalid','unavailable','ringing','ringinuse','onhold','queue','agi','dial','playback','NO\x20ANSWER','FAILED','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','bind','newexten','syncNewExten','newchannel','syncNewState','syncVarSet','hangup','syncNewCallerId','syncAttendedTransfer','syncBlindTransfer','syncMusicOnHoldStart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','emit','prototype','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','inspect','linkedid','isUndefined','merge','pick','[%s][voiceCallReport][newcallerid]','syncNewChannel','isNotNull','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','starttime','format','toNumber','channelstate','keys','split','user:%s','user:agentconnect','accountcode','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','lastapplication','lastdata','startsWith','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','[%s][voiceCallReport][newstate]\x20event:','answered','holdtime','connectedlinenum','connectedlinename','destinationchannel','UserId','membername','name','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid'];(function(_0x33f1e2,_0x2111bb){var _0x581421=function(_0x3a2628){while(--_0x3a2628){_0x33f1e2['push'](_0x33f1e2['shift']());}};_0x581421(++_0x2111bb);}(_0xdec1,0x105));var _0x1dec=function(_0x167c86,_0x2e4598){_0x167c86=_0x167c86-0x0;var _0x5db566=_0xdec1[_0x167c86];return _0x5db566;};'use strict';var BPromise=require(_0x1dec('0x0'));var _=require('lodash');var moment=require(_0x1dec('0x1'));var util=require(_0x1dec('0x2'));var path=require(_0x1dec('0x3'));var Redis=require('ioredis');var config=require(_0x1dec('0x4'));var logger=require(_0x1dec('0x5'))(_0x1dec('0x6'));var ami=require('../ami');var Channel=require(_0x1dec('0x7'));var RpcSetting=require(_0x1dec('0x8'));var statusDesc=['unknown',_0x1dec('0x9'),_0x1dec('0xa'),'busy',_0x1dec('0xb'),_0x1dec('0xc'),_0x1dec('0xd'),_0x1dec('0xe'),_0x1dec('0xf')];var applications=['set',_0x1dec('0x10'),_0x1dec('0x11'),_0x1dec('0x12'),_0x1dec('0x13'),'voicemail'];var dispositions=[_0x1dec('0x14'),_0x1dec('0x15'),'FAILED',_0x1dec('0x14'),_0x1dec('0x14'),_0x1dec('0x14'),'ANSWERED','BUSY','FAILED',_0x1dec('0x15'),_0x1dec('0x15')];var actions={};config['redis']=_[_0x1dec('0x16')](config['redis'],{'host':_0x1dec('0x17'),'port':0x18eb});var io=require(_0x1dec('0x18'))(new Redis(config['redis']));function VoiceCallReport(_0x50c06b){this[_0x1dec('0x19')]=_0x50c06b['channels'];this[_0x1dec('0x1a')]=_0x50c06b[_0x1dec('0x1a')];this[_0x1dec('0x1b')]={};ami['on'](_0x1dec('0x1c'),this['syncNewExten'][_0x1dec('0x1d')](this));ami['on'](_0x1dec('0x1e'),this[_0x1dec('0x1f')][_0x1dec('0x1d')](this));ami['on'](_0x1dec('0x20'),this['syncNewChannel'][_0x1dec('0x1d')](this));ami['on']('newstate',this[_0x1dec('0x21')][_0x1dec('0x1d')](this));ami['on']('varset',this[_0x1dec('0x22')][_0x1dec('0x1d')](this));ami['on'](_0x1dec('0x23'),this['syncHangup'][_0x1dec('0x1d')](this));ami['on']('newcallerid',this[_0x1dec('0x24')]['bind'](this));ami['on']('attendedtransfer',this[_0x1dec('0x25')][_0x1dec('0x1d')](this));ami['on']('blindtransfer',this[_0x1dec('0x26')][_0x1dec('0x1d')](this));ami['on']('musiconholdstart',this[_0x1dec('0x27')][_0x1dec('0x1d')](this));ami['on'](_0x1dec('0x28'),this['syncMusicOnHoldStop'][_0x1dec('0x1d')](this));try{logger[_0x1dec('0x29')](_0x1dec('0x2a'));ami[_0x1dec('0x2b')]();}catch(_0x4235c2){logger[_0x1dec('0x2c')](_0x1dec('0x2d'),util['inspect'](_0x4235c2,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype']['isNotNull']=function(_0x50201e){return _0x50201e!==null&&!_['isUndefined'](_0x50201e);};VoiceCallReport['prototype'][_0x1dec('0x2e')]=function(_0x174c33,_0x105f81,_0x20f6fd){io['to'](_0x174c33)['emit'](_0x105f81,_0x20f6fd);};VoiceCallReport[_0x1dec('0x2f')][_0x1dec('0x24')]=function(_0x4f9420){try{if(this['isNotNull'](_0x4f9420)){logger[_0x1dec('0x29')](_0x1dec('0x30'),_0x4f9420[_0x1dec('0x31')],_0x4f9420['calleridname'],_0x4f9420[_0x1dec('0x32')]);logger[_0x1dec('0x33')](_0x1dec('0x34'),_0x4f9420['uniqueid'],util[_0x1dec('0x35')](_0x4f9420,{'showHidden':![],'depth':null}));if(_0x4f9420[_0x1dec('0x31')]===_0x4f9420[_0x1dec('0x36')]){if(!_[_0x1dec('0x37')](this[_0x1dec('0x19')][_0x4f9420[_0x1dec('0x31')]])){_[_0x1dec('0x38')](this[_0x1dec('0x19')][_0x4f9420[_0x1dec('0x31')]],_[_0x1dec('0x39')](_0x4f9420,_['keys'](this[_0x1dec('0x19')][_0x4f9420[_0x1dec('0x31')]])));}}}}catch(_0x5d6b2d){logger[_0x1dec('0x2c')](_0x1dec('0x3a'),_0x4f9420[_0x1dec('0x31')],util[_0x1dec('0x35')](_0x5d6b2d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1dec('0x2f')][_0x1dec('0x3b')]=function(_0x521064){try{if(this[_0x1dec('0x3c')](_0x521064)){logger['debug'](_0x1dec('0x3d'),_0x521064[_0x1dec('0x31')],util[_0x1dec('0x35')](_0x521064,{'showHidden':![],'depth':null}));if(_0x521064['uniqueid']===_0x521064[_0x1dec('0x36')]&&_0x521064[_0x1dec('0x3e')]!=_0x1dec('0x3f')){if(_[_0x1dec('0x37')](this[_0x1dec('0x19')][_0x521064[_0x1dec('0x31')]])){logger[_0x1dec('0x29')](_0x1dec('0x40'),_0x521064[_0x1dec('0x31')],_0x521064[_0x1dec('0x41')],_0x521064[_0x1dec('0x42')]);this[_0x1dec('0x19')][_0x521064[_0x1dec('0x31')]]=new Channel();this[_0x1dec('0x19')][_0x521064[_0x1dec('0x31')]][_0x1dec('0x43')]=moment()[_0x1dec('0x44')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x1dec('0x19')][_0x521064[_0x1dec('0x31')]]['disposition']=dispositions[_[_0x1dec('0x45')](_0x521064[_0x1dec('0x46')])];_[_0x1dec('0x38')](this[_0x1dec('0x19')][_0x521064[_0x1dec('0x31')]],_['pick'](_0x521064,_[_0x1dec('0x47')](this['channels'][_0x521064[_0x1dec('0x31')]])));if(_0x521064[_0x1dec('0x41')]==='from-sip'){if(this[_0x1dec('0x1a')][_0x521064['channel'][_0x1dec('0x48')]('-')[0x0]]){this[_0x1dec('0x1a')][_0x521064[_0x1dec('0x3e')][_0x1dec('0x48')]('-')[0x0]]['destconnectedlinenum']=_0x521064[_0x1dec('0x42')];logger[_0x1dec('0x33')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x521064[_0x1dec('0x31')],util[_0x1dec('0x35')]({'destaccountcode':this['agents'][_0x521064[_0x1dec('0x3e')][_0x1dec('0x48')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x521064[_0x1dec('0x42')]},{'showHidden':![],'depth':null}));this[_0x1dec('0x2e')](util['format'](_0x1dec('0x49'),this[_0x1dec('0x1a')][_0x521064[_0x1dec('0x3e')][_0x1dec('0x48')]('-')[0x0]]['name']),_0x1dec('0x4a'),{'destaccountcode':this[_0x1dec('0x1a')][_0x521064[_0x1dec('0x3e')]['split']('-')[0x0]][_0x1dec('0x4b')],'destconnectedlinenum':_0x521064['exten']});}}}}}}catch(_0x2543b4){logger[_0x1dec('0x2c')](_0x1dec('0x4c'),_0x521064[_0x1dec('0x31')],util[_0x1dec('0x35')](_0x2543b4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1dec('0x2f')][_0x1dec('0x1f')]=function(_0x59b7d1){try{if(this[_0x1dec('0x3c')](_0x59b7d1)){logger['debug'](_0x1dec('0x4d'),_0x59b7d1[_0x1dec('0x31')],util[_0x1dec('0x35')](_0x59b7d1,{'showHidden':![],'depth':null}));if(_0x59b7d1[_0x1dec('0x31')]===_0x59b7d1[_0x1dec('0x36')]&&_0x59b7d1['exten']!='h'&&_0x59b7d1[_0x1dec('0x3e')]!=_0x1dec('0x3f')){_0x59b7d1[_0x1dec('0x4e')]=_0x59b7d1['application'][_0x1dec('0x4f')]();_0x59b7d1[_0x1dec('0x50')]=(_0x59b7d1[_0x1dec('0x51')]||_0x59b7d1['applicationdata'])[_0x1dec('0x4f')]();logger[_0x1dec('0x29')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x59b7d1['uniqueid'],_0x59b7d1[_0x1dec('0x4e')],_0x59b7d1['applicationdata']);if(_[_0x1dec('0x37')](this['channels'][_0x59b7d1['uniqueid']])){this['channels'][_0x59b7d1[_0x1dec('0x31')]]=new Channel();this[_0x1dec('0x19')][_0x59b7d1[_0x1dec('0x31')]]['starttime']=_0x59b7d1['duration']?moment()['subtract'](moment['duration'](_0x59b7d1[_0x1dec('0x52')])['seconds'](),_0x1dec('0x53'))['format'](_0x1dec('0x54')):moment()['format'](_0x1dec('0x54'));this['channels'][_0x59b7d1[_0x1dec('0x31')]]['disposition']=_0x1dec('0x14');}_[_0x1dec('0x38')](this[_0x1dec('0x19')][_0x59b7d1['uniqueid']],_['pick'](_0x59b7d1,_[_0x1dec('0x47')](this['channels'][_0x59b7d1[_0x1dec('0x31')]])));if(_['includes'](applications,_0x59b7d1[_0x1dec('0x4e')])){this[_0x1dec('0x19')][_0x59b7d1['uniqueid']][_0x1dec('0x55')]=_0x59b7d1['application'];this[_0x1dec('0x19')][_0x59b7d1[_0x1dec('0x31')]][_0x1dec('0x56')]=_0x59b7d1[_0x1dec('0x50')];if(_0x59b7d1[_0x1dec('0x4e')]==='set'&&_[_0x1dec('0x57')](_0x59b7d1[_0x1dec('0x50')],'cdr(')){var _0x4ce814=_0x59b7d1[_0x1dec('0x50')][_0x1dec('0x48')]('=');var _0x20ffbc=_0x4ce814[0x0]['match'](/cdr\((.*)\)/);if(_0x20ffbc){this['channels'][_0x59b7d1[_0x1dec('0x31')]][_0x20ffbc[0x1]]=_0x4ce814[0x1];}}else if(_0x59b7d1[_0x1dec('0x4e')]===_0x1dec('0x10')){this[_0x1dec('0x19')][_0x59b7d1[_0x1dec('0x31')]][_0x1dec('0x10')]=_0x59b7d1[_0x1dec('0x50')][_0x1dec('0x48')](',')[0x0];}}}}}catch(_0x208c4f){logger[_0x1dec('0x2c')](_0x1dec('0x58'),_0x59b7d1['uniqueid'],util[_0x1dec('0x35')](_0x208c4f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1dec('0x2f')]['syncNewState']=function(_0x474cde){try{if(this[_0x1dec('0x3c')](_0x474cde)){logger['info'](_0x1dec('0x59'),_0x474cde[_0x1dec('0x31')],_0x474cde[_0x1dec('0x36')],_0x474cde[_0x1dec('0x5a')],_0x474cde['calleridnum']);logger['debug'](_0x1dec('0x5b'),_0x474cde[_0x1dec('0x31')],util[_0x1dec('0x35')](_0x474cde,{'showHidden':![],'depth':null}));if(_0x474cde['uniqueid']!==_0x474cde[_0x1dec('0x36')]){if(this[_0x1dec('0x19')][_0x474cde['linkedid']]){if(_0x474cde['channelstate']==='6'){if(!this[_0x1dec('0x19')][_0x474cde[_0x1dec('0x36')]][_0x1dec('0x5c')]){var _0x29c346=moment();this[_0x1dec('0x19')][_0x474cde[_0x1dec('0x36')]][_0x1dec('0x5c')]=!![];this[_0x1dec('0x19')][_0x474cde['linkedid']]['answertime']=_0x29c346[_0x1dec('0x44')](_0x1dec('0x54'));if(this['channels'][_0x474cde[_0x1dec('0x36')]][_0x1dec('0x43')]){this['channels'][_0x474cde[_0x1dec('0x36')]][_0x1dec('0x5d')]=_0x29c346['diff'](this[_0x1dec('0x19')][_0x474cde[_0x1dec('0x36')]][_0x1dec('0x43')],_0x1dec('0x53'));}}this['channels'][_0x474cde[_0x1dec('0x36')]]['linkedid']=_0x474cde[_0x1dec('0x31')];if(_0x474cde[_0x1dec('0x32')]!=='xcally-motion-preview'){this[_0x1dec('0x19')][_0x474cde[_0x1dec('0x36')]][_0x1dec('0x5e')]=_0x474cde['calleridnum'];}this[_0x1dec('0x19')][_0x474cde['linkedid']][_0x1dec('0x5f')]=_0x474cde['calleridname'];this['channels'][_0x474cde[_0x1dec('0x36')]][_0x1dec('0x60')]=_0x474cde[_0x1dec('0x3e')];this['channels'][_0x474cde['linkedid']]['disposition']=dispositions[_['toNumber'](_0x474cde['channelstate'])];if(this['agents'][_0x474cde['channel']['split']('-')[0x0]]){this[_0x1dec('0x19')][_0x474cde[_0x1dec('0x36')]][_0x1dec('0x61')]=this[_0x1dec('0x1a')][_0x474cde[_0x1dec('0x3e')][_0x1dec('0x48')]('-')[0x0]]['id'];this['channels'][_0x474cde[_0x1dec('0x36')]][_0x1dec('0x62')]=this['agents'][_0x474cde[_0x1dec('0x3e')][_0x1dec('0x48')]('-')[0x0]][_0x1dec('0x63')];}}}}else{if(this['channels'][_0x474cde[_0x1dec('0x31')]]){if(_0x474cde['channelstate']==='6'){if(this[_0x1dec('0x1a')][_0x474cde[_0x1dec('0x3e')]['split']('-')[0x0]]){this['channels'][_0x474cde['uniqueid']][_0x1dec('0x61')]=this[_0x1dec('0x1a')][_0x474cde[_0x1dec('0x3e')][_0x1dec('0x48')]('-')[0x0]]['id'];this[_0x1dec('0x19')][_0x474cde['uniqueid']][_0x1dec('0x62')]=this[_0x1dec('0x1a')][_0x474cde['channel'][_0x1dec('0x48')]('-')[0x0]][_0x1dec('0x63')];}}}}}}catch(_0x15af33){logger[_0x1dec('0x2c')]('[%s][voiceCallReport][newstate]',_0x474cde[_0x1dec('0x31')],util[_0x1dec('0x35')](_0x15af33,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x1dec('0x64')]=function(_0x3c41b3,_0x104a40){try{if(this['channels'][_0x3c41b3]){logger['info'](_0x1dec('0x65'),_0x3c41b3,_0x104a40);this[_0x1dec('0x19')][_0x3c41b3][_0x1dec('0x66')]=!![];if(_[_0x1dec('0x67')](_0x104a40,_0x1dec('0x68'))){_0x104a40=_0x104a40[_0x1dec('0x69')](_0x1dec('0x68'),_0x1dec('0x6a'));}this[_0x1dec('0x19')][_0x3c41b3][_0x1dec('0x6b')]=_0x104a40;var _0x463728=_[_0x1dec('0x6c')](this['channels'][_0x3c41b3]['monitors'],{'filename':_0x104a40});if(_['isNil'](_0x463728)){this['channels'][_0x3c41b3][_0x1dec('0x6d')][_0x1dec('0x6e')]({'filename':_0x104a40,'createdAt':moment()[_0x1dec('0x44')](_0x1dec('0x54')),'mixmonitorid':'','status':_0x1dec('0x6f')});}}}catch(_0x47fc4b){logger[_0x1dec('0x2c')]('[%s][voiceCallReport][mixMonitorFilename]',_0x3c41b3,util[_0x1dec('0x35')](_0x47fc4b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x1dec('0x22')]=function(_0x33b6f5){try{if(this[_0x1dec('0x3c')](_0x33b6f5)){logger[_0x1dec('0x33')](_0x1dec('0x70'),_0x33b6f5[_0x1dec('0x31')],util['inspect'](_0x33b6f5,{'showHidden':![],'depth':null}));if(this[_0x1dec('0x19')][_0x33b6f5[_0x1dec('0x31')]]&&_0x33b6f5[_0x1dec('0x3e')]!='OutgoingSpoolFailed'){if(this['isNotNull'](_0x33b6f5[_0x1dec('0x71')])){if(this[_0x1dec('0x3c')](_0x33b6f5['variable'][_0x1dec('0x72')])){logger[_0x1dec('0x29')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x33b6f5['uniqueid'],_0x33b6f5[_0x1dec('0x73')]);this[_0x1dec('0x64')](_0x33b6f5[_0x1dec('0x31')],_0x33b6f5['value']);}else if(this['isNotNull'](_0x33b6f5[_0x1dec('0x71')][_0x1dec('0x74')])){logger[_0x1dec('0x29')](_0x1dec('0x75'),_0x33b6f5[_0x1dec('0x31')],_0x33b6f5[_0x1dec('0x73')]);this[_0x1dec('0x19')][_0x33b6f5[_0x1dec('0x31')]][_0x1dec('0x32')]=_0x33b6f5[_0x1dec('0x73')];}else if(this['isNotNull'](_0x33b6f5['variable'][_0x1dec('0x76')])){logger[_0x1dec('0x29')](_0x1dec('0x77'),_0x33b6f5[_0x1dec('0x31')],_0x33b6f5['value']);this[_0x1dec('0x19')][_0x33b6f5['uniqueid']]['callerid']=_0x33b6f5[_0x1dec('0x73')];}else if(this[_0x1dec('0x3c')](_0x33b6f5[_0x1dec('0x71')][_0x1dec('0x78')])){logger['info'](_0x1dec('0x79'),_0x33b6f5[_0x1dec('0x31')],_0x33b6f5[_0x1dec('0x73')]);this[_0x1dec('0x19')][_0x33b6f5[_0x1dec('0x31')]][_0x1dec('0x7a')]=_0x33b6f5['value'];}else if(this[_0x1dec('0x3c')](_0x33b6f5[_0x1dec('0x71')]['xmd-queue'])){logger['info'](_0x1dec('0x7b'),_0x33b6f5['uniqueid'],_0x33b6f5['value'][_0x1dec('0x48')](',')[0x0]);this[_0x1dec('0x19')][_0x33b6f5[_0x1dec('0x31')]][_0x1dec('0x10')]=_0x33b6f5['value']['split'](',')[0x0];}else if(this[_0x1dec('0x3c')](_0x33b6f5['variable'][_0x1dec('0x7c')])){logger[_0x1dec('0x29')](_0x1dec('0x7d'),_0x33b6f5[_0x1dec('0x31')],_0x33b6f5['value']);this[_0x1dec('0x19')][_0x33b6f5[_0x1dec('0x31')]][_0x1dec('0x7e')]=_0x33b6f5[_0x1dec('0x73')];}else if(this[_0x1dec('0x3c')](_0x33b6f5[_0x1dec('0x71')][_0x1dec('0x7f')])){logger[_0x1dec('0x29')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x33b6f5[_0x1dec('0x31')],_0x33b6f5[_0x1dec('0x73')]);this[_0x1dec('0x19')][_0x33b6f5[_0x1dec('0x31')]][_0x1dec('0x80')]=_0x33b6f5[_0x1dec('0x73')];}else if(this[_0x1dec('0x3c')](_0x33b6f5[_0x1dec('0x71')][_0x1dec('0x81')])){logger['info'](_0x1dec('0x82'),_0x33b6f5[_0x1dec('0x31')],_0x33b6f5[_0x1dec('0x73')]);this[_0x1dec('0x19')][_0x33b6f5[_0x1dec('0x31')]]['calleridpreview']=_0x33b6f5[_0x1dec('0x73')];}else if(this[_0x1dec('0x3c')](_0x33b6f5['variable'][_0x1dec('0x83')])){logger['info'](_0x1dec('0x84'),_0x33b6f5[_0x1dec('0x31')],_0x33b6f5[_0x1dec('0x73')]);this['channels'][_0x33b6f5['uniqueid']][_0x1dec('0x10')]=_0x33b6f5[_0x1dec('0x73')];}else if(this[_0x1dec('0x3c')](_0x33b6f5['variable']['sipcallid'])){logger[_0x1dec('0x29')](_0x1dec('0x85'),_0x33b6f5[_0x1dec('0x31')],_0x33b6f5['value']);this[_0x1dec('0x19')][_0x33b6f5['uniqueid']][_0x1dec('0x86')]=_0x33b6f5[_0x1dec('0x73')];}}}else if(this[_0x1dec('0x3c')](_0x33b6f5['variable']['mixmonitor_filename'])){if(_0x33b6f5[_0x1dec('0x73')]){var _0x133c68=path[_0x1dec('0x87')](_0x33b6f5['value'])[_0x1dec('0x63')];logger[_0x1dec('0x29')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x133c68,_0x33b6f5[_0x1dec('0x73')]);this['syncMixMonitorFilename'](_0x133c68,_0x33b6f5[_0x1dec('0x73')]);}}else if(this['channels'][_0x33b6f5[_0x1dec('0x36')]]){if(this[_0x1dec('0x3c')](_0x33b6f5[_0x1dec('0x71')])){if(this[_0x1dec('0x3c')](_0x33b6f5['variable']['sipcallid'])){logger[_0x1dec('0x29')](_0x1dec('0x85'),_0x33b6f5[_0x1dec('0x36')],_0x33b6f5[_0x1dec('0x73')]);this[_0x1dec('0x19')][_0x33b6f5[_0x1dec('0x36')]][_0x1dec('0x88')]=_0x33b6f5[_0x1dec('0x73')];}}}}}catch(_0x18d4c6){logger[_0x1dec('0x2c')](_0x1dec('0x89'),_0x33b6f5['uniqueid'],util[_0x1dec('0x35')](_0x18d4c6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1dec('0x2f')][_0x1dec('0x8a')]=function(_0x113f56){try{if(this['isNotNull'](_0x113f56)){logger[_0x1dec('0x33')](_0x1dec('0x8b'),_0x113f56[_0x1dec('0x31')],util['inspect'](_0x113f56,{'showHidden':![],'depth':null}));if(this['channels'][_0x113f56[_0x1dec('0x31')]]){logger['info'](_0x1dec('0x8c'),_0x113f56[_0x1dec('0x31')],_0x113f56[_0x1dec('0x8d')]);var _0x20c0c0=moment();this[_0x1dec('0x19')][_0x113f56[_0x1dec('0x31')]][_0x1dec('0x8e')]=_0x20c0c0[_0x1dec('0x44')](_0x1dec('0x54'));this[_0x1dec('0x19')][_0x113f56[_0x1dec('0x31')]]['duration']=_0x20c0c0[_0x1dec('0x8f')](this['channels'][_0x113f56[_0x1dec('0x31')]][_0x1dec('0x43')],_0x1dec('0x53'));if(this['channels'][_0x113f56[_0x1dec('0x31')]]['answered']){this[_0x1dec('0x19')][_0x113f56['uniqueid']][_0x1dec('0x90')]=_0x20c0c0[_0x1dec('0x8f')](this[_0x1dec('0x19')][_0x113f56[_0x1dec('0x31')]][_0x1dec('0x91')],_0x1dec('0x53'));this[_0x1dec('0x19')][_0x113f56['uniqueid']]['holdtime']=this[_0x1dec('0x19')][_0x113f56[_0x1dec('0x31')]][_0x1dec('0x52')]-this[_0x1dec('0x19')][_0x113f56[_0x1dec('0x31')]]['billableseconds'];}if(_0x113f56[_0x1dec('0x41')]===_0x1dec('0x92')){if(this[_0x1dec('0x1a')][_0x113f56[_0x1dec('0x3e')][_0x1dec('0x48')]('-')[0x0]]){this[_0x1dec('0x1a')][_0x113f56[_0x1dec('0x3e')][_0x1dec('0x48')]('-')[0x0]]=_[_0x1dec('0x93')](this[_0x1dec('0x1a')][_0x113f56[_0x1dec('0x3e')][_0x1dec('0x48')]('-')[0x0]],[_0x1dec('0x94')]);logger[_0x1dec('0x33')](_0x1dec('0x95'),_0x113f56['uniqueid'],util[_0x1dec('0x35')]({'destaccountcode':this['agents'][_0x113f56[_0x1dec('0x3e')][_0x1dec('0x48')]('-')[0x0]][_0x1dec('0x4b')]},{'showHidden':![],'depth':null}));this[_0x1dec('0x2e')](util[_0x1dec('0x44')](_0x1dec('0x49'),this[_0x1dec('0x1a')][_0x113f56[_0x1dec('0x3e')]['split']('-')[0x0]][_0x1dec('0x63')]),_0x1dec('0x96'),{'destaccountcode':this[_0x1dec('0x1a')][_0x113f56[_0x1dec('0x3e')][_0x1dec('0x48')]('-')[0x0]][_0x1dec('0x4b')]});}}var _0x7ecdd5=this;Promise['resolve']()['then'](function(){var _0x46390e=_0x7ecdd5[_0x1dec('0x19')][_0x113f56[_0x1dec('0x31')]];if(typeof _0x46390e[_0x1dec('0x97')]===_0x1dec('0x98'))return;if(_[_0x1dec('0x99')](_0x46390e[_0x1dec('0x6d')]))return;return RpcSetting['getSettings']()[_0x1dec('0x9a')](function(_0x24e66c){if(!_0x24e66c[_0x1dec('0x9b')])return;return Promise[_0x1dec('0x9c')]()['then'](function(){return ami[_0x1dec('0x9d')]({'action':_0x1dec('0x9e'),'channel':_0x46390e['channel']})[_0x1dec('0x9f')](function(){});})[_0x1dec('0x9a')](function(){return ami[_0x1dec('0x9d')]({'action':_0x1dec('0x9e'),'channel':_0x46390e[_0x1dec('0x60')]})[_0x1dec('0x9f')](function(){})[_0x1dec('0xa0')](function(){var _0x37ec5e=_0x7ecdd5[_0x1dec('0x1a')][_0x46390e[_0x1dec('0x60')][_0x1dec('0x48')]('-')[0x0]];if(!_0x37ec5e)return;io[_0x1dec('0x2e')](_0x1dec('0xa1'),{'agentId':_0x37ec5e['id'],'uniqueid':_0x46390e[_0x1dec('0x31')]});});});});})['then'](function(){if(_0x113f56[_0x1dec('0xa2')]===_0x1dec('0xa3')){_0x7ecdd5[_0x1dec('0x1b')][_0x113f56[_0x1dec('0x31')]]=_0x7ecdd5[_0x1dec('0x19')][_0x113f56[_0x1dec('0x31')]];}else{if(_0x7ecdd5['channels'][_0x113f56[_0x1dec('0x31')]][_0x1dec('0x7a')]===_0x1dec('0xa4')&&_0x7ecdd5[_0x1dec('0x1b')][_0x113f56[_0x1dec('0x31')]]){_0x7ecdd5[_0x1dec('0x19')][_0x113f56['uniqueid']]['uniqueid']=[_0x7ecdd5[_0x1dec('0x19')][_0x113f56[_0x1dec('0x31')]]['linkedid'],_0x7ecdd5['channels'][_0x113f56['uniqueid']][_0x1dec('0x36')]=_0x7ecdd5[_0x1dec('0x19')][_0x113f56[_0x1dec('0x31')]][_0x1dec('0x31')]][0x0];delete _0x7ecdd5['blindTransfers'][_0x113f56[_0x1dec('0x31')]];}}logger[_0x1dec('0x33')](_0x1dec('0xa5'),_0x113f56[_0x1dec('0x31')],util[_0x1dec('0x35')](_0x7ecdd5[_0x1dec('0x19')][_0x113f56['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x1dec('0x2e')]('custom:voiceCallReport',_0x7ecdd5[_0x1dec('0x19')][_0x113f56['uniqueid']]);delete _0x7ecdd5['channels'][_0x113f56[_0x1dec('0x31')]];});}}}catch(_0x529708){logger[_0x1dec('0x2c')](_0x1dec('0xa6'),_0x113f56[_0x1dec('0x31')],util[_0x1dec('0x35')](_0x529708,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1dec('0x2f')][_0x1dec('0x25')]=function(_0x56c054){try{if(this[_0x1dec('0x3c')](_0x56c054)){logger[_0x1dec('0x29')](_0x1dec('0xa7'),_0x56c054[_0x1dec('0x31')],_0x56c054['origtransferercalleridnum'],_0x56c054['transfertargetcalleridnum']);logger['debug'](_0x1dec('0xa8'),_0x56c054[_0x1dec('0x31')],util[_0x1dec('0x35')](_0x56c054,{'showHidden':![],'depth':null}));if(this[_0x1dec('0x19')][_0x56c054[_0x1dec('0xa9')]]){this['channels'][_0x56c054['transfereeuniqueid']][_0x1dec('0xaa')]=_0x56c054[_0x1dec('0xab')];this[_0x1dec('0x19')][_0x56c054['transfereeuniqueid']][_0x1dec('0xac')]=_0x56c054[_0x1dec('0xad')];if(this[_0x1dec('0x19')][_0x56c054[_0x1dec('0xae')]]){var _0x4c203f=this[_0x1dec('0x19')][_0x56c054[_0x1dec('0xae')]];this['channels'][_0x56c054['secondtransfereruniqueid']]=this[_0x1dec('0x19')][_0x56c054[_0x1dec('0xa9')]];this[_0x1dec('0x19')][_0x56c054[_0x1dec('0xa9')]]=_0x4c203f;}}else if(this['channels'][_0x56c054['transfertargetuniqueid']]){this[_0x1dec('0x19')][_0x56c054[_0x1dec('0xaf')]][_0x1dec('0xaa')]=_0x56c054[_0x1dec('0xab')];this[_0x1dec('0x19')][_0x56c054[_0x1dec('0xaf')]][_0x1dec('0xac')]=_0x56c054[_0x1dec('0xad')];if(this[_0x1dec('0x19')][_0x56c054[_0x1dec('0xb0')]]){var _0x4c203f=this[_0x1dec('0x19')][_0x56c054['origtransfereruniqueid']];this[_0x1dec('0x19')][_0x56c054[_0x1dec('0xb0')]]=this[_0x1dec('0x19')][_0x56c054[_0x1dec('0xaf')]];this['channels'][_0x56c054[_0x1dec('0xaf')]]=_0x4c203f;}}if((this[_0x1dec('0x19')][_0x56c054[_0x1dec('0xb0')]]||this[_0x1dec('0x19')][_0x56c054['origtransfererlinkedid']])&&this[_0x1dec('0x19')][_0x56c054[_0x1dec('0xae')]]){var _0x462fec=_[_0x1dec('0xb1')]([this[_0x1dec('0x19')][_0x56c054[_0x1dec('0xb0')]],this['channels'][_0x56c054[_0x1dec('0xb2')]],this['channels'][_0x56c054[_0x1dec('0xae')]]],function(_0x24a2f6){return _0x24a2f6&&_0x24a2f6[_0x1dec('0x7a')]===_0x1dec('0xa4')&&_0x24a2f6[_0x1dec('0xb3')];});if(_0x462fec){if(this[_0x1dec('0x19')][_0x56c054[_0x1dec('0xb0')]])this[_0x1dec('0x19')][_0x56c054['origtransfereruniqueid']][_0x1dec('0x97')]='ATTENDED';if(this[_0x1dec('0x19')][_0x56c054[_0x1dec('0xb2')]])this[_0x1dec('0x19')][_0x56c054[_0x1dec('0xb2')]][_0x1dec('0x97')]=_0x1dec('0xb4');this[_0x1dec('0x19')][_0x56c054[_0x1dec('0xae')]]['transferType']=_0x1dec('0xb4');}}}}catch(_0x306587){logger[_0x1dec('0x2c')](_0x1dec('0xb5'),_0x56c054[_0x1dec('0x31')],util[_0x1dec('0x35')](_0x306587,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1dec('0x2f')][_0x1dec('0x26')]=function(_0x1881c6){try{if(this[_0x1dec('0x3c')](_0x1881c6)){logger[_0x1dec('0x29')](_0x1dec('0xb6'),_0x1881c6[_0x1dec('0x31')],_0x1881c6[_0x1dec('0xb7')],_0x1881c6[_0x1dec('0xb8')]);logger['debug'](_0x1dec('0xb9'),_0x1881c6['uniqueid'],util[_0x1dec('0x35')](_0x1881c6,{'showHidden':![],'depth':null}));if(this[_0x1dec('0x19')][_0x1881c6[_0x1dec('0xa9')]]){this[_0x1dec('0x19')][_0x1881c6[_0x1dec('0xa9')]][_0x1dec('0xaa')]=_0x1881c6[_0x1dec('0xb7')];this[_0x1dec('0x19')][_0x1881c6[_0x1dec('0xa9')]][_0x1dec('0xac')]=_0x1881c6[_0x1dec('0xb8')];this[_0x1dec('0x19')][_0x1881c6[_0x1dec('0xa9')]]['transferType']=_0x1dec('0xba');this[_0x1dec('0x8a')]({'event':_0x1dec('0xa3'),'uniqueid':_0x1881c6[_0x1dec('0xa9')],'context':_0x1881c6[_0x1dec('0x41')],'channel':_0x1881c6[_0x1dec('0xbb')]});}else{this['channels'][_0x1881c6['transfereruniqueid']][_0x1dec('0x97')]=_0x1dec('0xba');}}}catch(_0x14fbd3){logger[_0x1dec('0x2c')](_0x1dec('0xbc'),_0x1881c6[_0x1dec('0x31')],util[_0x1dec('0x35')](_0x14fbd3,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x1dec('0x27')]=function(_0x36a381){try{if(this['isNotNull'](_0x36a381)){logger[_0x1dec('0x33')](_0x1dec('0xbd'),_0x36a381['uniqueid'],util[_0x1dec('0x35')](_0x36a381,{'showHidden':![],'depth':null}));if(this['channels'][_0x36a381[_0x1dec('0x31')]]){if(!_[_0x1dec('0xbe')](this[_0x1dec('0x19')][_0x36a381['uniqueid']][_0x1dec('0x91')])){this[_0x1dec('0x19')][_0x36a381[_0x1dec('0x31')]][_0x1dec('0xbf')]=moment()['format'](_0x1dec('0x54'));logger[_0x1dec('0x29')](_0x1dec('0xc0'),_0x36a381[_0x1dec('0x31')],this[_0x1dec('0x19')][_0x36a381['uniqueid']][_0x1dec('0xbf')]);}}}}catch(_0x4e2afc){logger[_0x1dec('0x2c')](_0x1dec('0xc1'),_0x36a381[_0x1dec('0x31')],util[_0x1dec('0x35')](_0x4e2afc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1dec('0x2f')]['syncMusicOnHoldStop']=function(_0x6fdb97){try{if(this[_0x1dec('0x3c')](_0x6fdb97)){logger[_0x1dec('0x33')]('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x6fdb97[_0x1dec('0x31')],util['inspect'](_0x6fdb97,{'showHidden':![],'depth':null}));if(this[_0x1dec('0x19')][_0x6fdb97['uniqueid']]){if(!_[_0x1dec('0xbe')](this['channels'][_0x6fdb97['uniqueid']][_0x1dec('0xbf')])){this['channels'][_0x6fdb97[_0x1dec('0x31')]][_0x1dec('0xc2')]+=moment()[_0x1dec('0xc3')](0x0)[_0x1dec('0x8f')](this[_0x1dec('0x19')][_0x6fdb97[_0x1dec('0x31')]]['mohstarttime'],'seconds');logger[_0x1dec('0x29')]('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x6fdb97[_0x1dec('0x31')],this[_0x1dec('0x19')][_0x6fdb97[_0x1dec('0x31')]][_0x1dec('0xc2')]);delete this[_0x1dec('0x19')][_0x6fdb97[_0x1dec('0x31')]][_0x1dec('0xbf')];}}}}catch(_0x27b4e1){logger['error'](_0x1dec('0xc4'),_0x6fdb97[_0x1dec('0x31')],util[_0x1dec('0x35')](_0x27b4e1,{'showHidden':![],'depth':null}));}};module[_0x1dec('0xc5')]=VoiceCallReport;
\ No newline at end of file
+var _0xf71b=['info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','debug','linkedid','merge','pick','keys','error','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','starttime','format','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','destconnectedlinenum','exten','split','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','duration','subtract','seconds','disposition','includes','lastdata','startsWith','cdr(','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','[%s][voiceCallReport][newstate]\x20event:','answertime','holdtime','diff','xcally-motion-preview','connectedlinenum','destinationchannel','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','replace','.wav49','find','monitors','isNil','push','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','answered','billableseconds','from-sip','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','transferType','isEmpty','getSettings','stopRecordingOnTransfer','StopMixMonitor','catch','then','Action','webbar:stopmonitors','event','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','origtransferercalleridnum','transfertargetcalleridnum','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','some','origtransfererlinkedid','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohstarttime','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]','bluebird','lodash','moment','util','path','ioredis','../../../config/environment','ami','../model/channel','../rpc/setting','unknown','inuse','busy','invalid','ringinuse','onhold','queue','agi','voicemail','FAILED','NO\x20ANSWER','redis','defaults','localhost','channels','agents','blindTransfers','coreshowchannel','syncNewExten','newexten','bind','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop'];(function(_0x58381c,_0x3b9374){var _0x1a7440=function(_0x2bc7f1){while(--_0x2bc7f1){_0x58381c['push'](_0x58381c['shift']());}};_0x1a7440(++_0x3b9374);}(_0xf71b,0x8e));var _0xbf71=function(_0xfeab80,_0x5daf3){_0xfeab80=_0xfeab80-0x0;var _0x5b6b72=_0xf71b[_0xfeab80];return _0x5b6b72;};'use strict';var BPromise=require(_0xbf71('0x0'));var _=require(_0xbf71('0x1'));var moment=require(_0xbf71('0x2'));var util=require(_0xbf71('0x3'));var path=require(_0xbf71('0x4'));var Redis=require(_0xbf71('0x5'));var config=require(_0xbf71('0x6'));var logger=require('../../../config/logger')(_0xbf71('0x7'));var ami=require('../ami');var Channel=require(_0xbf71('0x8'));var RpcSetting=require(_0xbf71('0x9'));var statusDesc=[_0xbf71('0xa'),'not_inuse',_0xbf71('0xb'),_0xbf71('0xc'),_0xbf71('0xd'),'unavailable','ringing',_0xbf71('0xe'),_0xbf71('0xf')];var applications=['set',_0xbf71('0x10'),_0xbf71('0x11'),'dial','playback',_0xbf71('0x12')];var dispositions=['NO\x20ANSWER',_0xbf71('0x13'),'FAILED',_0xbf71('0x14'),'NO\x20ANSWER',_0xbf71('0x14'),'ANSWERED','BUSY',_0xbf71('0x13'),_0xbf71('0x13'),'FAILED'];var actions={};config[_0xbf71('0x15')]=_[_0xbf71('0x16')](config[_0xbf71('0x15')],{'host':_0xbf71('0x17'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceCallReport(_0x1f7074){this[_0xbf71('0x18')]=_0x1f7074['channels'];this['agents']=_0x1f7074[_0xbf71('0x19')];this[_0xbf71('0x1a')]={};ami['on'](_0xbf71('0x1b'),this[_0xbf71('0x1c')]['bind'](this));ami['on'](_0xbf71('0x1d'),this[_0xbf71('0x1c')][_0xbf71('0x1e')](this));ami['on'](_0xbf71('0x1f'),this[_0xbf71('0x20')][_0xbf71('0x1e')](this));ami['on'](_0xbf71('0x21'),this[_0xbf71('0x22')][_0xbf71('0x1e')](this));ami['on'](_0xbf71('0x23'),this[_0xbf71('0x24')][_0xbf71('0x1e')](this));ami['on'](_0xbf71('0x25'),this[_0xbf71('0x26')][_0xbf71('0x1e')](this));ami['on'](_0xbf71('0x27'),this['syncNewCallerId']['bind'](this));ami['on']('attendedtransfer',this[_0xbf71('0x28')][_0xbf71('0x1e')](this));ami['on'](_0xbf71('0x29'),this['syncBlindTransfer'][_0xbf71('0x1e')](this));ami['on'](_0xbf71('0x2a'),this[_0xbf71('0x2b')]['bind'](this));ami['on'](_0xbf71('0x2c'),this[_0xbf71('0x2d')][_0xbf71('0x1e')](this));try{logger[_0xbf71('0x2e')](_0xbf71('0x2f'));ami[_0xbf71('0x30')]();}catch(_0x4cba63){logger['error'](_0xbf71('0x31'),util[_0xbf71('0x32')](_0x4cba63,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xbf71('0x33')][_0xbf71('0x34')]=function(_0x45796e){return _0x45796e!==null&&!_[_0xbf71('0x35')](_0x45796e);};VoiceCallReport[_0xbf71('0x33')][_0xbf71('0x36')]=function(_0x242f74,_0x5902c9,_0x523119){io['to'](_0x242f74)[_0xbf71('0x36')](_0x5902c9,_0x523119);};VoiceCallReport[_0xbf71('0x33')]['syncNewCallerId']=function(_0x5aaefc){try{if(this[_0xbf71('0x34')](_0x5aaefc)){logger[_0xbf71('0x2e')](_0xbf71('0x37'),_0x5aaefc[_0xbf71('0x38')],_0x5aaefc['calleridname'],_0x5aaefc[_0xbf71('0x39')]);logger[_0xbf71('0x3a')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x5aaefc[_0xbf71('0x38')],util[_0xbf71('0x32')](_0x5aaefc,{'showHidden':![],'depth':null}));if(_0x5aaefc[_0xbf71('0x38')]===_0x5aaefc[_0xbf71('0x3b')]){if(!_['isUndefined'](this[_0xbf71('0x18')][_0x5aaefc[_0xbf71('0x38')]])){_[_0xbf71('0x3c')](this['channels'][_0x5aaefc[_0xbf71('0x38')]],_[_0xbf71('0x3d')](_0x5aaefc,_[_0xbf71('0x3e')](this[_0xbf71('0x18')][_0x5aaefc[_0xbf71('0x38')]])));}}}}catch(_0xd73aab){logger[_0xbf71('0x3f')]('[%s][voiceCallReport][newcallerid]',_0x5aaefc['uniqueid'],util[_0xbf71('0x32')](_0xd73aab,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xbf71('0x33')][_0xbf71('0x20')]=function(_0x5d3f38){try{if(this[_0xbf71('0x34')](_0x5d3f38)){logger[_0xbf71('0x3a')]('[%s][voiceCallReport][newchannel]\x20event:',_0x5d3f38['uniqueid'],util[_0xbf71('0x32')](_0x5d3f38,{'showHidden':![],'depth':null}));if(_0x5d3f38[_0xbf71('0x38')]===_0x5d3f38['linkedid']&&_0x5d3f38[_0xbf71('0x40')]!=_0xbf71('0x41')){if(_[_0xbf71('0x35')](this['channels'][_0x5d3f38[_0xbf71('0x38')]])){logger[_0xbf71('0x2e')](_0xbf71('0x42'),_0x5d3f38[_0xbf71('0x38')],_0x5d3f38[_0xbf71('0x43')],_0x5d3f38['exten']);this[_0xbf71('0x18')][_0x5d3f38[_0xbf71('0x38')]]=new Channel();this[_0xbf71('0x18')][_0x5d3f38[_0xbf71('0x38')]][_0xbf71('0x44')]=moment()[_0xbf71('0x45')](_0xbf71('0x46'));this[_0xbf71('0x18')][_0x5d3f38[_0xbf71('0x38')]]['disposition']=dispositions[_[_0xbf71('0x47')](_0x5d3f38[_0xbf71('0x48')])];_[_0xbf71('0x3c')](this['channels'][_0x5d3f38[_0xbf71('0x38')]],_[_0xbf71('0x3d')](_0x5d3f38,_['keys'](this[_0xbf71('0x18')][_0x5d3f38['uniqueid']])));if(_0x5d3f38[_0xbf71('0x43')]==='from-sip'){if(this[_0xbf71('0x19')][_0x5d3f38[_0xbf71('0x40')]['split']('-')[0x0]]){this[_0xbf71('0x19')][_0x5d3f38[_0xbf71('0x40')]['split']('-')[0x0]][_0xbf71('0x49')]=_0x5d3f38[_0xbf71('0x4a')];logger[_0xbf71('0x3a')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x5d3f38[_0xbf71('0x38')],util[_0xbf71('0x32')]({'destaccountcode':this[_0xbf71('0x19')][_0x5d3f38[_0xbf71('0x40')][_0xbf71('0x4b')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x5d3f38['exten']},{'showHidden':![],'depth':null}));this[_0xbf71('0x36')](util[_0xbf71('0x45')](_0xbf71('0x4c'),this['agents'][_0x5d3f38['channel'][_0xbf71('0x4b')]('-')[0x0]][_0xbf71('0x4d')]),_0xbf71('0x4e'),{'destaccountcode':this['agents'][_0x5d3f38[_0xbf71('0x40')][_0xbf71('0x4b')]('-')[0x0]][_0xbf71('0x4f')],'destconnectedlinenum':_0x5d3f38[_0xbf71('0x4a')]});}}}}}}catch(_0x2af818){logger[_0xbf71('0x3f')]('[%s][voiceCallReport][newchannel]',_0x5d3f38[_0xbf71('0x38')],util[_0xbf71('0x32')](_0x2af818,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xbf71('0x33')]['syncNewExten']=function(_0x12de93){try{if(this['isNotNull'](_0x12de93)){logger[_0xbf71('0x3a')](_0xbf71('0x50'),_0x12de93[_0xbf71('0x38')],util[_0xbf71('0x32')](_0x12de93,{'showHidden':![],'depth':null}));if(_0x12de93['uniqueid']===_0x12de93[_0xbf71('0x3b')]&&_0x12de93[_0xbf71('0x4a')]!='h'&&_0x12de93[_0xbf71('0x40')]!=_0xbf71('0x41')){_0x12de93[_0xbf71('0x51')]=_0x12de93[_0xbf71('0x51')][_0xbf71('0x52')]();_0x12de93[_0xbf71('0x53')]=(_0x12de93[_0xbf71('0x54')]||_0x12de93['applicationdata'])[_0xbf71('0x52')]();logger['info']('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x12de93['uniqueid'],_0x12de93['application'],_0x12de93[_0xbf71('0x53')]);if(_[_0xbf71('0x35')](this[_0xbf71('0x18')][_0x12de93[_0xbf71('0x38')]])){this['channels'][_0x12de93[_0xbf71('0x38')]]=new Channel();this[_0xbf71('0x18')][_0x12de93[_0xbf71('0x38')]][_0xbf71('0x44')]=_0x12de93[_0xbf71('0x55')]?moment()[_0xbf71('0x56')](moment[_0xbf71('0x55')](_0x12de93[_0xbf71('0x55')])['seconds'](),_0xbf71('0x57'))[_0xbf71('0x45')](_0xbf71('0x46')):moment()['format'](_0xbf71('0x46'));this['channels'][_0x12de93['uniqueid']][_0xbf71('0x58')]=_0xbf71('0x14');}_['merge'](this[_0xbf71('0x18')][_0x12de93[_0xbf71('0x38')]],_[_0xbf71('0x3d')](_0x12de93,_[_0xbf71('0x3e')](this[_0xbf71('0x18')][_0x12de93[_0xbf71('0x38')]])));if(_[_0xbf71('0x59')](applications,_0x12de93[_0xbf71('0x51')])){this['channels'][_0x12de93[_0xbf71('0x38')]]['lastapplication']=_0x12de93[_0xbf71('0x51')];this['channels'][_0x12de93['uniqueid']][_0xbf71('0x5a')]=_0x12de93[_0xbf71('0x53')];if(_0x12de93[_0xbf71('0x51')]==='set'&&_[_0xbf71('0x5b')](_0x12de93['applicationdata'],_0xbf71('0x5c'))){var _0x37f278=_0x12de93[_0xbf71('0x53')]['split']('=');var _0x4f0a45=_0x37f278[0x0]['match'](/cdr\((.*)\)/);if(_0x4f0a45){this[_0xbf71('0x18')][_0x12de93['uniqueid']][_0x4f0a45[0x1]]=_0x37f278[0x1];}}else if(_0x12de93[_0xbf71('0x51')]===_0xbf71('0x10')){this[_0xbf71('0x18')][_0x12de93[_0xbf71('0x38')]]['queue']=_0x12de93['applicationdata'][_0xbf71('0x4b')](',')[0x0];}}}}}catch(_0x256457){logger[_0xbf71('0x3f')](_0xbf71('0x5d'),_0x12de93['uniqueid'],util[_0xbf71('0x32')](_0x256457,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xbf71('0x22')]=function(_0x16d740){try{if(this['isNotNull'](_0x16d740)){logger[_0xbf71('0x2e')](_0xbf71('0x5e'),_0x16d740[_0xbf71('0x38')],_0x16d740['linkedid'],_0x16d740[_0xbf71('0x5f')],_0x16d740[_0xbf71('0x39')]);logger[_0xbf71('0x3a')](_0xbf71('0x60'),_0x16d740[_0xbf71('0x38')],util[_0xbf71('0x32')](_0x16d740,{'showHidden':![],'depth':null}));if(_0x16d740[_0xbf71('0x38')]!==_0x16d740['linkedid']){if(this[_0xbf71('0x18')][_0x16d740['linkedid']]){if(_0x16d740[_0xbf71('0x48')]==='6'){if(!this[_0xbf71('0x18')][_0x16d740[_0xbf71('0x3b')]]['answered']){var _0x1d78eb=moment();this[_0xbf71('0x18')][_0x16d740['linkedid']]['answered']=!![];this['channels'][_0x16d740['linkedid']][_0xbf71('0x61')]=_0x1d78eb[_0xbf71('0x45')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xbf71('0x18')][_0x16d740['linkedid']][_0xbf71('0x44')]){this[_0xbf71('0x18')][_0x16d740[_0xbf71('0x3b')]][_0xbf71('0x62')]=_0x1d78eb[_0xbf71('0x63')](this[_0xbf71('0x18')][_0x16d740[_0xbf71('0x3b')]][_0xbf71('0x44')],_0xbf71('0x57'));}}this[_0xbf71('0x18')][_0x16d740[_0xbf71('0x3b')]][_0xbf71('0x3b')]=_0x16d740['uniqueid'];if(_0x16d740[_0xbf71('0x39')]!==_0xbf71('0x64')){this['channels'][_0x16d740[_0xbf71('0x3b')]][_0xbf71('0x65')]=_0x16d740[_0xbf71('0x39')];}this[_0xbf71('0x18')][_0x16d740[_0xbf71('0x3b')]]['connectedlinename']=_0x16d740[_0xbf71('0x5f')];this[_0xbf71('0x18')][_0x16d740['linkedid']][_0xbf71('0x66')]=_0x16d740[_0xbf71('0x40')];this[_0xbf71('0x18')][_0x16d740[_0xbf71('0x3b')]]['disposition']=dispositions[_[_0xbf71('0x47')](_0x16d740['channelstate'])];if(this[_0xbf71('0x19')][_0x16d740[_0xbf71('0x40')][_0xbf71('0x4b')]('-')[0x0]]){this[_0xbf71('0x18')][_0x16d740[_0xbf71('0x3b')]][_0xbf71('0x67')]=this[_0xbf71('0x19')][_0x16d740[_0xbf71('0x40')][_0xbf71('0x4b')]('-')[0x0]]['id'];this[_0xbf71('0x18')][_0x16d740[_0xbf71('0x3b')]]['membername']=this['agents'][_0x16d740[_0xbf71('0x40')][_0xbf71('0x4b')]('-')[0x0]][_0xbf71('0x4d')];}}}}else{if(this[_0xbf71('0x18')][_0x16d740[_0xbf71('0x38')]]){if(_0x16d740[_0xbf71('0x48')]==='6'){if(this[_0xbf71('0x19')][_0x16d740[_0xbf71('0x40')]['split']('-')[0x0]]){this['channels'][_0x16d740[_0xbf71('0x38')]][_0xbf71('0x67')]=this[_0xbf71('0x19')][_0x16d740[_0xbf71('0x40')][_0xbf71('0x4b')]('-')[0x0]]['id'];this[_0xbf71('0x18')][_0x16d740[_0xbf71('0x38')]][_0xbf71('0x68')]=this[_0xbf71('0x19')][_0x16d740[_0xbf71('0x40')][_0xbf71('0x4b')]('-')[0x0]][_0xbf71('0x4d')];}}}}}}catch(_0x1c1d86){logger['error'](_0xbf71('0x69'),_0x16d740[_0xbf71('0x38')],util[_0xbf71('0x32')](_0x1c1d86,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xbf71('0x6a')]=function(_0x1f0f12,_0x217040){try{if(this[_0xbf71('0x18')][_0x1f0f12]){logger[_0xbf71('0x2e')](_0xbf71('0x6b'),_0x1f0f12,_0x217040);this[_0xbf71('0x18')][_0x1f0f12]['monitor']=!![];if(_['endsWith'](_0x217040,'.wav49')){_0x217040=_0x217040[_0xbf71('0x6c')](_0xbf71('0x6d'),'.WAV');}this['channels'][_0x1f0f12]['monitorFilename']=_0x217040;var _0x3dfc55=_[_0xbf71('0x6e')](this[_0xbf71('0x18')][_0x1f0f12][_0xbf71('0x6f')],{'filename':_0x217040});if(_[_0xbf71('0x70')](_0x3dfc55)){this[_0xbf71('0x18')][_0x1f0f12]['monitors'][_0xbf71('0x71')]({'filename':_0x217040,'createdAt':moment()[_0xbf71('0x45')](_0xbf71('0x46')),'mixmonitorid':'','status':'rec'});}}}catch(_0x55a269){logger[_0xbf71('0x3f')]('[%s][voiceCallReport][mixMonitorFilename]',_0x1f0f12,util[_0xbf71('0x32')](_0x55a269,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xbf71('0x33')]['syncVarSet']=function(_0x4b24c4){try{if(this['isNotNull'](_0x4b24c4)){logger[_0xbf71('0x3a')]('[%s][voiceCallReport][varset]\x20event:',_0x4b24c4[_0xbf71('0x38')],util[_0xbf71('0x32')](_0x4b24c4,{'showHidden':![],'depth':null}));if(this[_0xbf71('0x18')][_0x4b24c4[_0xbf71('0x38')]]&&_0x4b24c4[_0xbf71('0x40')]!='OutgoingSpoolFailed'){if(this[_0xbf71('0x34')](_0x4b24c4['variable'])){if(this[_0xbf71('0x34')](_0x4b24c4[_0xbf71('0x72')][_0xbf71('0x73')])){logger['info'](_0xbf71('0x74'),_0x4b24c4['uniqueid'],_0x4b24c4[_0xbf71('0x75')]);this[_0xbf71('0x6a')](_0x4b24c4['uniqueid'],_0x4b24c4[_0xbf71('0x75')]);}else if(this[_0xbf71('0x34')](_0x4b24c4[_0xbf71('0x72')][_0xbf71('0x76')])){logger[_0xbf71('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x4b24c4[_0xbf71('0x38')],_0x4b24c4[_0xbf71('0x75')]);this[_0xbf71('0x18')][_0x4b24c4[_0xbf71('0x38')]][_0xbf71('0x39')]=_0x4b24c4['value'];}else if(this[_0xbf71('0x34')](_0x4b24c4[_0xbf71('0x72')][_0xbf71('0x77')])){logger[_0xbf71('0x2e')](_0xbf71('0x78'),_0x4b24c4[_0xbf71('0x38')],_0x4b24c4['value']);this[_0xbf71('0x18')][_0x4b24c4['uniqueid']][_0xbf71('0x79')]=_0x4b24c4['value'];}else if(this[_0xbf71('0x34')](_0x4b24c4['variable'][_0xbf71('0x7a')])){logger[_0xbf71('0x2e')](_0xbf71('0x7b'),_0x4b24c4['uniqueid'],_0x4b24c4[_0xbf71('0x75')]);this[_0xbf71('0x18')][_0x4b24c4['uniqueid']][_0xbf71('0x7c')]=_0x4b24c4[_0xbf71('0x75')];}else if(this[_0xbf71('0x34')](_0x4b24c4['variable'][_0xbf71('0x7d')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x4b24c4[_0xbf71('0x38')],_0x4b24c4[_0xbf71('0x75')]['split'](',')[0x0]);this[_0xbf71('0x18')][_0x4b24c4[_0xbf71('0x38')]][_0xbf71('0x10')]=_0x4b24c4[_0xbf71('0x75')]['split'](',')[0x0];}else if(this['isNotNull'](_0x4b24c4[_0xbf71('0x72')]['xmd-originatecalleridnum'])){logger[_0xbf71('0x2e')](_0xbf71('0x7e'),_0x4b24c4[_0xbf71('0x38')],_0x4b24c4[_0xbf71('0x75')]);this[_0xbf71('0x18')][_0x4b24c4[_0xbf71('0x38')]][_0xbf71('0x7f')]=_0x4b24c4[_0xbf71('0x75')];}else if(this[_0xbf71('0x34')](_0x4b24c4[_0xbf71('0x72')][_0xbf71('0x80')])){logger['info'](_0xbf71('0x81'),_0x4b24c4[_0xbf71('0x38')],_0x4b24c4['value']);this[_0xbf71('0x18')][_0x4b24c4['uniqueid']]['destination']=_0x4b24c4[_0xbf71('0x75')];}else if(this['isNotNull'](_0x4b24c4[_0xbf71('0x72')][_0xbf71('0x82')])){logger[_0xbf71('0x2e')](_0xbf71('0x83'),_0x4b24c4[_0xbf71('0x38')],_0x4b24c4[_0xbf71('0x75')]);this[_0xbf71('0x18')][_0x4b24c4[_0xbf71('0x38')]][_0xbf71('0x84')]=_0x4b24c4[_0xbf71('0x75')];}else if(this[_0xbf71('0x34')](_0x4b24c4[_0xbf71('0x72')]['xmcs-queue'])){logger[_0xbf71('0x2e')](_0xbf71('0x85'),_0x4b24c4['uniqueid'],_0x4b24c4[_0xbf71('0x75')]);this['channels'][_0x4b24c4['uniqueid']][_0xbf71('0x10')]=_0x4b24c4[_0xbf71('0x75')];}else if(this[_0xbf71('0x34')](_0x4b24c4[_0xbf71('0x72')][_0xbf71('0x86')])){logger['info'](_0xbf71('0x87'),_0x4b24c4[_0xbf71('0x38')],_0x4b24c4[_0xbf71('0x75')]);this[_0xbf71('0x18')][_0x4b24c4[_0xbf71('0x38')]]['sipcalluniqueid']=_0x4b24c4['value'];}}}else if(this[_0xbf71('0x34')](_0x4b24c4[_0xbf71('0x72')][_0xbf71('0x73')])){if(_0x4b24c4['value']){var _0x30189b=path[_0xbf71('0x88')](_0x4b24c4['value'])[_0xbf71('0x4d')];logger[_0xbf71('0x2e')](_0xbf71('0x74'),_0x30189b,_0x4b24c4['value']);this['syncMixMonitorFilename'](_0x30189b,_0x4b24c4[_0xbf71('0x75')]);}}else if(this[_0xbf71('0x18')][_0x4b24c4[_0xbf71('0x3b')]]){if(this['isNotNull'](_0x4b24c4[_0xbf71('0x72')])){if(this['isNotNull'](_0x4b24c4[_0xbf71('0x72')][_0xbf71('0x86')])){logger['info'](_0xbf71('0x87'),_0x4b24c4[_0xbf71('0x3b')],_0x4b24c4[_0xbf71('0x75')]);this['channels'][_0x4b24c4['linkedid']][_0xbf71('0x89')]=_0x4b24c4[_0xbf71('0x75')];}}}}}catch(_0x5a90b4){logger[_0xbf71('0x3f')](_0xbf71('0x8a'),_0x4b24c4[_0xbf71('0x38')],util[_0xbf71('0x32')](_0x5a90b4,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xbf71('0x26')]=function(_0x5cd6b8){try{if(this[_0xbf71('0x34')](_0x5cd6b8)){logger[_0xbf71('0x3a')](_0xbf71('0x8b'),_0x5cd6b8[_0xbf71('0x38')],util[_0xbf71('0x32')](_0x5cd6b8,{'showHidden':![],'depth':null}));if(this[_0xbf71('0x18')][_0x5cd6b8[_0xbf71('0x38')]]){logger[_0xbf71('0x2e')](_0xbf71('0x8c'),_0x5cd6b8[_0xbf71('0x38')],_0x5cd6b8['cause-txt']);var _0x3152a0=moment();this[_0xbf71('0x18')][_0x5cd6b8[_0xbf71('0x38')]][_0xbf71('0x8d')]=_0x3152a0[_0xbf71('0x45')](_0xbf71('0x46'));this[_0xbf71('0x18')][_0x5cd6b8['uniqueid']][_0xbf71('0x55')]=_0x3152a0[_0xbf71('0x63')](this[_0xbf71('0x18')][_0x5cd6b8[_0xbf71('0x38')]][_0xbf71('0x44')],'seconds');if(this[_0xbf71('0x18')][_0x5cd6b8[_0xbf71('0x38')]][_0xbf71('0x8e')]){this[_0xbf71('0x18')][_0x5cd6b8[_0xbf71('0x38')]][_0xbf71('0x8f')]=_0x3152a0[_0xbf71('0x63')](this[_0xbf71('0x18')][_0x5cd6b8['uniqueid']][_0xbf71('0x61')],_0xbf71('0x57'));this[_0xbf71('0x18')][_0x5cd6b8['uniqueid']][_0xbf71('0x62')]=this['channels'][_0x5cd6b8[_0xbf71('0x38')]][_0xbf71('0x55')]-this[_0xbf71('0x18')][_0x5cd6b8[_0xbf71('0x38')]][_0xbf71('0x8f')];}if(_0x5cd6b8['context']===_0xbf71('0x90')){if(this['agents'][_0x5cd6b8['channel'][_0xbf71('0x4b')]('-')[0x0]]){this[_0xbf71('0x19')][_0x5cd6b8['channel'][_0xbf71('0x4b')]('-')[0x0]]=_[_0xbf71('0x91')](this[_0xbf71('0x19')][_0x5cd6b8[_0xbf71('0x40')][_0xbf71('0x4b')]('-')[0x0]],[_0xbf71('0x49')]);logger[_0xbf71('0x3a')](_0xbf71('0x92'),_0x5cd6b8[_0xbf71('0x38')],util[_0xbf71('0x32')]({'destaccountcode':this[_0xbf71('0x19')][_0x5cd6b8[_0xbf71('0x40')][_0xbf71('0x4b')]('-')[0x0]][_0xbf71('0x4f')]},{'showHidden':![],'depth':null}));this[_0xbf71('0x36')](util['format']('user:%s',this[_0xbf71('0x19')][_0x5cd6b8[_0xbf71('0x40')][_0xbf71('0x4b')]('-')[0x0]]['name']),_0xbf71('0x93'),{'destaccountcode':this['agents'][_0x5cd6b8[_0xbf71('0x40')]['split']('-')[0x0]][_0xbf71('0x4f')]});}}var _0x229ab0=this;Promise['resolve']()['then'](function(){var _0x166d6d=_0x229ab0['channels'][_0x5cd6b8[_0xbf71('0x38')]];if(typeof _0x166d6d[_0xbf71('0x94')]==='undefined')return;if(_[_0xbf71('0x95')](_0x166d6d[_0xbf71('0x6f')]))return;return RpcSetting[_0xbf71('0x96')]()['then'](function(_0x22cc62){if(!_0x22cc62[_0xbf71('0x97')])return;return Promise['resolve']()['then'](function(){return ami['Action']({'action':_0xbf71('0x98'),'channel':_0x166d6d[_0xbf71('0x40')]})[_0xbf71('0x99')](function(){});})[_0xbf71('0x9a')](function(){return ami[_0xbf71('0x9b')]({'action':_0xbf71('0x98'),'channel':_0x166d6d[_0xbf71('0x66')]})[_0xbf71('0x99')](function(){})['finally'](function(){var _0x5b0671=_0x229ab0[_0xbf71('0x19')][_0x166d6d[_0xbf71('0x66')][_0xbf71('0x4b')]('-')[0x0]];if(!_0x5b0671)return;io['emit'](_0xbf71('0x9c'),{'agentId':_0x5b0671['id'],'uniqueid':_0x166d6d[_0xbf71('0x38')]});});});});})[_0xbf71('0x9a')](function(){if(_0x5cd6b8[_0xbf71('0x9d')]==='BlindTransfer'){_0x229ab0['blindTransfers'][_0x5cd6b8['uniqueid']]=_0x229ab0[_0xbf71('0x18')][_0x5cd6b8[_0xbf71('0x38')]];}else{if(_0x229ab0['channels'][_0x5cd6b8[_0xbf71('0x38')]]['type']===_0xbf71('0x9e')&&_0x229ab0['blindTransfers'][_0x5cd6b8['uniqueid']]){_0x229ab0['channels'][_0x5cd6b8['uniqueid']][_0xbf71('0x38')]=[_0x229ab0[_0xbf71('0x18')][_0x5cd6b8['uniqueid']][_0xbf71('0x3b')],_0x229ab0[_0xbf71('0x18')][_0x5cd6b8[_0xbf71('0x38')]]['linkedid']=_0x229ab0[_0xbf71('0x18')][_0x5cd6b8['uniqueid']]['uniqueid']][0x0];delete _0x229ab0[_0xbf71('0x1a')][_0x5cd6b8[_0xbf71('0x38')]];}}logger[_0xbf71('0x3a')](_0xbf71('0x9f'),_0x5cd6b8[_0xbf71('0x38')],util['inspect'](_0x229ab0['channels'][_0x5cd6b8[_0xbf71('0x38')]],{'showHidden':![],'depth':null}));ami[_0xbf71('0x36')](_0xbf71('0xa0'),_0x229ab0[_0xbf71('0x18')][_0x5cd6b8[_0xbf71('0x38')]]);delete _0x229ab0['channels'][_0x5cd6b8[_0xbf71('0x38')]];});}}}catch(_0x1a7c1c){logger['error'](_0xbf71('0xa1'),_0x5cd6b8['uniqueid'],util[_0xbf71('0x32')](_0x1a7c1c,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xbf71('0x28')]=function(_0x584295){try{if(this['isNotNull'](_0x584295)){logger['info']('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x584295[_0xbf71('0x38')],_0x584295[_0xbf71('0xa2')],_0x584295[_0xbf71('0xa3')]);logger[_0xbf71('0x3a')]('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x584295[_0xbf71('0x38')],util[_0xbf71('0x32')](_0x584295,{'showHidden':![],'depth':null}));if(this[_0xbf71('0x18')][_0x584295['transfereeuniqueid']]){this[_0xbf71('0x18')][_0x584295[_0xbf71('0xa4')]][_0xbf71('0xa5')]=_0x584295[_0xbf71('0xa2')];this['channels'][_0x584295[_0xbf71('0xa4')]][_0xbf71('0xa6')]=_0x584295['transfertargetcalleridnum'];if(this['channels'][_0x584295[_0xbf71('0xa7')]]){var _0x353f2a=this[_0xbf71('0x18')][_0x584295['secondtransfereruniqueid']];this[_0xbf71('0x18')][_0x584295['secondtransfereruniqueid']]=this[_0xbf71('0x18')][_0x584295[_0xbf71('0xa4')]];this[_0xbf71('0x18')][_0x584295[_0xbf71('0xa4')]]=_0x353f2a;}}else if(this[_0xbf71('0x18')][_0x584295[_0xbf71('0xa8')]]){this['channels'][_0x584295[_0xbf71('0xa8')]][_0xbf71('0xa5')]=_0x584295[_0xbf71('0xa2')];this['channels'][_0x584295[_0xbf71('0xa8')]][_0xbf71('0xa6')]=_0x584295[_0xbf71('0xa3')];if(this[_0xbf71('0x18')][_0x584295[_0xbf71('0xa9')]]){var _0x353f2a=this[_0xbf71('0x18')][_0x584295[_0xbf71('0xa9')]];this[_0xbf71('0x18')][_0x584295[_0xbf71('0xa9')]]=this[_0xbf71('0x18')][_0x584295[_0xbf71('0xa8')]];this['channels'][_0x584295[_0xbf71('0xa8')]]=_0x353f2a;}}if((this[_0xbf71('0x18')][_0x584295[_0xbf71('0xa9')]]||this[_0xbf71('0x18')][_0x584295['origtransfererlinkedid']])&&this[_0xbf71('0x18')][_0x584295[_0xbf71('0xa7')]]){var _0x49063d=_[_0xbf71('0xaa')]([this['channels'][_0x584295[_0xbf71('0xa9')]],this[_0xbf71('0x18')][_0x584295[_0xbf71('0xab')]],this[_0xbf71('0x18')][_0x584295[_0xbf71('0xa7')]]],function(_0x58c103){return _0x58c103&&_0x58c103[_0xbf71('0x7c')]===_0xbf71('0x9e')&&_0x58c103[_0xbf71('0xac')];});if(_0x49063d){if(this[_0xbf71('0x18')][_0x584295[_0xbf71('0xa9')]])this[_0xbf71('0x18')][_0x584295[_0xbf71('0xa9')]]['transferType']=_0xbf71('0xad');if(this[_0xbf71('0x18')][_0x584295['origtransfererlinkedid']])this[_0xbf71('0x18')][_0x584295['origtransfererlinkedid']][_0xbf71('0x94')]=_0xbf71('0xad');this['channels'][_0x584295[_0xbf71('0xa7')]][_0xbf71('0x94')]=_0xbf71('0xad');}}}}catch(_0x22b535){logger[_0xbf71('0x3f')](_0xbf71('0xae'),_0x584295[_0xbf71('0x38')],util[_0xbf71('0x32')](_0x22b535,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xbf71('0x33')]['syncBlindTransfer']=function(_0x4b94ea){try{if(this[_0xbf71('0x34')](_0x4b94ea)){logger[_0xbf71('0x2e')](_0xbf71('0xaf'),_0x4b94ea[_0xbf71('0x38')],_0x4b94ea[_0xbf71('0xb0')],_0x4b94ea[_0xbf71('0xb1')]);logger[_0xbf71('0x3a')](_0xbf71('0xb2'),_0x4b94ea[_0xbf71('0x38')],util[_0xbf71('0x32')](_0x4b94ea,{'showHidden':![],'depth':null}));if(this[_0xbf71('0x18')][_0x4b94ea['transfereeuniqueid']]){this[_0xbf71('0x18')][_0x4b94ea[_0xbf71('0xa4')]][_0xbf71('0xa5')]=_0x4b94ea[_0xbf71('0xb0')];this['channels'][_0x4b94ea[_0xbf71('0xa4')]][_0xbf71('0xa6')]=_0x4b94ea[_0xbf71('0xb1')];this[_0xbf71('0x18')][_0x4b94ea[_0xbf71('0xa4')]]['transferType']='BLIND';this[_0xbf71('0x26')]({'event':'BlindTransfer','uniqueid':_0x4b94ea['transfereeuniqueid'],'context':_0x4b94ea[_0xbf71('0x43')],'channel':_0x4b94ea['transfererchannel']});}else{this['channels'][_0x4b94ea['transfereruniqueid']][_0xbf71('0x94')]=_0xbf71('0xb3');}}}catch(_0x29f5e2){logger[_0xbf71('0x3f')]('[%s][voiceCallReport][blindtransfer]',_0x4b94ea[_0xbf71('0x38')],util[_0xbf71('0x32')](_0x29f5e2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xbf71('0x33')][_0xbf71('0x2b')]=function(_0x449906){try{if(this['isNotNull'](_0x449906)){logger[_0xbf71('0x3a')](_0xbf71('0xb4'),_0x449906[_0xbf71('0x38')],util[_0xbf71('0x32')](_0x449906,{'showHidden':![],'depth':null}));if(this[_0xbf71('0x18')][_0x449906[_0xbf71('0x38')]]){if(!_[_0xbf71('0x70')](this[_0xbf71('0x18')][_0x449906['uniqueid']][_0xbf71('0x61')])){this[_0xbf71('0x18')][_0x449906[_0xbf71('0x38')]]['mohstarttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0xbf71('0x2e')](_0xbf71('0xb5'),_0x449906['uniqueid'],this['channels'][_0x449906['uniqueid']]['mohstarttime']);}}}}catch(_0xf03079){logger[_0xbf71('0x3f')](_0xbf71('0xb6'),_0x449906[_0xbf71('0x38')],util[_0xbf71('0x32')](_0xf03079,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xbf71('0x33')][_0xbf71('0x2d')]=function(_0x444824){try{if(this[_0xbf71('0x34')](_0x444824)){logger[_0xbf71('0x3a')](_0xbf71('0xb7'),_0x444824['uniqueid'],util['inspect'](_0x444824,{'showHidden':![],'depth':null}));if(this[_0xbf71('0x18')][_0x444824[_0xbf71('0x38')]]){if(!_[_0xbf71('0x70')](this[_0xbf71('0x18')][_0x444824[_0xbf71('0x38')]][_0xbf71('0xb8')])){this['channels'][_0x444824['uniqueid']][_0xbf71('0xb9')]+=moment()[_0xbf71('0xba')](0x0)[_0xbf71('0x63')](this[_0xbf71('0x18')][_0x444824[_0xbf71('0x38')]][_0xbf71('0xb8')],_0xbf71('0x57'));logger[_0xbf71('0x2e')]('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x444824[_0xbf71('0x38')],this[_0xbf71('0x18')][_0x444824['uniqueid']][_0xbf71('0xb9')]);delete this[_0xbf71('0x18')][_0x444824[_0xbf71('0x38')]]['mohstarttime'];}}}}catch(_0x47a6e0){logger[_0xbf71('0x3f')](_0xbf71('0xbb'),_0x444824['uniqueid'],util[_0xbf71('0x32')](_0x47a6e0,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport;
\ No newline at end of file