Skip to content

Commit

Permalink
uac_redirect: check if reason parameter ifs provided for get_redirects()
Browse files Browse the repository at this point in the history
- cope properly with the common function used for the two function
  variants
- GH #3197
  • Loading branch information
miconda committed Aug 12, 2022
1 parent 939ceb3 commit 3b1354e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/modules/uac_redirect/uac_redirect.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,17 +344,19 @@ static int w_get_redirect2(struct sip_msg* msg, char *max_c, char *reason)
{
int n;
unsigned short max;
str sreason;
str sreason = {0};

if(fixup_get_svalue(msg, (gparam_t*)reason, &sreason)<0) {
LM_ERR("failed to get reason parameter\n");
return -1;
if(reason!=NULL) {
if(fixup_get_svalue(msg, (gparam_t*)reason, &sreason)<0) {
LM_ERR("failed to get reason parameter\n");
return -1;
}
}

msg_tracer( msg, 0);
/* get the contacts */
max = (unsigned short)(long)max_c;
n = get_redirect(msg , (max>>8)&0xff, max&0xff, &sreason, bflags);
n = get_redirect(msg , (max>>8)&0xff, max&0xff, (reason)?&sreason:NULL, bflags);
reset_filters();
/* reset the tracer */
msg_tracer( msg, 1);
Expand Down

0 comments on commit 3b1354e

Please sign in to comment.