Calls are started by means of the methods INVITE together with SDP (Session Description Protocol) which carry the information necessary to allow the endpoints of the calls to exchange audio in form of RTP (Real Time Protocol) packets.
Let’s see a typical call dialog:
The INVITE method containing SDP is sent to the called party which replies with a provisional message Ringing (which indicates that the remote endpoint is ringing). Before Ringing, a Trying is usually sent by the SIP Proxy to prevent the caller from retransmitting the message.
The callee can then either accept the call with OK or refuse it with an error. The callee can interrupt the session at any time by sending a CANCEL.
Let’s see in detail which data are exchanged and which headers are important to us during debug:
INVITE sip:001234567890@10.135.0.1:5060;user=phone SIP/2.0 Via: SIP/2.0/UDP 10.135.0.12:5060;branch=z9hG4bKhye0bem20x.nx8hnt Max-Forwards: 70 From: "Calling User" <sip:151@10.135.0.1:5060>;tag=m3l2hbp To: <sip:001234567890@10.135.0.1:5060;user=phone> Call-ID: ud04chatv9q@10.135.0.1 CSeq: 10691 INVITE Contact: <sip:151@10.135.0.12;line=12071>;+sip.instance="<urn:uuid:0d9a008d-0355-0024-0004-000276f3d664>" Allow: INVITE, CANCEL, BYE, ACK, REGISTER, OPTIONS, REFER, SUBSCRIBE, NOTIFY, MESSAGE, INFO, PRACK, UPDATE Content-Disposition: session Supported: replaces,100rel User-Agent: Wildix W-AIR 03.55.00.24 9c7514340722 02:76:f3:d6:64 Content-Type: application/sdp Content-Length: 254 v=0 o=151 9655 9655 IN IP4 10.135.0.12 s=- c=IN IP4 10.135.0.12 t=0 0 m=audio 50024 RTP/AVP 8 0 2 18 a=rtpmap:8 PCMA/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:2 G726-32/8000/1 a=rtpmap:18 G729/8000 a=ptime:20 a=maxptime:80 a=sendrecv a=rtcp:50025
- The method is INVITE and the SIP URI requested is the number dialed: 001234567890 (a leading 0 is added by the phone to use the outgoing line; this leading 0 might not be present, or – in countries like the United States – it might be substituted with 9)
- Cseq: in case methods different from REGISTER are used, the number does not have to start with 1 so the User Agent picked 10691
- Contact: in this case Contact includes also +sip.instance or a unique identifier which allows the SIP Registrar / Proxy to easily detect duplicated registrations
- Supported: indicates that the User Agent supports Replaces (needed during transfers to replace an existing session) – 100rel (indicates support for the reliable transmission of provisional responses 1XX)
- Content-Type: indicates that the SIP message includes also an SDP body which provides the information about the media supported by the calling party
SIP/2.0 407 Proxy Authentication Required Via: SIP/2.0/UDP 10.135.0.12:5060;branch=z9hG4bKhye0bem20x.nx8hnt;rport=5060 From: "Calling User" <sip:151@10.135.0.1:5060>;tag=m3l2hbp To: <sip:001234567890@10.135.0.1:5060;user=phone>;tag=b27e1a1d33761e85846fc98f5f3a7e58.d5d4 Call-ID: ud04chatv9q@10.135.0.1 CSeq: 10691 INVITE Proxy-Authenticate: Digest realm="10.135.0.1", nonce="WWdAiVlnPjECocBoyYtBDshUs+RxMS+3" Server: Wildix GW-4.2.5.35963 Content-Length: 0
As in the case of the REGISTER message, the server will request authentication before accepting the request, as the initial INVITE does not contain any information needed for authentication.
In this case the message is slightly different – 407 Proxy Authentication Required – to indicate that it is a Proxy requesting the authentication.
ACK sip:001234567890@10.135.0.1:5060;user=phone SIP/2.0 Via: SIP/2.0/UDP 10.135.0.12:5060;branch=z9hG4bKhye0bem20x.nx8hnt Max-Forwards: 70 From: "Calling User" <sip:151@10.135.0.1:5060>;tag=m3l2hbp To: <sip:001234567890@10.135.0.1:5060;user=phone>;tag=b27e1a1d33761e85846fc98f5f3a7e58.d5d4 Call-ID: ud04chatv9q@10.135.0.1 CSeq: 10691 ACK User-Agent: Wildix W-AIR 03.55.00.24 9c7514340722 Content-Length: 0
The client acknowledges having received the authentication challenge.
INVITE sip:001234567890@10.135.0.1:5060;user=phone SIP/2.0 Via: SIP/2.0/UDP 10.135.0.12:5060;branch=z9hG4bKw5ij3wn4knq9hn8kkrmoa64.ahrre7d Max-Forwards: 70 From: "Calling User" <sip:151@10.135.0.1:5060>;tag=m3l2hbp To: <sip:001234567890@10.135.0.1:5060;user=phone> Call-ID: ud04chatv9q@10.135.0.1 CSeq: 10692 INVITE Contact: <sip:151@10.135.0.12;line=12071>;+sip.instance="<urn:uuid:0d9a008d-0355-0024-0004-000276f3d664>" Allow: INVITE, CANCEL, BYE, ACK, REGISTER, OPTIONS, REFER, SUBSCRIBE, NOTIFY, MESSAGE, INFO, PRACK, UPDATE Content-Disposition: session Proxy-Authorization: Digest username="151", realm="10.135.0.1", nonce="WWdAiVlnPjECocBoyYtBDshUs+RxMS+3", uri="sip:001234567890@10.135.0.1:5060;user=phone", response="b6194033119482068b09dc2688172baf" Supported: replaces,100rel User-Agent: Wildix W-AIR 03.55.00.24 9c7514340722 02:76:f3:d6:64 Content-Type: application/sdp Content-Length: 254 v=0 o=151 9655 9655 IN IP4 10.135.0.12 s=- c=IN IP4 10.135.0.12 t=0 0 m=audio 50024 RTP/AVP 8 0 2 18 a=rtpmap:8 PCMA/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:2 G726-32/8000/1a=rtpmap:18 G729/8000 a=ptime:20 a=maxptime:80 a=sendrecv a=rtcp:50025
The second INVITE looks pretty much the same, but the CSeq value has increased and the authentication information is now present.
SIP/2.0 100 trying -- your call is important to us Via: SIP/2.0/UDP 10.135.0.12:5060;branch=z9hG4bKw5ij3wn4knq9hn8kkrmoa64.ahrre7d;rport=5060 From: "Calling User" <sip:151@10.135.0.1:5060>;tag=m3l2hbp To: <sip:001234567890@10.135.0.1:5060;user=phone> Call-ID: ud04chatv9q@10.135.0.1 CSeq: 10692 INVITE Server: Wildix GW-4.2.5.35963 Content-Length: 0
Server replies immediately with Trying, to indicate that the message has been received and avoid re-transmissions from the client which would happen within 500 ms (the standard T1 Timer 1 for SIP) – 1000 ms (twice the previous timeout) – 2000 ms (1000 ms x 2) – 4000 ms (2000 ms x 2) up to 16000 milliseconds. Thus in total an SIP Client will by default try 32 seconds before cancelling a request which is called Timer B (64 times T1). T1 can be modified and should be equal to the estimated maximum round trip time between client and server.
SIP/2.0 100 Ringing Via: SIP/2.0/UDP 10.135.0.12:5060;branch=z9hG4bKw5ij3wn4knq9hn8kkrmoa64.ahrre7d;rport=5060 From: "Calling User" <sip:151@10.135.0.1:5060>;tag=m3l2hbp To: <sip:001234567890@10.135.0.1:5060;user=phone> Call-ID: ud04chatv9q@10.135.0.1 CSeq: 10692 INVITE Server: Wildix GW-4.2.5.35963 Content-Length: 0
The remote side indicates Alerting state – the remote device is ringing.
SIP/2.0 183 Session in Progress Via: SIP/2.0/UDP 10.135.0.12:5060;branch=z9hG4bKw5ij3wn4knq9hn8kkrmoa64.ahrre7d;rport= 5060 From: "Calling User" <sip:151@10.135.0.1:5060>;tag=m3l2hbp To: <sip:001234567890@10.135.0.1:5060;user=phone> Call-ID: ud04chatv9q@10.135.0.1 CSeq: 10692 INVITE Server: Wildix GW-4.2.5.35963 Content-Type: application/sdp Content-Length: 170 v=0 o=root 1673140232 1673140232 IN IP4 10.135.0.1 s=Wildix 35935 c=IN IP4 10.135.0.1 t=0 0 m=audio 13504 RTP/AVP 8 a=rtpmap:8 PCMA/8000/1 a=ptime:20 a=sendrecv
Besides Ringing the remove side might provide inband information such as early media before connection as in the example above. This is used for example by operators to provide free messages before transferring a call to voicemail.
SIP/2.0 200 OK Via: SIP/2.0/UDP 10.135.0.12:5060;rport=5060;branch=z9hG4bKw5ij3wn4knq9hn8kkrmoa64.ahrre7d From: "Calling User" <sip:151@10.135.0.1:5060>;tag=m3l2hbp To: <sip:001234567890@10.135.0.1:5060;user=phone>;tag=as27b249ee Call-ID: ud04chatv9q@10.135.0.1 CSeq: 10692 INVITE Server: WildixGW 35935 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH Supported: replaces, timer Session-Expires: 600;refresher=uas Contact: <sip:001234567890@10.135.0.1;transport=UDP> P-Asserted-Identity: "+331XXXXXXXX" <sip:+331XXXXXXXX@10.135.0.1> Content-Type: application/sdp Content-Length: 170 v=0 o=root 1673140232 1673140232 IN IP4 10.135.0.1 s=Wildix 35935 c=IN IP4 10.135.0.1 t=0 0 m=audio 13504 RTP/AVP 8 a=rtpmap:8 PCMA/8000/1 a=ptime:20 a=sendrecv
Please note that the SDP contains only one codec. It is also important to notice that the header “P-Asserted-Identity” contains the information which will be then displayed to the caller on the screen.
Information request: