Skip to content

Commit

Permalink
When stripping the display name, remove everything from start of disp…
Browse files Browse the repository at this point in the history
…lay name up to uri. This helps prevent any extra spaces from being present in the resulting header.
  • Loading branch information
rrb3942 committed Jun 25, 2019
1 parent 82c446d commit 2b66e88
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions modules/uac/replace.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ int replace_uri( struct sip_msg *msg, str *display, str *uri,
int i;
struct dlg_cell *dlg = NULL;
pv_value_t val;
int ret;
int ret, start_offset, display_len;

/* consistency check! in AUTO mode, do NOT allow URI changing
* in sequential request */
Expand All @@ -270,8 +270,19 @@ int replace_uri( struct sip_msg *msg, str *display, str *uri,
if ( body->display.len) {
LM_DBG("removing display [%.*s]\n",
body->display.len,body->display.s);

start_offset = body->display.s-msg->buf;

//If replacing leave trailing spaces
if (display->len) {
display_len = body->display.len;
} else {
//Removing, strip all characters up to the URI
display_len = ((body->uri.s-msg->buf) - start_offset) - 1;
}

/* build del lump */
l = del_lump( msg, body->display.s-msg->buf, body->display.len, 0);
l = del_lump( msg, start_offset, display_len, 0);
if (l==0) {
LM_ERR("display del lump failed\n");
goto error;
Expand Down

0 comments on commit 2b66e88

Please sign in to comment.