Skip to content

Commit

Permalink
topoh: modparam to control header masking
Browse files Browse the repository at this point in the history
- mask_mode - a new parameter
- if bit 1 is set, the masking of contact header in 3xx replies is
  skipped
- GH #3256
  • Loading branch information
miconda committed Oct 12, 2022
1 parent 17ef6f2 commit 279de09
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/modules/topoh/topoh_mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
MODULE_VERSION


#define TH_MASKMODE_SLIP3XXCONTACT 1

/** module parameters */
str _th_key = str_init("aL9.n8~Hm]Z");
str th_cookie_name = str_init("TH"); /* lost parameter? */
Expand All @@ -75,6 +77,7 @@ str th_via_prefix = {0, 0};
str th_uri_prefix = {0, 0};

int th_param_mask_callid = 0;
int th_param_mask_mode = 0;

int th_sanity_checks = 0;
int th_uri_prefix_checks = 0;
Expand Down Expand Up @@ -103,6 +106,7 @@ static param_export_t params[]={
{"mask_key", PARAM_STR, &_th_key},
{"mask_ip", PARAM_STR, &th_ip},
{"mask_callid", PARAM_INT, &th_param_mask_callid},
{"mask_mode", PARAM_INT, &th_param_mask_mode},
{"uparam_name", PARAM_STR, &th_uparam_name},
{"uparam_prefix", PARAM_STR, &th_uparam_prefix},
{"vparam_name", PARAM_STR, &th_vparam_name},
Expand Down Expand Up @@ -515,7 +519,11 @@ int th_msg_sent(sr_event_param_t *evp)
}
} else {
th_flip_record_route(&msg, 1);
th_mask_contact(&msg);
if(!(th_param_mask_mode & TH_MASKMODE_SLIP3XXCONTACT)
|| msg.first_line.u.reply.statuscode < 300
|| msg.first_line.u.reply.statuscode > 399) {
th_mask_contact(&msg);
}
if(th_cookie_value.s[0]=='d') {
th_mask_callid(&msg);
}
Expand Down

0 comments on commit 279de09

Please sign in to comment.