Hello!
We have run into a problem regarding from_domain on PJSIP endpoints when using a domain with a port. Example:
from_domain=sip.example.com:6060
When sending an INVITE with this endpoint, the from-header looks like:
From: sip:12345@[sip.example.com:6060];tag=abcde
As the brackets were added, this lead us to believe this was interpreted as IPV6.
While trying to find why this happens I found this in function sip_dialog_create_from in res_pjsip.c:
/* If the host is IPv6 turn the transport into an IPv6 version */
if (pj_strchr(&sip_uri->host, ':')) {
type |= PJSIP_TRANSPORT_IPV6;
}
This looks for a : in the uri, and then says this must be IPV6. A bit further down in the same function, the same logic is applied again, and after that brackets are added if the PJSIP_TRANSPORT_IPV6 bit is set.
Is this the probable culprit for this behaviour?
Would a check for two : be a solution? Like
if (pj_strchr(pj_strchr(&sip_uri->host, ':')+1, ':')) {
type |= PJSIP_TRANSPORT_IPV6;
}
Thanks in advance!
Best Regards
Torbjörn Abrahamsson