From a56316423f113423a1fe070d2749932fbdfccb9a Mon Sep 17 00:00:00 2001 From: Daniel Tryba <daniel@tryba.nl> Date: Fri, 6 Oct 2017 12:14:40 +0200 Subject: [PATCH] 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 --- res/res_pjsip.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/res/res_pjsip.c b/res/res_pjsip.c index a784e12623..f81d34ca44 100644 --- a/res/res_pjsip.c +++ b/res/res_pjsip.c @@ -3095,6 +3095,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; -- GitLab