Skip to content

Commit

Permalink
[nathelper]before trying to remove check if remove_on_timeout flag set
Browse files Browse the repository at this point in the history
  • Loading branch information
ionutrazvanionita committed Jan 22, 2016
1 parent 9f68260 commit dfa7787
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion modules/nathelper/nathelper.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ mod_init(void)
sipping_method.len = strlen(sipping_method.s);
sipping_from.len = strlen(sipping_from.s);
exports.response_f = sipping_rpl_filter;
init_sip_ping();
init_sip_ping(rm_on_to_flag);
}

if (REMOVE_ON_TIMEOUT &&
Expand Down
6 changes: 4 additions & 2 deletions modules/nathelper/sip_pinger.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@ static int sipping_callid_cnt = 0;
static str sipping_callid = {0,0};
static str sipping_from = {0,0};
static str sipping_method = {"OPTIONS",7};
static int remove_on_timeout=0;


static void init_sip_ping(void)
static void init_sip_ping(int rto)
{
int len;
char *p;
Expand All @@ -85,6 +86,7 @@ static void init_sip_ping(void)
sipping_callid.len = 8-len;
/* callid counter part */
sipping_callid_cnt = rand();
remove_on_timeout=(rto>0?1:0);
}


Expand Down Expand Up @@ -186,7 +188,7 @@ static int sipping_rpl_filter(struct sip_msg *rpl)
LM_DBG("reply for SIP natping filtered\n");
/* it's a reply to a SIP NAT ping -> absorb it and stop any
* further processing of it */
if (parse_branch(rpl->via1->branch->value))
if (remove_on_timeout && parse_branch(rpl->via1->branch->value))
goto skip;

return 0;
Expand Down

0 comments on commit dfa7787

Please sign in to comment.