Built motion from commit a8c4dd89.|2.6.33
[motion2.git] / server / services / ami / report / voiceDialReport.js
index 0da32c5..21775ff 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x25f0=['answered','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','toLowerCase','applicationdata','appdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceDialReport][newexten]','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','localhost','socket.io-emitter','channels','outbound','applications','variables','syncDialBegin','bind','dialend','syncDialEnd','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','debug','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','substring','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','emit','voice:outbound','custom:dialbegin','error','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinenum','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','outboundrouteid','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','memberdynamic','memberlastcall','memberrealtime','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','complete','total'];(function(_0x3d542c,_0x2098ae){var _0x4946de=function(_0x51171f){while(--_0x51171f){_0x3d542c['push'](_0x3d542c['shift']());}};_0x4946de(++_0x2098ae);}(_0x25f0,0x108));var _0x025f=function(_0x499b93,_0x5b114a){_0x499b93=_0x499b93-0x0;var _0x35c422=_0x25f0[_0x499b93];return _0x35c422;};'use strict';var _=require(_0x025f('0x0'));var moment=require(_0x025f('0x1'));var util=require(_0x025f('0x2'));var Redis=require(_0x025f('0x3'));var config=require(_0x025f('0x4'));var logger=require(_0x025f('0x5'))(_0x025f('0x6'));var ami=require(_0x025f('0x7'));config['redis']=_[_0x025f('0x8')](config[_0x025f('0x9')],{'host':_0x025f('0xa'),'port':0x18eb});var io=require(_0x025f('0xb'))(new Redis(config[_0x025f('0x9')]));function VoiceDialReport(_0x5d74fb){this[_0x025f('0xc')]=_0x5d74fb['outboundChannels'];this[_0x025f('0xd')]=_0x5d74fb[_0x025f('0xd')];this[_0x025f('0xe')]={};this[_0x025f('0xf')]={};ami['on']('dialbegin',this[_0x025f('0x10')][_0x025f('0x11')](this));ami['on'](_0x025f('0x12'),this[_0x025f('0x13')][_0x025f('0x11')](this));ami['on']('varset',this[_0x025f('0x14')]['bind'](this));ami['on'](_0x025f('0x15'),this[_0x025f('0x16')][_0x025f('0x11')](this));}VoiceDialReport[_0x025f('0x17')][_0x025f('0x18')]=function(_0x51d1eb){return _0x51d1eb!==null&&!_[_0x025f('0x19')](_0x51d1eb);};VoiceDialReport[_0x025f('0x17')]['emit']=function(_0x4e58ab,_0x51d599,_0x429347){io['to'](_0x4e58ab)['emit'](_0x51d599,_0x429347);};VoiceDialReport[_0x025f('0x17')]['syncDialBegin']=function(_0x4ff809){try{if(this[_0x025f('0x18')](_0x4ff809)){logger[_0x025f('0x1a')]('[%s][voiceDialReport][dialbegin]\x20event:',_0x4ff809[_0x025f('0x1b')],util[_0x025f('0x1c')](_0x4ff809,{'showHidden':![],'depth':null}));if(this['channels'][_0x4ff809['uniqueid']]){_[_0x025f('0x1d')](this[_0x025f('0xc')][_0x4ff809[_0x025f('0x1b')]],{'starttime':moment()[_0x025f('0x1e')](_0x025f('0x1f')),'lastevent':_0x025f('0x20'),'interface':_0x4ff809[_0x025f('0x21')]['substring'](0x0,_0x4ff809[_0x025f('0x21')][_0x025f('0x22')]('-')),'membername':_0x4ff809[_0x025f('0x21')][_0x025f('0x23')](_0x4ff809[_0x025f('0x21')][_0x025f('0x22')]('/')+0x1,_0x4ff809['channel'][_0x025f('0x22')]('-'))},_[_0x025f('0x24')](_0x4ff809,[_0x025f('0x25'),_0x025f('0x26')]));logger[_0x025f('0x27')](_0x025f('0x28'),_0x4ff809['uniqueid'],this[_0x025f('0xc')][_0x4ff809[_0x025f('0x1b')]][_0x025f('0x29')],this['channels'][_0x4ff809[_0x025f('0x1b')]][_0x025f('0x2a')]);logger[_0x025f('0x1a')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x4ff809[_0x025f('0x1b')],util[_0x025f('0x1c')](this[_0x025f('0xc')][_0x4ff809['uniqueid']],{'showHidden':![],'depth':null}));if(this[_0x025f('0xe')][_0x4ff809['uniqueid']])_['merge'](this[_0x025f('0xc')][_0x4ff809[_0x025f('0x1b')]],this[_0x025f('0xe')][_0x4ff809[_0x025f('0x1b')]]);this[_0x025f('0x2b')](_0x025f('0x2c'),'voice_outbound_channel:save',this[_0x025f('0xc')][_0x4ff809['uniqueid']]);logger[_0x025f('0x1a')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x4ff809[_0x025f('0x1b')],util[_0x025f('0x1c')](this[_0x025f('0xc')][_0x4ff809['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x025f('0x2b')](_0x025f('0x2d'),this['channels'][_0x4ff809[_0x025f('0x1b')]]);}}}catch(_0x1c33e7){logger[_0x025f('0x2e')]('[%s][voiceDialReport][dialbegin]',_0x4ff809[_0x025f('0x1b')],util[_0x025f('0x1c')](_0x1c33e7,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x025f('0x17')][_0x025f('0x13')]=function(_0x39a228){try{if(this[_0x025f('0x18')](_0x39a228)){logger[_0x025f('0x1a')](_0x025f('0x2f'),_0x39a228[_0x025f('0x1b')],util[_0x025f('0x1c')](_0x39a228,{'showHidden':![],'depth':null}));if(this[_0x025f('0xc')][_0x39a228[_0x025f('0x1b')]]){this['channels'][_0x39a228[_0x025f('0x1b')]][_0x025f('0x30')]=_0x39a228['dialstatus'];if(_0x39a228[_0x025f('0x30')]==='ANSWER'){this[_0x025f('0xc')][_0x39a228[_0x025f('0x1b')]][_0x025f('0x31')]=_0x39a228[_0x025f('0x31')];this[_0x025f('0xc')][_0x39a228[_0x025f('0x1b')]]['connectedlinename']=_0x39a228['connectedlinename'];this[_0x025f('0xc')][_0x39a228['uniqueid']][_0x025f('0x32')]=moment()[_0x025f('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x025f('0xc')][_0x39a228[_0x025f('0x1b')]][_0x025f('0x33')]=_0x025f('0x34');logger['info'](_0x025f('0x35'),_0x39a228['uniqueid'],_0x39a228[_0x025f('0x21')][_0x025f('0x23')](_0x39a228[_0x025f('0x21')][_0x025f('0x22')]('/')+0x1,_0x39a228[_0x025f('0x21')][_0x025f('0x22')]('-')));logger[_0x025f('0x1a')](_0x025f('0x36'),_0x39a228['uniqueid'],util['inspect'](this[_0x025f('0xc')][_0x39a228[_0x025f('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x025f('0x2b')]('custom:dialconnect',this[_0x025f('0xc')][_0x39a228['uniqueid']]);}logger['debug']('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x39a228[_0x025f('0x1b')],util[_0x025f('0x1c')](this['channels'][_0x39a228[_0x025f('0x1b')]],{'showHidden':![],'depth':null}));this['emit'](_0x025f('0x2c'),_0x025f('0x37'),this[_0x025f('0xc')][_0x39a228[_0x025f('0x1b')]]);}}}catch(_0x5ddf94){logger[_0x025f('0x2e')](_0x025f('0x38'),_0x39a228[_0x025f('0x1b')],util['inspect'](_0x5ddf94,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x025f('0x17')][_0x025f('0x14')]=function(_0x320742){try{if(this[_0x025f('0x18')](_0x320742)){logger[_0x025f('0x1a')](_0x025f('0x39'),_0x320742[_0x025f('0x1b')],util[_0x025f('0x1c')](_0x320742,{'showHidden':![],'depth':null}));this[_0x025f('0x3a')](_0x320742['uniqueid'],_[_0x025f('0x3b')](_0x320742[_0x025f('0x3c')])[0x0],_0x320742['value']);if(this[_0x025f('0x18')](_0x320742[_0x025f('0x3c')])&&this['isNotNull'](_0x320742[_0x025f('0x3c')]['outboundrouteid'])){if(_['isUndefined'](this[_0x025f('0xc')][_0x320742['uniqueid']])){this[_0x025f('0xc')][_0x320742[_0x025f('0x1b')]]={'routeId':_0x320742[_0x025f('0x3d')],'variables':this[_0x025f('0xf')][_0x320742[_0x025f('0x1b')]],'motionChannel':_0x025f('0x3e')};logger[_0x025f('0x27')](_0x025f('0x3f'),_0x320742[_0x025f('0x1b')],_0x320742['variable'][_0x025f('0x40')],_[_0x025f('0x3b')](_0x320742[_0x025f('0x3c')])[0x0],_0x320742[_0x025f('0x3d')]);logger[_0x025f('0x1a')](_0x025f('0x41'),_0x320742['uniqueid'],util['inspect'](this[_0x025f('0xc')][_0x320742[_0x025f('0x1b')]],{'showHidden':![],'depth':null}));this[_0x025f('0x2b')](_0x025f('0x2c'),_0x025f('0x37'),this[_0x025f('0xc')][_0x320742[_0x025f('0x1b')]]);}}}}catch(_0x1122a3){logger[_0x025f('0x2e')]('[%s][voiceDialReport][varset]',_0x320742[_0x025f('0x1b')],util['inspect'](_0x1122a3,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x025f('0x17')][_0x025f('0x3a')]=function(_0x2eaee9,_0x33e533,_0x394f6c){var _0x49bfc0=[_0x025f('0x42'),_0x025f('0x43'),_0x025f('0x44'),'rtpaudioqosjitterbridged',_0x025f('0x45'),_0x025f('0x46'),_0x025f('0x47'),_0x025f('0x48'),_0x025f('0x49'),'sipuri',_0x025f('0x4a'),_0x025f('0x4b'),'membercalls',_0x025f('0x4c'),'memberinterface',_0x025f('0x4d'),'membername','memberpenalty',_0x025f('0x4e')];if(!_['isNil'](_0x33e533)&&!_[_0x025f('0x4f')](_0x49bfc0,_0x33e533)){if(_[_0x025f('0x19')](this[_0x025f('0xf')][_0x2eaee9])){this[_0x025f('0xf')][_0x2eaee9]={};}this['variables'][_0x2eaee9][_0x33e533]=_0x394f6c;}};VoiceDialReport['prototype']['syncHangup']=function(_0x5eb041){try{if(this[_0x025f('0x18')](_0x5eb041)){logger['debug'](_0x025f('0x50'),_0x5eb041[_0x025f('0x1b')],util[_0x025f('0x1c')](_0x5eb041,{'showHidden':![],'depth':null}));if(this[_0x025f('0xc')][_0x5eb041['uniqueid']]){logger[_0x025f('0x27')](_0x025f('0x51'),_0x5eb041[_0x025f('0x1b')],_0x5eb041[_0x025f('0x52')]);this[_0x025f('0xc')][_0x5eb041['uniqueid']][_0x025f('0x53')]=moment()[_0x025f('0x1e')](_0x025f('0x1f'));this['channels'][_0x5eb041[_0x025f('0x1b')]][_0x025f('0x54')]=moment(this[_0x025f('0xc')][_0x5eb041['uniqueid']][_0x025f('0x53')])[_0x025f('0x55')](this[_0x025f('0xc')][_0x5eb041[_0x025f('0x1b')]][_0x025f('0x56')],_0x025f('0x57'));this['channels'][_0x5eb041[_0x025f('0x1b')]]['lastevent']=_0x025f('0x58');this[_0x025f('0xd')][_0x025f('0x59')]+=0x1;if(this['channels'][_0x5eb041[_0x025f('0x1b')]][_0x025f('0x32')]){this[_0x025f('0xd')][_0x025f('0x5a')]+=0x1;this['channels'][_0x5eb041[_0x025f('0x1b')]][_0x025f('0x5b')]=moment(this[_0x025f('0xc')][_0x5eb041[_0x025f('0x1b')]][_0x025f('0x32')])[_0x025f('0x55')](this[_0x025f('0xc')][_0x5eb041[_0x025f('0x1b')]]['starttime'],_0x025f('0x57'));this[_0x025f('0xc')][_0x5eb041['uniqueid']][_0x025f('0x5c')]=moment(this[_0x025f('0xc')][_0x5eb041[_0x025f('0x1b')]]['endtime'])['diff'](this[_0x025f('0xc')][_0x5eb041[_0x025f('0x1b')]][_0x025f('0x32')],_0x025f('0x57'));this[_0x025f('0xd')][_0x025f('0x5d')]+=this[_0x025f('0xc')][_0x5eb041['uniqueid']]['holdtime']||0x0;this[_0x025f('0xd')][_0x025f('0x5e')]+=this[_0x025f('0xc')][_0x5eb041['uniqueid']][_0x025f('0x5c')];}this[_0x025f('0xd')][_0x025f('0x5f')]+=this[_0x025f('0xc')][_0x5eb041[_0x025f('0x1b')]][_0x025f('0x54')];logger['debug'](_0x025f('0x60'),_0x5eb041[_0x025f('0x1b')],util[_0x025f('0x1c')](this['channels'][_0x5eb041[_0x025f('0x1b')]],{'showHidden':![],'depth':null}));ami['emit'](_0x025f('0x61'),this[_0x025f('0xc')][_0x5eb041[_0x025f('0x1b')]]);logger['debug'](_0x025f('0x62'),_0x5eb041[_0x025f('0x1b')],util[_0x025f('0x1c')](this[_0x025f('0xc')][_0x5eb041[_0x025f('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x025f('0x2b')](_0x025f('0x63'),this[_0x025f('0xc')][_0x5eb041['uniqueid']]);logger[_0x025f('0x1a')](_0x025f('0x64'),_0x5eb041[_0x025f('0x1b')],util[_0x025f('0x1c')](this[_0x025f('0xc')][_0x5eb041[_0x025f('0x1b')]],{'showHidden':![],'depth':null}));this[_0x025f('0x2b')](_0x025f('0x2c'),_0x025f('0x65'),this[_0x025f('0xd')]);logger[_0x025f('0x27')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON['stringify'](this[_0x025f('0xc')][_0x5eb041[_0x025f('0x1b')]]));logger['debug'](_0x025f('0x66'),_0x5eb041[_0x025f('0x1b')],util[_0x025f('0x1c')](this['channels'][_0x5eb041['uniqueid']],{'showHidden':![],'depth':null}));this[_0x025f('0x2b')]('voice:outbound',_0x025f('0x67'),this[_0x025f('0xc')][_0x5eb041[_0x025f('0x1b')]]);this[_0x025f('0x68')](_0x5eb041[_0x025f('0x1b')]);}else if(this[_0x025f('0xc')][_0x5eb041[_0x025f('0x69')]]){this[_0x025f('0xc')][_0x5eb041[_0x025f('0x69')]][_0x025f('0x1b')]=this[_0x025f('0xc')][_0x5eb041[_0x025f('0x69')]][_0x025f('0x6a')];}if(this[_0x025f('0xf')][_0x5eb041[_0x025f('0x1b')]]){delete this[_0x025f('0xf')][_0x5eb041[_0x025f('0x1b')]];}}}catch(_0x44100a){logger[_0x025f('0x2e')](_0x025f('0x6b'),_0x5eb041[_0x025f('0x1b')],util['inspect'](_0x44100a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x025f('0x17')]['syncNewExten']=function(_0x25cc20){try{if(this[_0x025f('0x18')](_0x25cc20)){logger['debug'](_0x025f('0x6c'),_0x25cc20['uniqueid'],util[_0x025f('0x1c')](_0x25cc20,{'showHidden':![],'depth':null}));if(_0x25cc20['application'][_0x025f('0x6d')]()==='set'){_0x25cc20[_0x025f('0x6e')]=(_0x25cc20[_0x025f('0x6f')]||_0x25cc20[_0x025f('0x6e')])['toLowerCase']();if(_[_0x025f('0x70')](_0x25cc20[_0x025f('0x6e')],_0x025f('0x71'))){if(_['isUndefined'](this[_0x025f('0xe')][_0x25cc20[_0x025f('0x1b')]]))this[_0x025f('0xe')][_0x25cc20['uniqueid']]={};logger['info'](_0x025f('0x72'),_0x25cc20[_0x025f('0x1b')],_0x25cc20['application'],_0x25cc20[_0x025f('0x6e')]);var _0x3ae821=_0x25cc20[_0x025f('0x6e')][_0x025f('0x73')]('=');var _0x2f5a8f=_0x3ae821[0x0][_0x025f('0x74')](/cdr\((.*)\)/);if(_0x2f5a8f)this['applications'][_0x25cc20[_0x025f('0x1b')]][_0x2f5a8f[0x1]]=_0x3ae821[0x1];}}}}catch(_0x314330){logger[_0x025f('0x2e')](_0x025f('0x75'),_0x25cc20['uniqueid'],util[_0x025f('0x1c')](_0x314330,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x025f('0x17')][_0x025f('0x68')]=function(_0x1b70e6,_0x12579d=0x2710){if(this['channels'][_0x1b70e6]){setTimeout(()=>{delete this[_0x025f('0xc')][_0x1b70e6];},_0x12579d);}};module['exports']=VoiceDialReport;
\ No newline at end of file
+var _0x4020=['[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','toLowerCase','applicationdata','appdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','channels','outboundChannels','outbound','applications','variables','dialbegin','bind','varset','syncVarSet','hangup','syncHangup','prototype','isUndefined','emit','isNotNull','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','lastIndexOf','substring','omit','event','privilege','info','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','answertime','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify'];(function(_0x13187a,_0x2fcec4){var _0x65b85f=function(_0x33bf1f){while(--_0x33bf1f){_0x13187a['push'](_0x13187a['shift']());}};_0x65b85f(++_0x2fcec4);}(_0x4020,0x1f0));var _0x0402=function(_0x5d6968,_0x4f7cef){_0x5d6968=_0x5d6968-0x0;var _0x131ead=_0x4020[_0x5d6968];return _0x131ead;};'use strict';var _=require('lodash');var moment=require(_0x0402('0x0'));var util=require(_0x0402('0x1'));var Redis=require(_0x0402('0x2'));var config=require(_0x0402('0x3'));var logger=require(_0x0402('0x4'))(_0x0402('0x5'));var ami=require('../ami');config[_0x0402('0x6')]=_[_0x0402('0x7')](config[_0x0402('0x6')],{'host':_0x0402('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0402('0x6')]));function VoiceDialReport(_0x48f4d2){this[_0x0402('0x9')]=_0x48f4d2[_0x0402('0xa')];this[_0x0402('0xb')]=_0x48f4d2[_0x0402('0xb')];this[_0x0402('0xc')]={};this[_0x0402('0xd')]={};ami['on'](_0x0402('0xe'),this['syncDialBegin']['bind'](this));ami['on']('dialend',this['syncDialEnd'][_0x0402('0xf')](this));ami['on'](_0x0402('0x10'),this[_0x0402('0x11')]['bind'](this));ami['on'](_0x0402('0x12'),this[_0x0402('0x13')]['bind'](this));}VoiceDialReport[_0x0402('0x14')]['isNotNull']=function(_0x3e9d6c){return _0x3e9d6c!==null&&!_[_0x0402('0x15')](_0x3e9d6c);};VoiceDialReport['prototype'][_0x0402('0x16')]=function(_0x907f68,_0x5959af,_0x1648e1){io['to'](_0x907f68)[_0x0402('0x16')](_0x5959af,_0x1648e1);};VoiceDialReport['prototype']['syncDialBegin']=function(_0x59000d){try{if(this[_0x0402('0x17')](_0x59000d)){logger['debug'](_0x0402('0x18'),_0x59000d[_0x0402('0x19')],util['inspect'](_0x59000d,{'showHidden':![],'depth':null}));if(this[_0x0402('0x9')][_0x59000d[_0x0402('0x19')]]){_[_0x0402('0x1a')](this[_0x0402('0x9')][_0x59000d[_0x0402('0x19')]],{'starttime':moment()[_0x0402('0x1b')](_0x0402('0x1c')),'lastevent':'called','interface':_0x59000d[_0x0402('0x1d')]['substring'](0x0,_0x59000d['channel'][_0x0402('0x1e')]('-')),'membername':_0x59000d[_0x0402('0x1d')][_0x0402('0x1f')](_0x59000d[_0x0402('0x1d')][_0x0402('0x1e')]('/')+0x1,_0x59000d[_0x0402('0x1d')]['lastIndexOf']('-'))},_[_0x0402('0x20')](_0x59000d,[_0x0402('0x21'),_0x0402('0x22')]));logger[_0x0402('0x23')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x59000d[_0x0402('0x19')],this[_0x0402('0x9')][_0x59000d['uniqueid']]['membername'],this['channels'][_0x59000d[_0x0402('0x19')]][_0x0402('0x24')]);logger[_0x0402('0x25')](_0x0402('0x26'),_0x59000d[_0x0402('0x19')],util[_0x0402('0x27')](this[_0x0402('0x9')][_0x59000d[_0x0402('0x19')]],{'showHidden':![],'depth':null}));if(this[_0x0402('0xc')][_0x59000d[_0x0402('0x19')]])_[_0x0402('0x1a')](this['channels'][_0x59000d[_0x0402('0x19')]],this[_0x0402('0xc')][_0x59000d['uniqueid']]);this[_0x0402('0x16')](_0x0402('0x28'),_0x0402('0x29'),this['channels'][_0x59000d[_0x0402('0x19')]]);logger['debug']('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x59000d[_0x0402('0x19')],util[_0x0402('0x27')](this['channels'][_0x59000d[_0x0402('0x19')]],{'showHidden':![],'depth':null}));ami[_0x0402('0x16')](_0x0402('0x2a'),this[_0x0402('0x9')][_0x59000d[_0x0402('0x19')]]);}}}catch(_0x5d75e5){logger[_0x0402('0x2b')](_0x0402('0x2c'),_0x59000d['uniqueid'],util[_0x0402('0x27')](_0x5d75e5,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0402('0x14')][_0x0402('0x2d')]=function(_0x25d163){try{if(this[_0x0402('0x17')](_0x25d163)){logger[_0x0402('0x25')](_0x0402('0x2e'),_0x25d163[_0x0402('0x19')],util[_0x0402('0x27')](_0x25d163,{'showHidden':![],'depth':null}));if(this[_0x0402('0x9')][_0x25d163['uniqueid']]){this[_0x0402('0x9')][_0x25d163[_0x0402('0x19')]][_0x0402('0x2f')]=_0x25d163[_0x0402('0x2f')];if(_0x25d163['dialstatus']===_0x0402('0x30')){this[_0x0402('0x9')][_0x25d163['uniqueid']]['connectedlinenum']=_0x25d163['connectedlinenum'];this[_0x0402('0x9')][_0x25d163[_0x0402('0x19')]]['connectedlinename']=_0x25d163['connectedlinename'];this[_0x0402('0x9')][_0x25d163[_0x0402('0x19')]][_0x0402('0x31')]=moment()[_0x0402('0x1b')](_0x0402('0x1c'));this[_0x0402('0x9')][_0x25d163[_0x0402('0x19')]]['lastevent']=_0x0402('0x32');logger[_0x0402('0x23')](_0x0402('0x33'),_0x25d163['uniqueid'],_0x25d163[_0x0402('0x1d')][_0x0402('0x1f')](_0x25d163['channel'][_0x0402('0x1e')]('/')+0x1,_0x25d163['channel'][_0x0402('0x1e')]('-')));logger['debug'](_0x0402('0x34'),_0x25d163['uniqueid'],util[_0x0402('0x27')](this[_0x0402('0x9')][_0x25d163[_0x0402('0x19')]],{'showHidden':![],'depth':null}));ami[_0x0402('0x16')](_0x0402('0x35'),this[_0x0402('0x9')][_0x25d163[_0x0402('0x19')]]);}logger['debug']('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x25d163[_0x0402('0x19')],util[_0x0402('0x27')](this[_0x0402('0x9')][_0x25d163[_0x0402('0x19')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound','voice_outbound_channel:save',this[_0x0402('0x9')][_0x25d163[_0x0402('0x19')]]);}}}catch(_0x2b1d7f){logger['error'](_0x0402('0x36'),_0x25d163['uniqueid'],util[_0x0402('0x27')](_0x2b1d7f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0402('0x14')][_0x0402('0x11')]=function(_0x3d4004){try{if(this['isNotNull'](_0x3d4004)){logger[_0x0402('0x25')](_0x0402('0x37'),_0x3d4004['uniqueid'],util[_0x0402('0x27')](_0x3d4004,{'showHidden':![],'depth':null}));this[_0x0402('0x38')](_0x3d4004[_0x0402('0x19')],_[_0x0402('0x39')](_0x3d4004[_0x0402('0x3a')])[0x0],_0x3d4004[_0x0402('0x3b')]);if(this[_0x0402('0x17')](_0x3d4004[_0x0402('0x3a')])&&this[_0x0402('0x17')](_0x3d4004[_0x0402('0x3a')][_0x0402('0x3c')])){if(_['isUndefined'](this[_0x0402('0x9')][_0x3d4004[_0x0402('0x19')]])){this['channels'][_0x3d4004[_0x0402('0x19')]]={'routeId':_0x3d4004[_0x0402('0x3b')],'variables':this[_0x0402('0xd')][_0x3d4004[_0x0402('0x19')]],'motionChannel':_0x0402('0x3d')};logger[_0x0402('0x23')](_0x0402('0x3e'),_0x3d4004[_0x0402('0x19')],_0x3d4004[_0x0402('0x3a')][_0x0402('0x3c')],_[_0x0402('0x39')](_0x3d4004[_0x0402('0x3a')])[0x0],_0x3d4004[_0x0402('0x3b')]);logger[_0x0402('0x25')](_0x0402('0x3f'),_0x3d4004[_0x0402('0x19')],util['inspect'](this[_0x0402('0x9')][_0x3d4004[_0x0402('0x19')]],{'showHidden':![],'depth':null}));this[_0x0402('0x16')]('voice:outbound',_0x0402('0x29'),this['channels'][_0x3d4004['uniqueid']]);}}}}catch(_0x1db004){logger[_0x0402('0x2b')](_0x0402('0x40'),_0x3d4004[_0x0402('0x19')],util[_0x0402('0x27')](_0x1db004,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x0402('0x38')]=function(_0x1d2087,_0x1e74cd,_0x178ee2){var _0x2d06ab=[_0x0402('0x41'),_0x0402('0x42'),_0x0402('0x43'),_0x0402('0x44'),_0x0402('0x45'),_0x0402('0x46'),_0x0402('0x47'),_0x0402('0x48'),_0x0402('0x49'),'sipuri',_0x0402('0x4a'),'bridgepvtcallid',_0x0402('0x4b'),_0x0402('0x4c'),_0x0402('0x4d'),_0x0402('0x4e'),_0x0402('0x4f'),_0x0402('0x50'),_0x0402('0x51')];if(!_[_0x0402('0x52')](_0x1e74cd)&&!_[_0x0402('0x53')](_0x2d06ab,_0x1e74cd)){if(_['isUndefined'](this[_0x0402('0xd')][_0x1d2087])){this[_0x0402('0xd')][_0x1d2087]={};}this['variables'][_0x1d2087][_0x1e74cd]=_0x178ee2;}};VoiceDialReport[_0x0402('0x14')][_0x0402('0x13')]=function(_0x2ea6fe){try{if(this[_0x0402('0x17')](_0x2ea6fe)){logger[_0x0402('0x25')](_0x0402('0x54'),_0x2ea6fe[_0x0402('0x19')],util['inspect'](_0x2ea6fe,{'showHidden':![],'depth':null}));if(this[_0x0402('0x9')][_0x2ea6fe['uniqueid']]){logger[_0x0402('0x23')](_0x0402('0x55'),_0x2ea6fe[_0x0402('0x19')],_0x2ea6fe[_0x0402('0x56')]);this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]][_0x0402('0x57')]=moment()['format'](_0x0402('0x1c'));this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]][_0x0402('0x58')]=moment(this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]][_0x0402('0x57')])[_0x0402('0x59')](this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]][_0x0402('0x5a')],_0x0402('0x5b'));this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]]['lastevent']='complete';this[_0x0402('0xb')]['total']+=0x1;if(this[_0x0402('0x9')][_0x2ea6fe['uniqueid']][_0x0402('0x31')]){this[_0x0402('0xb')]['answered']+=0x1;this[_0x0402('0x9')][_0x2ea6fe['uniqueid']][_0x0402('0x5c')]=moment(this['channels'][_0x2ea6fe['uniqueid']][_0x0402('0x31')])['diff'](this[_0x0402('0x9')][_0x2ea6fe['uniqueid']][_0x0402('0x5a')],_0x0402('0x5b'));this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]][_0x0402('0x5d')]=moment(this[_0x0402('0x9')][_0x2ea6fe['uniqueid']][_0x0402('0x57')])[_0x0402('0x59')](this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]]['answertime'],'seconds');this[_0x0402('0xb')][_0x0402('0x5e')]+=this['channels'][_0x2ea6fe['uniqueid']][_0x0402('0x5c')]||0x0;this[_0x0402('0xb')][_0x0402('0x5f')]+=this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]][_0x0402('0x5d')];}this[_0x0402('0xb')][_0x0402('0x60')]+=this['channels'][_0x2ea6fe[_0x0402('0x19')]][_0x0402('0x58')];logger[_0x0402('0x25')](_0x0402('0x61'),_0x2ea6fe[_0x0402('0x19')],util[_0x0402('0x27')](this[_0x0402('0x9')][_0x2ea6fe['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x0402('0x16')](_0x0402('0x62'),this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]]);logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x2ea6fe[_0x0402('0x19')],util[_0x0402('0x27')](this['channels'][_0x2ea6fe[_0x0402('0x19')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0402('0x63'),this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]]);logger[_0x0402('0x25')](_0x0402('0x64'),_0x2ea6fe[_0x0402('0x19')],util['inspect'](this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]],{'showHidden':![],'depth':null}));this[_0x0402('0x16')]('voice:outbound',_0x0402('0x65'),this[_0x0402('0xb')]);logger['info'](_0x0402('0x66'),JSON[_0x0402('0x67')](this[_0x0402('0x9')][_0x2ea6fe['uniqueid']]));logger[_0x0402('0x25')](_0x0402('0x68'),_0x2ea6fe[_0x0402('0x19')],util['inspect'](this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]],{'showHidden':![],'depth':null}));this['emit'](_0x0402('0x28'),'voice_outbound_channel:remove',this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]]);this[_0x0402('0x69')](_0x2ea6fe[_0x0402('0x19')]);}else if(this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x6a')]]){this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x6a')]][_0x0402('0x19')]=this[_0x0402('0x9')][_0x2ea6fe['linkedid']][_0x0402('0x6b')];}if(this[_0x0402('0xd')][_0x2ea6fe[_0x0402('0x19')]]){delete this['variables'][_0x2ea6fe['uniqueid']];}}}catch(_0x114ffd){logger[_0x0402('0x2b')](_0x0402('0x6c'),_0x2ea6fe[_0x0402('0x19')],util[_0x0402('0x27')](_0x114ffd,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x0402('0x6d')]=function(_0xf3c05d){try{if(this['isNotNull'](_0xf3c05d)){logger[_0x0402('0x25')](_0x0402('0x6e'),_0xf3c05d[_0x0402('0x19')],util[_0x0402('0x27')](_0xf3c05d,{'showHidden':![],'depth':null}));if(_0xf3c05d['application'][_0x0402('0x6f')]()==='set'){_0xf3c05d[_0x0402('0x70')]=(_0xf3c05d[_0x0402('0x71')]||_0xf3c05d[_0x0402('0x70')])[_0x0402('0x6f')]();if(_[_0x0402('0x72')](_0xf3c05d['applicationdata'],_0x0402('0x73'))){if(_[_0x0402('0x15')](this[_0x0402('0xc')][_0xf3c05d[_0x0402('0x19')]]))this[_0x0402('0xc')][_0xf3c05d[_0x0402('0x19')]]={};logger[_0x0402('0x23')](_0x0402('0x74'),_0xf3c05d[_0x0402('0x19')],_0xf3c05d['application'],_0xf3c05d[_0x0402('0x70')]);var _0x373971=_0xf3c05d[_0x0402('0x70')][_0x0402('0x75')]('=');var _0xd04699=_0x373971[0x0][_0x0402('0x76')](/cdr\((.*)\)/);if(_0xd04699)this[_0x0402('0xc')][_0xf3c05d[_0x0402('0x19')]][_0xd04699[0x1]]=_0x373971[0x1];}}}}catch(_0x24ed10){logger[_0x0402('0x2b')]('[%s][voiceDialReport][newexten]',_0xf3c05d[_0x0402('0x19')],util[_0x0402('0x27')](_0x24ed10,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0402('0x14')]['deleteChannelAfterTimeout']=function(_0x1d2f8b,_0x476647=0x2710){if(this[_0x0402('0x9')][_0x1d2f8b]){setTimeout(()=>{delete this[_0x0402('0x9')][_0x1d2f8b];},_0x476647);}};module[_0x0402('0x77')]=VoiceDialReport;
\ No newline at end of file