From: MikeNaso Date: Tue, 8 Aug 2023 14:23:37 +0000 (-0400) Subject: res_pjsip.c: Set contact_user on incoming call local Contact header X-Git-Tag: 21.0.0-rc1~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=59618c3a34ce8eac99abc0273546f8270a84dc0a;p=thirdparty%2Fasterisk.git res_pjsip.c: Set contact_user on incoming call local Contact header 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 (cherry picked from commit 720813dc97e1c51f350a735916103d00bb24cfca) --- diff --git a/res/res_pjsip.c b/res/res_pjsip.c index 98a406d74f..781446eb2a 100644 --- a/res/res_pjsip.c +++ b/res/res_pjsip.c @@ -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) ? "]" : "",