The SIP is most widely used protocol for VoIP calls. It defines specific format of messages (SIP packets) and their sequence to make calls over IP networks.
The SIP messages are carried by means of
UDP,
TCP, or TLS/TCP (it is called
SIPS).
A typical sequence of SIP messages during a VoIP call (SIP call flow diagram) is displayed in beginning of the book, here we show it one more time:
- INVITE packet (request from endpoint A to endpoint B) means initiation of call: "A wants to make new call to B"
- 100 Trying packet (response from B to A to INVITE) means confirmation of INVITE packet delivery: "B received the INVITE". 100 means response code
- 180 Ringing packet (response from B to A to INVITE) means indication of ringing state: "Phone B started to make rings". At ths time caller (A) starts to hear ringback tone. 180 means response code
- 200 OK packet (response from B to A to INVITE) means indication of answer (connection, start of billing): "Phone B answered to the call". 200 means response code
- ACK packet (from B to A) means confirmation of 200 OK packet delivery: "A received the 200 OK"
- BYE packet (request from A to B) means termination of call: "Phone A ends the call"
- 200 OK packet (response from B to A to BYE) means confirmation of BYE packet delivery: "B received the BYE"
Task: open
this file in wireshark, go to "Telephony - VoIP calls" in menu and see SIP call flow diagram for the recorded VoIP call.
Other possible scenarios of VoIP calls:
- Call is ended by B after answer
- Difference from previous flow is initiator of BYE packet
Task: open
this file in wireshark, see which party (A or B, caller or callee) ended the call with BYE.
- Call is ended by A before answer
- Caller party (endpoint A) sends SIP packet "CANCEL" before connection - means "A ends the call before answer"
- Called party (endpoint B) responds to CANCEL with "200 OK" - means "B confirms receiving of CANCEL"
- Called party (endpoint B) responds to initial INVITE with "487 Request Terminated" - means "B confirms ending of call". 487 means response code
- Caller party (endpoint A) sends ACK to 487 packet - means "A confirms receiving of 487"
- Call is rejected by B (ended before answer)
- Called party (endpoint B) responds to initial INVITE with "486 Busy Here" - means "B rejects the call with status = busy". 486 means response code
- Caller party (endpoint A) sends ACK to 486 packet - means "A confirms receiving of 486"
- Normal call flow (same as on first diagram) but with audio ringtone coming from B (can be ringback tone or music)
- Called party (endpoint B) responds to INVITE with "183 Session Progress" which means initiation of audio channel between A and B
- RTP media packets (audio signal) are sent between endpoints after "183", before "200 OK" (answer signal), it is called early media. Note that it is bidirectional audio stream, but it does not mean that SIP servers always pass early media from A to B. It depends on every particular softswitch. From our experience we see that most softswitches really pass early media from caller to called party in early media, before start of billing. It is safe for caller-side software because caller does not pay for early media RTP traffic.
Tasks:
- Does this file contain early media (RTP packets before 200 OK)?
- Does this file contain early media?
Caller and called parties are also called SIP endpoints, A and B, user agents,
UAC (User Agent Client) and UAS (User Agent Server).
Full technical documentation is available in
RFC3261 standard document published by IETF.
Also, you can find many articles and tutorials
published on our website.
SIP response codes
In this book we publish only most needed information about SIP, here is list of most popular response codes. Full list of SIP response codes is in
RFC3261,
- 100 Trying - confirmation about receiving INVITE request
- 180 Ringing - indication of ringing phone and ringback tone
- 183 Session Progress - set up of early media (sound coming from destination with custom ringback tone before answer, during call setup)
- 200 OK - answer of the call, connection between A and B endpoints
- 302 Moved Temporarily - redirection of call to another destiantion
- 400 Bad Request - indication of incorrect format (malformed request packet). Usually the malformed packets are sent by hackers. Normally the 400 response is received if endpoints have different understanding of SIP packet format and syntax (e.g. if made by different vendors)
- 401 Unauthorized - it is actually request of another INVITE with encrypted user/password credentials
- 403 Forbidden - means that the caller has no right to make call (invalid user name or password, invalid source IP address)
- 404 Not Found - usually means wrong number format or call to non-existent extension in PBX
- 401 Proxy Authentication Required - it is actually request of another INVITE with encrypted user/password credentials. Same as 401, but sent by SIP servers
- 408 Request Timeout - means that UAC did not receive any response from UAS after series of INVITE retransmissions. Usually happens when destination server is down, when sending call to wrong IP address and port, when INVITE is blocked by firewall
- 486 Busy Here - destination is busy (usually busy by another call)
- 487 Request Terminated - usually follows after CANCEL SIP packet, when call is cancelled, ended before answer
- 488 Not Acceptable Here - usually means incompatible codecs between UAC and UAS
- 500 Internal Server Error - some internal error happened in the UAS, usually indicates a bug in VoIP server, or malformed INVITE request
- 503 Service Not Available - usually means temporarily overload: UAS can not accept more calls at this time
- 603 Decline - means generic declining for various reasons
SIP trace
SIP trace is a series of captured/recorded SIP packets, SIP packet data represented as text. The SIP trace is necessary element for VoIP troubleshooting.
When something goes wrong with your phone system, the first thing to look at is SIP trace. SIP trace and pcap recordings provide evidence of VoIP issues.
SIP messages contain request/status line (
red), headers (
blue) and body (
green) (format of body is defined by protocol
SDP).
Here is sample SIP trace:
SIP messages for Call-ID 524c3ea2fdd1401ab4a90c940b073359
17:42:22.442 [+0,00ms] [TX] INVITE to 5.135.179.50:6000
INVITE sip:123456@startrinity.com SIP/2.0
Via: SIP/2.0/UDP 192.168.10.4:5090;rport;branch=z9hG4bKPjefcc1928b9d44bf68b202f5674f15b9c
Max-Forwards: 70
From: sip:unknown@startrinity.com;tag=d03ca0a253134ecc82c17a89e4b31e45
To: sip:123456@startrinity.com
Contact: <sip:unknown@192.168.10.4:5090>
Call-ID: 524c3ea2fdd1401ab4a90c940b073359
CSeq: 17970 INVITE
Allow: INFO, PRACK, SUBSCRIBE, NOTIFY, REFER, INVITE, ACK, BYE, CANCEL, UPDATE
Supported: 100rel, timer
User-Agent: StarTrinity.SIP 2018-06-14 19.29 UTC
Session-Expires: 72000;refresher=uas
Content-Type: application/sdp
Content-Length: 291
v=0
o=- 3739369344 3739369344 IN IP4 192.168.10.4
s=o3.proxy.stream0
c=IN IP4 192.168.10.4
t=0 0
m=audio 21504 RTP/AVP 8 0 4 18 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:4 G723/8000
a=rtpmap:18 G729/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
============================================================end of message=================
17:42:22.532 [+90,26ms] [RX] Trying from 5.135.179.50:6000
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.10.4:5090;rport=5090;received=87.117.173.127;branch=z9hG4bKPjefcc1928b9d44bf68b202f5674f15b9c
Call-ID: 524c3ea2fdd1401ab4a90c940b073359
From: <sip:unknown@startrinity.com>;tag=d03ca0a253134ecc82c17a89e4b31e45
To: <sip:123456@startrinity.com>
CSeq: 17970 INVITE
Supported: 100rel, timer
Content-Length: 0
============================================================end of message=================
17:42:22.542 [+100,16ms] [RX] Session Progress from 5.135.179.50:6000
SIP/2.0 183 Session Progress
Via: SIP/2.0/UDP 192.168.10.4:5090;rport=5090;received=87.117.173.127;branch=z9hG4bKPjefcc1928b9d44bf68b202f5674f15b9c
Call-ID: 524c3ea2fdd1401ab4a90c940b073359
From: <sip:unknown@startrinity.com>;tag=d03ca0a253134ecc82c17a89e4b31e45
To: <sip:123456@startrinity.com>;tag=e5316920762f4d01b4618882a3fbcad4
CSeq: 17970 INVITE
Supported: 100rel, timer
Contact: <sip:123456@5.135.179.50:6000>
Allow: INFO, PRACK, SUBSCRIBE, NOTIFY, REFER, INVITE, ACK, BYE, CANCEL, UPDATE
Server:
Content-Type: application/sdp
Content-Length: 251
v=0
o=- 3739358524 3739358524 IN IP4 5.135.179.50
s=i2.proxy.stream0
c=IN IP4 5.135.179.50
t=0 0
m=audio 26000 RTP/AVP 8 101
a=rtcp:26001 IN IP4 5.135.179.50
a=rtpmap:8 PCMA/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
============================================================end of message=================
17:42:25.584 [+3 142,67ms] [RX] Service Unavailable from 5.135.179.50:6000
SIP/2.0 503 Service Unavailable
Via: SIP/2.0/UDP 192.168.10.4:5090;rport=5090;received=87.117.173.127;branch=z9hG4bKPjefcc1928b9d44bf68b202f5674f15b9c
Call-ID: 524c3ea2fdd1401ab4a90c940b073359
From: <sip:unknown@startrinity.com>;tag=d03ca0a253134ecc82c17a89e4b31e45
To: <sip:123456@startrinity.com>;tag=e5316920762f4d01b4618882a3fbcad4
CSeq: 17970 INVITE
Supported: 100rel, timer
Allow: INFO, PRACK, SUBSCRIBE, NOTIFY, REFER, INVITE, ACK, BYE, CANCEL, UPDATE
Server:
Content-Length: 0
============================================================end of message=================
17:42:25.584 [+3 142,70ms] [TX] ACK to 5.135.179.50:6000
ACK sip:123456@startrinity.com SIP/2.0
Via: SIP/2.0/UDP 192.168.10.4:5090;rport;branch=z9hG4bKPjefcc1928b9d44bf68b202f5674f15b9c
Max-Forwards: 70
From: sip:unknown@startrinity.com;tag=d03ca0a253134ecc82c17a89e4b31e45
To: sip:123456@startrinity.com;tag=e5316920762f4d01b4618882a3fbcad4
Call-ID: 524c3ea2fdd1401ab4a90c940b073359
CSeq: 17970 ACK
Content-Length: 0
============================================================end of message=================
===============================saved by StarTrinity SIP Tester at 2018-06-30 18:27:45======
You can see INVITE request sent by UAC, multiple responses sent by UAS (100 Trying,
183 Session Progress,
503 Service Unavailable).
SIP Request Line INVITE sip:123456@startrinity.com SIP/2.0 means request type = "INVITE" (making a VoIP call),
SIP protocol version = "2.0" (the only one version used, as we see in 2018), and
destination SIP URI = "sip:123456@startrinity.com".
The URI in SIP is simular to URL in HTTP, it specifies target for the request. "sip:" or "sips:" here define protocol type,
"123456" is called number (telephone number of B endpoint).
In next chapters we will describe the SIP trace in detail.
Types of SIP packets
SIP Requests also known as SIP methods, SIP request methods. Most popular SIP request types:
- INVITE - most widely used SIP request, means request to make new VoIP call from UAC to UAS. When the INVITE is sent after connection (after "200 OK response") it usually means change of audio codec, putting call on hold, or sending/receiving fax
- ACK - confirmation that response was delivered to UAS
- BYE - ends current VoIP call after answer, sent by UAS or UAC
- CANCEL - ends a call before answer, sent by UAC
- REGISTER - sent from SIP phone user-agent to SIP server to register the phone to specific extension (i.e. internal phone number)
- REFER - starts call transfer procedure: e.g. A makes call, B answers, understands that call needs to be passed to C and sends request to B: "please transfer to C"
- We have listed only most popular SIP request types, see others in RFC3261
SIP Responses
The SIP response packets are is sent back to requesting endpoint and contain
SIP response code and optional error details in
SIP headers:
SIP/2.0 500 Internal Server Error
Via: SIP/2.0/UDP 9.45.33.11:5081;branch=z9hG4bK-10854-1-0
From: sipp <sip:111@9.45.33.11:5081>;tag=10854SIPpTag001
To: sut <sip:222@9.43.29.50:5060>;tag=38404-23F2
Date: Tue, 05 Feb 2013 05:49:37 GMT
Call-ID: 1-10854@9.45.33.11
CSeq: 1 INVITE
Allow-Events: telephone-event
Warning: 399 9.43.29.50 "Transcoder Not Configured"
Server: Cisco-SIPGateway/IOS-15.3.20130202.123643.
Reason: Q.850;cause=16
Content-Length: 0
In this example "Warning" header gives details about the error and "Reason" header gives information about
PSTN release code.
If a packet is lost somewhere between the endpoints A or B (UDP protocol does not gaurantee delivery of packets), the SIP packets are retransmitted.
Task: see types of SIP packets (requests, responses), and number of retransmitted packets in
file #1,
file #2,
file #3.
See what is destination IP address where packets are retransmitted to, do you think it is correct or not?
A header in SIP packet has a simple format:
[name]: [value]. SIP headers are separated by line breaks.
Most widely used SIP headers are
- From header indicates identity of caller, usually contains Caller ID (ANI, CLI, A number). Also contains unique "tag" set by UAC
- To header identifies recipient of the call, usually contains Called ID (called number, B number). Also contains unique "tag" set by UAS
- Via header saves information about proxy servers - server IP address and port - to pass response from UAS back to UAC via same set of proxy servers
- Record-Route header is optionally inserted by proxy servers to route subsequent SIP requests for the same SIP call
- Call-ID header identifies SIP call along with "From" and "To" headers
- Contact header specifies IP address and port to be used by peer SIP endpoints for subsequent SIP requests for the same SIP call
- CSeq header contains a decimal number which increases by 1 with every subsequent SIP request within the same SIP call, with the exception of CANCEL and ACK requests which use the CSeq number of corresponding INVITE request
- Server header indicates model, software/firmware version of UAS
- User-Agent header indicates model, software/firmware version of UAC
- Content-Length header as you will read later, INVITE and "200 OK" packets usually contain encapsulated SDP protocol data with information about RTP audio streams.
This header specifies size of encapsulated SDP (or other) data
- Content-Type header specifies type of encapsulated data. Equals to "application/sdp" in case of encapsulated SDP
- Allow header lists set of SIP requests supported by user agent which generated the SIP message
- Supported header specifies set of supported SIP extensions by user agent which generated the SIP message
- Require header specifies set of required SIP extensions by user agent which generated the SIP message
- Session-Expires header - part of RFC 4028 (Session Timers) SIP extension - specifies max. interval to refresh SIP call with keep-alive packet (the RFC3261 standard does not define way to abort hang calls)
- WWW-Authenticate, Authorization headers are used for digest authentication
There are many more headers; adding custom headers into requests and responses is a way to
extend SIP protocol.
Tasks:
- See SIP headers in this file: what software is used for UAC and UAS? What is SIP Call ID?
- See how to fix Contact header sent by UAS in this file
Registration
Registration in SIP means passing information about user agent to server, it is implemented with
REGISTER.
It means "Hello SIP server, here are my contact details for extension number 456: IP address 1.2.3.4, SIP port 5060".
Without registration SIP phones must know IP addresses of every destination phone; with registration the IP addresses are stored by SIP server, also known as
SIP registrar server.
Her is example SIP trace for the registration process:
SIP messages for Call-ID 64b10daa51dd4c5a9d6038a43163b22d
14:32:00.599 [+0,00ms] [TX] REGISTER to 5.135.179.50:6000
REGISTER sip:startrinity.com:6000 SIP/2.0
Via: SIP/2.0/UDP 192.168.10.4:5090;rport;branch=z9hG4bKPj609d6772ba754dcab9cba92bcb34be69
Max-Forwards: 70
From: <sip:100@startrinity.com>;tag=aef6297c37914f69832efc2c44c980aa
To: <sip:100@startrinity.com>
Call-ID: 64b10daa51dd4c5a9d6038a43163b22d
CSeq: 22151 REGISTER
Allow: INFO, PRACK, SUBSCRIBE, NOTIFY, REFER, INVITE, ACK, BYE, CANCEL, UPDATE
Contact: <sip:100@192.168.10.4:5090>
User-Agent: StarTrinity.SIP 2018-06-14 19.29 UTC
Expires: 3600
Content-Length: 0
============================================================end of message=================
14:32:00.674 [+74,84ms] [RX] Unauthorized from 5.135.179.50:6000
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 87.117.173.127:5090;rport=5090;received=87.117.173.127;branch=z9hG4bKPj609d6772ba754dcab9cba92bcb34be69
Call-ID: 64b10daa51dd4c5a9d6038a43163b22d
From: <sip:100@startrinity.com>;tag=aef6297c37914f69832efc2c44c980aa
To: <sip:100@startrinity.com>
CSeq: 22151 REGISTER
WWW-Authenticate: Digest realm="*",nonce="6ab702ae1b742592",opaque="66982f5173f64308",algorithm=md5
Content-Length: 0
============================================================end of message=================
14:32:00.674 [+74,88ms] [TX] REGISTER to 5.135.179.50:6000
REGISTER sip:startrinity.com:6000 SIP/2.0
Via: SIP/2.0/UDP 192.168.10.4:5090;rport;branch=z9hG4bKPjcfb02f366c7f435ba7991cbb13b9497c
Max-Forwards: 70
From: <sip:100@startrinity.com>;tag=aef6297c37914f69832efc2c44c980aa
To: <sip:100@startrinity.com>
Call-ID: 64b10daa51dd4c5a9d6038a43163b22d
CSeq: 22152 REGISTER
Allow: INFO, PRACK, SUBSCRIBE, NOTIFY, REFER, INVITE, ACK, BYE, CANCEL, UPDATE
Contact: <sip:100@192.168.10.4:5090>
User-Agent: StarTrinity.SIP 2018-06-14 19.29 UTC
Expires: 3600
Authorization: Digest username="100", realm="*", nonce="6ab702ae1b742592", uri="sip:startrinity.com:6000", response="abd79c866205325d0511a95b1e5f5087", algorithm=md5, opaque="66982f5173f64308"
Content-Length: 0
============================================================end of message=================
14:32:00.758 [+158,50ms] [RX] OK from 5.135.179.50:6000
SIP/2.0 200 OK
Via: SIP/2.0/UDP 87.117.173.127:5090;rport=5090;received=87.117.173.127;branch=z9hG4bKPjcfb02f366c7f435ba7991cbb13b9497c
Call-ID: 64b10daa51dd4c5a9d6038a43163b22d
From: <sip:100@startrinity.com>;tag=aef6297c37914f69832efc2c44c980aa
To: <sip:100@startrinity.com>
CSeq: 22152 REGISTER
Contact: sip:100@87.117.173.127:5090;expires=3600
Content-Length: 0
============================================================end of message=================
===============================saved by StarTrinity SIP Tester at 2018-07-02 14:32:12======
As you can see in the SIP trace, first REGISTER request sent by UAC
192.168.10.4 to UAS
5.135.179.50 means resitration of extension
100 at SIP server startrinity.com on SIP port 6000.
The UAC sends its IP address in Contact header:
Contact: <sip:100@192.168.10.4:5090>.
"Expires" SIP header equals to 3600 means that the registration entry should be valid for 3600 seconds -
in 60 minutes the registrar server should clear the registration entry if not received new REGISTER requests for this extension.
REGISTER request with "Expires: 0" means unregistration.
Digest authentication
As you can see in previous SIP trace (with REGISTER), first request is rejected with status "401 Unauthorized" and
WWW-Authenticate header, it is called
digest challenge.
The
WWW-Authenticate SIP header contains
nonce and
opaque values which are used by UAC along with user name and password to send second INVITE request.
The second INVITE request contains
Authorization header with
digest response, it is used by UAS to verify user name and password.
If user name and password are correct, UAS sends "200 OK" response, otherwise it sends "403 Unauthorized" response.
SIP extensions
Extensions of SIP protocol are defined by additional RFC standard documents (beyond RFC3261),
you can find them
here.
Most important SIP extensions are
- 100rel extension defines PRACK method to provide reliable delivery of provisional SIP responses.
It is fully described in RFC3262.
The PRACK packets are sent in response to 18x provisional responses via chain of SIP proxy servers from UAC to UAS:
Here is example SIP call flow for PRACK:
Without the PRACK, 18x SIP responses could be lost in IP network between UAS and UAC, it means no ringback tone played to caller.
With PRACK, 18x SIP response is retransmitted by UAS if it does not receive PRACK from UAC.
- timer extension defines a keep-alive mechanism for SIP calls, it is described in RFC4068 (Session Timers).
The keep-alive packets are sent as re-INVITE or UPDATE SIP packets between UAC and UAS; if the keep-alive packet is not received within session interval,
UAC or UAS considers call as hang (dead) and drops the call.
Without the session timer extension there could appear hang calls, existing on one SIP UA and already destroyed on another SIP UA.
Such situation can happen if internet connection drops between UAC and UAS during end of call, and BYE packet gets lost.
The RTP transfers audio or video stream between
user agents over
UDP protocol.
RTP media stream goes from source
IP address and
UDP port to destination
IP address and
UDP port.
In most cases RTP streams in VoIP are bidirectional.
Task: open
this file in wireshark, see what is source and destination IP addresses and UDP ports for RTP streams. How many RTP streams do you see in the file?
RTP is defined by
RFC3550 IETF standard document; its usage for VoIP is described in
RFC3551.
RTP packets (
encapsulated in UDP) contain following important fields:
- SSRC (synchronization source identifier) - a randomly selected 32-bit identifier for source of RTP stream,
usually also unique for many VoIP calls and does not change during call (SSRC may be changed only in rare cases, for example when call is put on hold).
The SSRC is used to detect RTP collisions (when multiple RTP streams are sent to same UDP port)
- Sequence number - 16-bit integer number which is incrememented by 1 with every subsequent transmitted RTP packet.
Is used in jitter buffer on receiver side to detect and compensate lost and delayed packets.
Initial value for the sequence number is usually assigned randomly.
- Timestamp - 32-bit field, usually randonly initialized like sequence number and incremented
with every transmitted RTP frame by number of transmitted samples.
For example for audio RTP packets with sample rate 8kHz and containing 20ms audio in every RTP packets, RTP timestamp gets incremented by
8000 / 1000 * 20 = 160 samples.
For a MPEG video RTP packet with sample rate 90000Hz and 30FPS it would be 90000/30 = 3000 samples per frame.
For codecs with variable bit rate (VBR) it is more complex.
Note: Timestamp and Sequence number values may jump, and VoIP software must be able to handle the jumps.
- Payload - encapsulated voice/video data, or DTMF digit.
The media stream is splitted into small frames of 10..50 milliseconds and transmitted over RTP packets.
The duration of the frame is called packet time, it is configurable in VoIP software.
The audio/video data is encoded with a codec. Type of the codec is specified by payload type and SDP.
- Payload type - 7-bit integer (0-127), specifies format of encapsulated payload: encoded audio/video or DTMF digit.
RTP streams are used to transfer DTMF digits (when caller presses a key on phone during call), it is defined by RFC2833.
Range of payload types (0..127) is divided into static payload types (0..95) and dynamic payload types (96..127),
for more information please refer to RFC3551.
Most common static payload types / audio codecs are:
- 0 / G.711 mU-law (also known as PCMU) and
- 8 / G.711 A-law (also known as PCMA) - stateless audio codec with simplest implementation.
There is one-to-one mapping between uncompressed 16-bit PCM samples and compressed 8-bit G.711 samples; the mapping is different for mu-law and a-law.
A-law is used in EU; mu-law is used in US.
The G.711 codec is used in TDM networks.
Sample frequency is 8 kHz (8000 audio samples per second).
Here word stateless means that encoding/decoding of an audio sample does not use information about previously encoded/decoded audio samples.
Bandwidth of G.711 codec is 64kbit/s.
- 18 / G.729 - stateful 8kbit/s audio codec, royalty-free since 2017 (patent has expired).
G.729 has been extended with annexes G.729A and G.729B:
- G.729A has a medium complexity, and is compatible with original G729. It provides a slightly lower voice quality
- G.729B extends G.729 with silence suppression, and is not compatible with the previous versions.
The G729B introduces CNG (comfort noise generator) packets with smaller size, in this way reducing bandwidth when there is no sound
- G.729AB extends G729A with silence suppression, and is only compatible with G729B
DTMF digits and fax transmission cannot be transported reliably with G729.
- 3 / GSM - GSM codec, stateful. Is rarely used
- 4 / G.723 - G.723 codec, stateful. Is rarely used
Other codecs and DTMF digits are transmitted with dynamic payload types.
The dynamic payload types are used in conjunction with SDP, where actual name of codec is specified.
SDP - example #1
INVITE sip:123456@5.6.7.8;user=phone SIP/2.0
Via: SIP/2.0/UDP 1.2.3.4:5061;rport;branch=z9hG4bK-3767867992-3776019369-1982645923-1415686538
From: <sip:srct_tel_num@1.2.3.4:5061;user=phone>;tag=910826072-3776019369-1982645923-1415686538
To: <sip:123456@5.6.7.8;user=phone>
Call-ID: 581a4a72a97b11e1a3c62c768aa96154@1.2.3.4
CSeq: 1 INVITE
Contact: <sip:srct_tel_num@1.2.3.4:5061;user=phone>
Content-Type: application/sdp
Allow: ACK, BYE, CANCEL, INFO, INVITE, OPTIONS, REFER, REGISTER, UPDATE
Max-Forwards: 70
User-Agent: StarTrinity v.4.4.0-19a
Content-Length: 714
v=0
o=- 1338288302 1338288302 IN IP4 1.2.3.4
s=-
c=IN IP4 1.2.3.4
t=0 0
m=audio 35018 RTP/AVP 18 103 0 8 4 3 96 102
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:103 G729/8000
a=fmtp:103 annexb=yes
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:4 G723/8000
a=fmtp:4 annexa=yes
a=rtpmap:3 GSM/8000
a=rtpmap:96 speex/8000
a=fmtp:96 mode=3;vbr=off
a=rtpmap:102 telephone-event/8000
a=fmtp:102 0-15
a=sendrecv
- Marker bit - could be is set to 1 with every start of new RTP stream fragment (for example when RTP stream is interrupted by DTMF digit).
The marker bit is used as a flag to re-initialize jitter buffer.
Task: open
this file in wireshark, see RTP codec, packet time in samples, packet time in milliseconds, SSRC identifiers.
RTP streams in Wireshark
The Wireshark tool provides great functionality to analyse RTP streams in recorded VoIP traffic.
You can view RTP streams in Wireshark using menu Telephony - RTP - RTP Streams.
Task: open
this file, see
- How many VoIP calls captured in the file, what are dialed destination numbers, what are caller ID's
- How many RTP streams captured in the file
- What are source and destination IP addresses and UDP port numbers
Multiple RTP streams are selectable with a mouse (left button click).
Button "prepare filter" allows you to view only selected RTP streams in main window area.
It is useful when you have many VoIP calls recorded and need to debug only one call:
The filtered RTP packets could be analysed to check their payload type, timestamp, sequence field, the payload itself as hex bytes (see screenshot).
Tasks with
same file: see
- Is there any pattern in marker bit?
- What is size of DTMF payload, size of G.711 payload?
- How many RTP packets transmit every single DTMF digit? What is duration of DTMF digits (in milliseconds and samples)?
- Which party sends DTMF: UAC or UAS?
The selected RTP stream(s) could be analysed (button "Analyse") to see some great details (see screenshot)
and listened via sound card:
If you need to link RTP streams to VoIP calls, it is possible with Wireshark's VoIP call flow diagram:
menu item Telephony - VoIP calls - (select a call) - Flow sequence:
Clicking on RTP stream in the call flow selects corresponding RTP packet inside main window area.
Task with
same file: what DTMF sequence(s) are played within the recorded VoIP calls? All same or different?
todo: what is delta and skew? What are normal values? What if skew is too high: desync of RTP clock. in TDM circuits there was a special wire for this 8khz synchronization. and in voip - no. and it is a potential issue, not covered by RTP and SIP.