Built motion from commit 362b9399b4d0ed5560fbb795af995925d345fc38. Version 3.0.0...
[motion-next.git] / server / services / ami / report / voiceDialReport.js
1 const a1265_0x7a61=['starttime','ANSWER','connect','billableseconds','outbound','endtime','[%s][voiceDialReport][hangup]\x20event:','memberdynamic','lodash','keys','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','merge','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]\x20event:','seconds','sipuri','bridgepeer','destuniqueid','custom:dialend','exports','rtpaudioqoslossbridged','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','addVariable','custom:dialbegin','sumDuration','rtpaudioqosbridged','rtpaudioqosjitterbridged','voice_outbound_channel:save','rtpaudioqos','[%s][voiceDialReport][dialbegin]\x20event:','debug','sipcallid','sumBillable','outboundChannels','uniqueid','syncVarSet','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','isNotNull','called','total','YYYY-MM-DD\x20HH:mm:ss','memberlastcall','ami','../../../rediscache','variable','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','syncDialBegin','channels','[%s][voiceDialReport][dialend]\x20event:','variables','omit','answertime','custom:dialconnect','answered','emit','../../../config/logger','lastevent','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','memberinterface','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','voice_outbound_channel:remove','bridgepvtcallid','channel','memberpenalty','custom:voiceDialReport','sumHoldTime','connectedlinename','outboundrouteid','stringify','hangup','isUndefined','lastIndexOf','syncHangup','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','interface','linkedid','substring','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','membercalls','duration','format','[%s][voiceDialReport][varset]','value','includes','dialend','bind','info','diff','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','rtpaudioqosjitter','moment','error','varset','inspect','prototype','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','syncDialEnd','util','holdtime','membername','rtpaudioqosrtt','voice_outbound:save','cause-txt','voice:outbound','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','dialstatus'];(function(_0x46ed1a,_0x5a703c){const _0x7a613a=function(_0x4fbb0a){while(--_0x4fbb0a){_0x46ed1a['push'](_0x46ed1a['shift']());}};_0x7a613a(++_0x5a703c);}(a1265_0x7a61,0x1a8));const a1265_0x4fbb=function(_0x46ed1a,_0x5a703c){_0x46ed1a=_0x46ed1a-0x132;let _0x7a613a=a1265_0x7a61[_0x46ed1a];return _0x7a613a;};const a1265_0xb91ee0=a1265_0x4fbb;'use strict';const _=require(a1265_0xb91ee0(0x14a)),moment=require(a1265_0xb91ee0(0x132)),util=require(a1265_0xb91ee0(0x139)),logger=require(a1265_0xb91ee0(0x17d))(a1265_0xb91ee0(0x16f)),ami=require('../ami'),{getSocket}=require(a1265_0xb91ee0(0x170)),io=getSocket();function VoiceDialReport(_0x409b45){const _0x3bf38d=a1265_0xb91ee0;this[_0x3bf38d(0x175)]=_0x409b45[_0x3bf38d(0x166)],this[_0x3bf38d(0x146)]=_0x409b45[_0x3bf38d(0x146)],this['variables']={},ami['on']('dialbegin',this['syncDialBegin'][_0x3bf38d(0x19b)](this)),ami['on'](_0x3bf38d(0x19a),this[_0x3bf38d(0x138)][_0x3bf38d(0x19b)](this)),ami['on'](_0x3bf38d(0x134),this[_0x3bf38d(0x168)][_0x3bf38d(0x19b)](this)),ami['on'](_0x3bf38d(0x18b),this[_0x3bf38d(0x18e)]['bind'](this));}VoiceDialReport['prototype'][a1265_0xb91ee0(0x16a)]=function(_0x3cba2b){const _0x25313d=a1265_0xb91ee0;return _0x3cba2b!==null&&!_[_0x25313d(0x18c)](_0x3cba2b);},VoiceDialReport['prototype'][a1265_0xb91ee0(0x17c)]=function(_0xe584d0,_0x37eccc,_0x14e850){const _0x2cacdb=a1265_0xb91ee0;io['to'](_0xe584d0)[_0x2cacdb(0x17c)](_0x37eccc,_0x14e850);},VoiceDialReport['prototype'][a1265_0xb91ee0(0x174)]=function(_0x3fa983){const _0x2a892e=a1265_0xb91ee0;try{this['isNotNull'](_0x3fa983)&&(logger[_0x2a892e(0x163)](_0x2a892e(0x162),_0x3fa983[_0x2a892e(0x167)],util[_0x2a892e(0x135)](_0x3fa983,{'showHidden':![],'depth':null})),this[_0x2a892e(0x175)][_0x3fa983['uniqueid']]&&(_[_0x2a892e(0x14d)](this[_0x2a892e(0x175)][_0x3fa983[_0x2a892e(0x167)]],{'starttime':moment()[_0x2a892e(0x196)](_0x2a892e(0x16d)),'lastevent':_0x2a892e(0x16b),'interface':_0x3fa983['channel'][_0x2a892e(0x192)](0x0,_0x3fa983['channel'][_0x2a892e(0x18d)]('-')),'membername':_0x3fa983[_0x2a892e(0x184)][_0x2a892e(0x192)](_0x3fa983[_0x2a892e(0x184)][_0x2a892e(0x18d)]('/')+0x1,_0x3fa983[_0x2a892e(0x184)][_0x2a892e(0x18d)]('-'))},_[_0x2a892e(0x178)](_0x3fa983,['event','privilege'])),logger['info'](_0x2a892e(0x159),_0x3fa983['uniqueid'],this['channels'][_0x3fa983[_0x2a892e(0x167)]][_0x2a892e(0x13b)],this['channels'][_0x3fa983['uniqueid']][_0x2a892e(0x190)]),logger['debug'](_0x2a892e(0x158),_0x3fa983[_0x2a892e(0x167)],util[_0x2a892e(0x135)](this['channels'][_0x3fa983['uniqueid']],{'showHidden':![],'depth':null})),this[_0x2a892e(0x17c)](_0x2a892e(0x13f),_0x2a892e(0x160),this['channels'][_0x3fa983[_0x2a892e(0x167)]]),logger[_0x2a892e(0x163)](_0x2a892e(0x193),_0x3fa983[_0x2a892e(0x167)],util[_0x2a892e(0x135)](this['channels'][_0x3fa983[_0x2a892e(0x167)]],{'showHidden':![],'depth':null})),ami[_0x2a892e(0x17c)](_0x2a892e(0x15c),this['channels'][_0x3fa983[_0x2a892e(0x167)]])));}catch(_0x4e24be){logger[_0x2a892e(0x133)]('[%s][voiceDialReport][dialbegin]',_0x3fa983[_0x2a892e(0x167)],util[_0x2a892e(0x135)](_0x4e24be,{'showHidden':![],'depth':null}));}},VoiceDialReport[a1265_0xb91ee0(0x136)]['syncDialEnd']=function(_0x153bf7){const _0xe00390=a1265_0xb91ee0;try{this[_0xe00390(0x16a)](_0x153bf7)&&(logger[_0xe00390(0x163)](_0xe00390(0x176),_0x153bf7[_0xe00390(0x167)],util[_0xe00390(0x135)](_0x153bf7,{'showHidden':![],'depth':null})),this[_0xe00390(0x175)][_0x153bf7[_0xe00390(0x167)]]&&(this['channels'][_0x153bf7[_0xe00390(0x167)]][_0xe00390(0x141)]=_0x153bf7[_0xe00390(0x141)],_0x153bf7[_0xe00390(0x141)]===_0xe00390(0x143)&&(this[_0xe00390(0x175)][_0x153bf7[_0xe00390(0x167)]]['connectedlinenum']=_0x153bf7['connectedlinenum'],this[_0xe00390(0x175)][_0x153bf7[_0xe00390(0x167)]][_0xe00390(0x188)]=_0x153bf7[_0xe00390(0x188)],this[_0xe00390(0x175)][_0x153bf7[_0xe00390(0x167)]][_0xe00390(0x179)]=moment()[_0xe00390(0x196)](_0xe00390(0x16d)),this['channels'][_0x153bf7[_0xe00390(0x167)]][_0xe00390(0x17e)]=_0xe00390(0x144),logger[_0xe00390(0x19c)](_0xe00390(0x14c),_0x153bf7[_0xe00390(0x167)],_0x153bf7['channel'][_0xe00390(0x192)](_0x153bf7['channel'][_0xe00390(0x18d)]('/')+0x1,_0x153bf7[_0xe00390(0x184)]['lastIndexOf']('-'))),logger[_0xe00390(0x163)](_0xe00390(0x15a),_0x153bf7['uniqueid'],util[_0xe00390(0x135)](this[_0xe00390(0x175)][_0x153bf7[_0xe00390(0x167)]],{'showHidden':![],'depth':null})),ami[_0xe00390(0x17c)](_0xe00390(0x17a),this[_0xe00390(0x175)][_0x153bf7['uniqueid']])),logger[_0xe00390(0x163)](_0xe00390(0x140),_0x153bf7[_0xe00390(0x167)],util[_0xe00390(0x135)](this[_0xe00390(0x175)][_0x153bf7[_0xe00390(0x167)]],{'showHidden':![],'depth':null})),this[_0xe00390(0x17c)]('voice:outbound',_0xe00390(0x160),this[_0xe00390(0x175)][_0x153bf7[_0xe00390(0x167)]])));}catch(_0x20e14d){logger[_0xe00390(0x133)](_0xe00390(0x172),_0x153bf7[_0xe00390(0x167)],util[_0xe00390(0x135)](_0x20e14d,{'showHidden':![],'depth':null}));}},VoiceDialReport[a1265_0xb91ee0(0x136)][a1265_0xb91ee0(0x168)]=function(_0x1d74ca){const _0x48c34b=a1265_0xb91ee0;try{this[_0x48c34b(0x16a)](_0x1d74ca)&&(logger[_0x48c34b(0x163)](_0x48c34b(0x14f),_0x1d74ca[_0x48c34b(0x167)],util[_0x48c34b(0x135)](_0x1d74ca,{'showHidden':![],'depth':null})),this[_0x48c34b(0x15b)](_0x1d74ca[_0x48c34b(0x167)],_[_0x48c34b(0x14b)](_0x1d74ca[_0x48c34b(0x171)])[0x0],_0x1d74ca[_0x48c34b(0x198)]),this[_0x48c34b(0x16a)](_0x1d74ca['variable'])&&this[_0x48c34b(0x16a)](_0x1d74ca['variable'][_0x48c34b(0x189)])&&(_[_0x48c34b(0x18c)](this[_0x48c34b(0x175)][_0x1d74ca[_0x48c34b(0x167)]])&&(this['channels'][_0x1d74ca[_0x48c34b(0x167)]]={'routeId':_0x1d74ca['value'],'variables':this['variables'][_0x1d74ca[_0x48c34b(0x167)]]},logger[_0x48c34b(0x19c)](_0x48c34b(0x17f),_0x1d74ca['uniqueid'],_0x1d74ca[_0x48c34b(0x171)][_0x48c34b(0x189)],_[_0x48c34b(0x14b)](_0x1d74ca['variable'])[0x0],_0x1d74ca[_0x48c34b(0x198)]),logger[_0x48c34b(0x163)](_0x48c34b(0x14e),_0x1d74ca[_0x48c34b(0x167)],util[_0x48c34b(0x135)](this['channels'][_0x1d74ca['uniqueid']],{'showHidden':![],'depth':null})),this[_0x48c34b(0x17c)](_0x48c34b(0x13f),'voice_outbound_channel:save',this[_0x48c34b(0x175)][_0x1d74ca[_0x48c34b(0x167)]]))));}catch(_0x117b9f){logger[_0x48c34b(0x133)](_0x48c34b(0x197),_0x1d74ca[_0x48c34b(0x167)],util[_0x48c34b(0x135)](_0x117b9f,{'showHidden':![],'depth':null}));}},VoiceDialReport[a1265_0xb91ee0(0x136)][a1265_0xb91ee0(0x15b)]=function(_0x139197,_0x22d015,_0x16e11c){const _0x187c08=a1265_0xb91ee0,_0xbbf245=[_0x187c08(0x161),_0x187c08(0x15e),_0x187c08(0x19f),_0x187c08(0x15f),'rtpaudioqosloss',_0x187c08(0x156),_0x187c08(0x13c),'rtpaudioqosrttbridged',_0x187c08(0x164),_0x187c08(0x151),_0x187c08(0x152),_0x187c08(0x183),_0x187c08(0x194),_0x187c08(0x149),_0x187c08(0x180),_0x187c08(0x16e),_0x187c08(0x13b),_0x187c08(0x185),'memberrealtime'];!_['isNil'](_0x22d015)&&!_[_0x187c08(0x199)](_0xbbf245,_0x22d015)&&(_[_0x187c08(0x18c)](this[_0x187c08(0x177)][_0x139197])&&(this[_0x187c08(0x177)][_0x139197]={}),this['variables'][_0x139197][_0x22d015]=_0x16e11c);},VoiceDialReport[a1265_0xb91ee0(0x136)][a1265_0xb91ee0(0x18e)]=function(_0x9a8bc){const _0x17a44d=a1265_0xb91ee0;try{if(this['isNotNull'](_0x9a8bc)){logger[_0x17a44d(0x163)](_0x17a44d(0x148),_0x9a8bc[_0x17a44d(0x167)],util[_0x17a44d(0x135)](_0x9a8bc,{'showHidden':![],'depth':null}));if(this[_0x17a44d(0x175)][_0x9a8bc[_0x17a44d(0x167)]])logger[_0x17a44d(0x19c)](_0x17a44d(0x181),_0x9a8bc['uniqueid'],_0x9a8bc[_0x17a44d(0x13e)]),this[_0x17a44d(0x175)][_0x9a8bc[_0x17a44d(0x167)]]['endtime']=moment()[_0x17a44d(0x196)](_0x17a44d(0x16d)),this[_0x17a44d(0x175)][_0x9a8bc['uniqueid']][_0x17a44d(0x195)]=moment(this[_0x17a44d(0x175)][_0x9a8bc[_0x17a44d(0x167)]]['endtime'])[_0x17a44d(0x19d)](this[_0x17a44d(0x175)][_0x9a8bc[_0x17a44d(0x167)]][_0x17a44d(0x142)],_0x17a44d(0x150)),this[_0x17a44d(0x175)][_0x9a8bc[_0x17a44d(0x167)]][_0x17a44d(0x17e)]='complete',this[_0x17a44d(0x146)][_0x17a44d(0x16c)]+=0x1,this[_0x17a44d(0x175)][_0x9a8bc[_0x17a44d(0x167)]][_0x17a44d(0x179)]&&(this[_0x17a44d(0x146)][_0x17a44d(0x17b)]+=0x1,this['channels'][_0x9a8bc[_0x17a44d(0x167)]][_0x17a44d(0x13a)]=moment(this[_0x17a44d(0x175)][_0x9a8bc['uniqueid']][_0x17a44d(0x179)])[_0x17a44d(0x19d)](this[_0x17a44d(0x175)][_0x9a8bc[_0x17a44d(0x167)]]['starttime'],_0x17a44d(0x150)),this['channels'][_0x9a8bc[_0x17a44d(0x167)]][_0x17a44d(0x145)]=moment(this[_0x17a44d(0x175)][_0x9a8bc['uniqueid']][_0x17a44d(0x147)])[_0x17a44d(0x19d)](this[_0x17a44d(0x175)][_0x9a8bc[_0x17a44d(0x167)]][_0x17a44d(0x179)],'seconds'),this['outbound'][_0x17a44d(0x187)]+=this[_0x17a44d(0x175)][_0x9a8bc['uniqueid']][_0x17a44d(0x13a)]||0x0,this[_0x17a44d(0x146)][_0x17a44d(0x165)]+=this['channels'][_0x9a8bc['uniqueid']]['billableseconds']),this[_0x17a44d(0x146)][_0x17a44d(0x15d)]+=this['channels'][_0x9a8bc['uniqueid']][_0x17a44d(0x195)],logger[_0x17a44d(0x163)](_0x17a44d(0x137),_0x9a8bc['uniqueid'],util[_0x17a44d(0x135)](this[_0x17a44d(0x175)][_0x9a8bc[_0x17a44d(0x167)]],{'showHidden':![],'depth':null})),ami[_0x17a44d(0x17c)](_0x17a44d(0x186),this[_0x17a44d(0x175)][_0x9a8bc[_0x17a44d(0x167)]]),logger['debug'](_0x17a44d(0x173),_0x9a8bc[_0x17a44d(0x167)],util['inspect'](this[_0x17a44d(0x175)][_0x9a8bc[_0x17a44d(0x167)]],{'showHidden':![],'depth':null})),ami[_0x17a44d(0x17c)](_0x17a44d(0x154),this[_0x17a44d(0x175)][_0x9a8bc[_0x17a44d(0x167)]]),logger['debug'](_0x17a44d(0x19e),_0x9a8bc[_0x17a44d(0x167)],util['inspect'](this[_0x17a44d(0x175)][_0x9a8bc[_0x17a44d(0x167)]],{'showHidden':![],'depth':null})),this[_0x17a44d(0x17c)](_0x17a44d(0x13f),_0x17a44d(0x13d),this[_0x17a44d(0x146)]),logger['info'](_0x17a44d(0x18f),JSON[_0x17a44d(0x18a)](this[_0x17a44d(0x175)][_0x9a8bc[_0x17a44d(0x167)]])),logger[_0x17a44d(0x163)](_0x17a44d(0x169),_0x9a8bc[_0x17a44d(0x167)],util[_0x17a44d(0x135)](this['channels'][_0x9a8bc[_0x17a44d(0x167)]],{'showHidden':![],'depth':null})),this[_0x17a44d(0x17c)](_0x17a44d(0x13f),_0x17a44d(0x182),this[_0x17a44d(0x175)][_0x9a8bc['uniqueid']]),delete this[_0x17a44d(0x175)][_0x9a8bc[_0x17a44d(0x167)]];else this[_0x17a44d(0x175)][_0x9a8bc[_0x17a44d(0x191)]]&&(this[_0x17a44d(0x175)][_0x9a8bc['linkedid']][_0x17a44d(0x167)]=this[_0x17a44d(0x175)][_0x9a8bc['linkedid']][_0x17a44d(0x153)]);this[_0x17a44d(0x177)][_0x9a8bc[_0x17a44d(0x167)]]&&delete this[_0x17a44d(0x177)][_0x9a8bc[_0x17a44d(0x167)]];}}catch(_0x50d54d){logger[_0x17a44d(0x133)](_0x17a44d(0x157),_0x9a8bc[_0x17a44d(0x167)],util[_0x17a44d(0x135)](_0x50d54d,{'showHidden':![],'depth':null}));}},module[a1265_0xb91ee0(0x155)]=VoiceDialReport;