Reporting end-of-call RTP statistics in SIP BYE message

Supported in Softphone.Pro 4.9 and newer.

Softphone.Pro can send diagnostic information to the SIP server after the end of the call. You can see this information on the server in the real-time or log it to investigate later.

End-of-call statistics is sent if the call is finished by Softphone.Pro.

Setup statistics reporting

1. Exit Softphone.Pro.

2. Open SoftphonePro.ini config file with a text editor and find SendEndOfCallStatistics parameter in [AppSettings] section. Change its value to 1.

3. Save changes and launch Softphone.Pro.

Example of end-of-call statistics

End-of-call statistics is sent in P-RTP-Stat header in a BYE message. Softphone.Pro sends BYE message when the call is finished by user.

BYE message example:

BYE sip:pbxdomain:5060 SIP/2.0
Via: SIP/2.0/UDP;rport;branch=z9hG4bKPj4d4e824874a248059054c7bf75162090
Max-Forwards: 70
From: ;tag=6c2ed5c456ef4f93aec2a14970fa3ba3
To: ;tag=49d6bde5-07a2-49ea-b90c-bc805fdf68e6
Call-ID: 79c00fcf332647ada26da7726271511b
CSeq: 10964 BYE
User-Agent: SoftphonePro
P-RTP-Stat: PS=246, OS=39360, PR=242, OR=38720, PL=0, JI=180, LA=0, DU=5
Content-Length:  0

P-RTP-Stat header with end-of-call statistics has multiple fields:

  • PS - Packets Sent, number of packets sent;
  • OS - Octets Sent, number of bytes sent;
  • PR - Packets Received, number of packets received;
  • OR - Octets Received, number of bytes received;
  • PL - Packets Lost, number of packets lost;
  • JI - Jitter, in milliseconds;
  • LA - Round Trip Delay, the time it takes a signal to be sent and received, in milliseconds;
  • DU - Call Duration, in seconds.

This information can be useful in VoIP quality troubleshooting. You can find out more on VoIP call quality in the following article.

Real-time end-of-call statistics monitoring on SIP server

For example, you can use sngrep tool to analyze end-of-call statistics in real-time. This tool allows you to capture SIP packets on your PBX in real time. This can be useful if you want to see statistics for a particular user.

End-of-call statistics example in BYE message captured by sngrep:

Sngrep example

Logging end-of-call statistics on SIP server

You can collect end-of-call statistics on your PBX for a particular time period, and write it to a file.

For example, you can use sipgrep tool to capture SIP packets with a particular header and write data to a text file.

Command example:

sipgrep -l 'P-RTP-Stat:' -M | grep --line-buffered -P -o '(^U ).*(\.\d{6})|^From:.*>|^To:.*>|^P-RTP-Stat:.*' >> stats.log

This command will capture all packets with P-RTP-Stat header, and will write to stats.log file the time the packet was received, caller ID, DID number and the end-of-call statistics. You can investigate that file later and extract data in any format you need.

Stats.log example:

Log file captured by sipgrep

You may also like:

Blog Yes, we DID: 5 awesome VoIP terms that might make you smile