9. - SIP Header

A sip message looks like an HTTP message

here is an example of a SIP header.

 

INVITE sip:user@example.com SIP/2.0
Via: SIP/2.0/UDP 192.168.0.10:5060;branch=z9hG4bK776asdhds
Max-Forwards: 70
To: <sip:user@example.com>
From: "John" <sip:john@example.com>;tag=4234235
Call-ID: 985673242@192.168.0.10
CSeq: 1 INVITE
Contact: <sip:john@192.168.0.10:5060>
Content-Type: application/sdp
Content-Length: 142

v=0
o=- 2304919776 2304919776 IN IP4 192.168.0.10
s=SDP Seminar
c=IN IP4 192.168.0.10
t=0 0
m=audio 49170 RTP/AVP 0
a=rtpmap:0 PCMU/8000

This is an example of a SIP INVITE message, which is used to initiate a session between two SIP endpoints. The header contains various fields that provide information about the message, including the sender and recipient addresses, a unique call ID, the type of message, and any session description information in the SDP (Session Description Protocol) body.

Here is another example with more details

INVITE sip:bob@biloxi.com SIP/2.0
Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bK776asdhds
Max-Forwards: 70
To: Bob <sip:bob@biloxi.com>
From: Alice <sip:alice@atlanta.com>;tag=1928301774
Call-ID: a84b4c76e66710
CSeq: 314159 INVITE
Contact: <sip:alice@pc33.atlanta.com>
User-Agent: model300/7.6.9
Allow: INVITE,ACK,CANCEL,BYE,OPTIONS,NOTIFY,SUBSCRIBE
Allow-Events: talk,hold,refer
Session-Expires: 3600;refresher=uas
Content-Type: application/sdp
Content-Length: 142

 

Here is the 200 Response
SIP/2.0 200 OK
Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bK776asdhds;received=192.0.2.1;rport=5060
To: Bob <sip:bob@biloxi.com>;tag=9fxced76sl
From: Alice <sip:alice@atlanta.com>;tag=1928301774
Call-ID: a84b4c76e66710
CSeq: 314159 INVITE
Contact: <sip:bob@192.0.2.4:5060>
User-Agent: server500/2.0.3
Allow: INVITE,ACK,CANCEL,BYE,OPTIONS,NOTIFY,SUBSCRIBE
Allow-Events: talk,hold,refer
Session-Expires: 1800;refresher=uac
Record-Route: <sip:192.0.2.100;lr=on>
Content-Type: application/sdp
Content-Length: 238

v=0
o=bob 2890844526 2890844526 IN IP4 192.0.2.4
s=-
c=IN IP4 192.0.2.4
t=0 0
m=audio 49170 RTP/AVP 0
a=rtpmap:0 PCMU/8000

 

 

Remember that in the header the Via, From, To, Call-ID, CSeq are copied exactly from request.
TO and FROM are NOT swapped around in Request and Response headers!

Alice -> Bob:  INVITE sip:bob@biloxi.com SIP/2.0
Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bK776asdhds
Max-Forwards: 70
To: Bob <sip:bob@biloxi.com>
From: Alice <sip:alice@atlanta.com>;tag=1928301774
Call-ID: a84b4c76e66710
CSeq: 314159 INVITE
Contact: <sip:alice@pc33.atlanta.com>

Revision #1
Created 6 May 2023 03:34:17 by Cesar Gzz
Updated 6 May 2023 05:30:38 by Cesar Gzz