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;
}
And looking more at the code, it’s a parsed URI so I would think the parser would have already parsed out the port into the URI properly for the code you referenced.
Is there a correct way to use from_domain, if you want to address a non standard port, like 6060? So that the domain part of the From-header would contain the correct port? We might have missed something obvious…