Built motion from commit 6a0adb95.|2.6.31
[motion2.git] / server / services / ami / report / voiceDialReport.js
index 1268916..3fbdbc5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5502=['sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','endtime','starttime','seconds','complete','total','answered','diff','billableseconds','sumHoldTime','sumDuration','duration','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','linkedid','destuniqueid','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','startsWith','cdr(','match','[%s][voiceDialReport][newexten]','deleteChannelAfterTimeout','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','channels','outboundChannels','outbound','variables','dialbegin','bind','dialend','syncDialEnd','varset','syncHangup','isUndefined','prototype','emit','isNotNull','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','format','channel','substring','lastIndexOf','omit','event','info','membername','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','merge','applications','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinenum','connectedlinename','answertime','YYYY-MM-DD\x20HH:mm:ss','lastevent','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','[%s][voiceDialReport][dialend]','syncVarSet','[%s][voiceDialReport][varset]\x20event:','keys','variable','outboundrouteid','value','[%s][voiceDialReport][varset]','addVariable','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged'];(function(_0x3626f4,_0x5b1cb6){var _0x23c7db=function(_0x5e534f){while(--_0x5e534f){_0x3626f4['push'](_0x3626f4['shift']());}};_0x23c7db(++_0x5b1cb6);}(_0x5502,0x10b));var _0x2550=function(_0x2dbfa5,_0x46ff7e){_0x2dbfa5=_0x2dbfa5-0x0;var _0xb8b54e=_0x5502[_0x2dbfa5];return _0xb8b54e;};'use strict';var _=require(_0x2550('0x0'));var moment=require(_0x2550('0x1'));var util=require(_0x2550('0x2'));var Redis=require(_0x2550('0x3'));var config=require(_0x2550('0x4'));var logger=require(_0x2550('0x5'))(_0x2550('0x6'));var ami=require(_0x2550('0x7'));config[_0x2550('0x8')]=_['defaults'](config['redis'],{'host':_0x2550('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2550('0x8')]));function VoiceDialReport(_0x40f108){this[_0x2550('0xa')]=_0x40f108[_0x2550('0xb')];this[_0x2550('0xc')]=_0x40f108[_0x2550('0xc')];this['applications']={};this[_0x2550('0xd')]={};ami['on'](_0x2550('0xe'),this['syncDialBegin'][_0x2550('0xf')](this));ami['on'](_0x2550('0x10'),this[_0x2550('0x11')]['bind'](this));ami['on'](_0x2550('0x12'),this['syncVarSet']['bind'](this));ami['on']('hangup',this[_0x2550('0x13')]['bind'](this));}VoiceDialReport['prototype']['isNotNull']=function(_0x35a293){return _0x35a293!==null&&!_[_0x2550('0x14')](_0x35a293);};VoiceDialReport[_0x2550('0x15')][_0x2550('0x16')]=function(_0x1161af,_0x18cbd6,_0x2849d8){io['to'](_0x1161af)[_0x2550('0x16')](_0x18cbd6,_0x2849d8);};VoiceDialReport[_0x2550('0x15')]['syncDialBegin']=function(_0x4ac256){try{if(this[_0x2550('0x17')](_0x4ac256)){logger[_0x2550('0x18')](_0x2550('0x19'),_0x4ac256[_0x2550('0x1a')],util[_0x2550('0x1b')](_0x4ac256,{'showHidden':![],'depth':null}));if(this[_0x2550('0xa')][_0x4ac256['uniqueid']]){_['merge'](this[_0x2550('0xa')][_0x4ac256['uniqueid']],{'starttime':moment()[_0x2550('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','interface':_0x4ac256[_0x2550('0x1d')][_0x2550('0x1e')](0x0,_0x4ac256[_0x2550('0x1d')]['lastIndexOf']('-')),'membername':_0x4ac256[_0x2550('0x1d')][_0x2550('0x1e')](_0x4ac256['channel'][_0x2550('0x1f')]('/')+0x1,_0x4ac256[_0x2550('0x1d')][_0x2550('0x1f')]('-'))},_[_0x2550('0x20')](_0x4ac256,[_0x2550('0x21'),'privilege']));logger[_0x2550('0x22')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x4ac256[_0x2550('0x1a')],this[_0x2550('0xa')][_0x4ac256[_0x2550('0x1a')]][_0x2550('0x23')],this[_0x2550('0xa')][_0x4ac256[_0x2550('0x1a')]]['interface']);logger[_0x2550('0x18')](_0x2550('0x24'),_0x4ac256[_0x2550('0x1a')],util[_0x2550('0x1b')](this[_0x2550('0xa')][_0x4ac256[_0x2550('0x1a')]],{'showHidden':![],'depth':null}));if(this['applications'][_0x4ac256[_0x2550('0x1a')]])_[_0x2550('0x25')](this[_0x2550('0xa')][_0x4ac256[_0x2550('0x1a')]],this[_0x2550('0x26')][_0x4ac256[_0x2550('0x1a')]]);this['emit'](_0x2550('0x27'),_0x2550('0x28'),this[_0x2550('0xa')][_0x4ac256[_0x2550('0x1a')]]);logger[_0x2550('0x18')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x4ac256[_0x2550('0x1a')],util[_0x2550('0x1b')](this[_0x2550('0xa')][_0x4ac256[_0x2550('0x1a')]],{'showHidden':![],'depth':null}));ami['emit'](_0x2550('0x29'),this[_0x2550('0xa')][_0x4ac256['uniqueid']]);}}}catch(_0xd25ea3){logger[_0x2550('0x2a')](_0x2550('0x2b'),_0x4ac256[_0x2550('0x1a')],util['inspect'](_0xd25ea3,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x2550('0x15')][_0x2550('0x11')]=function(_0x1e649b){try{if(this['isNotNull'](_0x1e649b)){logger[_0x2550('0x18')](_0x2550('0x2c'),_0x1e649b[_0x2550('0x1a')],util[_0x2550('0x1b')](_0x1e649b,{'showHidden':![],'depth':null}));if(this[_0x2550('0xa')][_0x1e649b['uniqueid']]){this[_0x2550('0xa')][_0x1e649b[_0x2550('0x1a')]][_0x2550('0x2d')]=_0x1e649b[_0x2550('0x2d')];if(_0x1e649b[_0x2550('0x2d')]==='ANSWER'){this[_0x2550('0xa')][_0x1e649b[_0x2550('0x1a')]][_0x2550('0x2e')]=_0x1e649b['connectedlinenum'];this[_0x2550('0xa')][_0x1e649b[_0x2550('0x1a')]][_0x2550('0x2f')]=_0x1e649b['connectedlinename'];this[_0x2550('0xa')][_0x1e649b[_0x2550('0x1a')]][_0x2550('0x30')]=moment()[_0x2550('0x1c')](_0x2550('0x31'));this['channels'][_0x1e649b[_0x2550('0x1a')]][_0x2550('0x32')]='connect';logger[_0x2550('0x22')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x1e649b[_0x2550('0x1a')],_0x1e649b[_0x2550('0x1d')][_0x2550('0x1e')](_0x1e649b[_0x2550('0x1d')]['lastIndexOf']('/')+0x1,_0x1e649b[_0x2550('0x1d')][_0x2550('0x1f')]('-')));logger[_0x2550('0x18')](_0x2550('0x33'),_0x1e649b[_0x2550('0x1a')],util[_0x2550('0x1b')](this[_0x2550('0xa')][_0x1e649b[_0x2550('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x2550('0x16')]('custom:dialconnect',this[_0x2550('0xa')][_0x1e649b[_0x2550('0x1a')]]);}logger['debug']('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x1e649b[_0x2550('0x1a')],util[_0x2550('0x1b')](this[_0x2550('0xa')][_0x1e649b['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0x2550('0x27'),_0x2550('0x28'),this[_0x2550('0xa')][_0x1e649b[_0x2550('0x1a')]]);}}}catch(_0x1805bb){logger['error'](_0x2550('0x34'),_0x1e649b['uniqueid'],util[_0x2550('0x1b')](_0x1805bb,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x2550('0x15')][_0x2550('0x35')]=function(_0x17b50c){try{if(this[_0x2550('0x17')](_0x17b50c)){logger[_0x2550('0x18')](_0x2550('0x36'),_0x17b50c[_0x2550('0x1a')],util[_0x2550('0x1b')](_0x17b50c,{'showHidden':![],'depth':null}));this['addVariable'](_0x17b50c[_0x2550('0x1a')],_[_0x2550('0x37')](_0x17b50c['variable'])[0x0],_0x17b50c['value']);if(this['isNotNull'](_0x17b50c[_0x2550('0x38')])&&this['isNotNull'](_0x17b50c[_0x2550('0x38')][_0x2550('0x39')])){if(_[_0x2550('0x14')](this['channels'][_0x17b50c[_0x2550('0x1a')]])){this[_0x2550('0xa')][_0x17b50c['uniqueid']]={'routeId':_0x17b50c[_0x2550('0x3a')],'variables':this[_0x2550('0xd')][_0x17b50c[_0x2550('0x1a')]],'motionChannel':'voice'};logger[_0x2550('0x22')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x17b50c[_0x2550('0x1a')],_0x17b50c['variable'][_0x2550('0x39')],_[_0x2550('0x37')](_0x17b50c[_0x2550('0x38')])[0x0],_0x17b50c['value']);logger[_0x2550('0x18')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x17b50c['uniqueid'],util[_0x2550('0x1b')](this[_0x2550('0xa')][_0x17b50c[_0x2550('0x1a')]],{'showHidden':![],'depth':null}));this[_0x2550('0x16')](_0x2550('0x27'),_0x2550('0x28'),this['channels'][_0x17b50c[_0x2550('0x1a')]]);}}}}catch(_0x3467b8){logger[_0x2550('0x2a')](_0x2550('0x3b'),_0x17b50c[_0x2550('0x1a')],util[_0x2550('0x1b')](_0x3467b8,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x2550('0x15')][_0x2550('0x3c')]=function(_0x3c252a,_0x4ca75d,_0x3f4506){var _0x2e2b25=[_0x2550('0x3d'),'rtpaudioqosbridged',_0x2550('0x3e'),'rtpaudioqosjitterbridged',_0x2550('0x3f'),'rtpaudioqoslossbridged',_0x2550('0x40'),_0x2550('0x41'),_0x2550('0x42'),_0x2550('0x43'),_0x2550('0x44'),_0x2550('0x45'),_0x2550('0x46'),_0x2550('0x47'),_0x2550('0x48'),_0x2550('0x49'),'membername',_0x2550('0x4a'),_0x2550('0x4b')];if(!_[_0x2550('0x4c')](_0x4ca75d)&&!_[_0x2550('0x4d')](_0x2e2b25,_0x4ca75d)){if(_[_0x2550('0x14')](this['variables'][_0x3c252a])){this['variables'][_0x3c252a]={};}this[_0x2550('0xd')][_0x3c252a][_0x4ca75d]=_0x3f4506;}};VoiceDialReport[_0x2550('0x15')][_0x2550('0x13')]=function(_0x42b4d7){try{if(this[_0x2550('0x17')](_0x42b4d7)){logger['debug'](_0x2550('0x4e'),_0x42b4d7[_0x2550('0x1a')],util['inspect'](_0x42b4d7,{'showHidden':![],'depth':null}));if(this[_0x2550('0xa')][_0x42b4d7[_0x2550('0x1a')]]){logger[_0x2550('0x22')](_0x2550('0x4f'),_0x42b4d7[_0x2550('0x1a')],_0x42b4d7['cause-txt']);this[_0x2550('0xa')][_0x42b4d7[_0x2550('0x1a')]][_0x2550('0x50')]=moment()[_0x2550('0x1c')](_0x2550('0x31'));this['channels'][_0x42b4d7[_0x2550('0x1a')]]['duration']=moment(this['channels'][_0x42b4d7[_0x2550('0x1a')]][_0x2550('0x50')])['diff'](this[_0x2550('0xa')][_0x42b4d7[_0x2550('0x1a')]][_0x2550('0x51')],_0x2550('0x52'));this[_0x2550('0xa')][_0x42b4d7[_0x2550('0x1a')]][_0x2550('0x32')]=_0x2550('0x53');this[_0x2550('0xc')][_0x2550('0x54')]+=0x1;if(this['channels'][_0x42b4d7[_0x2550('0x1a')]][_0x2550('0x30')]){this[_0x2550('0xc')][_0x2550('0x55')]+=0x1;this['channels'][_0x42b4d7[_0x2550('0x1a')]]['holdtime']=moment(this[_0x2550('0xa')][_0x42b4d7[_0x2550('0x1a')]][_0x2550('0x30')])[_0x2550('0x56')](this[_0x2550('0xa')][_0x42b4d7[_0x2550('0x1a')]][_0x2550('0x51')],_0x2550('0x52'));this[_0x2550('0xa')][_0x42b4d7[_0x2550('0x1a')]][_0x2550('0x57')]=moment(this[_0x2550('0xa')][_0x42b4d7['uniqueid']][_0x2550('0x50')])[_0x2550('0x56')](this[_0x2550('0xa')][_0x42b4d7['uniqueid']][_0x2550('0x30')],_0x2550('0x52'));this[_0x2550('0xc')][_0x2550('0x58')]+=this[_0x2550('0xa')][_0x42b4d7['uniqueid']]['holdtime']||0x0;this[_0x2550('0xc')]['sumBillable']+=this[_0x2550('0xa')][_0x42b4d7[_0x2550('0x1a')]]['billableseconds'];}this[_0x2550('0xc')][_0x2550('0x59')]+=this[_0x2550('0xa')][_0x42b4d7[_0x2550('0x1a')]][_0x2550('0x5a')];logger[_0x2550('0x18')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x42b4d7[_0x2550('0x1a')],util[_0x2550('0x1b')](this[_0x2550('0xa')][_0x42b4d7['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x2550('0x16')](_0x2550('0x5b'),this[_0x2550('0xa')][_0x42b4d7[_0x2550('0x1a')]]);logger[_0x2550('0x18')](_0x2550('0x5c'),_0x42b4d7[_0x2550('0x1a')],util[_0x2550('0x1b')](this[_0x2550('0xa')][_0x42b4d7[_0x2550('0x1a')]],{'showHidden':![],'depth':null}));ami['emit'](_0x2550('0x5d'),this[_0x2550('0xa')][_0x42b4d7[_0x2550('0x1a')]]);logger[_0x2550('0x18')](_0x2550('0x5e'),_0x42b4d7[_0x2550('0x1a')],util['inspect'](this[_0x2550('0xa')][_0x42b4d7[_0x2550('0x1a')]],{'showHidden':![],'depth':null}));this[_0x2550('0x16')]('voice:outbound','voice_outbound:save',this['outbound']);logger[_0x2550('0x22')](_0x2550('0x5f'),JSON[_0x2550('0x60')](this['channels'][_0x42b4d7[_0x2550('0x1a')]]));logger[_0x2550('0x18')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x42b4d7[_0x2550('0x1a')],util[_0x2550('0x1b')](this[_0x2550('0xa')][_0x42b4d7[_0x2550('0x1a')]],{'showHidden':![],'depth':null}));this['emit'](_0x2550('0x27'),_0x2550('0x61'),this[_0x2550('0xa')][_0x42b4d7[_0x2550('0x1a')]]);this['deleteChannelAfterTimeout'](_0x42b4d7[_0x2550('0x1a')]);}else if(this['channels'][_0x42b4d7[_0x2550('0x62')]]){this[_0x2550('0xa')][_0x42b4d7['linkedid']][_0x2550('0x1a')]=this[_0x2550('0xa')][_0x42b4d7[_0x2550('0x62')]][_0x2550('0x63')];}if(this[_0x2550('0xd')][_0x42b4d7['uniqueid']]){delete this[_0x2550('0xd')][_0x42b4d7['uniqueid']];}}}catch(_0x464027){logger[_0x2550('0x2a')]('[%s][voiceDialReport][hangup]',_0x42b4d7[_0x2550('0x1a')],util['inspect'](_0x464027,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x2550('0x15')][_0x2550('0x64')]=function(_0xfa7e02){try{if(this['isNotNull'](_0xfa7e02)){logger[_0x2550('0x18')](_0x2550('0x65'),_0xfa7e02['uniqueid'],util['inspect'](_0xfa7e02,{'showHidden':![],'depth':null}));if(_0xfa7e02[_0x2550('0x66')][_0x2550('0x67')]()===_0x2550('0x68')){_0xfa7e02[_0x2550('0x69')]=(_0xfa7e02['appdata']||_0xfa7e02['applicationdata'])['toLowerCase']();if(_[_0x2550('0x6a')](_0xfa7e02[_0x2550('0x69')],_0x2550('0x6b'))){if(_[_0x2550('0x14')](this[_0x2550('0x26')][_0xfa7e02[_0x2550('0x1a')]]))this['applications'][_0xfa7e02['uniqueid']]={};logger[_0x2550('0x22')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0xfa7e02['uniqueid'],_0xfa7e02[_0x2550('0x66')],_0xfa7e02[_0x2550('0x69')]);var _0x2a8fd8=_0xfa7e02[_0x2550('0x69')]['split']('=');var _0x59b382=_0x2a8fd8[0x0][_0x2550('0x6c')](/cdr\((.*)\)/);if(_0x59b382)this['applications'][_0xfa7e02[_0x2550('0x1a')]][_0x59b382[0x1]]=_0x2a8fd8[0x1];}}}}catch(_0x456781){logger[_0x2550('0x2a')](_0x2550('0x6d'),_0xfa7e02['uniqueid'],util[_0x2550('0x1b')](_0x456781,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x2550('0x15')][_0x2550('0x6e')]=function(_0x483952,_0x1a83b6=0x2710){if(this[_0x2550('0xa')][_0x483952]){setTimeout(()=>{delete this[_0x2550('0xa')][_0x483952];},_0x1a83b6);}};module['exports']=VoiceDialReport;
\ No newline at end of file
+var _0xc33f=['deleteChannelAfterTimeout','exports','util','ioredis','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','substring','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','merge','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','syncDialEnd','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','voice:outbound','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','keys','variable','value','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','starttime','seconds','complete','total','answered','holdtime','diff','billableseconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','startsWith','cdr(','applications','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceDialReport][newexten]'];(function(_0x3b3247,_0x44b48d){var _0x31f9e2=function(_0x1f0793){while(--_0x1f0793){_0x3b3247['push'](_0x3b3247['shift']());}};_0x31f9e2(++_0x44b48d);}(_0xc33f,0x1ee));var _0xfc33=function(_0x1c5feb,_0x3d9b3b){_0x1c5feb=_0x1c5feb-0x0;var _0x534222=_0xc33f[_0x1c5feb];return _0x534222;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xfc33('0x0'));var Redis=require(_0xfc33('0x1'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xfc33('0x2'));var ami=require(_0xfc33('0x3'));config[_0xfc33('0x4')]=_[_0xfc33('0x5')](config[_0xfc33('0x4')],{'host':_0xfc33('0x6'),'port':0x18eb});var io=require(_0xfc33('0x7'))(new Redis(config['redis']));function VoiceDialReport(_0x433d4b){this[_0xfc33('0x8')]=_0x433d4b[_0xfc33('0x9')];this['outbound']=_0x433d4b[_0xfc33('0xa')];this['applications']={};this[_0xfc33('0xb')]={};ami['on'](_0xfc33('0xc'),this[_0xfc33('0xd')][_0xfc33('0xe')](this));ami['on'](_0xfc33('0xf'),this['syncDialEnd'][_0xfc33('0xe')](this));ami['on'](_0xfc33('0x10'),this[_0xfc33('0x11')][_0xfc33('0xe')](this));ami['on'](_0xfc33('0x12'),this[_0xfc33('0x13')][_0xfc33('0xe')](this));}VoiceDialReport[_0xfc33('0x14')][_0xfc33('0x15')]=function(_0x5873b5){return _0x5873b5!==null&&!_[_0xfc33('0x16')](_0x5873b5);};VoiceDialReport['prototype'][_0xfc33('0x17')]=function(_0x3e588f,_0x4ea180,_0x32c2a6){io['to'](_0x3e588f)[_0xfc33('0x17')](_0x4ea180,_0x32c2a6);};VoiceDialReport[_0xfc33('0x14')]['syncDialBegin']=function(_0x277a08){try{if(this[_0xfc33('0x15')](_0x277a08)){logger[_0xfc33('0x18')](_0xfc33('0x19'),_0x277a08[_0xfc33('0x1a')],util[_0xfc33('0x1b')](_0x277a08,{'showHidden':![],'depth':null}));if(this['channels'][_0x277a08[_0xfc33('0x1a')]]){_['merge'](this[_0xfc33('0x8')][_0x277a08[_0xfc33('0x1a')]],{'starttime':moment()[_0xfc33('0x1c')](_0xfc33('0x1d')),'lastevent':_0xfc33('0x1e'),'interface':_0x277a08[_0xfc33('0x1f')]['substring'](0x0,_0x277a08[_0xfc33('0x1f')][_0xfc33('0x20')]('-')),'membername':_0x277a08[_0xfc33('0x1f')][_0xfc33('0x21')](_0x277a08['channel'][_0xfc33('0x20')]('/')+0x1,_0x277a08[_0xfc33('0x1f')]['lastIndexOf']('-'))},_[_0xfc33('0x22')](_0x277a08,[_0xfc33('0x23'),_0xfc33('0x24')]));logger[_0xfc33('0x25')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x277a08[_0xfc33('0x1a')],this[_0xfc33('0x8')][_0x277a08[_0xfc33('0x1a')]]['membername'],this[_0xfc33('0x8')][_0x277a08['uniqueid']]['interface']);logger[_0xfc33('0x18')](_0xfc33('0x26'),_0x277a08[_0xfc33('0x1a')],util[_0xfc33('0x1b')](this[_0xfc33('0x8')][_0x277a08['uniqueid']],{'showHidden':![],'depth':null}));if(this['applications'][_0x277a08[_0xfc33('0x1a')]])_[_0xfc33('0x27')](this[_0xfc33('0x8')][_0x277a08[_0xfc33('0x1a')]],this['applications'][_0x277a08[_0xfc33('0x1a')]]);this[_0xfc33('0x17')]('voice:outbound',_0xfc33('0x28'),this[_0xfc33('0x8')][_0x277a08[_0xfc33('0x1a')]]);logger[_0xfc33('0x18')](_0xfc33('0x29'),_0x277a08[_0xfc33('0x1a')],util[_0xfc33('0x1b')](this[_0xfc33('0x8')][_0x277a08[_0xfc33('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xfc33('0x17')](_0xfc33('0x2a'),this[_0xfc33('0x8')][_0x277a08[_0xfc33('0x1a')]]);}}}catch(_0x426f0e){logger[_0xfc33('0x2b')](_0xfc33('0x2c'),_0x277a08[_0xfc33('0x1a')],util[_0xfc33('0x1b')](_0x426f0e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xfc33('0x14')][_0xfc33('0x2d')]=function(_0x33aeee){try{if(this[_0xfc33('0x15')](_0x33aeee)){logger[_0xfc33('0x18')]('[%s][voiceDialReport][dialend]\x20event:',_0x33aeee[_0xfc33('0x1a')],util[_0xfc33('0x1b')](_0x33aeee,{'showHidden':![],'depth':null}));if(this[_0xfc33('0x8')][_0x33aeee['uniqueid']]){this['channels'][_0x33aeee[_0xfc33('0x1a')]][_0xfc33('0x2e')]=_0x33aeee[_0xfc33('0x2e')];if(_0x33aeee[_0xfc33('0x2e')]===_0xfc33('0x2f')){this[_0xfc33('0x8')][_0x33aeee[_0xfc33('0x1a')]][_0xfc33('0x30')]=_0x33aeee[_0xfc33('0x30')];this[_0xfc33('0x8')][_0x33aeee['uniqueid']]['connectedlinename']=_0x33aeee[_0xfc33('0x31')];this[_0xfc33('0x8')][_0x33aeee[_0xfc33('0x1a')]][_0xfc33('0x32')]=moment()[_0xfc33('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xfc33('0x8')][_0x33aeee[_0xfc33('0x1a')]]['lastevent']=_0xfc33('0x33');logger[_0xfc33('0x25')](_0xfc33('0x34'),_0x33aeee['uniqueid'],_0x33aeee[_0xfc33('0x1f')][_0xfc33('0x21')](_0x33aeee[_0xfc33('0x1f')]['lastIndexOf']('/')+0x1,_0x33aeee[_0xfc33('0x1f')][_0xfc33('0x20')]('-')));logger[_0xfc33('0x18')](_0xfc33('0x35'),_0x33aeee[_0xfc33('0x1a')],util[_0xfc33('0x1b')](this[_0xfc33('0x8')][_0x33aeee['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xfc33('0x17')](_0xfc33('0x36'),this[_0xfc33('0x8')][_0x33aeee['uniqueid']]);}logger[_0xfc33('0x18')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x33aeee[_0xfc33('0x1a')],util[_0xfc33('0x1b')](this[_0xfc33('0x8')][_0x33aeee[_0xfc33('0x1a')]],{'showHidden':![],'depth':null}));this[_0xfc33('0x17')](_0xfc33('0x37'),_0xfc33('0x28'),this[_0xfc33('0x8')][_0x33aeee[_0xfc33('0x1a')]]);}}}catch(_0x4ac6d7){logger[_0xfc33('0x2b')](_0xfc33('0x38'),_0x33aeee[_0xfc33('0x1a')],util[_0xfc33('0x1b')](_0x4ac6d7,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xfc33('0x14')][_0xfc33('0x11')]=function(_0x6843f7){try{if(this[_0xfc33('0x15')](_0x6843f7)){logger[_0xfc33('0x18')](_0xfc33('0x39'),_0x6843f7[_0xfc33('0x1a')],util[_0xfc33('0x1b')](_0x6843f7,{'showHidden':![],'depth':null}));this['addVariable'](_0x6843f7['uniqueid'],_[_0xfc33('0x3a')](_0x6843f7[_0xfc33('0x3b')])[0x0],_0x6843f7[_0xfc33('0x3c')]);if(this[_0xfc33('0x15')](_0x6843f7[_0xfc33('0x3b')])&&this['isNotNull'](_0x6843f7[_0xfc33('0x3b')][_0xfc33('0x3d')])){if(_[_0xfc33('0x16')](this[_0xfc33('0x8')][_0x6843f7[_0xfc33('0x1a')]])){this[_0xfc33('0x8')][_0x6843f7[_0xfc33('0x1a')]]={'routeId':_0x6843f7[_0xfc33('0x3c')],'variables':this[_0xfc33('0xb')][_0x6843f7[_0xfc33('0x1a')]],'motionChannel':_0xfc33('0x3e')};logger['info']('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x6843f7['uniqueid'],_0x6843f7[_0xfc33('0x3b')][_0xfc33('0x3d')],_[_0xfc33('0x3a')](_0x6843f7[_0xfc33('0x3b')])[0x0],_0x6843f7['value']);logger[_0xfc33('0x18')](_0xfc33('0x3f'),_0x6843f7[_0xfc33('0x1a')],util[_0xfc33('0x1b')](this['channels'][_0x6843f7[_0xfc33('0x1a')]],{'showHidden':![],'depth':null}));this[_0xfc33('0x17')]('voice:outbound',_0xfc33('0x28'),this[_0xfc33('0x8')][_0x6843f7[_0xfc33('0x1a')]]);}}}}catch(_0x20e4d7){logger['error'](_0xfc33('0x40'),_0x6843f7[_0xfc33('0x1a')],util[_0xfc33('0x1b')](_0x20e4d7,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xfc33('0x14')]['addVariable']=function(_0x431b04,_0x43b6c5,_0xacee58){var _0x486839=[_0xfc33('0x41'),_0xfc33('0x42'),_0xfc33('0x43'),_0xfc33('0x44'),_0xfc33('0x45'),_0xfc33('0x46'),_0xfc33('0x47'),_0xfc33('0x48'),_0xfc33('0x49'),_0xfc33('0x4a'),_0xfc33('0x4b'),_0xfc33('0x4c'),'membercalls',_0xfc33('0x4d'),_0xfc33('0x4e'),_0xfc33('0x4f'),_0xfc33('0x50'),_0xfc33('0x51'),_0xfc33('0x52')];if(!_[_0xfc33('0x53')](_0x43b6c5)&&!_['includes'](_0x486839,_0x43b6c5)){if(_[_0xfc33('0x16')](this[_0xfc33('0xb')][_0x431b04])){this[_0xfc33('0xb')][_0x431b04]={};}this[_0xfc33('0xb')][_0x431b04][_0x43b6c5]=_0xacee58;}};VoiceDialReport['prototype'][_0xfc33('0x13')]=function(_0x10ec0f){try{if(this['isNotNull'](_0x10ec0f)){logger['debug'](_0xfc33('0x54'),_0x10ec0f[_0xfc33('0x1a')],util[_0xfc33('0x1b')](_0x10ec0f,{'showHidden':![],'depth':null}));if(this[_0xfc33('0x8')][_0x10ec0f[_0xfc33('0x1a')]]){logger['info'](_0xfc33('0x55'),_0x10ec0f['uniqueid'],_0x10ec0f[_0xfc33('0x56')]);this[_0xfc33('0x8')][_0x10ec0f[_0xfc33('0x1a')]][_0xfc33('0x57')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x10ec0f[_0xfc33('0x1a')]][_0xfc33('0x58')]=moment(this[_0xfc33('0x8')][_0x10ec0f[_0xfc33('0x1a')]][_0xfc33('0x57')])['diff'](this['channels'][_0x10ec0f[_0xfc33('0x1a')]][_0xfc33('0x59')],_0xfc33('0x5a'));this[_0xfc33('0x8')][_0x10ec0f[_0xfc33('0x1a')]]['lastevent']=_0xfc33('0x5b');this[_0xfc33('0xa')][_0xfc33('0x5c')]+=0x1;if(this[_0xfc33('0x8')][_0x10ec0f[_0xfc33('0x1a')]][_0xfc33('0x32')]){this['outbound'][_0xfc33('0x5d')]+=0x1;this[_0xfc33('0x8')][_0x10ec0f[_0xfc33('0x1a')]][_0xfc33('0x5e')]=moment(this[_0xfc33('0x8')][_0x10ec0f[_0xfc33('0x1a')]][_0xfc33('0x32')])[_0xfc33('0x5f')](this[_0xfc33('0x8')][_0x10ec0f[_0xfc33('0x1a')]][_0xfc33('0x59')],_0xfc33('0x5a'));this[_0xfc33('0x8')][_0x10ec0f[_0xfc33('0x1a')]][_0xfc33('0x60')]=moment(this['channels'][_0x10ec0f[_0xfc33('0x1a')]]['endtime'])['diff'](this[_0xfc33('0x8')][_0x10ec0f[_0xfc33('0x1a')]]['answertime'],_0xfc33('0x5a'));this[_0xfc33('0xa')][_0xfc33('0x61')]+=this[_0xfc33('0x8')][_0x10ec0f[_0xfc33('0x1a')]][_0xfc33('0x5e')]||0x0;this[_0xfc33('0xa')][_0xfc33('0x62')]+=this['channels'][_0x10ec0f['uniqueid']]['billableseconds'];}this['outbound'][_0xfc33('0x63')]+=this['channels'][_0x10ec0f['uniqueid']][_0xfc33('0x58')];logger[_0xfc33('0x18')](_0xfc33('0x64'),_0x10ec0f[_0xfc33('0x1a')],util['inspect'](this[_0xfc33('0x8')][_0x10ec0f[_0xfc33('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xfc33('0x17')](_0xfc33('0x65'),this[_0xfc33('0x8')][_0x10ec0f[_0xfc33('0x1a')]]);logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x10ec0f[_0xfc33('0x1a')],util[_0xfc33('0x1b')](this[_0xfc33('0x8')][_0x10ec0f[_0xfc33('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xfc33('0x17')]('custom:dialend',this[_0xfc33('0x8')][_0x10ec0f[_0xfc33('0x1a')]]);logger[_0xfc33('0x18')](_0xfc33('0x66'),_0x10ec0f[_0xfc33('0x1a')],util[_0xfc33('0x1b')](this['channels'][_0x10ec0f[_0xfc33('0x1a')]],{'showHidden':![],'depth':null}));this[_0xfc33('0x17')](_0xfc33('0x37'),_0xfc33('0x67'),this[_0xfc33('0xa')]);logger[_0xfc33('0x25')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON['stringify'](this[_0xfc33('0x8')][_0x10ec0f['uniqueid']]));logger[_0xfc33('0x18')](_0xfc33('0x68'),_0x10ec0f[_0xfc33('0x1a')],util[_0xfc33('0x1b')](this[_0xfc33('0x8')][_0x10ec0f[_0xfc33('0x1a')]],{'showHidden':![],'depth':null}));this[_0xfc33('0x17')](_0xfc33('0x37'),_0xfc33('0x69'),this[_0xfc33('0x8')][_0x10ec0f[_0xfc33('0x1a')]]);this['deleteChannelAfterTimeout'](_0x10ec0f[_0xfc33('0x1a')]);}else if(this[_0xfc33('0x8')][_0x10ec0f['linkedid']]){this[_0xfc33('0x8')][_0x10ec0f[_0xfc33('0x6a')]][_0xfc33('0x1a')]=this[_0xfc33('0x8')][_0x10ec0f['linkedid']][_0xfc33('0x6b')];}if(this[_0xfc33('0xb')][_0x10ec0f[_0xfc33('0x1a')]]){delete this[_0xfc33('0xb')][_0x10ec0f[_0xfc33('0x1a')]];}}}catch(_0xaa5242){logger['error']('[%s][voiceDialReport][hangup]',_0x10ec0f[_0xfc33('0x1a')],util[_0xfc33('0x1b')](_0xaa5242,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xfc33('0x14')][_0xfc33('0x6c')]=function(_0x18eb85){try{if(this[_0xfc33('0x15')](_0x18eb85)){logger[_0xfc33('0x18')](_0xfc33('0x6d'),_0x18eb85['uniqueid'],util[_0xfc33('0x1b')](_0x18eb85,{'showHidden':![],'depth':null}));if(_0x18eb85[_0xfc33('0x6e')][_0xfc33('0x6f')]()===_0xfc33('0x70')){_0x18eb85[_0xfc33('0x71')]=(_0x18eb85['appdata']||_0x18eb85[_0xfc33('0x71')])['toLowerCase']();if(_[_0xfc33('0x72')](_0x18eb85[_0xfc33('0x71')],_0xfc33('0x73'))){if(_[_0xfc33('0x16')](this['applications'][_0x18eb85[_0xfc33('0x1a')]]))this[_0xfc33('0x74')][_0x18eb85['uniqueid']]={};logger[_0xfc33('0x25')](_0xfc33('0x75'),_0x18eb85[_0xfc33('0x1a')],_0x18eb85[_0xfc33('0x6e')],_0x18eb85[_0xfc33('0x71')]);var _0x6c50aa=_0x18eb85['applicationdata'][_0xfc33('0x76')]('=');var _0x341e57=_0x6c50aa[0x0][_0xfc33('0x77')](/cdr\((.*)\)/);if(_0x341e57)this[_0xfc33('0x74')][_0x18eb85[_0xfc33('0x1a')]][_0x341e57[0x1]]=_0x6c50aa[0x1];}}}}catch(_0x3d9f3d){logger['error'](_0xfc33('0x78'),_0x18eb85['uniqueid'],util[_0xfc33('0x1b')](_0x3d9f3d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xfc33('0x14')][_0xfc33('0x79')]=function(_0x3e7b41,_0x3cdcd8=0x2710){if(this[_0xfc33('0x8')][_0x3e7b41]){setTimeout(()=>{delete this['channels'][_0x3e7b41];},_0x3cdcd8);}};module[_0xfc33('0x7a')]=VoiceDialReport;
\ No newline at end of file