From: Daniel Tryba Date: Fri, 6 Oct 2017 10:14:40 +0000 (+0200) Subject: res_pjsip: Prevent "user=phone" being added multiple times to header X-Git-Tag: 15.1.0-rc1~9^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3a692949b7f2ee12bb8e9e105148bace1e646dd2;p=thirdparty%2Fasterisk.git res_pjsip: Prevent "user=phone" being added multiple times to header ast_sip_add_usereqphone adds "user=phone" to the header every time is is called without checking whether the param already exists. Preventing this by searching to string representation of header for "user=phone". ASTERISK-26988 #close Change-Id: Ib84383b07254de357dc6a98d91fc1d2c2c3719e6 --- diff --git a/res/res_pjsip.c b/res/res_pjsip.c index bbf3b5ea43..11c0bf95c3 100644 --- a/res/res_pjsip.c +++ b/res/res_pjsip.c @@ -3109,6 +3109,11 @@ void ast_sip_add_usereqphone(const struct ast_sip_endpoint *endpoint, pj_pool_t return; } + if (pjsip_param_find(&sip_uri->other_param, &STR_USER)) { + /* Don't add it if it's already there */ + return; + } + param = PJ_POOL_ALLOC_T(pool, pjsip_param); param->name = STR_USER; param->value = STR_PHONE;