Built motion from commit f67b3b02.|2.6.31
[motion2.git] / server / services / ami / report / voiceDialReport.js
index bebb8f3..0da32c5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1403=['moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','applications','variables','dialbegin','syncDialBegin','dialend','syncVarSet','bind','isNotNull','isUndefined','prototype','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','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','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','error','[%s][voiceDialReport][dialbegin]','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][dialend]','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','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipuri','bridgepvtcallid','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','syncHangup','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','endtime','diff','starttime','seconds','complete','total','holdtime','billableseconds','sumHoldTime','duration','[%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','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','toLowerCase','set','applicationdata','appdata','cdr(','application','split','match','exports','lodash'];(function(_0x5b697a,_0x280202){var _0x5de43b=function(_0x2bc32f){while(--_0x2bc32f){_0x5b697a['push'](_0x5b697a['shift']());}};_0x5de43b(++_0x280202);}(_0x1403,0x167));var _0x3140=function(_0x18f386,_0x48a562){_0x18f386=_0x18f386-0x0;var _0x331244=_0x1403[_0x18f386];return _0x331244;};'use strict';var _=require(_0x3140('0x0'));var moment=require(_0x3140('0x1'));var util=require(_0x3140('0x2'));var Redis=require(_0x3140('0x3'));var config=require(_0x3140('0x4'));var logger=require(_0x3140('0x5'))('ami');var ami=require(_0x3140('0x6'));config[_0x3140('0x7')]=_[_0x3140('0x8')](config['redis'],{'host':_0x3140('0x9'),'port':0x18eb});var io=require(_0x3140('0xa'))(new Redis(config[_0x3140('0x7')]));function VoiceDialReport(_0x444f49){this[_0x3140('0xb')]=_0x444f49[_0x3140('0xc')];this[_0x3140('0xd')]=_0x444f49[_0x3140('0xd')];this[_0x3140('0xe')]={};this[_0x3140('0xf')]={};ami['on'](_0x3140('0x10'),this[_0x3140('0x11')]['bind'](this));ami['on'](_0x3140('0x12'),this['syncDialEnd']['bind'](this));ami['on']('varset',this[_0x3140('0x13')]['bind'](this));ami['on']('hangup',this['syncHangup'][_0x3140('0x14')](this));}VoiceDialReport['prototype'][_0x3140('0x15')]=function(_0x4afcf5){return _0x4afcf5!==null&&!_[_0x3140('0x16')](_0x4afcf5);};VoiceDialReport[_0x3140('0x17')][_0x3140('0x18')]=function(_0x3a3d9f,_0x2e16d9,_0x46519b){io['to'](_0x3a3d9f)[_0x3140('0x18')](_0x2e16d9,_0x46519b);};VoiceDialReport[_0x3140('0x17')]['syncDialBegin']=function(_0x1c066c){try{if(this[_0x3140('0x15')](_0x1c066c)){logger[_0x3140('0x19')](_0x3140('0x1a'),_0x1c066c[_0x3140('0x1b')],util[_0x3140('0x1c')](_0x1c066c,{'showHidden':![],'depth':null}));if(this[_0x3140('0xb')][_0x1c066c[_0x3140('0x1b')]]){_[_0x3140('0x1d')](this[_0x3140('0xb')][_0x1c066c[_0x3140('0x1b')]],{'starttime':moment()[_0x3140('0x1e')](_0x3140('0x1f')),'lastevent':_0x3140('0x20'),'interface':_0x1c066c[_0x3140('0x21')]['substring'](0x0,_0x1c066c[_0x3140('0x21')][_0x3140('0x22')]('-')),'membername':_0x1c066c[_0x3140('0x21')][_0x3140('0x23')](_0x1c066c[_0x3140('0x21')][_0x3140('0x22')]('/')+0x1,_0x1c066c['channel'][_0x3140('0x22')]('-'))},_[_0x3140('0x24')](_0x1c066c,[_0x3140('0x25'),_0x3140('0x26')]));logger[_0x3140('0x27')](_0x3140('0x28'),_0x1c066c['uniqueid'],this[_0x3140('0xb')][_0x1c066c[_0x3140('0x1b')]][_0x3140('0x29')],this[_0x3140('0xb')][_0x1c066c[_0x3140('0x1b')]][_0x3140('0x2a')]);logger['debug'](_0x3140('0x2b'),_0x1c066c[_0x3140('0x1b')],util[_0x3140('0x1c')](this['channels'][_0x1c066c['uniqueid']],{'showHidden':![],'depth':null}));if(this[_0x3140('0xe')][_0x1c066c[_0x3140('0x1b')]])_[_0x3140('0x1d')](this['channels'][_0x1c066c[_0x3140('0x1b')]],this[_0x3140('0xe')][_0x1c066c['uniqueid']]);this[_0x3140('0x18')]('voice:outbound',_0x3140('0x2c'),this[_0x3140('0xb')][_0x1c066c[_0x3140('0x1b')]]);logger['debug'](_0x3140('0x2d'),_0x1c066c[_0x3140('0x1b')],util[_0x3140('0x1c')](this[_0x3140('0xb')][_0x1c066c[_0x3140('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x3140('0x18')]('custom:dialbegin',this[_0x3140('0xb')][_0x1c066c['uniqueid']]);}}}catch(_0x2153b0){logger[_0x3140('0x2e')](_0x3140('0x2f'),_0x1c066c[_0x3140('0x1b')],util['inspect'](_0x2153b0,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x3140('0x17')][_0x3140('0x30')]=function(_0x1312dc){try{if(this[_0x3140('0x15')](_0x1312dc)){logger[_0x3140('0x19')](_0x3140('0x31'),_0x1312dc[_0x3140('0x1b')],util['inspect'](_0x1312dc,{'showHidden':![],'depth':null}));if(this['channels'][_0x1312dc[_0x3140('0x1b')]]){this[_0x3140('0xb')][_0x1312dc['uniqueid']]['dialstatus']=_0x1312dc[_0x3140('0x32')];if(_0x1312dc[_0x3140('0x32')]===_0x3140('0x33')){this[_0x3140('0xb')][_0x1312dc[_0x3140('0x1b')]][_0x3140('0x34')]=_0x1312dc[_0x3140('0x34')];this['channels'][_0x1312dc[_0x3140('0x1b')]][_0x3140('0x35')]=_0x1312dc[_0x3140('0x35')];this['channels'][_0x1312dc[_0x3140('0x1b')]][_0x3140('0x36')]=moment()['format'](_0x3140('0x1f'));this[_0x3140('0xb')][_0x1312dc[_0x3140('0x1b')]][_0x3140('0x37')]=_0x3140('0x38');logger[_0x3140('0x27')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x1312dc['uniqueid'],_0x1312dc['channel'][_0x3140('0x23')](_0x1312dc[_0x3140('0x21')][_0x3140('0x22')]('/')+0x1,_0x1312dc[_0x3140('0x21')]['lastIndexOf']('-')));logger[_0x3140('0x19')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x1312dc['uniqueid'],util[_0x3140('0x1c')](this['channels'][_0x1312dc[_0x3140('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x3140('0x18')](_0x3140('0x39'),this[_0x3140('0xb')][_0x1312dc['uniqueid']]);}logger[_0x3140('0x19')](_0x3140('0x3a'),_0x1312dc[_0x3140('0x1b')],util[_0x3140('0x1c')](this[_0x3140('0xb')][_0x1312dc[_0x3140('0x1b')]],{'showHidden':![],'depth':null}));this[_0x3140('0x18')](_0x3140('0x3b'),_0x3140('0x2c'),this[_0x3140('0xb')][_0x1312dc[_0x3140('0x1b')]]);}}}catch(_0x18ec5b){logger[_0x3140('0x2e')](_0x3140('0x3c'),_0x1312dc[_0x3140('0x1b')],util[_0x3140('0x1c')](_0x18ec5b,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x3140('0x17')][_0x3140('0x13')]=function(_0x169d67){try{if(this[_0x3140('0x15')](_0x169d67)){logger[_0x3140('0x19')]('[%s][voiceDialReport][varset]\x20event:',_0x169d67['uniqueid'],util[_0x3140('0x1c')](_0x169d67,{'showHidden':![],'depth':null}));this[_0x3140('0x3d')](_0x169d67[_0x3140('0x1b')],_[_0x3140('0x3e')](_0x169d67[_0x3140('0x3f')])[0x0],_0x169d67['value']);if(this['isNotNull'](_0x169d67[_0x3140('0x3f')])&&this[_0x3140('0x15')](_0x169d67[_0x3140('0x3f')]['outboundrouteid'])){if(_['isUndefined'](this[_0x3140('0xb')][_0x169d67[_0x3140('0x1b')]])){this[_0x3140('0xb')][_0x169d67[_0x3140('0x1b')]]={'routeId':_0x169d67[_0x3140('0x40')],'variables':this[_0x3140('0xf')][_0x169d67[_0x3140('0x1b')]],'motionChannel':_0x3140('0x41')};logger['info'](_0x3140('0x42'),_0x169d67[_0x3140('0x1b')],_0x169d67['variable'][_0x3140('0x43')],_[_0x3140('0x3e')](_0x169d67[_0x3140('0x3f')])[0x0],_0x169d67[_0x3140('0x40')]);logger[_0x3140('0x19')](_0x3140('0x44'),_0x169d67[_0x3140('0x1b')],util[_0x3140('0x1c')](this[_0x3140('0xb')][_0x169d67[_0x3140('0x1b')]],{'showHidden':![],'depth':null}));this[_0x3140('0x18')](_0x3140('0x3b'),_0x3140('0x2c'),this[_0x3140('0xb')][_0x169d67[_0x3140('0x1b')]]);}}}}catch(_0x227833){logger[_0x3140('0x2e')]('[%s][voiceDialReport][varset]',_0x169d67[_0x3140('0x1b')],util[_0x3140('0x1c')](_0x227833,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x3140('0x17')]['addVariable']=function(_0x3adfaf,_0x10f41f,_0x9fbce0){var _0x5a22fe=[_0x3140('0x45'),_0x3140('0x46'),_0x3140('0x47'),_0x3140('0x48'),_0x3140('0x49'),_0x3140('0x4a'),'rtpaudioqosrtt',_0x3140('0x4b'),'sipcallid',_0x3140('0x4c'),'bridgepeer',_0x3140('0x4d'),'membercalls','memberdynamic',_0x3140('0x4e'),_0x3140('0x4f'),'membername',_0x3140('0x50'),_0x3140('0x51')];if(!_[_0x3140('0x52')](_0x10f41f)&&!_[_0x3140('0x53')](_0x5a22fe,_0x10f41f)){if(_['isUndefined'](this[_0x3140('0xf')][_0x3adfaf])){this['variables'][_0x3adfaf]={};}this[_0x3140('0xf')][_0x3adfaf][_0x10f41f]=_0x9fbce0;}};VoiceDialReport[_0x3140('0x17')][_0x3140('0x54')]=function(_0x10a72c){try{if(this[_0x3140('0x15')](_0x10a72c)){logger[_0x3140('0x19')](_0x3140('0x55'),_0x10a72c[_0x3140('0x1b')],util[_0x3140('0x1c')](_0x10a72c,{'showHidden':![],'depth':null}));if(this[_0x3140('0xb')][_0x10a72c[_0x3140('0x1b')]]){logger[_0x3140('0x27')](_0x3140('0x56'),_0x10a72c[_0x3140('0x1b')],_0x10a72c['cause-txt']);this[_0x3140('0xb')][_0x10a72c[_0x3140('0x1b')]][_0x3140('0x57')]=moment()[_0x3140('0x1e')](_0x3140('0x1f'));this['channels'][_0x10a72c[_0x3140('0x1b')]]['duration']=moment(this['channels'][_0x10a72c[_0x3140('0x1b')]][_0x3140('0x57')])[_0x3140('0x58')](this[_0x3140('0xb')][_0x10a72c[_0x3140('0x1b')]][_0x3140('0x59')],_0x3140('0x5a'));this[_0x3140('0xb')][_0x10a72c['uniqueid']][_0x3140('0x37')]=_0x3140('0x5b');this[_0x3140('0xd')][_0x3140('0x5c')]+=0x1;if(this[_0x3140('0xb')][_0x10a72c[_0x3140('0x1b')]][_0x3140('0x36')]){this[_0x3140('0xd')]['answered']+=0x1;this[_0x3140('0xb')][_0x10a72c['uniqueid']][_0x3140('0x5d')]=moment(this['channels'][_0x10a72c[_0x3140('0x1b')]][_0x3140('0x36')])[_0x3140('0x58')](this['channels'][_0x10a72c[_0x3140('0x1b')]][_0x3140('0x59')],_0x3140('0x5a'));this[_0x3140('0xb')][_0x10a72c['uniqueid']][_0x3140('0x5e')]=moment(this[_0x3140('0xb')][_0x10a72c['uniqueid']]['endtime'])[_0x3140('0x58')](this['channels'][_0x10a72c[_0x3140('0x1b')]][_0x3140('0x36')],'seconds');this[_0x3140('0xd')][_0x3140('0x5f')]+=this[_0x3140('0xb')][_0x10a72c['uniqueid']][_0x3140('0x5d')]||0x0;this[_0x3140('0xd')]['sumBillable']+=this[_0x3140('0xb')][_0x10a72c[_0x3140('0x1b')]][_0x3140('0x5e')];}this['outbound']['sumDuration']+=this[_0x3140('0xb')][_0x10a72c[_0x3140('0x1b')]][_0x3140('0x60')];logger[_0x3140('0x19')](_0x3140('0x61'),_0x10a72c[_0x3140('0x1b')],util[_0x3140('0x1c')](this[_0x3140('0xb')][_0x10a72c['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x3140('0x62'),this[_0x3140('0xb')][_0x10a72c[_0x3140('0x1b')]]);logger[_0x3140('0x19')](_0x3140('0x63'),_0x10a72c[_0x3140('0x1b')],util[_0x3140('0x1c')](this[_0x3140('0xb')][_0x10a72c['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x3140('0x18')](_0x3140('0x64'),this[_0x3140('0xb')][_0x10a72c[_0x3140('0x1b')]]);logger[_0x3140('0x19')](_0x3140('0x65'),_0x10a72c[_0x3140('0x1b')],util[_0x3140('0x1c')](this[_0x3140('0xb')][_0x10a72c[_0x3140('0x1b')]],{'showHidden':![],'depth':null}));this[_0x3140('0x18')](_0x3140('0x3b'),_0x3140('0x66'),this['outbound']);logger[_0x3140('0x27')](_0x3140('0x67'),JSON['stringify'](this[_0x3140('0xb')][_0x10a72c[_0x3140('0x1b')]]));logger['debug'](_0x3140('0x68'),_0x10a72c[_0x3140('0x1b')],util[_0x3140('0x1c')](this[_0x3140('0xb')][_0x10a72c['uniqueid']],{'showHidden':![],'depth':null}));this[_0x3140('0x18')](_0x3140('0x3b'),_0x3140('0x69'),this[_0x3140('0xb')][_0x10a72c[_0x3140('0x1b')]]);this[_0x3140('0x6a')](_0x10a72c[_0x3140('0x1b')]);}else if(this['channels'][_0x10a72c['linkedid']]){this[_0x3140('0xb')][_0x10a72c[_0x3140('0x6b')]]['uniqueid']=this['channels'][_0x10a72c[_0x3140('0x6b')]][_0x3140('0x6c')];}if(this[_0x3140('0xf')][_0x10a72c['uniqueid']]){delete this['variables'][_0x10a72c[_0x3140('0x1b')]];}}}catch(_0x4d8101){logger[_0x3140('0x2e')](_0x3140('0x6d'),_0x10a72c[_0x3140('0x1b')],util['inspect'](_0x4d8101,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x3140('0x17')][_0x3140('0x6e')]=function(_0x4a59d0){try{if(this[_0x3140('0x15')](_0x4a59d0)){logger['debug']('[%s][voiceDialReport][newexten]\x20event:',_0x4a59d0[_0x3140('0x1b')],util[_0x3140('0x1c')](_0x4a59d0,{'showHidden':![],'depth':null}));if(_0x4a59d0['application'][_0x3140('0x6f')]()===_0x3140('0x70')){_0x4a59d0[_0x3140('0x71')]=(_0x4a59d0[_0x3140('0x72')]||_0x4a59d0['applicationdata'])[_0x3140('0x6f')]();if(_['startsWith'](_0x4a59d0[_0x3140('0x71')],_0x3140('0x73'))){if(_[_0x3140('0x16')](this['applications'][_0x4a59d0[_0x3140('0x1b')]]))this[_0x3140('0xe')][_0x4a59d0['uniqueid']]={};logger['info']('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x4a59d0[_0x3140('0x1b')],_0x4a59d0[_0x3140('0x74')],_0x4a59d0[_0x3140('0x71')]);var _0x396dc0=_0x4a59d0['applicationdata'][_0x3140('0x75')]('=');var _0x9bb15=_0x396dc0[0x0][_0x3140('0x76')](/cdr\((.*)\)/);if(_0x9bb15)this['applications'][_0x4a59d0[_0x3140('0x1b')]][_0x9bb15[0x1]]=_0x396dc0[0x1];}}}}catch(_0x111797){logger['error']('[%s][voiceDialReport][newexten]',_0x4a59d0[_0x3140('0x1b')],util[_0x3140('0x1c')](_0x111797,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x3140('0x17')]['deleteChannelAfterTimeout']=function(_0x19696d,_0x3afee3=0x2710){if(this['channels'][_0x19696d]){setTimeout(()=>{delete this['channels'][_0x19696d];},_0x3afee3);}};module[_0x3140('0x77')]=VoiceDialReport;
\ No newline at end of file
+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