Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2b66e88

Browse files
committedJun 25, 2019
When stripping the display name, remove everything from start of display name up to uri. This helps prevent any extra spaces from being present in the resulting header.
1 parent 82c446d commit 2b66e88

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed
 

‎modules/uac/replace.c

+13-2
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ int replace_uri( struct sip_msg *msg, str *display, str *uri,
244244
int i;
245245
struct dlg_cell *dlg = NULL;
246246
pv_value_t val;
247-
int ret;
247+
int ret, start_offset, display_len;
248248

249249
/* consistency check! in AUTO mode, do NOT allow URI changing
250250
* in sequential request */
@@ -270,8 +270,19 @@ int replace_uri( struct sip_msg *msg, str *display, str *uri,
270270
if ( body->display.len) {
271271
LM_DBG("removing display [%.*s]\n",
272272
body->display.len,body->display.s);
273+
274+
start_offset = body->display.s-msg->buf;
275+
276+
//If replacing leave trailing spaces
277+
if (display->len) {
278+
display_len = body->display.len;
279+
} else {
280+
//Removing, strip all characters up to the URI
281+
display_len = ((body->uri.s-msg->buf) - start_offset) - 1;
282+
}
283+
273284
/* build del lump */
274-
l = del_lump( msg, body->display.s-msg->buf, body->display.len, 0);
285+
l = del_lump( msg, start_offset, display_len, 0);
275286
if (l==0) {
276287
LM_ERR("display del lump failed\n");
277288
goto error;

0 commit comments

Comments
 (0)
Please sign in to comment.