Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In SIP, why the Contact header field MUST be present in the Invite request

Tags:

sip

Usually, the Contact header field in the Invite request is useless. For example, the UAC and the UAS are in different LANs. The Contact field may be:

INVITE sip:bob@sipprovider SIP/2.0
Contact: Alice<[email protected]>
.....

There is no use of the Contact field while we can still build a dialog. Then, why the Contact header field is mandatory?

like image 983
Phoenix Luo Avatar asked Feb 29 '12 09:02

Phoenix Luo


People also ask

What are mandatory headers in SIP invite?

Call-ID. The Call-ID header field is mandatory in all SIP requests and responses. It is used to uniquely identify a call between two user agents. A Call-ID must be unique across calls.

What is a contact header?

The Contact header identifies the most direct route for sending future requests to the requesting device. The Contact header specifies a caller domain name or IP address and a transport type.

What is the difference between from and contact header in SIP?

2 Answers. Show activity on this post. From header is the logical identity of the user that will be used for auth/callerid (i.e. sip:[email protected]). The Contact header is the TCP/IP network address where you should send all packets to (i.e. sip:[email protected]:43085;transport=tcp) - IP/port/transport info.

What are the mandatory general headers you will see in SIP requests and responses?

Here you can see the mandatory SIP header fields, such Request-URI, along with Via, From, To, Call-ID, Max-Forwards, and CSeq. This example also shows the required SIP INVITE fields, such as Contact, Allow, Supported, and Accept.


1 Answers

The Contact header says where you are (or rather, where your User Agent is), while the From header says who you are.

You might have several SIP devices all registered to the same Address of Record (the URI you put in the From header).

Further, REGISTER requests use Contact headers to maintain SIP's location service: they let a user agent update a registrar's location information.

(As an aside, if Alice calls Bob, the Contact header needs to be in a 2xx response so that Alice can route the 2xx's ACK to Bob. This points to DarkDust's comment about some SIP proxies mangling Contact headers: if it doesn't, you find yourself in the uncomfortable position of having a call that's only half established: Alice thinks the call's set up because she sent her ACK, but Bob never receives it. An alternative to a Contact-mangling Proxy is using a B2BUA as a network gateway; it wouldn't need to mangle the Contact header because the header would point to the B2BUA itself.)

In response to Phoenix Luo's comments, because of the shortcomings of using LAN IPs in a Contact header, RFC 5627 describes a solution - using globally routable user agent URIs (GRUUs) in the Contact header/s.

like image 80
Frank Shearar Avatar answered Sep 23 '22 03:09

Frank Shearar