PJSIP Outbound registration contact

I’m quite new to asterisk.
I’ve set up asterisk v.13.1 + FreePBX 12.0 on a Centos 6.6 VPS.
I thought I needed to NAT the machine so after reading some, I decided to use the PJSIP stack rather than the Chan_SIP stack.

I have set up one trunk on FreePBX that works fine, inbound and outbound, except it is just for test.
Now I need to set up the production outbound/inbound trunk.
I have tried many combinations of parameters, but registration fails.
The provider pointed out that I am sending them the wrong string in the “Contact” field.
The problem is that somebody somewhere is filling in the fields with the wrong values.

CSeq: 10248 REGISTER Contact: <sip:s@149.210.xx.xx:5060>
I have no idea where the “s” comes from, and the IP is my server’s, instead of the provider’s.

It should look like this:

CSeq: 1791 REGISTER Contact: <sip:0381xxxxx@80.244.xx.xx:5060>;q=0.1;expires=120 Server: VoIP Connect v3.0

where the first part is my username and the IP address is the provider’s.
I have read the asterisk page about outbound registrations https://wiki.asterisk.org/wiki/display/AST/Configuring+Outbound+Registrations and it is quite clear from the examples that only the username part should be specified.

I have checked the pjsip.registration.conf file that FreePBX produces and it looks ok.
If I add the “advanced” parameters it will write them in, including “Contact”, “Client URI” and "ServerURI"
If I leave them blank the lines are deleted.

If I fill the Contact field in FreePBX with the whole contact URI, asterisk throws an error:
res_sorcery_config.c: Could not create an object of type ‘registration’

If I set the “Contact” field to @<provider’s IP address>
asterisk will try to add another address to the end of it.

[2015-02-27 01:22:17] DEBUG[822] pjsip: sip_reg.c Invalid Contact: "<sip:0381xxxxxx@80.244.xx.xx:5060@149.210.xx.xx:5060>" [2015-02-27 01:22:17] DEBUG[821] threadpool.c: Increasing threadpool SIP's size by 5 [2015-02-27 01:22:17] ERROR[822] res_sorcery_config.c: Could not create an object of type 'registration' with id 'trunk-enuvola' from configuration file 'pjsip.conf' [2015-02-27 01:22:17] DEBUG[822] config.c: Parsing /etc/asterisk/pjsip.conf

Any suggestions?

Doing some more googling, looks as if the “s” in “Contact” has turned up before:


According to the last post, its a configuration issue…

The Contact you send MUST contain your address. s simply means you didn’t specify an extension in the registration and any compliant peer should not care less about what it is set to, as its only purpose is to tell the peer what to put in INVITEs it sends to you.

(If you put the ITSPs address in the contact header, and it has a valid SIP implementation, it will route all your incoming calls back to itself!)

david55, thanks a lot for your response.
It gave me the ammunition to respond to the provider.
As I suspected, they are rather understaffed from the technical point of view.

In the end, the provider’s technician admitted there was no problem with the configuration, the problem was with their ?firewall/asterisk setup, that was filtering requests from my VPS, based on geographical location. :imp:

I just wonder if the stuff about “s” and the IP that is automatically appended should be included in the documentation/wiki I quoted above.
I think it would have saved me some of the hours I spent between midnight and 4 in the morning.

Can I do that or should somebody better qualified fill in the blanks? :blush:

Is the “Contact User” just something from the past or is it actually used by the provider in the context of outbound registration?

The contact URI is the one to which the registrar should send INVITEs. I presume, if they are providing a DID service, they can ignore the user part.