Built motion from commit 97153652.|2.6.26
[motion2.git] / server / services / ami / report / voiceDialReport.js
index 812a14e..5b2eea0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6f47=['debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','membername','interface','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','connectedlinenum','connectedlinename','answertime','lastevent','connect','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%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]','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','cause-txt','starttime','seconds','complete','answered','billableseconds','endtime','diff','sumHoldTime','holdtime','duration','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][newexten]\x20event:','application','set','applicationdata','appdata','toLowerCase','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','[%s][voiceDialReport][newexten]','exports','moment','util','../../../config/environment','ami','redis','defaults','localhost','channels','outbound','applications','variables','dialbegin','dialend','syncDialEnd','syncVarSet','bind','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','syncDialBegin'];(function(_0x32ae47,_0xb4d351){var _0x105150=function(_0x1f9be6){while(--_0x1f9be6){_0x32ae47['push'](_0x32ae47['shift']());}};_0x105150(++_0xb4d351);}(_0x6f47,0xc7));var _0x76f4=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x6f47[_0x1e3c16];return _0x47a0c9;};'use strict';var _=require('lodash');var moment=require(_0x76f4('0x0'));var util=require(_0x76f4('0x1'));var Redis=require('ioredis');var config=require(_0x76f4('0x2'));var logger=require('../../../config/logger')(_0x76f4('0x3'));var ami=require('../ami');config[_0x76f4('0x4')]=_[_0x76f4('0x5')](config[_0x76f4('0x4')],{'host':_0x76f4('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x76f4('0x4')]));function VoiceDialReport(_0xfc2405){this[_0x76f4('0x7')]=_0xfc2405['outboundChannels'];this[_0x76f4('0x8')]=_0xfc2405[_0x76f4('0x8')];this[_0x76f4('0x9')]={};this[_0x76f4('0xa')]={};ami['on'](_0x76f4('0xb'),this['syncDialBegin']['bind'](this));ami['on'](_0x76f4('0xc'),this[_0x76f4('0xd')]['bind'](this));ami['on']('varset',this[_0x76f4('0xe')][_0x76f4('0xf')](this));ami['on'](_0x76f4('0x10'),this[_0x76f4('0x11')][_0x76f4('0xf')](this));}VoiceDialReport[_0x76f4('0x12')][_0x76f4('0x13')]=function(_0x3ec740){return _0x3ec740!==null&&!_[_0x76f4('0x14')](_0x3ec740);};VoiceDialReport['prototype'][_0x76f4('0x15')]=function(_0x30dabf,_0x5da1ff,_0x4b6021){io['to'](_0x30dabf)['emit'](_0x5da1ff,_0x4b6021);};VoiceDialReport[_0x76f4('0x12')][_0x76f4('0x16')]=function(_0x979946){try{if(this[_0x76f4('0x13')](_0x979946)){logger[_0x76f4('0x17')](_0x76f4('0x18'),_0x979946[_0x76f4('0x19')],util[_0x76f4('0x1a')](_0x979946,{'showHidden':![],'depth':null}));if(this[_0x76f4('0x7')][_0x979946[_0x76f4('0x19')]]){_[_0x76f4('0x1b')](this[_0x76f4('0x7')][_0x979946[_0x76f4('0x19')]],{'starttime':moment()[_0x76f4('0x1c')](_0x76f4('0x1d')),'lastevent':_0x76f4('0x1e'),'interface':_0x979946[_0x76f4('0x1f')][_0x76f4('0x20')](0x0,_0x979946[_0x76f4('0x1f')][_0x76f4('0x21')]('-')),'membername':_0x979946[_0x76f4('0x1f')][_0x76f4('0x20')](_0x979946['channel'][_0x76f4('0x21')]('/')+0x1,_0x979946['channel'][_0x76f4('0x21')]('-'))},_[_0x76f4('0x22')](_0x979946,[_0x76f4('0x23'),'privilege']));logger['info']('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x979946[_0x76f4('0x19')],this[_0x76f4('0x7')][_0x979946[_0x76f4('0x19')]][_0x76f4('0x24')],this[_0x76f4('0x7')][_0x979946[_0x76f4('0x19')]][_0x76f4('0x25')]);logger['debug']('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x979946[_0x76f4('0x19')],util['inspect'](this[_0x76f4('0x7')][_0x979946['uniqueid']],{'showHidden':![],'depth':null}));if(this['applications'][_0x979946['uniqueid']])_[_0x76f4('0x1b')](this[_0x76f4('0x7')][_0x979946[_0x76f4('0x19')]],this[_0x76f4('0x9')][_0x979946[_0x76f4('0x19')]]);this[_0x76f4('0x15')]('voice:outbound',_0x76f4('0x26'),this['channels'][_0x979946['uniqueid']]);logger['debug'](_0x76f4('0x27'),_0x979946[_0x76f4('0x19')],util[_0x76f4('0x1a')](this[_0x76f4('0x7')][_0x979946['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x76f4('0x15')]('custom:dialbegin',this[_0x76f4('0x7')][_0x979946[_0x76f4('0x19')]]);}}}catch(_0x43ac4a){logger[_0x76f4('0x28')](_0x76f4('0x29'),_0x979946['uniqueid'],util['inspect'](_0x43ac4a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x76f4('0x12')][_0x76f4('0xd')]=function(_0x36c360){try{if(this[_0x76f4('0x13')](_0x36c360)){logger[_0x76f4('0x17')](_0x76f4('0x2a'),_0x36c360[_0x76f4('0x19')],util[_0x76f4('0x1a')](_0x36c360,{'showHidden':![],'depth':null}));if(this[_0x76f4('0x7')][_0x36c360[_0x76f4('0x19')]]){this[_0x76f4('0x7')][_0x36c360[_0x76f4('0x19')]]['dialstatus']=_0x36c360['dialstatus'];if(_0x36c360['dialstatus']==='ANSWER'){this[_0x76f4('0x7')][_0x36c360[_0x76f4('0x19')]][_0x76f4('0x2b')]=_0x36c360[_0x76f4('0x2b')];this[_0x76f4('0x7')][_0x36c360['uniqueid']][_0x76f4('0x2c')]=_0x36c360[_0x76f4('0x2c')];this[_0x76f4('0x7')][_0x36c360[_0x76f4('0x19')]][_0x76f4('0x2d')]=moment()[_0x76f4('0x1c')](_0x76f4('0x1d'));this[_0x76f4('0x7')][_0x36c360[_0x76f4('0x19')]][_0x76f4('0x2e')]=_0x76f4('0x2f');logger[_0x76f4('0x30')](_0x76f4('0x31'),_0x36c360[_0x76f4('0x19')],_0x36c360[_0x76f4('0x1f')][_0x76f4('0x20')](_0x36c360[_0x76f4('0x1f')][_0x76f4('0x21')]('/')+0x1,_0x36c360['channel'][_0x76f4('0x21')]('-')));logger[_0x76f4('0x17')](_0x76f4('0x32'),_0x36c360['uniqueid'],util['inspect'](this[_0x76f4('0x7')][_0x36c360['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x76f4('0x15')]('custom:dialconnect',this[_0x76f4('0x7')][_0x36c360[_0x76f4('0x19')]]);}logger[_0x76f4('0x17')](_0x76f4('0x33'),_0x36c360[_0x76f4('0x19')],util[_0x76f4('0x1a')](this[_0x76f4('0x7')][_0x36c360[_0x76f4('0x19')]],{'showHidden':![],'depth':null}));this[_0x76f4('0x15')](_0x76f4('0x34'),'voice_outbound_channel:save',this['channels'][_0x36c360[_0x76f4('0x19')]]);}}}catch(_0x13a5a7){logger[_0x76f4('0x28')](_0x76f4('0x35'),_0x36c360[_0x76f4('0x19')],util[_0x76f4('0x1a')](_0x13a5a7,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x76f4('0x12')][_0x76f4('0xe')]=function(_0x308bab){try{if(this['isNotNull'](_0x308bab)){logger[_0x76f4('0x17')](_0x76f4('0x36'),_0x308bab['uniqueid'],util['inspect'](_0x308bab,{'showHidden':![],'depth':null}));this[_0x76f4('0x37')](_0x308bab[_0x76f4('0x19')],_[_0x76f4('0x38')](_0x308bab[_0x76f4('0x39')])[0x0],_0x308bab[_0x76f4('0x3a')]);if(this['isNotNull'](_0x308bab[_0x76f4('0x39')])&&this[_0x76f4('0x13')](_0x308bab[_0x76f4('0x39')][_0x76f4('0x3b')])){if(_[_0x76f4('0x14')](this[_0x76f4('0x7')][_0x308bab['uniqueid']])){this[_0x76f4('0x7')][_0x308bab[_0x76f4('0x19')]]={'routeId':_0x308bab[_0x76f4('0x3a')],'variables':this['variables'][_0x308bab['uniqueid']],'motionChannel':_0x76f4('0x3c')};logger[_0x76f4('0x30')](_0x76f4('0x3d'),_0x308bab[_0x76f4('0x19')],_0x308bab[_0x76f4('0x39')]['outboundrouteid'],_['keys'](_0x308bab[_0x76f4('0x39')])[0x0],_0x308bab['value']);logger[_0x76f4('0x17')](_0x76f4('0x3e'),_0x308bab['uniqueid'],util['inspect'](this[_0x76f4('0x7')][_0x308bab[_0x76f4('0x19')]],{'showHidden':![],'depth':null}));this[_0x76f4('0x15')](_0x76f4('0x34'),'voice_outbound_channel:save',this[_0x76f4('0x7')][_0x308bab[_0x76f4('0x19')]]);}}}}catch(_0x28922a){logger['error'](_0x76f4('0x3f'),_0x308bab[_0x76f4('0x19')],util['inspect'](_0x28922a,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x76f4('0x37')]=function(_0x1d2240,_0x3cc726,_0x1edc96){var _0x2a61d3=['rtpaudioqos',_0x76f4('0x40'),'rtpaudioqosjitter',_0x76f4('0x41'),_0x76f4('0x42'),_0x76f4('0x43'),'rtpaudioqosrtt',_0x76f4('0x44'),_0x76f4('0x45'),'sipuri',_0x76f4('0x46'),_0x76f4('0x47'),_0x76f4('0x48'),_0x76f4('0x49'),_0x76f4('0x4a'),'memberlastcall',_0x76f4('0x24'),'memberpenalty',_0x76f4('0x4b')];if(!_[_0x76f4('0x4c')](_0x3cc726)&&!_[_0x76f4('0x4d')](_0x2a61d3,_0x3cc726)){if(_['isUndefined'](this[_0x76f4('0xa')][_0x1d2240])){this[_0x76f4('0xa')][_0x1d2240]={};}this[_0x76f4('0xa')][_0x1d2240][_0x3cc726]=_0x1edc96;}};VoiceDialReport[_0x76f4('0x12')]['syncHangup']=function(_0x2028e9){try{if(this[_0x76f4('0x13')](_0x2028e9)){logger[_0x76f4('0x17')](_0x76f4('0x4e'),_0x2028e9['uniqueid'],util[_0x76f4('0x1a')](_0x2028e9,{'showHidden':![],'depth':null}));if(this['channels'][_0x2028e9[_0x76f4('0x19')]]){logger[_0x76f4('0x30')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x2028e9['uniqueid'],_0x2028e9[_0x76f4('0x4f')]);this[_0x76f4('0x7')][_0x2028e9[_0x76f4('0x19')]]['endtime']=moment()[_0x76f4('0x1c')](_0x76f4('0x1d'));this[_0x76f4('0x7')][_0x2028e9['uniqueid']]['duration']=moment(this[_0x76f4('0x7')][_0x2028e9[_0x76f4('0x19')]]['endtime'])['diff'](this[_0x76f4('0x7')][_0x2028e9[_0x76f4('0x19')]][_0x76f4('0x50')],_0x76f4('0x51'));this[_0x76f4('0x7')][_0x2028e9[_0x76f4('0x19')]][_0x76f4('0x2e')]=_0x76f4('0x52');this[_0x76f4('0x8')]['total']+=0x1;if(this['channels'][_0x2028e9['uniqueid']][_0x76f4('0x2d')]){this[_0x76f4('0x8')][_0x76f4('0x53')]+=0x1;this[_0x76f4('0x7')][_0x2028e9['uniqueid']]['holdtime']=moment(this[_0x76f4('0x7')][_0x2028e9['uniqueid']][_0x76f4('0x2d')])['diff'](this[_0x76f4('0x7')][_0x2028e9[_0x76f4('0x19')]][_0x76f4('0x50')],_0x76f4('0x51'));this['channels'][_0x2028e9[_0x76f4('0x19')]][_0x76f4('0x54')]=moment(this[_0x76f4('0x7')][_0x2028e9[_0x76f4('0x19')]][_0x76f4('0x55')])[_0x76f4('0x56')](this[_0x76f4('0x7')][_0x2028e9['uniqueid']][_0x76f4('0x2d')],_0x76f4('0x51'));this[_0x76f4('0x8')][_0x76f4('0x57')]+=this[_0x76f4('0x7')][_0x2028e9[_0x76f4('0x19')]][_0x76f4('0x58')]||0x0;this[_0x76f4('0x8')]['sumBillable']+=this['channels'][_0x2028e9[_0x76f4('0x19')]][_0x76f4('0x54')];}this[_0x76f4('0x8')]['sumDuration']+=this[_0x76f4('0x7')][_0x2028e9['uniqueid']][_0x76f4('0x59')];logger[_0x76f4('0x17')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x2028e9[_0x76f4('0x19')],util[_0x76f4('0x1a')](this[_0x76f4('0x7')][_0x2028e9[_0x76f4('0x19')]],{'showHidden':![],'depth':null}));ami[_0x76f4('0x15')](_0x76f4('0x5a'),this[_0x76f4('0x7')][_0x2028e9[_0x76f4('0x19')]]);logger[_0x76f4('0x17')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x2028e9[_0x76f4('0x19')],util['inspect'](this[_0x76f4('0x7')][_0x2028e9[_0x76f4('0x19')]],{'showHidden':![],'depth':null}));ami[_0x76f4('0x15')](_0x76f4('0x5b'),this[_0x76f4('0x7')][_0x2028e9[_0x76f4('0x19')]]);logger[_0x76f4('0x17')](_0x76f4('0x5c'),_0x2028e9[_0x76f4('0x19')],util[_0x76f4('0x1a')](this['channels'][_0x2028e9[_0x76f4('0x19')]],{'showHidden':![],'depth':null}));this[_0x76f4('0x15')]('voice:outbound',_0x76f4('0x5d'),this[_0x76f4('0x8')]);logger[_0x76f4('0x30')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x76f4('0x5e')](this[_0x76f4('0x7')][_0x2028e9[_0x76f4('0x19')]]));logger['debug'](_0x76f4('0x5f'),_0x2028e9[_0x76f4('0x19')],util[_0x76f4('0x1a')](this[_0x76f4('0x7')][_0x2028e9[_0x76f4('0x19')]],{'showHidden':![],'depth':null}));this[_0x76f4('0x15')](_0x76f4('0x34'),_0x76f4('0x60'),this[_0x76f4('0x7')][_0x2028e9['uniqueid']]);delete this[_0x76f4('0x7')][_0x2028e9[_0x76f4('0x19')]];}else if(this[_0x76f4('0x7')][_0x2028e9[_0x76f4('0x61')]]){this['channels'][_0x2028e9[_0x76f4('0x61')]][_0x76f4('0x19')]=this[_0x76f4('0x7')][_0x2028e9['linkedid']][_0x76f4('0x62')];}if(this[_0x76f4('0xa')][_0x2028e9[_0x76f4('0x19')]]){delete this[_0x76f4('0xa')][_0x2028e9[_0x76f4('0x19')]];}}}catch(_0x505a6e){logger[_0x76f4('0x28')]('[%s][voiceDialReport][hangup]',_0x2028e9[_0x76f4('0x19')],util[_0x76f4('0x1a')](_0x505a6e,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncNewExten']=function(_0x58251e){try{if(this[_0x76f4('0x13')](_0x58251e)){logger[_0x76f4('0x17')](_0x76f4('0x63'),_0x58251e[_0x76f4('0x19')],util[_0x76f4('0x1a')](_0x58251e,{'showHidden':![],'depth':null}));if(_0x58251e[_0x76f4('0x64')]['toLowerCase']()===_0x76f4('0x65')){_0x58251e[_0x76f4('0x66')]=(_0x58251e[_0x76f4('0x67')]||_0x58251e[_0x76f4('0x66')])[_0x76f4('0x68')]();if(_[_0x76f4('0x69')](_0x58251e[_0x76f4('0x66')],_0x76f4('0x6a'))){if(_['isUndefined'](this[_0x76f4('0x9')][_0x58251e['uniqueid']]))this[_0x76f4('0x9')][_0x58251e[_0x76f4('0x19')]]={};logger[_0x76f4('0x30')](_0x76f4('0x6b'),_0x58251e[_0x76f4('0x19')],_0x58251e[_0x76f4('0x64')],_0x58251e[_0x76f4('0x66')]);var _0x2a0491=_0x58251e['applicationdata'][_0x76f4('0x6c')]('=');var _0x521f00=_0x2a0491[0x0]['match'](/cdr\((.*)\)/);if(_0x521f00)this['applications'][_0x58251e[_0x76f4('0x19')]][_0x521f00[0x1]]=_0x2a0491[0x1];}}}}catch(_0x402209){logger[_0x76f4('0x28')](_0x76f4('0x6d'),_0x58251e['uniqueid'],util[_0x76f4('0x1a')](_0x402209,{'showHidden':![],'depth':null}));}};module[_0x76f4('0x6e')]=VoiceDialReport;
\ No newline at end of file
+var _0xfdbd=['appdata','startsWith','cdr(','application','match','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','socket.io-emitter','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','syncVarSet','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','channels','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','interface','inspect','applications','voice_outbound_channel:save','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','dialstatus','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][dialend]','addVariable','keys','variable','outboundrouteid','value','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','includes','[%s][voiceDialReport][hangup]\x20event:','cause-txt','endtime','duration','starttime','seconds','complete','total','holdtime','diff','billableseconds','sumHoldTime','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','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','toLowerCase','set','applicationdata'];(function(_0x4ad492,_0x4a5e96){var _0x29e358=function(_0x330187){while(--_0x330187){_0x4ad492['push'](_0x4ad492['shift']());}};_0x29e358(++_0x4a5e96);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x4c4042,_0x1ea485){_0x4c4042=_0x4c4042-0x0;var _0xbd10dc=_0xfdbd[_0x4c4042];return _0xbd10dc;};'use strict';var _=require(_0xdfdb('0x0'));var moment=require(_0xdfdb('0x1'));var util=require(_0xdfdb('0x2'));var Redis=require(_0xdfdb('0x3'));var config=require(_0xdfdb('0x4'));var logger=require(_0xdfdb('0x5'))(_0xdfdb('0x6'));var ami=require(_0xdfdb('0x7'));config[_0xdfdb('0x8')]=_['defaults'](config[_0xdfdb('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xdfdb('0x9'))(new Redis(config[_0xdfdb('0x8')]));function VoiceDialReport(_0x489f19){this['channels']=_0x489f19['outboundChannels'];this[_0xdfdb('0xa')]=_0x489f19[_0xdfdb('0xa')];this['applications']={};this[_0xdfdb('0xb')]={};ami['on'](_0xdfdb('0xc'),this[_0xdfdb('0xd')][_0xdfdb('0xe')](this));ami['on'](_0xdfdb('0xf'),this[_0xdfdb('0x10')][_0xdfdb('0xe')](this));ami['on']('varset',this[_0xdfdb('0x11')][_0xdfdb('0xe')](this));ami['on']('hangup',this[_0xdfdb('0x12')][_0xdfdb('0xe')](this));}VoiceDialReport[_0xdfdb('0x13')][_0xdfdb('0x14')]=function(_0x2a95f1){return _0x2a95f1!==null&&!_[_0xdfdb('0x15')](_0x2a95f1);};VoiceDialReport[_0xdfdb('0x13')][_0xdfdb('0x16')]=function(_0x51162f,_0x48a66a,_0x2c44dc){io['to'](_0x51162f)['emit'](_0x48a66a,_0x2c44dc);};VoiceDialReport[_0xdfdb('0x13')][_0xdfdb('0xd')]=function(_0x11a56a){try{if(this[_0xdfdb('0x14')](_0x11a56a)){logger[_0xdfdb('0x17')](_0xdfdb('0x18'),_0x11a56a['uniqueid'],util['inspect'](_0x11a56a,{'showHidden':![],'depth':null}));if(this[_0xdfdb('0x19')][_0x11a56a[_0xdfdb('0x1a')]]){_[_0xdfdb('0x1b')](this['channels'][_0x11a56a[_0xdfdb('0x1a')]],{'starttime':moment()[_0xdfdb('0x1c')](_0xdfdb('0x1d')),'lastevent':_0xdfdb('0x1e'),'interface':_0x11a56a[_0xdfdb('0x1f')][_0xdfdb('0x20')](0x0,_0x11a56a[_0xdfdb('0x1f')][_0xdfdb('0x21')]('-')),'membername':_0x11a56a['channel'][_0xdfdb('0x20')](_0x11a56a[_0xdfdb('0x1f')][_0xdfdb('0x21')]('/')+0x1,_0x11a56a['channel'][_0xdfdb('0x21')]('-'))},_[_0xdfdb('0x22')](_0x11a56a,[_0xdfdb('0x23'),'privilege']));logger[_0xdfdb('0x24')](_0xdfdb('0x25'),_0x11a56a[_0xdfdb('0x1a')],this['channels'][_0x11a56a[_0xdfdb('0x1a')]]['membername'],this[_0xdfdb('0x19')][_0x11a56a[_0xdfdb('0x1a')]][_0xdfdb('0x26')]);logger[_0xdfdb('0x17')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x11a56a[_0xdfdb('0x1a')],util[_0xdfdb('0x27')](this[_0xdfdb('0x19')][_0x11a56a[_0xdfdb('0x1a')]],{'showHidden':![],'depth':null}));if(this[_0xdfdb('0x28')][_0x11a56a[_0xdfdb('0x1a')]])_['merge'](this[_0xdfdb('0x19')][_0x11a56a[_0xdfdb('0x1a')]],this[_0xdfdb('0x28')][_0x11a56a['uniqueid']]);this[_0xdfdb('0x16')]('voice:outbound',_0xdfdb('0x29'),this[_0xdfdb('0x19')][_0x11a56a[_0xdfdb('0x1a')]]);logger['debug']('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x11a56a[_0xdfdb('0x1a')],util[_0xdfdb('0x27')](this[_0xdfdb('0x19')][_0x11a56a[_0xdfdb('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xdfdb('0x16')](_0xdfdb('0x2a'),this['channels'][_0x11a56a[_0xdfdb('0x1a')]]);}}}catch(_0x364805){logger[_0xdfdb('0x2b')](_0xdfdb('0x2c'),_0x11a56a[_0xdfdb('0x1a')],util[_0xdfdb('0x27')](_0x364805,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xdfdb('0x13')][_0xdfdb('0x10')]=function(_0x68398d){try{if(this[_0xdfdb('0x14')](_0x68398d)){logger[_0xdfdb('0x17')]('[%s][voiceDialReport][dialend]\x20event:',_0x68398d['uniqueid'],util[_0xdfdb('0x27')](_0x68398d,{'showHidden':![],'depth':null}));if(this['channels'][_0x68398d[_0xdfdb('0x1a')]]){this[_0xdfdb('0x19')][_0x68398d[_0xdfdb('0x1a')]][_0xdfdb('0x2d')]=_0x68398d['dialstatus'];if(_0x68398d[_0xdfdb('0x2d')]==='ANSWER'){this[_0xdfdb('0x19')][_0x68398d[_0xdfdb('0x1a')]][_0xdfdb('0x2e')]=_0x68398d[_0xdfdb('0x2e')];this[_0xdfdb('0x19')][_0x68398d[_0xdfdb('0x1a')]]['connectedlinename']=_0x68398d[_0xdfdb('0x2f')];this[_0xdfdb('0x19')][_0x68398d['uniqueid']][_0xdfdb('0x30')]=moment()[_0xdfdb('0x1c')](_0xdfdb('0x1d'));this[_0xdfdb('0x19')][_0x68398d[_0xdfdb('0x1a')]][_0xdfdb('0x31')]=_0xdfdb('0x32');logger[_0xdfdb('0x24')](_0xdfdb('0x33'),_0x68398d[_0xdfdb('0x1a')],_0x68398d[_0xdfdb('0x1f')]['substring'](_0x68398d[_0xdfdb('0x1f')][_0xdfdb('0x21')]('/')+0x1,_0x68398d[_0xdfdb('0x1f')][_0xdfdb('0x21')]('-')));logger[_0xdfdb('0x17')](_0xdfdb('0x34'),_0x68398d[_0xdfdb('0x1a')],util[_0xdfdb('0x27')](this['channels'][_0x68398d['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xdfdb('0x16')](_0xdfdb('0x35'),this[_0xdfdb('0x19')][_0x68398d[_0xdfdb('0x1a')]]);}logger[_0xdfdb('0x17')](_0xdfdb('0x36'),_0x68398d[_0xdfdb('0x1a')],util[_0xdfdb('0x27')](this[_0xdfdb('0x19')][_0x68398d['uniqueid']],{'showHidden':![],'depth':null}));this[_0xdfdb('0x16')](_0xdfdb('0x37'),_0xdfdb('0x29'),this[_0xdfdb('0x19')][_0x68398d[_0xdfdb('0x1a')]]);}}}catch(_0x5a1bee){logger[_0xdfdb('0x2b')](_0xdfdb('0x38'),_0x68398d[_0xdfdb('0x1a')],util[_0xdfdb('0x27')](_0x5a1bee,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xdfdb('0x13')]['syncVarSet']=function(_0x1d7a3a){try{if(this[_0xdfdb('0x14')](_0x1d7a3a)){logger[_0xdfdb('0x17')]('[%s][voiceDialReport][varset]\x20event:',_0x1d7a3a[_0xdfdb('0x1a')],util['inspect'](_0x1d7a3a,{'showHidden':![],'depth':null}));this[_0xdfdb('0x39')](_0x1d7a3a['uniqueid'],_[_0xdfdb('0x3a')](_0x1d7a3a[_0xdfdb('0x3b')])[0x0],_0x1d7a3a['value']);if(this[_0xdfdb('0x14')](_0x1d7a3a['variable'])&&this[_0xdfdb('0x14')](_0x1d7a3a[_0xdfdb('0x3b')][_0xdfdb('0x3c')])){if(_[_0xdfdb('0x15')](this[_0xdfdb('0x19')][_0x1d7a3a['uniqueid']])){this['channels'][_0x1d7a3a[_0xdfdb('0x1a')]]={'routeId':_0x1d7a3a[_0xdfdb('0x3d')],'variables':this['variables'][_0x1d7a3a[_0xdfdb('0x1a')]],'motionChannel':'voice'};logger[_0xdfdb('0x24')](_0xdfdb('0x3e'),_0x1d7a3a[_0xdfdb('0x1a')],_0x1d7a3a[_0xdfdb('0x3b')][_0xdfdb('0x3c')],_[_0xdfdb('0x3a')](_0x1d7a3a[_0xdfdb('0x3b')])[0x0],_0x1d7a3a[_0xdfdb('0x3d')]);logger[_0xdfdb('0x17')](_0xdfdb('0x3f'),_0x1d7a3a[_0xdfdb('0x1a')],util[_0xdfdb('0x27')](this[_0xdfdb('0x19')][_0x1d7a3a[_0xdfdb('0x1a')]],{'showHidden':![],'depth':null}));this[_0xdfdb('0x16')](_0xdfdb('0x37'),'voice_outbound_channel:save',this['channels'][_0x1d7a3a[_0xdfdb('0x1a')]]);}}}}catch(_0x1aff71){logger[_0xdfdb('0x2b')]('[%s][voiceDialReport][varset]',_0x1d7a3a[_0xdfdb('0x1a')],util[_0xdfdb('0x27')](_0x1aff71,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xdfdb('0x13')][_0xdfdb('0x39')]=function(_0x5a0e29,_0x2b83c5,_0x7ab4d9){var _0x5446f6=[_0xdfdb('0x40'),_0xdfdb('0x41'),_0xdfdb('0x42'),_0xdfdb('0x43'),_0xdfdb('0x44'),_0xdfdb('0x45'),_0xdfdb('0x46'),_0xdfdb('0x47'),_0xdfdb('0x48'),'sipuri',_0xdfdb('0x49'),'bridgepvtcallid',_0xdfdb('0x4a'),_0xdfdb('0x4b'),_0xdfdb('0x4c'),_0xdfdb('0x4d'),_0xdfdb('0x4e'),_0xdfdb('0x4f'),_0xdfdb('0x50')];if(!_['isNil'](_0x2b83c5)&&!_[_0xdfdb('0x51')](_0x5446f6,_0x2b83c5)){if(_[_0xdfdb('0x15')](this[_0xdfdb('0xb')][_0x5a0e29])){this[_0xdfdb('0xb')][_0x5a0e29]={};}this[_0xdfdb('0xb')][_0x5a0e29][_0x2b83c5]=_0x7ab4d9;}};VoiceDialReport['prototype'][_0xdfdb('0x12')]=function(_0x4df3b6){try{if(this[_0xdfdb('0x14')](_0x4df3b6)){logger[_0xdfdb('0x17')](_0xdfdb('0x52'),_0x4df3b6[_0xdfdb('0x1a')],util[_0xdfdb('0x27')](_0x4df3b6,{'showHidden':![],'depth':null}));if(this['channels'][_0x4df3b6[_0xdfdb('0x1a')]]){logger[_0xdfdb('0x24')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x4df3b6[_0xdfdb('0x1a')],_0x4df3b6[_0xdfdb('0x53')]);this[_0xdfdb('0x19')][_0x4df3b6['uniqueid']][_0xdfdb('0x54')]=moment()[_0xdfdb('0x1c')](_0xdfdb('0x1d'));this[_0xdfdb('0x19')][_0x4df3b6[_0xdfdb('0x1a')]][_0xdfdb('0x55')]=moment(this['channels'][_0x4df3b6['uniqueid']][_0xdfdb('0x54')])['diff'](this['channels'][_0x4df3b6['uniqueid']][_0xdfdb('0x56')],_0xdfdb('0x57'));this[_0xdfdb('0x19')][_0x4df3b6[_0xdfdb('0x1a')]][_0xdfdb('0x31')]=_0xdfdb('0x58');this[_0xdfdb('0xa')][_0xdfdb('0x59')]+=0x1;if(this[_0xdfdb('0x19')][_0x4df3b6['uniqueid']]['answertime']){this[_0xdfdb('0xa')]['answered']+=0x1;this[_0xdfdb('0x19')][_0x4df3b6[_0xdfdb('0x1a')]][_0xdfdb('0x5a')]=moment(this['channels'][_0x4df3b6[_0xdfdb('0x1a')]][_0xdfdb('0x30')])[_0xdfdb('0x5b')](this[_0xdfdb('0x19')][_0x4df3b6[_0xdfdb('0x1a')]][_0xdfdb('0x56')],_0xdfdb('0x57'));this[_0xdfdb('0x19')][_0x4df3b6['uniqueid']][_0xdfdb('0x5c')]=moment(this[_0xdfdb('0x19')][_0x4df3b6['uniqueid']][_0xdfdb('0x54')])[_0xdfdb('0x5b')](this[_0xdfdb('0x19')][_0x4df3b6[_0xdfdb('0x1a')]]['answertime'],'seconds');this[_0xdfdb('0xa')][_0xdfdb('0x5d')]+=this['channels'][_0x4df3b6[_0xdfdb('0x1a')]][_0xdfdb('0x5a')]||0x0;this[_0xdfdb('0xa')]['sumBillable']+=this['channels'][_0x4df3b6[_0xdfdb('0x1a')]][_0xdfdb('0x5c')];}this['outbound']['sumDuration']+=this[_0xdfdb('0x19')][_0x4df3b6['uniqueid']]['duration'];logger[_0xdfdb('0x17')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x4df3b6[_0xdfdb('0x1a')],util[_0xdfdb('0x27')](this['channels'][_0x4df3b6['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xdfdb('0x16')](_0xdfdb('0x5e'),this['channels'][_0x4df3b6[_0xdfdb('0x1a')]]);logger[_0xdfdb('0x17')](_0xdfdb('0x5f'),_0x4df3b6[_0xdfdb('0x1a')],util[_0xdfdb('0x27')](this['channels'][_0x4df3b6['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xdfdb('0x16')](_0xdfdb('0x60'),this[_0xdfdb('0x19')][_0x4df3b6[_0xdfdb('0x1a')]]);logger[_0xdfdb('0x17')](_0xdfdb('0x61'),_0x4df3b6['uniqueid'],util[_0xdfdb('0x27')](this[_0xdfdb('0x19')][_0x4df3b6[_0xdfdb('0x1a')]],{'showHidden':![],'depth':null}));this[_0xdfdb('0x16')](_0xdfdb('0x37'),_0xdfdb('0x62'),this[_0xdfdb('0xa')]);logger[_0xdfdb('0x24')](_0xdfdb('0x63'),JSON[_0xdfdb('0x64')](this['channels'][_0x4df3b6[_0xdfdb('0x1a')]]));logger[_0xdfdb('0x17')](_0xdfdb('0x65'),_0x4df3b6[_0xdfdb('0x1a')],util[_0xdfdb('0x27')](this['channels'][_0x4df3b6[_0xdfdb('0x1a')]],{'showHidden':![],'depth':null}));this[_0xdfdb('0x16')](_0xdfdb('0x37'),_0xdfdb('0x66'),this['channels'][_0x4df3b6[_0xdfdb('0x1a')]]);delete this[_0xdfdb('0x19')][_0x4df3b6[_0xdfdb('0x1a')]];}else if(this[_0xdfdb('0x19')][_0x4df3b6[_0xdfdb('0x67')]]){this[_0xdfdb('0x19')][_0x4df3b6[_0xdfdb('0x67')]][_0xdfdb('0x1a')]=this[_0xdfdb('0x19')][_0x4df3b6[_0xdfdb('0x67')]][_0xdfdb('0x68')];}if(this['variables'][_0x4df3b6[_0xdfdb('0x1a')]]){delete this[_0xdfdb('0xb')][_0x4df3b6['uniqueid']];}}}catch(_0x28d4ac){logger[_0xdfdb('0x2b')](_0xdfdb('0x69'),_0x4df3b6['uniqueid'],util['inspect'](_0x28d4ac,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xdfdb('0x6a')]=function(_0x465565){try{if(this[_0xdfdb('0x14')](_0x465565)){logger[_0xdfdb('0x17')](_0xdfdb('0x6b'),_0x465565[_0xdfdb('0x1a')],util[_0xdfdb('0x27')](_0x465565,{'showHidden':![],'depth':null}));if(_0x465565['application'][_0xdfdb('0x6c')]()===_0xdfdb('0x6d')){_0x465565[_0xdfdb('0x6e')]=(_0x465565[_0xdfdb('0x6f')]||_0x465565[_0xdfdb('0x6e')])[_0xdfdb('0x6c')]();if(_[_0xdfdb('0x70')](_0x465565['applicationdata'],_0xdfdb('0x71'))){if(_[_0xdfdb('0x15')](this[_0xdfdb('0x28')][_0x465565[_0xdfdb('0x1a')]]))this[_0xdfdb('0x28')][_0x465565['uniqueid']]={};logger[_0xdfdb('0x24')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x465565[_0xdfdb('0x1a')],_0x465565[_0xdfdb('0x72')],_0x465565[_0xdfdb('0x6e')]);var _0x30eea1=_0x465565[_0xdfdb('0x6e')]['split']('=');var _0x3361b1=_0x30eea1[0x0][_0xdfdb('0x73')](/cdr\((.*)\)/);if(_0x3361b1)this['applications'][_0x465565['uniqueid']][_0x3361b1[0x1]]=_0x30eea1[0x1];}}}}catch(_0x284439){logger['error']('[%s][voiceDialReport][newexten]',_0x465565[_0xdfdb('0x1a')],util[_0xdfdb('0x27')](_0x284439,{'showHidden':![],'depth':null}));}};module[_0xdfdb('0x74')]=VoiceDialReport;
\ No newline at end of file