]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_pjsip.c: Set contact_user on incoming call local Contact header
authorMikeNaso <pbxip.it@gmail.com>
Tue, 8 Aug 2023 14:23:37 +0000 (10:23 -0400)
committerMikeNaso <pbxip.it@gmail.com>
Mon, 14 Aug 2023 17:21:35 +0000 (17:21 +0000)
If the contact_user is configured on the endpoint it will now be set on the local Contact header URI for incoming calls. The contact_user has already been set on the local Contact header URI for outgoing calls.

Resolves: #226

res/res_pjsip.c

index 98a406d74f3eb196a746c089c7e4802dd76f318f..781446eb2a54f819a1a872fc5ba2e4f8afed792b 100644 (file)
@@ -1141,9 +1141,11 @@ static pjsip_dialog *create_dialog_uas(const struct ast_sip_endpoint *endpoint,
 
        contact.ptr = pj_pool_alloc(rdata->tp_info.pool, PJSIP_MAX_URL_SIZE);
        contact.slen = pj_ansi_snprintf(contact.ptr, PJSIP_MAX_URL_SIZE,
-                       "<%s:%s%.*s%s:%d%s%s>",
+                       "<%s:%s%s%s%.*s%s:%d%s%s>",
                        uas_use_sips_contact(rdata) ? "sips" : "sip",
                        (type & PJSIP_TRANSPORT_IPV6) ? "[" : "",
+                       S_OR(endpoint->contact_user, ""),
+                        (!ast_strlen_zero(endpoint->contact_user)) ? "@" : "",
                        (int)transport->local_name.host.slen,
                        transport->local_name.host.ptr,
                        (type & PJSIP_TRANSPORT_IPV6) ? "]" : "",