Bashab
Bashab

Reputation: 33

Is user part in sip 'Contact' header madatory?

I have a SIP Server which is registering to a trunk. So, SIP Server sends a REGISTER message to the trunk. But the trunk device sends a "406 Not Acceptable" error message. I have been told that this error is because there is no user part in 'Contact' header. However, as per RFC, Contact header on its own is not mandatory to be in a REGISTER request.

Could you please help to confirm if my understanding is right and advise accordingly?

REGISTER sip:10.5.5.1 SIP/2.0
From: sip:[email protected];tag=8CD78147-5BDB-40C1-87F6-64A6905F1A6D-9
To: <sip:[email protected]>
Call-ID: [email protected]
CSeq: 1 REGISTER
Content-Length: 0
Via: SIP/2.0/UDP 10.5.5.2:5060;branch=z9hG4bKA761AE66-C376-4895-BBF7-51CF2C675C52-9
**Contact: <sip:10.5.5.2:5060>**
Expires: 600


SIP/2.0 406 Not Acceptable
Via: SIP/2.0/UDP 10.5.5.2:5060;branch=z9hG4bKA761AE66-C376-4895-BBF7-51CF2C675C52-9
From: <sip:[email protected]>;tag=8CD78147-5BDB-40C1-87F6-64A6905F1A6D-9
To: <sip:[email protected]>;tag=10a8faa5
Call-ID: [email protected]
CSeq: 1 REGISTER
User-Agent: XXX XXX XXX
Allow: INVITE, ACK, REGISTER, BYE, OPTIONS, INFO, CANCEL, REFER, NOTIFY, SUBSCRIBE, PRACK, UPDATE
Content-Length: 0

10.5.5.2 is my SIP Server and 10.5.5.1 is the Trunk device

Thank you.

Upvotes: 0

Views: 1598

Answers (1)

sipsorcery
sipsorcery

Reputation: 30699

You are correct. For all address of records, including any in a Contact header, the user portion is optional.

For REGISTER requests in particular see 10.2.1 Adding Bindings which states:

The Contact header field values of the request typically consist of SIP or SIPS URIs that identify particular SIP endpoints (for example, "sip:[email protected]"), but they MAY use any URI scheme. A SIP UA can choose to register telephone numbers (with the tel URL, RFC 2806 [9]) or email addresses (with a mailto URL, RFC 2368 [32]) as Contacts for an address-of-record, for example.

For the case where the Contact header contains a SIP URI the rules are specified as shown below. The [userinfo] portion which contains the "user part" you're referring to is optional.

SIP-URI          =  "sip:" [ userinfo ] hostport
                    uri-parameters [ headers ]
SIPS-URI         =  "sips:" [ userinfo ] hostport
                    uri-parameters [ headers ]
userinfo         =  ( user / telephone-subscriber ) [ ":" password ] "@" 

Despite the fact that you are correct most SIP servers do implement additional business rules. Some Registrars don't accept request with a private IP address in the Contact URI etc.

Upvotes: 3

Related Questions