]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_pjsip: Prevent "user=phone" being added multiple times to header
authorDaniel Tryba <daniel@tryba.nl>
Fri, 6 Oct 2017 10:14:40 +0000 (12:14 +0200)
committerSean Bright <sean.bright@gmail.com>
Wed, 11 Oct 2017 20:34:52 +0000 (16:34 -0400)
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

index 510b6b4fde822006fb1e1bd9fbf4c61c6d7a22c0..e215946a3932ddad37ba12ba67abd93f8f95fd6a 100644 (file)
@@ -3073,6 +3073,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;