Built motion from commit (unavailable).|2.5.12
[motion2.git] / server / services / ami / report / voiceCallReport.js
index 576269d..665222c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9a02=['attendedtransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','then','actionCoreShowChannels','log','prototype','emit','syncNewCallerId','isNotNull','uniqueid','linkedid','isUndefined','pick','keys','[syncNewCallerId][VoiceCallReport]','channel','OutgoingSpoolFailed','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','merge','context','from-sip','split','destconnectedlinenum','user:%s','name','user:agentconnect','accountcode','exten','error','[syncNewChannel][VoiceCallReport]','inspect','application','applicationdata','appdata','toLowerCase','subtract','duration','includes','lastdata','startsWith','match','[syncNewExten][VoiceCallReport]','syncNewState','answered','answertime','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinenum','calleridname','destinationchannel','UserId','membername','monitor','endsWith','.wav49','replace','monitorFilename','monitors','isNil','push','rec','variable','mixmonitor_filename','value','xmd-phone','xmd-callerid','callerid','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','destination','xmd-callerid-preview','xmcs-queue','sipcallid','sipcalluniqueid','syncMixMonitorFilename','sipcalllinkedid','[syncVarSet][VoiceCallReport]','endtime','billableseconds','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','syncAttendedTransfer','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','extension','BlindTransfer','transfererchannel','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','milliseconds','seconds','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','moment','ioredis','../../../config/logger','ami','../model/channel','busy','invalid','unavailable','ringing','ringinuse','onhold','set','queue','agi','dial','playback','FAILED','NO\x20ANSWER','ANSWERED','defaults','localhost','socket.io-emitter','redis','channels','agents','coreshowchannel','bind','syncNewExten','newchannel','syncNewChannel','varset','syncVarSet','hangup','syncHangup','newcallerid'];(function(_0x3b640b,_0xc19b69){var _0x1a0d9e=function(_0x3aecea){while(--_0x3aecea){_0x3b640b['push'](_0x3b640b['shift']());}};_0x1a0d9e(++_0xc19b69);}(_0x9a02,0x1a4));var _0x29a0=function(_0x184617,_0x52deaf){_0x184617=_0x184617-0x0;var _0xc7395f=_0x9a02[_0x184617];return _0xc7395f;};'use strict';var BPromise=require(_0x29a0('0x0'));var _=require('lodash');var moment=require(_0x29a0('0x1'));var util=require('util');var path=require('path');var Redis=require(_0x29a0('0x2'));var config=require('../../../config/environment');var logger=require(_0x29a0('0x3'))(_0x29a0('0x4'));var ami=require('../ami');var Channel=require(_0x29a0('0x5'));var statusDesc=['unknown','not_inuse','inuse',_0x29a0('0x6'),_0x29a0('0x7'),_0x29a0('0x8'),_0x29a0('0x9'),_0x29a0('0xa'),_0x29a0('0xb')];var applications=[_0x29a0('0xc'),_0x29a0('0xd'),_0x29a0('0xe'),_0x29a0('0xf'),_0x29a0('0x10'),'voicemail'];var dispositions=['NO\x20ANSWER',_0x29a0('0x11'),'FAILED',_0x29a0('0x12'),'NO\x20ANSWER','NO\x20ANSWER',_0x29a0('0x13'),'BUSY',_0x29a0('0x11'),_0x29a0('0x11'),'FAILED'];var actions={};config['redis']=_[_0x29a0('0x14')](config['redis'],{'host':_0x29a0('0x15'),'port':0x18eb});var io=require(_0x29a0('0x16'))(new Redis(config[_0x29a0('0x17')]));function VoiceCallReport(_0x147710){this[_0x29a0('0x18')]=_0x147710[_0x29a0('0x18')];this[_0x29a0('0x19')]=_0x147710['agents'];ami['on'](_0x29a0('0x1a'),this['syncNewExten'][_0x29a0('0x1b')](this));ami['on']('newexten',this[_0x29a0('0x1c')]['bind'](this));ami['on'](_0x29a0('0x1d'),this[_0x29a0('0x1e')][_0x29a0('0x1b')](this));ami['on']('newstate',this['syncNewState'][_0x29a0('0x1b')](this));ami['on'](_0x29a0('0x1f'),this[_0x29a0('0x20')][_0x29a0('0x1b')](this));ami['on'](_0x29a0('0x21'),this[_0x29a0('0x22')][_0x29a0('0x1b')](this));ami['on'](_0x29a0('0x23'),this['syncNewCallerId'][_0x29a0('0x1b')](this));ami['on'](_0x29a0('0x24'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0x29a0('0x25'),this[_0x29a0('0x26')][_0x29a0('0x1b')](this));ami['on'](_0x29a0('0x27'),this[_0x29a0('0x28')][_0x29a0('0x1b')](this));ami['on']('musiconholdstop',this[_0x29a0('0x29')]['bind'](this));return BPromise['resolve']()[_0x29a0('0x2a')](ami[_0x29a0('0x2b')]())['catch'](function(_0x435519){console[_0x29a0('0x2c')](_0x435519);});}VoiceCallReport[_0x29a0('0x2d')]['isNotNull']=function(_0x3caa85){return _0x3caa85!==null&&!_['isUndefined'](_0x3caa85);};VoiceCallReport[_0x29a0('0x2d')][_0x29a0('0x2e')]=function(_0x3dbad7,_0x48a70c,_0x5d613){io['to'](_0x3dbad7)[_0x29a0('0x2e')](_0x48a70c,_0x5d613);};VoiceCallReport['prototype'][_0x29a0('0x2f')]=function(_0x4d1b78){try{if(this[_0x29a0('0x30')](_0x4d1b78)){if(_0x4d1b78[_0x29a0('0x31')]===_0x4d1b78[_0x29a0('0x32')]){if(!_[_0x29a0('0x33')](this[_0x29a0('0x18')][_0x4d1b78[_0x29a0('0x31')]])){_['merge'](this[_0x29a0('0x18')][_0x4d1b78[_0x29a0('0x31')]],_[_0x29a0('0x34')](_0x4d1b78,_[_0x29a0('0x35')](this[_0x29a0('0x18')][_0x4d1b78['uniqueid']])));}}}}catch(_0x5c9a3c){logger['error'](_0x29a0('0x36'),util['inspect'](_0x5c9a3c,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x29a0('0x1e')]=function(_0x2e121c){try{if(this[_0x29a0('0x30')](_0x2e121c)){if(_0x2e121c['uniqueid']===_0x2e121c[_0x29a0('0x32')]&&_0x2e121c[_0x29a0('0x37')]!=_0x29a0('0x38')){if(_[_0x29a0('0x33')](this['channels'][_0x2e121c[_0x29a0('0x31')]])){this[_0x29a0('0x18')][_0x2e121c[_0x29a0('0x31')]]=new Channel();this['channels'][_0x2e121c['uniqueid']][_0x29a0('0x39')]=moment()[_0x29a0('0x3a')](_0x29a0('0x3b'));this[_0x29a0('0x18')][_0x2e121c[_0x29a0('0x31')]][_0x29a0('0x3c')]=dispositions[_[_0x29a0('0x3d')](_0x2e121c[_0x29a0('0x3e')])];_[_0x29a0('0x3f')](this['channels'][_0x2e121c[_0x29a0('0x31')]],_[_0x29a0('0x34')](_0x2e121c,_[_0x29a0('0x35')](this['channels'][_0x2e121c[_0x29a0('0x31')]])));if(_0x2e121c[_0x29a0('0x40')]===_0x29a0('0x41')){if(this['agents'][_0x2e121c[_0x29a0('0x37')][_0x29a0('0x42')]('-')[0x0]]){this[_0x29a0('0x19')][_0x2e121c[_0x29a0('0x37')][_0x29a0('0x42')]('-')[0x0]][_0x29a0('0x43')]=_0x2e121c['exten'];this[_0x29a0('0x2e')](util[_0x29a0('0x3a')](_0x29a0('0x44'),this['agents'][_0x2e121c['channel']['split']('-')[0x0]][_0x29a0('0x45')]),_0x29a0('0x46'),{'destaccountcode':this[_0x29a0('0x19')][_0x2e121c['channel'][_0x29a0('0x42')]('-')[0x0]][_0x29a0('0x47')],'destconnectedlinenum':_0x2e121c[_0x29a0('0x48')]});}}}}}}catch(_0x46d23a){logger[_0x29a0('0x49')](_0x29a0('0x4a'),util[_0x29a0('0x4b')](_0x46d23a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x29a0('0x2d')][_0x29a0('0x1c')]=function(_0x2ed672){try{if(this['isNotNull'](_0x2ed672)){if(_0x2ed672['uniqueid']===_0x2ed672[_0x29a0('0x32')]&&_0x2ed672['exten']!='h'&&_0x2ed672[_0x29a0('0x37')]!=_0x29a0('0x38')){_0x2ed672[_0x29a0('0x4c')]=_0x2ed672['application']['toLowerCase']();_0x2ed672[_0x29a0('0x4d')]=(_0x2ed672[_0x29a0('0x4e')]||_0x2ed672[_0x29a0('0x4d')])[_0x29a0('0x4f')]();if(_[_0x29a0('0x33')](this[_0x29a0('0x18')][_0x2ed672['uniqueid']])){this['channels'][_0x2ed672[_0x29a0('0x31')]]=new Channel();this[_0x29a0('0x18')][_0x2ed672[_0x29a0('0x31')]][_0x29a0('0x39')]=_0x2ed672['duration']?moment()[_0x29a0('0x50')](moment[_0x29a0('0x51')](_0x2ed672[_0x29a0('0x51')])['seconds'](),'seconds')[_0x29a0('0x3a')](_0x29a0('0x3b')):moment()['format'](_0x29a0('0x3b'));this[_0x29a0('0x18')][_0x2ed672[_0x29a0('0x31')]][_0x29a0('0x3c')]=_0x29a0('0x12');}_[_0x29a0('0x3f')](this[_0x29a0('0x18')][_0x2ed672['uniqueid']],_[_0x29a0('0x34')](_0x2ed672,_[_0x29a0('0x35')](this['channels'][_0x2ed672[_0x29a0('0x31')]])));if(_[_0x29a0('0x52')](applications,_0x2ed672[_0x29a0('0x4c')])){this['channels'][_0x2ed672[_0x29a0('0x31')]]['lastapplication']=_0x2ed672[_0x29a0('0x4c')];this['channels'][_0x2ed672[_0x29a0('0x31')]][_0x29a0('0x53')]=_0x2ed672[_0x29a0('0x4d')];if(_0x2ed672['application']==='set'&&_[_0x29a0('0x54')](_0x2ed672[_0x29a0('0x4d')],'cdr(')){var _0x3d2ba6=_0x2ed672[_0x29a0('0x4d')][_0x29a0('0x42')]('=');var _0x222a15=_0x3d2ba6[0x0][_0x29a0('0x55')](/cdr\((.*)\)/);if(_0x222a15){this[_0x29a0('0x18')][_0x2ed672['uniqueid']][_0x222a15[0x1]]=_0x3d2ba6[0x1];}}else if(_0x2ed672[_0x29a0('0x4c')]===_0x29a0('0xd')){this[_0x29a0('0x18')][_0x2ed672[_0x29a0('0x31')]][_0x29a0('0xd')]=_0x2ed672[_0x29a0('0x4d')][_0x29a0('0x42')](',')[0x0];}}}}}catch(_0x5b95ab){logger[_0x29a0('0x49')](_0x29a0('0x56'),util['inspect'](_0x5b95ab,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x29a0('0x2d')][_0x29a0('0x57')]=function(_0x153b16){try{if(this[_0x29a0('0x30')](_0x153b16)){if(_0x153b16[_0x29a0('0x31')]!==_0x153b16['linkedid']){if(this[_0x29a0('0x18')][_0x153b16[_0x29a0('0x32')]]){if(_0x153b16[_0x29a0('0x3e')]==='6'){if(!this[_0x29a0('0x18')][_0x153b16[_0x29a0('0x32')]][_0x29a0('0x58')]){var _0x7cc13a=moment();this['channels'][_0x153b16[_0x29a0('0x32')]][_0x29a0('0x58')]=!![];this[_0x29a0('0x18')][_0x153b16[_0x29a0('0x32')]][_0x29a0('0x59')]=_0x7cc13a[_0x29a0('0x3a')](_0x29a0('0x3b'));if(this[_0x29a0('0x18')][_0x153b16[_0x29a0('0x32')]]['starttime']){this['channels'][_0x153b16[_0x29a0('0x32')]][_0x29a0('0x5a')]=_0x7cc13a[_0x29a0('0x5b')](this[_0x29a0('0x18')][_0x153b16[_0x29a0('0x32')]][_0x29a0('0x39')],'seconds');}}this['channels'][_0x153b16['linkedid']][_0x29a0('0x32')]=_0x153b16['uniqueid'];if(_0x153b16[_0x29a0('0x5c')]!==_0x29a0('0x5d')){this[_0x29a0('0x18')][_0x153b16['linkedid']][_0x29a0('0x5e')]=_0x153b16[_0x29a0('0x5c')];}this[_0x29a0('0x18')][_0x153b16['linkedid']]['connectedlinename']=_0x153b16[_0x29a0('0x5f')];this[_0x29a0('0x18')][_0x153b16[_0x29a0('0x32')]][_0x29a0('0x60')]=_0x153b16[_0x29a0('0x37')];this[_0x29a0('0x18')][_0x153b16[_0x29a0('0x32')]]['disposition']=dispositions[_[_0x29a0('0x3d')](_0x153b16[_0x29a0('0x3e')])];if(this[_0x29a0('0x19')][_0x153b16[_0x29a0('0x37')][_0x29a0('0x42')]('-')[0x0]]){this[_0x29a0('0x18')][_0x153b16[_0x29a0('0x32')]][_0x29a0('0x61')]=this[_0x29a0('0x19')][_0x153b16[_0x29a0('0x37')][_0x29a0('0x42')]('-')[0x0]]['id'];this[_0x29a0('0x18')][_0x153b16[_0x29a0('0x32')]][_0x29a0('0x62')]=this[_0x29a0('0x19')][_0x153b16[_0x29a0('0x37')]['split']('-')[0x0]][_0x29a0('0x45')];}}}}else{if(this[_0x29a0('0x18')][_0x153b16['uniqueid']]){if(_0x153b16['channelstate']==='6'){if(this['agents'][_0x153b16['channel'][_0x29a0('0x42')]('-')[0x0]]){this['channels'][_0x153b16[_0x29a0('0x31')]][_0x29a0('0x61')]=this['agents'][_0x153b16[_0x29a0('0x37')][_0x29a0('0x42')]('-')[0x0]]['id'];this['channels'][_0x153b16['uniqueid']][_0x29a0('0x62')]=this['agents'][_0x153b16[_0x29a0('0x37')][_0x29a0('0x42')]('-')[0x0]][_0x29a0('0x45')];}}}}}}catch(_0x44b51f){logger['error']('[syncNewState][VoiceCallReport]',util[_0x29a0('0x4b')](_0x44b51f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMixMonitorFilename']=function(_0x2f70d4,_0x348543){if(this[_0x29a0('0x18')][_0x2f70d4]){this[_0x29a0('0x18')][_0x2f70d4][_0x29a0('0x63')]=!![];if(_[_0x29a0('0x64')](_0x348543,_0x29a0('0x65'))){_0x348543=_0x348543[_0x29a0('0x66')](_0x29a0('0x65'),'.WAV');}this[_0x29a0('0x18')][_0x2f70d4][_0x29a0('0x67')]=_0x348543;var _0x39ec16=_['find'](this[_0x29a0('0x18')][_0x2f70d4][_0x29a0('0x68')],{'filename':_0x348543});if(_[_0x29a0('0x69')](_0x39ec16)){this[_0x29a0('0x18')][_0x2f70d4][_0x29a0('0x68')][_0x29a0('0x6a')]({'filename':_0x348543,'createdAt':moment()['format'](_0x29a0('0x3b')),'mixmonitorid':'','status':_0x29a0('0x6b')});}}};VoiceCallReport[_0x29a0('0x2d')][_0x29a0('0x20')]=function(_0x509430){try{if(this[_0x29a0('0x30')](_0x509430)){if(this[_0x29a0('0x18')][_0x509430[_0x29a0('0x31')]]&&_0x509430[_0x29a0('0x37')]!=_0x29a0('0x38')){if(this[_0x29a0('0x30')](_0x509430[_0x29a0('0x6c')])){if(this['isNotNull'](_0x509430['variable'][_0x29a0('0x6d')])){this['syncMixMonitorFilename'](_0x509430[_0x29a0('0x31')],_0x509430[_0x29a0('0x6e')]);}else if(this[_0x29a0('0x30')](_0x509430[_0x29a0('0x6c')][_0x29a0('0x6f')])){this[_0x29a0('0x18')][_0x509430[_0x29a0('0x31')]]['calleridnum']=_0x509430[_0x29a0('0x6e')];}else if(this[_0x29a0('0x30')](_0x509430['variable'][_0x29a0('0x70')])){this[_0x29a0('0x18')][_0x509430[_0x29a0('0x31')]][_0x29a0('0x71')]=_0x509430['value'];}else if(this[_0x29a0('0x30')](_0x509430[_0x29a0('0x6c')][_0x29a0('0x72')])){this[_0x29a0('0x18')][_0x509430['uniqueid']][_0x29a0('0x73')]=_0x509430[_0x29a0('0x6e')];}else if(this[_0x29a0('0x30')](_0x509430[_0x29a0('0x6c')][_0x29a0('0x74')])){this['channels'][_0x509430[_0x29a0('0x31')]][_0x29a0('0xd')]=_0x509430[_0x29a0('0x6e')][_0x29a0('0x42')](',')[0x0];}else if(this[_0x29a0('0x30')](_0x509430['variable'][_0x29a0('0x75')])){this[_0x29a0('0x18')][_0x509430['uniqueid']][_0x29a0('0x76')]=_0x509430[_0x29a0('0x6e')];}else if(this[_0x29a0('0x30')](_0x509430[_0x29a0('0x6c')]['xmd-destination'])){this[_0x29a0('0x18')][_0x509430[_0x29a0('0x31')]][_0x29a0('0x77')]=_0x509430['value'];}else if(this[_0x29a0('0x30')](_0x509430['variable'][_0x29a0('0x78')])){this[_0x29a0('0x18')][_0x509430[_0x29a0('0x31')]]['calleridpreview']=_0x509430[_0x29a0('0x6e')];}else if(this[_0x29a0('0x30')](_0x509430[_0x29a0('0x6c')][_0x29a0('0x79')])){this[_0x29a0('0x18')][_0x509430[_0x29a0('0x31')]][_0x29a0('0xd')]=_0x509430[_0x29a0('0x6e')];}else if(this[_0x29a0('0x30')](_0x509430[_0x29a0('0x6c')][_0x29a0('0x7a')])){this[_0x29a0('0x18')][_0x509430['uniqueid']][_0x29a0('0x7b')]=_0x509430[_0x29a0('0x6e')];}}}else if(this['isNotNull'](_0x509430[_0x29a0('0x6c')]['mixmonitor_filename'])){if(_0x509430['value']){var _0x3c8361=path['parse'](_0x509430['value'])[_0x29a0('0x45')];this[_0x29a0('0x7c')](_0x3c8361,_0x509430[_0x29a0('0x6e')]);}}else if(this[_0x29a0('0x18')][_0x509430[_0x29a0('0x32')]]){if(this[_0x29a0('0x30')](_0x509430[_0x29a0('0x6c')])){if(this[_0x29a0('0x30')](_0x509430[_0x29a0('0x6c')][_0x29a0('0x7a')])){this[_0x29a0('0x18')][_0x509430[_0x29a0('0x32')]][_0x29a0('0x7d')]=_0x509430[_0x29a0('0x6e')];}}}}}catch(_0x30c9fb){logger['error'](_0x29a0('0x7e'),util[_0x29a0('0x4b')](_0x30c9fb,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x29a0('0x2d')][_0x29a0('0x22')]=function(_0x3e67cd){try{if(this[_0x29a0('0x30')](_0x3e67cd)){if(this[_0x29a0('0x18')][_0x3e67cd[_0x29a0('0x31')]]){var _0x1d436e=moment();this['channels'][_0x3e67cd[_0x29a0('0x31')]][_0x29a0('0x7f')]=_0x1d436e[_0x29a0('0x3a')](_0x29a0('0x3b'));this[_0x29a0('0x18')][_0x3e67cd[_0x29a0('0x31')]]['duration']=_0x1d436e['diff'](this[_0x29a0('0x18')][_0x3e67cd['uniqueid']][_0x29a0('0x39')],'seconds');if(this[_0x29a0('0x18')][_0x3e67cd['uniqueid']][_0x29a0('0x58')]){this[_0x29a0('0x18')][_0x3e67cd[_0x29a0('0x31')]][_0x29a0('0x80')]=_0x1d436e['diff'](this[_0x29a0('0x18')][_0x3e67cd['uniqueid']]['answertime'],'seconds');this[_0x29a0('0x18')][_0x3e67cd[_0x29a0('0x31')]][_0x29a0('0x5a')]=this[_0x29a0('0x18')][_0x3e67cd[_0x29a0('0x31')]][_0x29a0('0x51')]-this[_0x29a0('0x18')][_0x3e67cd[_0x29a0('0x31')]]['billableseconds'];}if(_0x3e67cd['context']===_0x29a0('0x41')){if(this[_0x29a0('0x19')][_0x3e67cd[_0x29a0('0x37')][_0x29a0('0x42')]('-')[0x0]]){this[_0x29a0('0x19')][_0x3e67cd[_0x29a0('0x37')][_0x29a0('0x42')]('-')[0x0]]=_['omit'](this[_0x29a0('0x19')][_0x3e67cd[_0x29a0('0x37')][_0x29a0('0x42')]('-')[0x0]],[_0x29a0('0x43')]);this[_0x29a0('0x2e')](util[_0x29a0('0x3a')](_0x29a0('0x44'),this[_0x29a0('0x19')][_0x3e67cd[_0x29a0('0x37')]['split']('-')[0x0]][_0x29a0('0x45')]),_0x29a0('0x81'),{'destaccountcode':this[_0x29a0('0x19')][_0x3e67cd[_0x29a0('0x37')]['split']('-')[0x0]][_0x29a0('0x47')]});}}ami['emit'](_0x29a0('0x82'),this[_0x29a0('0x18')][_0x3e67cd['uniqueid']]);delete this[_0x29a0('0x18')][_0x3e67cd[_0x29a0('0x31')]];}}}catch(_0x28212c){logger[_0x29a0('0x49')](_0x29a0('0x83'),util[_0x29a0('0x4b')](_0x28212c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x29a0('0x2d')][_0x29a0('0x84')]=function(_0x3eeae9){try{if(this[_0x29a0('0x30')](_0x3eeae9)){if(this[_0x29a0('0x18')][_0x3eeae9['transfereeuniqueid']]){this[_0x29a0('0x18')][_0x3eeae9[_0x29a0('0x85')]][_0x29a0('0x86')]=_0x3eeae9[_0x29a0('0x87')];this[_0x29a0('0x18')][_0x3eeae9[_0x29a0('0x85')]]['transferconnectedlinenum']=_0x3eeae9[_0x29a0('0x88')];if(this[_0x29a0('0x18')][_0x3eeae9[_0x29a0('0x89')]]){var _0x192316=this['channels'][_0x3eeae9[_0x29a0('0x89')]];this[_0x29a0('0x18')][_0x3eeae9[_0x29a0('0x89')]]=this[_0x29a0('0x18')][_0x3eeae9['transfereeuniqueid']];this[_0x29a0('0x18')][_0x3eeae9['transfereeuniqueid']]=_0x192316;}}else if(this[_0x29a0('0x18')][_0x3eeae9[_0x29a0('0x8a')]]){this[_0x29a0('0x18')][_0x3eeae9['transfertargetuniqueid']]['transfercalleridnum']=_0x3eeae9[_0x29a0('0x87')];this[_0x29a0('0x18')][_0x3eeae9[_0x29a0('0x8a')]][_0x29a0('0x8b')]=_0x3eeae9['transfertargetcalleridnum'];if(this[_0x29a0('0x18')][_0x3eeae9[_0x29a0('0x8c')]]){var _0x192316=this[_0x29a0('0x18')][_0x3eeae9['origtransfereruniqueid']];this[_0x29a0('0x18')][_0x3eeae9[_0x29a0('0x8c')]]=this['channels'][_0x3eeae9[_0x29a0('0x8a')]];this[_0x29a0('0x18')][_0x3eeae9[_0x29a0('0x8a')]]=_0x192316;}}}}catch(_0x11eecf){logger[_0x29a0('0x49')](_0x29a0('0x8d'),util['inspect'](_0x11eecf,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x29a0('0x2d')][_0x29a0('0x26')]=function(_0x8ef516){try{if(this[_0x29a0('0x30')](_0x8ef516)){if(this[_0x29a0('0x18')][_0x8ef516[_0x29a0('0x85')]]){this[_0x29a0('0x18')][_0x8ef516[_0x29a0('0x85')]][_0x29a0('0x86')]=_0x8ef516[_0x29a0('0x8e')];this[_0x29a0('0x18')][_0x8ef516[_0x29a0('0x85')]]['transferconnectedlinenum']=_0x8ef516[_0x29a0('0x8f')];this['syncHangup']({'event':_0x29a0('0x90'),'uniqueid':_0x8ef516[_0x29a0('0x85')],'context':_0x8ef516[_0x29a0('0x40')],'channel':_0x8ef516[_0x29a0('0x91')]});}}}catch(_0x25ed75){logger[_0x29a0('0x49')]('[syncBlindTransfer][VoiceCallReport]',util[_0x29a0('0x4b')](_0x25ed75,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x29a0('0x2d')][_0x29a0('0x28')]=function(_0x113208){try{if(this[_0x29a0('0x30')](_0x113208)){if(this['channels'][_0x113208[_0x29a0('0x31')]]){if(!_[_0x29a0('0x69')](this[_0x29a0('0x18')][_0x113208['uniqueid']][_0x29a0('0x59')])){this[_0x29a0('0x18')][_0x113208['uniqueid']][_0x29a0('0x92')]=moment()[_0x29a0('0x3a')](_0x29a0('0x3b'));}}}}catch(_0x3593b9){logger['error'](_0x29a0('0x93'),util[_0x29a0('0x4b')](_0x3593b9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x29a0('0x2d')][_0x29a0('0x29')]=function(_0x231c21){try{if(this[_0x29a0('0x30')](_0x231c21)){if(this['channels'][_0x231c21[_0x29a0('0x31')]]){if(!_[_0x29a0('0x69')](this[_0x29a0('0x18')][_0x231c21[_0x29a0('0x31')]][_0x29a0('0x92')])){this[_0x29a0('0x18')][_0x231c21[_0x29a0('0x31')]]['mohtime']+=moment()[_0x29a0('0x94')](0x0)[_0x29a0('0x5b')](this[_0x29a0('0x18')][_0x231c21[_0x29a0('0x31')]][_0x29a0('0x92')],_0x29a0('0x95'));delete this[_0x29a0('0x18')][_0x231c21[_0x29a0('0x31')]][_0x29a0('0x92')];}}}}catch(_0x53a105){logger[_0x29a0('0x49')](_0x29a0('0x96'),util[_0x29a0('0x4b')](_0x53a105,{'showHidden':![],'depth':null}));}};module[_0x29a0('0x97')]=VoiceCallReport;
\ No newline at end of file
+var _0x1453=['transfertargetcalleridnum','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','util','path','../../../config/logger','ami','../ami','../model/channel','unknown','inuse','invalid','ringing','ringinuse','onhold','set','agi','dial','playback','FAILED','NO\x20ANSWER','ANSWERED','redis','localhost','socket.io-emitter','channels','blindTransfers','coreshowchannel','syncNewExten','newexten','syncNewChannel','syncNewState','bind','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','error','[voiceCallReport][coreshowchannels]','prototype','isNotNull','isUndefined','emit','info','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','pick','debug','[%s][voiceCallReport][newchannel]\x20event:','inspect','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','merge','from-sip','agents','split','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','name','[%s][voiceCallReport][newexten]\x20event:','linkedid','application','toLowerCase','applicationdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','keys','lastapplication','startsWith','cdr(','match','queue','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','[%s][voiceCallReport][newstate]\x20event:','channelstate','answered','answertime','starttime','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','membername','UserId','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','monitorFilename','find','monitors','isNil','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','xmd-originatecalleridnum','[%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','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','sipcallid','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','cause-txt','endtime','diff','billableseconds','holdtime','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:%s','user:agentcomplete','event','BlindTransfer','type','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','origtransferercalleridnum'];(function(_0x310d96,_0x3bd3f3){var _0x2149de=function(_0x20b32d){while(--_0x20b32d){_0x310d96['push'](_0x310d96['shift']());}};_0x2149de(++_0x3bd3f3);}(_0x1453,0xd3));var _0x3145=function(_0x860966,_0x4c00b){_0x860966=_0x860966-0x0;var _0x33770f=_0x1453[_0x860966];return _0x33770f;};'use strict';var BPromise=require(_0x3145('0x0'));var _=require(_0x3145('0x1'));var moment=require('moment');var util=require(_0x3145('0x2'));var path=require(_0x3145('0x3'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x3145('0x4'))(_0x3145('0x5'));var ami=require(_0x3145('0x6'));var Channel=require(_0x3145('0x7'));var statusDesc=[_0x3145('0x8'),'not_inuse',_0x3145('0x9'),'busy',_0x3145('0xa'),'unavailable',_0x3145('0xb'),_0x3145('0xc'),_0x3145('0xd')];var applications=[_0x3145('0xe'),'queue',_0x3145('0xf'),_0x3145('0x10'),_0x3145('0x11'),'voicemail'];var dispositions=['NO\x20ANSWER',_0x3145('0x12'),_0x3145('0x12'),'NO\x20ANSWER',_0x3145('0x13'),_0x3145('0x13'),_0x3145('0x14'),'BUSY',_0x3145('0x12'),_0x3145('0x12'),_0x3145('0x12')];var actions={};config[_0x3145('0x15')]=_['defaults'](config[_0x3145('0x15')],{'host':_0x3145('0x16'),'port':0x18eb});var io=require(_0x3145('0x17'))(new Redis(config[_0x3145('0x15')]));function VoiceCallReport(_0x42fbc7){this[_0x3145('0x18')]=_0x42fbc7[_0x3145('0x18')];this['agents']=_0x42fbc7['agents'];this[_0x3145('0x19')]={};ami['on'](_0x3145('0x1a'),this[_0x3145('0x1b')]['bind'](this));ami['on'](_0x3145('0x1c'),this[_0x3145('0x1b')]['bind'](this));ami['on']('newchannel',this[_0x3145('0x1d')]['bind'](this));ami['on']('newstate',this[_0x3145('0x1e')][_0x3145('0x1f')](this));ami['on']('varset',this[_0x3145('0x20')][_0x3145('0x1f')](this));ami['on'](_0x3145('0x21'),this[_0x3145('0x22')][_0x3145('0x1f')](this));ami['on'](_0x3145('0x23'),this[_0x3145('0x24')][_0x3145('0x1f')](this));ami['on']('attendedtransfer',this[_0x3145('0x25')][_0x3145('0x1f')](this));ami['on'](_0x3145('0x26'),this[_0x3145('0x27')][_0x3145('0x1f')](this));ami['on']('musiconholdstart',this[_0x3145('0x28')]['bind'](this));ami['on'](_0x3145('0x29'),this[_0x3145('0x2a')][_0x3145('0x1f')](this));try{logger['info'](_0x3145('0x2b'));ami['actionCoreShowChannels']();}catch(_0x2fbb9b){logger[_0x3145('0x2c')](_0x3145('0x2d'),util['inspect'](_0x2fbb9b,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x3145('0x2e')][_0x3145('0x2f')]=function(_0x4d9bea){return _0x4d9bea!==null&&!_[_0x3145('0x30')](_0x4d9bea);};VoiceCallReport[_0x3145('0x2e')][_0x3145('0x31')]=function(_0x1bb393,_0x3ddd32,_0x57ee1f){io['to'](_0x1bb393)[_0x3145('0x31')](_0x3ddd32,_0x57ee1f);};VoiceCallReport[_0x3145('0x2e')][_0x3145('0x24')]=function(_0x413012){try{if(this['isNotNull'](_0x413012)){logger[_0x3145('0x32')](_0x3145('0x33'),_0x413012[_0x3145('0x34')],_0x413012['calleridname'],_0x413012[_0x3145('0x35')]);logger['debug'](_0x3145('0x36'),_0x413012[_0x3145('0x34')],util['inspect'](_0x413012,{'showHidden':![],'depth':null}));if(_0x413012['uniqueid']===_0x413012['linkedid']){if(!_['isUndefined'](this['channels'][_0x413012[_0x3145('0x34')]])){_['merge'](this[_0x3145('0x18')][_0x413012['uniqueid']],_[_0x3145('0x37')](_0x413012,_['keys'](this['channels'][_0x413012['uniqueid']])));}}}}catch(_0x450913){logger[_0x3145('0x2c')]('[%s][voiceCallReport][newcallerid]',_0x413012['uniqueid'],util['inspect'](_0x450913,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x3145('0x1d')]=function(_0x37afe3){try{if(this['isNotNull'](_0x37afe3)){logger[_0x3145('0x38')](_0x3145('0x39'),_0x37afe3[_0x3145('0x34')],util[_0x3145('0x3a')](_0x37afe3,{'showHidden':![],'depth':null}));if(_0x37afe3[_0x3145('0x34')]===_0x37afe3['linkedid']&&_0x37afe3[_0x3145('0x3b')]!=_0x3145('0x3c')){if(_[_0x3145('0x30')](this[_0x3145('0x18')][_0x37afe3[_0x3145('0x34')]])){logger[_0x3145('0x32')](_0x3145('0x3d'),_0x37afe3[_0x3145('0x34')],_0x37afe3[_0x3145('0x3e')],_0x37afe3[_0x3145('0x3f')]);this[_0x3145('0x18')][_0x37afe3[_0x3145('0x34')]]=new Channel();this[_0x3145('0x18')][_0x37afe3['uniqueid']]['starttime']=moment()[_0x3145('0x40')](_0x3145('0x41'));this['channels'][_0x37afe3['uniqueid']][_0x3145('0x42')]=dispositions[_[_0x3145('0x43')](_0x37afe3['channelstate'])];_[_0x3145('0x44')](this['channels'][_0x37afe3[_0x3145('0x34')]],_[_0x3145('0x37')](_0x37afe3,_['keys'](this[_0x3145('0x18')][_0x37afe3[_0x3145('0x34')]])));if(_0x37afe3[_0x3145('0x3e')]===_0x3145('0x45')){if(this[_0x3145('0x46')][_0x37afe3['channel'][_0x3145('0x47')]('-')[0x0]]){this['agents'][_0x37afe3[_0x3145('0x3b')][_0x3145('0x47')]('-')[0x0]][_0x3145('0x48')]=_0x37afe3[_0x3145('0x3f')];logger[_0x3145('0x38')](_0x3145('0x49'),_0x37afe3[_0x3145('0x34')],util[_0x3145('0x3a')]({'destaccountcode':this['agents'][_0x37afe3['channel'][_0x3145('0x47')]('-')[0x0]][_0x3145('0x4a')],'destconnectedlinenum':_0x37afe3['exten']},{'showHidden':![],'depth':null}));this[_0x3145('0x31')](util['format']('user:%s',this[_0x3145('0x46')][_0x37afe3[_0x3145('0x3b')][_0x3145('0x47')]('-')[0x0]][_0x3145('0x4b')]),'user:agentconnect',{'destaccountcode':this[_0x3145('0x46')][_0x37afe3[_0x3145('0x3b')][_0x3145('0x47')]('-')[0x0]][_0x3145('0x4a')],'destconnectedlinenum':_0x37afe3[_0x3145('0x3f')]});}}}}}}catch(_0x55cb82){logger[_0x3145('0x2c')]('[%s][voiceCallReport][newchannel]',_0x37afe3[_0x3145('0x34')],util[_0x3145('0x3a')](_0x55cb82,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3145('0x2e')][_0x3145('0x1b')]=function(_0x4e95f1){try{if(this['isNotNull'](_0x4e95f1)){logger['debug'](_0x3145('0x4c'),_0x4e95f1[_0x3145('0x34')],util[_0x3145('0x3a')](_0x4e95f1,{'showHidden':![],'depth':null}));if(_0x4e95f1[_0x3145('0x34')]===_0x4e95f1[_0x3145('0x4d')]&&_0x4e95f1['exten']!='h'&&_0x4e95f1[_0x3145('0x3b')]!='OutgoingSpoolFailed'){_0x4e95f1[_0x3145('0x4e')]=_0x4e95f1[_0x3145('0x4e')][_0x3145('0x4f')]();_0x4e95f1[_0x3145('0x50')]=(_0x4e95f1['appdata']||_0x4e95f1[_0x3145('0x50')])[_0x3145('0x4f')]();logger[_0x3145('0x32')](_0x3145('0x51'),_0x4e95f1['uniqueid'],_0x4e95f1[_0x3145('0x4e')],_0x4e95f1[_0x3145('0x50')]);if(_[_0x3145('0x30')](this[_0x3145('0x18')][_0x4e95f1['uniqueid']])){this[_0x3145('0x18')][_0x4e95f1['uniqueid']]=new Channel();this['channels'][_0x4e95f1[_0x3145('0x34')]]['starttime']=_0x4e95f1[_0x3145('0x52')]?moment()['subtract'](moment[_0x3145('0x52')](_0x4e95f1[_0x3145('0x52')])[_0x3145('0x53')](),_0x3145('0x53'))[_0x3145('0x40')](_0x3145('0x41')):moment()[_0x3145('0x40')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x4e95f1[_0x3145('0x34')]]['disposition']=_0x3145('0x13');}_[_0x3145('0x44')](this[_0x3145('0x18')][_0x4e95f1['uniqueid']],_[_0x3145('0x37')](_0x4e95f1,_[_0x3145('0x54')](this[_0x3145('0x18')][_0x4e95f1[_0x3145('0x34')]])));if(_['includes'](applications,_0x4e95f1[_0x3145('0x4e')])){this[_0x3145('0x18')][_0x4e95f1[_0x3145('0x34')]][_0x3145('0x55')]=_0x4e95f1[_0x3145('0x4e')];this[_0x3145('0x18')][_0x4e95f1[_0x3145('0x34')]]['lastdata']=_0x4e95f1[_0x3145('0x50')];if(_0x4e95f1[_0x3145('0x4e')]===_0x3145('0xe')&&_[_0x3145('0x56')](_0x4e95f1[_0x3145('0x50')],_0x3145('0x57'))){var _0x20f2b1=_0x4e95f1[_0x3145('0x50')][_0x3145('0x47')]('=');var _0x2a753b=_0x20f2b1[0x0][_0x3145('0x58')](/cdr\((.*)\)/);if(_0x2a753b){this[_0x3145('0x18')][_0x4e95f1[_0x3145('0x34')]][_0x2a753b[0x1]]=_0x20f2b1[0x1];}}else if(_0x4e95f1['application']==='queue'){this[_0x3145('0x18')][_0x4e95f1[_0x3145('0x34')]][_0x3145('0x59')]=_0x4e95f1[_0x3145('0x50')]['split'](',')[0x0];}}}}}catch(_0x538a60){logger['error'](_0x3145('0x5a'),_0x4e95f1[_0x3145('0x34')],util[_0x3145('0x3a')](_0x538a60,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3145('0x2e')]['syncNewState']=function(_0x583dd7){try{if(this[_0x3145('0x2f')](_0x583dd7)){logger[_0x3145('0x32')](_0x3145('0x5b'),_0x583dd7[_0x3145('0x34')],_0x583dd7['linkedid'],_0x583dd7[_0x3145('0x5c')],_0x583dd7[_0x3145('0x35')]);logger['debug'](_0x3145('0x5d'),_0x583dd7[_0x3145('0x34')],util[_0x3145('0x3a')](_0x583dd7,{'showHidden':![],'depth':null}));if(_0x583dd7[_0x3145('0x34')]!==_0x583dd7['linkedid']){if(this[_0x3145('0x18')][_0x583dd7[_0x3145('0x4d')]]){if(_0x583dd7[_0x3145('0x5e')]==='6'){if(!this[_0x3145('0x18')][_0x583dd7[_0x3145('0x4d')]][_0x3145('0x5f')]){var _0x5c444e=moment();this[_0x3145('0x18')][_0x583dd7[_0x3145('0x4d')]]['answered']=!![];this['channels'][_0x583dd7['linkedid']][_0x3145('0x60')]=_0x5c444e[_0x3145('0x40')](_0x3145('0x41'));if(this[_0x3145('0x18')][_0x583dd7[_0x3145('0x4d')]][_0x3145('0x61')]){this[_0x3145('0x18')][_0x583dd7[_0x3145('0x4d')]]['holdtime']=_0x5c444e['diff'](this[_0x3145('0x18')][_0x583dd7['linkedid']][_0x3145('0x61')],_0x3145('0x53'));}}this[_0x3145('0x18')][_0x583dd7['linkedid']]['linkedid']=_0x583dd7[_0x3145('0x34')];if(_0x583dd7[_0x3145('0x35')]!==_0x3145('0x62')){this[_0x3145('0x18')][_0x583dd7[_0x3145('0x4d')]][_0x3145('0x63')]=_0x583dd7['calleridnum'];}this[_0x3145('0x18')][_0x583dd7['linkedid']][_0x3145('0x64')]=_0x583dd7[_0x3145('0x5c')];this[_0x3145('0x18')][_0x583dd7['linkedid']][_0x3145('0x65')]=_0x583dd7[_0x3145('0x3b')];this[_0x3145('0x18')][_0x583dd7[_0x3145('0x4d')]][_0x3145('0x42')]=dispositions[_[_0x3145('0x43')](_0x583dd7['channelstate'])];if(this[_0x3145('0x46')][_0x583dd7['channel'][_0x3145('0x47')]('-')[0x0]]){this[_0x3145('0x18')][_0x583dd7['linkedid']]['UserId']=this[_0x3145('0x46')][_0x583dd7[_0x3145('0x3b')][_0x3145('0x47')]('-')[0x0]]['id'];this[_0x3145('0x18')][_0x583dd7[_0x3145('0x4d')]][_0x3145('0x66')]=this[_0x3145('0x46')][_0x583dd7['channel'][_0x3145('0x47')]('-')[0x0]][_0x3145('0x4b')];}}}}else{if(this[_0x3145('0x18')][_0x583dd7[_0x3145('0x34')]]){if(_0x583dd7['channelstate']==='6'){if(this['agents'][_0x583dd7[_0x3145('0x3b')][_0x3145('0x47')]('-')[0x0]]){this[_0x3145('0x18')][_0x583dd7['uniqueid']][_0x3145('0x67')]=this[_0x3145('0x46')][_0x583dd7[_0x3145('0x3b')][_0x3145('0x47')]('-')[0x0]]['id'];this[_0x3145('0x18')][_0x583dd7['uniqueid']][_0x3145('0x66')]=this[_0x3145('0x46')][_0x583dd7[_0x3145('0x3b')][_0x3145('0x47')]('-')[0x0]][_0x3145('0x4b')];}}}}}}catch(_0x265714){logger[_0x3145('0x2c')](_0x3145('0x68'),_0x583dd7[_0x3145('0x34')],util[_0x3145('0x3a')](_0x265714,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x3145('0x69')]=function(_0x2c9e7d,_0x2e4136){try{if(this[_0x3145('0x18')][_0x2c9e7d]){logger[_0x3145('0x32')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x2c9e7d,_0x2e4136);this[_0x3145('0x18')][_0x2c9e7d][_0x3145('0x6a')]=!![];if(_[_0x3145('0x6b')](_0x2e4136,_0x3145('0x6c'))){_0x2e4136=_0x2e4136[_0x3145('0x6d')](_0x3145('0x6c'),'.WAV');}this['channels'][_0x2c9e7d][_0x3145('0x6e')]=_0x2e4136;var _0x54ddc1=_[_0x3145('0x6f')](this[_0x3145('0x18')][_0x2c9e7d][_0x3145('0x70')],{'filename':_0x2e4136});if(_[_0x3145('0x71')](_0x54ddc1)){this[_0x3145('0x18')][_0x2c9e7d][_0x3145('0x70')][_0x3145('0x72')]({'filename':_0x2e4136,'createdAt':moment()['format'](_0x3145('0x41')),'mixmonitorid':'','status':_0x3145('0x73')});}}}catch(_0x3bdd37){logger[_0x3145('0x2c')](_0x3145('0x74'),_0x2c9e7d,util[_0x3145('0x3a')](_0x3bdd37,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3145('0x2e')]['syncVarSet']=function(_0x29d0cf){try{if(this[_0x3145('0x2f')](_0x29d0cf)){logger[_0x3145('0x38')](_0x3145('0x75'),_0x29d0cf['uniqueid'],util[_0x3145('0x3a')](_0x29d0cf,{'showHidden':![],'depth':null}));if(this[_0x3145('0x18')][_0x29d0cf[_0x3145('0x34')]]&&_0x29d0cf[_0x3145('0x3b')]!=_0x3145('0x3c')){if(this[_0x3145('0x2f')](_0x29d0cf['variable'])){if(this[_0x3145('0x2f')](_0x29d0cf[_0x3145('0x76')][_0x3145('0x77')])){logger[_0x3145('0x32')](_0x3145('0x78'),_0x29d0cf['uniqueid'],_0x29d0cf[_0x3145('0x79')]);this[_0x3145('0x69')](_0x29d0cf['uniqueid'],_0x29d0cf[_0x3145('0x79')]);}else if(this[_0x3145('0x2f')](_0x29d0cf['variable'][_0x3145('0x7a')])){logger[_0x3145('0x32')](_0x3145('0x7b'),_0x29d0cf[_0x3145('0x34')],_0x29d0cf[_0x3145('0x79')]);this['channels'][_0x29d0cf[_0x3145('0x34')]][_0x3145('0x35')]=_0x29d0cf[_0x3145('0x79')];}else if(this[_0x3145('0x2f')](_0x29d0cf[_0x3145('0x76')][_0x3145('0x7c')])){logger[_0x3145('0x32')](_0x3145('0x7d'),_0x29d0cf['uniqueid'],_0x29d0cf['value']);this[_0x3145('0x18')][_0x29d0cf['uniqueid']][_0x3145('0x7e')]=_0x29d0cf['value'];}else if(this[_0x3145('0x2f')](_0x29d0cf[_0x3145('0x76')][_0x3145('0x7f')])){logger[_0x3145('0x32')](_0x3145('0x80'),_0x29d0cf[_0x3145('0x34')],_0x29d0cf[_0x3145('0x79')]);this[_0x3145('0x18')][_0x29d0cf['uniqueid']]['type']=_0x29d0cf[_0x3145('0x79')];}else if(this[_0x3145('0x2f')](_0x29d0cf['variable'][_0x3145('0x81')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x29d0cf['uniqueid'],_0x29d0cf[_0x3145('0x79')]['split'](',')[0x0]);this[_0x3145('0x18')][_0x29d0cf[_0x3145('0x34')]][_0x3145('0x59')]=_0x29d0cf[_0x3145('0x79')][_0x3145('0x47')](',')[0x0];}else if(this[_0x3145('0x2f')](_0x29d0cf[_0x3145('0x76')][_0x3145('0x82')])){logger[_0x3145('0x32')](_0x3145('0x83'),_0x29d0cf[_0x3145('0x34')],_0x29d0cf[_0x3145('0x79')]);this['channels'][_0x29d0cf[_0x3145('0x34')]][_0x3145('0x84')]=_0x29d0cf[_0x3145('0x79')];}else if(this['isNotNull'](_0x29d0cf[_0x3145('0x76')][_0x3145('0x85')])){logger['info'](_0x3145('0x86'),_0x29d0cf[_0x3145('0x34')],_0x29d0cf['value']);this[_0x3145('0x18')][_0x29d0cf['uniqueid']]['destination']=_0x29d0cf['value'];}else if(this[_0x3145('0x2f')](_0x29d0cf[_0x3145('0x76')][_0x3145('0x87')])){logger[_0x3145('0x32')](_0x3145('0x88'),_0x29d0cf[_0x3145('0x34')],_0x29d0cf[_0x3145('0x79')]);this[_0x3145('0x18')][_0x29d0cf['uniqueid']][_0x3145('0x89')]=_0x29d0cf[_0x3145('0x79')];}else if(this['isNotNull'](_0x29d0cf['variable'][_0x3145('0x8a')])){logger[_0x3145('0x32')](_0x3145('0x8b'),_0x29d0cf[_0x3145('0x34')],_0x29d0cf['value']);this['channels'][_0x29d0cf[_0x3145('0x34')]]['queue']=_0x29d0cf['value'];}else if(this[_0x3145('0x2f')](_0x29d0cf[_0x3145('0x76')]['sipcallid'])){logger[_0x3145('0x32')](_0x3145('0x8c'),_0x29d0cf['uniqueid'],_0x29d0cf[_0x3145('0x79')]);this[_0x3145('0x18')][_0x29d0cf[_0x3145('0x34')]][_0x3145('0x8d')]=_0x29d0cf[_0x3145('0x79')];}}}else if(this[_0x3145('0x2f')](_0x29d0cf[_0x3145('0x76')]['mixmonitor_filename'])){if(_0x29d0cf['value']){var _0x4295ba=path['parse'](_0x29d0cf[_0x3145('0x79')])[_0x3145('0x4b')];logger['info'](_0x3145('0x78'),_0x4295ba,_0x29d0cf[_0x3145('0x79')]);this[_0x3145('0x69')](_0x4295ba,_0x29d0cf['value']);}}else if(this[_0x3145('0x18')][_0x29d0cf[_0x3145('0x4d')]]){if(this[_0x3145('0x2f')](_0x29d0cf[_0x3145('0x76')])){if(this[_0x3145('0x2f')](_0x29d0cf[_0x3145('0x76')][_0x3145('0x8e')])){logger[_0x3145('0x32')](_0x3145('0x8c'),_0x29d0cf['linkedid'],_0x29d0cf['value']);this['channels'][_0x29d0cf[_0x3145('0x4d')]][_0x3145('0x8f')]=_0x29d0cf[_0x3145('0x79')];}}}}}catch(_0x3d3972){logger[_0x3145('0x2c')](_0x3145('0x90'),_0x29d0cf[_0x3145('0x34')],util[_0x3145('0x3a')](_0x3d3972,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3145('0x2e')][_0x3145('0x22')]=function(_0x20d126){try{if(this[_0x3145('0x2f')](_0x20d126)){logger[_0x3145('0x38')](_0x3145('0x91'),_0x20d126[_0x3145('0x34')],util[_0x3145('0x3a')](_0x20d126,{'showHidden':![],'depth':null}));if(this[_0x3145('0x18')][_0x20d126['uniqueid']]){logger[_0x3145('0x32')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x20d126[_0x3145('0x34')],_0x20d126[_0x3145('0x92')]);var _0x392cb3=moment();this[_0x3145('0x18')][_0x20d126['uniqueid']][_0x3145('0x93')]=_0x392cb3[_0x3145('0x40')](_0x3145('0x41'));this[_0x3145('0x18')][_0x20d126[_0x3145('0x34')]][_0x3145('0x52')]=_0x392cb3[_0x3145('0x94')](this[_0x3145('0x18')][_0x20d126['uniqueid']]['starttime'],_0x3145('0x53'));if(this[_0x3145('0x18')][_0x20d126[_0x3145('0x34')]][_0x3145('0x5f')]){this[_0x3145('0x18')][_0x20d126[_0x3145('0x34')]][_0x3145('0x95')]=_0x392cb3[_0x3145('0x94')](this[_0x3145('0x18')][_0x20d126[_0x3145('0x34')]][_0x3145('0x60')],_0x3145('0x53'));this[_0x3145('0x18')][_0x20d126[_0x3145('0x34')]][_0x3145('0x96')]=this['channels'][_0x20d126[_0x3145('0x34')]]['duration']-this[_0x3145('0x18')][_0x20d126[_0x3145('0x34')]][_0x3145('0x95')];}if(_0x20d126[_0x3145('0x3e')]===_0x3145('0x45')){if(this[_0x3145('0x46')][_0x20d126[_0x3145('0x3b')][_0x3145('0x47')]('-')[0x0]]){this[_0x3145('0x46')][_0x20d126['channel'][_0x3145('0x47')]('-')[0x0]]=_[_0x3145('0x97')](this[_0x3145('0x46')][_0x20d126[_0x3145('0x3b')]['split']('-')[0x0]],[_0x3145('0x48')]);logger[_0x3145('0x38')](_0x3145('0x98'),_0x20d126['uniqueid'],util['inspect']({'destaccountcode':this[_0x3145('0x46')][_0x20d126[_0x3145('0x3b')][_0x3145('0x47')]('-')[0x0]][_0x3145('0x4a')]},{'showHidden':![],'depth':null}));this[_0x3145('0x31')](util[_0x3145('0x40')](_0x3145('0x99'),this[_0x3145('0x46')][_0x20d126['channel'][_0x3145('0x47')]('-')[0x0]][_0x3145('0x4b')]),_0x3145('0x9a'),{'destaccountcode':this[_0x3145('0x46')][_0x20d126['channel']['split']('-')[0x0]]['accountcode']});}}if(_0x20d126[_0x3145('0x9b')]===_0x3145('0x9c')){this[_0x3145('0x19')][_0x20d126['uniqueid']]=this['channels'][_0x20d126[_0x3145('0x34')]];}else{if(this[_0x3145('0x18')][_0x20d126[_0x3145('0x34')]][_0x3145('0x9d')]===_0x3145('0x9e')&&this['blindTransfers'][_0x20d126[_0x3145('0x34')]]){this[_0x3145('0x18')][_0x20d126[_0x3145('0x34')]][_0x3145('0x34')]=[this[_0x3145('0x18')][_0x20d126['uniqueid']][_0x3145('0x4d')],this[_0x3145('0x18')][_0x20d126['uniqueid']]['linkedid']=this[_0x3145('0x18')][_0x20d126[_0x3145('0x34')]][_0x3145('0x34')]][0x0];delete this[_0x3145('0x19')][_0x20d126[_0x3145('0x34')]];}}logger['debug'](_0x3145('0x9f'),_0x20d126[_0x3145('0x34')],util[_0x3145('0x3a')](this['channels'][_0x20d126[_0x3145('0x34')]],{'showHidden':![],'depth':null}));ami['emit'](_0x3145('0xa0'),this[_0x3145('0x18')][_0x20d126['uniqueid']]);delete this[_0x3145('0x18')][_0x20d126[_0x3145('0x34')]];}}}catch(_0x28d8ad){logger[_0x3145('0x2c')](_0x3145('0xa1'),_0x20d126[_0x3145('0x34')],util[_0x3145('0x3a')](_0x28d8ad,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3145('0x2e')][_0x3145('0x25')]=function(_0x1fc6b9){try{if(this[_0x3145('0x2f')](_0x1fc6b9)){logger[_0x3145('0x32')]('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x1fc6b9[_0x3145('0x34')],_0x1fc6b9[_0x3145('0xa2')],_0x1fc6b9[_0x3145('0xa3')]);logger[_0x3145('0x38')]('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x1fc6b9[_0x3145('0x34')],util[_0x3145('0x3a')](_0x1fc6b9,{'showHidden':![],'depth':null}));if(this['channels'][_0x1fc6b9['transfereeuniqueid']]){this[_0x3145('0x18')][_0x1fc6b9[_0x3145('0xa4')]][_0x3145('0xa5')]=_0x1fc6b9[_0x3145('0xa2')];this['channels'][_0x1fc6b9['transfereeuniqueid']][_0x3145('0xa6')]=_0x1fc6b9[_0x3145('0xa3')];if(this[_0x3145('0x18')][_0x1fc6b9[_0x3145('0xa7')]]){var _0x58b4fd=this[_0x3145('0x18')][_0x1fc6b9[_0x3145('0xa7')]];this[_0x3145('0x18')][_0x1fc6b9['secondtransfereruniqueid']]=this[_0x3145('0x18')][_0x1fc6b9['transfereeuniqueid']];this[_0x3145('0x18')][_0x1fc6b9['transfereeuniqueid']]=_0x58b4fd;}}else if(this[_0x3145('0x18')][_0x1fc6b9[_0x3145('0xa8')]]){this[_0x3145('0x18')][_0x1fc6b9[_0x3145('0xa8')]][_0x3145('0xa5')]=_0x1fc6b9['origtransferercalleridnum'];this[_0x3145('0x18')][_0x1fc6b9['transfertargetuniqueid']]['transferconnectedlinenum']=_0x1fc6b9[_0x3145('0xa3')];if(this[_0x3145('0x18')][_0x1fc6b9['origtransfereruniqueid']]){var _0x58b4fd=this[_0x3145('0x18')][_0x1fc6b9[_0x3145('0xa9')]];this['channels'][_0x1fc6b9['origtransfereruniqueid']]=this[_0x3145('0x18')][_0x1fc6b9['transfertargetuniqueid']];this[_0x3145('0x18')][_0x1fc6b9['transfertargetuniqueid']]=_0x58b4fd;}}}}catch(_0x377f34){logger['error'](_0x3145('0xaa'),_0x1fc6b9['uniqueid'],util[_0x3145('0x3a')](_0x377f34,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3145('0x2e')][_0x3145('0x27')]=function(_0x2cbf29){try{if(this[_0x3145('0x2f')](_0x2cbf29)){logger['info'](_0x3145('0xab'),_0x2cbf29[_0x3145('0x34')],_0x2cbf29[_0x3145('0xac')],_0x2cbf29[_0x3145('0xad')]);logger[_0x3145('0x38')](_0x3145('0xae'),_0x2cbf29[_0x3145('0x34')],util[_0x3145('0x3a')](_0x2cbf29,{'showHidden':![],'depth':null}));if(this[_0x3145('0x18')][_0x2cbf29[_0x3145('0xa4')]]){this['channels'][_0x2cbf29['transfereeuniqueid']][_0x3145('0xa5')]=_0x2cbf29[_0x3145('0xac')];this['channels'][_0x2cbf29[_0x3145('0xa4')]]['transferconnectedlinenum']=_0x2cbf29[_0x3145('0xad')];this[_0x3145('0x22')]({'event':'BlindTransfer','uniqueid':_0x2cbf29[_0x3145('0xa4')],'context':_0x2cbf29[_0x3145('0x3e')],'channel':_0x2cbf29[_0x3145('0xaf')]});}}}catch(_0x1eeb26){logger[_0x3145('0x2c')](_0x3145('0xb0'),_0x2cbf29[_0x3145('0x34')],util['inspect'](_0x1eeb26,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3145('0x2e')]['syncMusicOnHoldStart']=function(_0x568292){try{if(this[_0x3145('0x2f')](_0x568292)){logger[_0x3145('0x38')](_0x3145('0xb1'),_0x568292[_0x3145('0x34')],util[_0x3145('0x3a')](_0x568292,{'showHidden':![],'depth':null}));if(this[_0x3145('0x18')][_0x568292[_0x3145('0x34')]]){if(!_['isNil'](this[_0x3145('0x18')][_0x568292[_0x3145('0x34')]]['answertime'])){this[_0x3145('0x18')][_0x568292[_0x3145('0x34')]][_0x3145('0xb2')]=moment()[_0x3145('0x40')](_0x3145('0x41'));logger['info'](_0x3145('0xb3'),_0x568292[_0x3145('0x34')],this['channels'][_0x568292['uniqueid']][_0x3145('0xb2')]);}}}}catch(_0x372146){logger[_0x3145('0x2c')](_0x3145('0xb4'),_0x568292['uniqueid'],util['inspect'](_0x372146,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStop']=function(_0x3040eb){try{if(this[_0x3145('0x2f')](_0x3040eb)){logger[_0x3145('0x38')](_0x3145('0xb5'),_0x3040eb[_0x3145('0x34')],util[_0x3145('0x3a')](_0x3040eb,{'showHidden':![],'depth':null}));if(this[_0x3145('0x18')][_0x3040eb[_0x3145('0x34')]]){if(!_['isNil'](this[_0x3145('0x18')][_0x3040eb['uniqueid']]['mohstarttime'])){this[_0x3145('0x18')][_0x3040eb['uniqueid']][_0x3145('0xb6')]+=moment()[_0x3145('0xb7')](0x0)[_0x3145('0x94')](this[_0x3145('0x18')][_0x3040eb[_0x3145('0x34')]][_0x3145('0xb2')],_0x3145('0x53'));logger[_0x3145('0x32')](_0x3145('0xb8'),_0x3040eb[_0x3145('0x34')],this[_0x3145('0x18')][_0x3040eb['uniqueid']][_0x3145('0xb6')]);delete this[_0x3145('0x18')][_0x3040eb[_0x3145('0x34')]][_0x3145('0xb2')];}}}}catch(_0x31e2a2){logger[_0x3145('0x2c')](_0x3145('0xb9'),_0x3040eb[_0x3145('0x34')],util['inspect'](_0x31e2a2,{'showHidden':![],'depth':null}));}};module[_0x3145('0xba')]=VoiceCallReport;
\ No newline at end of file