Adding :5060 in To field

Hello,

For trunking with one provider, I’m asked to send INVITE messages tailored with a port number in To field such as:
To: sip:123456789@foobar.lan:5060;user=phone

instead of (as currently):
To: sip:123456789@foobar.lan;user=phone

Is it possible to set this with PJSIP ? I’m using Asterisk 16 but can upgrade to Asterisk 20.

Best regards

The To header duplicates the request URI. The request URI comes from the contact setting.

In my pjsip.conf, I’ve got:

[whatever]
type=aor
contact=sip:foobar.lan:5060

Still, INVITE sent includes
To: sip:123456789@foobar.lan;user=phone

It seems To effectively reflects whatever is set in contact parameter except for this port number.

I looked to RFC3261 and couldn’t find any example with a port set in To field (but that itself, doesn’t prove this is forbidden).

I believe PJSIP doesn’t embed a port there unless it is different than the standard one, because lack of a port means to use the standard one.

I thought that might be the case, but the RFC is pretty clear that:

  1. the Request URI should be set to the value of the initial To header (8.1.1.1);

  2. a URI with a port number is not the same as a URI with the default port number (19.1.4).

(On the other hand, the provider really shouldn’t care that much about the To header (8.2.2.1.)

In a quick and dirty test between two Asterisk instances, I changed the above setting to:

[whatever]
type=aor
contact=sip:foobar.lan:5064

Still, To: field didn’t include any reference to port number (5064 in the present test).

To better understand the issue I’m dealing with, this question arose when trunking with an Oracle SBC. Calls are passing in and out but provider says I don’t conform to its rules.
My feeling is his reading of its own rules is incorrect as this port number should be present in other headers (from, …) but not on this specific To field.

I asked Kamailio community for an opinion on this and I’m about to do the same on PJSIP mailing list.