mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 12:36:58 +00:00
res_pjsip.c: Support endpoints with domain info in username
In multidomain environments, it is desirable to create PJSIP endpoints with the domain info in the endpoint name in pjsip_endpoint.conf. This resulted in an error with registrations, NOTIFY, and OPTIONS packet generation. This commit will detect if there is an @ in the endpoint identifier and generate the URI accordingly so NOTIFY and OPTIONS From headers will generate correctly. ASTERISK-28393 Change-Id: I96f8d01dfdd5573ba7a28299e46271dd4210b619
This commit is contained in:
committed by
George Joseph
parent
a985e5069c
commit
98e4119642
5
doc/CHANGES-staging/res_pjsip.txt
Normal file
5
doc/CHANGES-staging/res_pjsip.txt
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
Subject: res_pjsip
|
||||||
|
|
||||||
|
PJSIP support of registrations of endpoints in multidomain
|
||||||
|
scenarios, where the endpoint contains the domain info
|
||||||
|
in pjsip_endpoint.conf
|
@@ -3841,6 +3841,17 @@ static int sip_dialog_create_from(pj_pool_t *pool, pj_str_t *from, const char *u
|
|||||||
type |= PJSIP_TRANSPORT_IPV6;
|
type |= PJSIP_TRANSPORT_IPV6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* In multidomain scenario, username may contain @ with domain info */
|
||||||
|
if (!ast_sip_get_disable_multi_domain() && strchr(user, '@')) {
|
||||||
|
from->ptr = pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE);
|
||||||
|
from->slen = pj_ansi_snprintf(from->ptr, PJSIP_MAX_URL_SIZE,
|
||||||
|
"<sip:%s%s%s>",
|
||||||
|
user,
|
||||||
|
(type != PJSIP_TRANSPORT_UDP && type != PJSIP_TRANSPORT_UDP6) ? ";transport=" : "",
|
||||||
|
(type != PJSIP_TRANSPORT_UDP && type != PJSIP_TRANSPORT_UDP6) ? pjsip_transport_get_type_name(type) : "");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!ast_strlen_zero(domain)) {
|
if (!ast_strlen_zero(domain)) {
|
||||||
from->ptr = pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE);
|
from->ptr = pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE);
|
||||||
from->slen = pj_ansi_snprintf(from->ptr, PJSIP_MAX_URL_SIZE,
|
from->slen = pj_ansi_snprintf(from->ptr, PJSIP_MAX_URL_SIZE,
|
||||||
|
Reference in New Issue
Block a user