Skip to content

Voice quality probe for end-to-end measurement of jitter and packet loss

Notifications You must be signed in to change notification settings

voxserv/voip_qos_probe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Voice quality probe for end-to-end measurement of jitter and packet loss
========================================================================

This is a clone of minimal FreeSWITCH configuration
(https://github.com/voxserv/freeswitch_conf_minimal) and a few additional
scripts that I built when we needed to measure end-to-end QoS for voice
communication. The same setup is used on the probe computers on both
sides. The test script starts a 30-second SIP call between ports 5080 on
each side and plays MOH in both directions. Few seconds before the call,
tshark is started on both ends, so that RTP stream quality is analyzed
and printed at the end of the call. The results are then stored in a CSV
file in "/var/local/voip_probe/reports" directory.

The resulting report contains jitter and packet loss statistics for both
ends of the call (on receiving side).

WARNING: the test script assumes that there is no NAT between the
probes. In case of NAT, far-end statistics will not be properly
displayed.

Also a tcpdump process is permanently running on every probe and stores
the SIP and RTP packet content on the disk.

Anonymous FTP server is enabled on the probe, so that reports and packet
captures can be easily downloaded.

You can set up as many probes as needed with the same installation
sequence, and set up the calls between them in cron jobs. "simple-cdd"
package allows to automate the installation, so that it's replicated on
multiple computers.

Old Intel Atom netbooks can be used as probes, or also PC Engines' new
APU platform (https://github.com/ssinyagin/pcengines-apu-debian-cd).

This installation is tested with Debian Wheezy, and should also work
with Debian Squeeze or Ubuntu.

You need to make sure that root user on every probe can login as root on
the probe on the other end of a call with SSH public key, and the public
key should have empty passphrase. The test script executes tshark on the
far end via SSH. The easiest way is to distribute the same set of
private and public keys and authorized_keys among all probes in the
test.



Installation procedure (Debian Wheezy)
--------------------------------------

# required packages

apt-get update
apt-get install -y \
ntp curl git tshark tcpdump vsftpd \
libnet-address-ip-local-perl libdatetime-perl

# install FreeSWITCH from packages

cat >/etc/apt/sources.list.d/freeswitch.list <<EOT
deb http://files.freeswitch.org/repo/deb/debian/ wheezy main
EOT

curl http://files.freeswitch.org/repo/deb/debian/freeswitch_archive_g0.pub | \
apt-key add -

apt-get update
apt-get install -y freeswitch-meta-all 

# install the probe

cd /etc
git clone https://github.com/voxserv/voip_qos_probe.git freeswitch

insserv freeswitch
service freeswitch start

# reports and packet captures will be stored here

mkdir /var/local/voip_probe
mkdir /var/local/voip_probe/reports
mkdir /var/local/voip_probe/pcap

# packet capture and the startup script for it

cat >/usr/local/sbin/start_voip_sniffer <<'EOF'
#!/bin/sh
/usr/sbin/tcpdump -i eth0 -p -s0 \
    -G 3600 -w /var/local/voip_probe/pcap/voip-%F--%H-%M-%S.pcap \
    udp port 5080 or udp port 5060 or udp portrange 16384-32767
EOF

chmod 744 /usr/local/sbin/start_voip_sniffer

cat >/etc/init.d/voip_sniffer <<'EOF'
#!/bin/sh
#

### BEGIN INIT INFO
# Provides:          voip_sniffer
# Required-Start:    $local_fs $remote_fs $network $syslog
# Required-Stop:     $local_fs $remote_fs $network $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      
# Short-Description: tcpdump for UDP packets
### END INIT INFO

PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON="/usr/local/sbin/start_voip_sniffer"
DESC="tcpdump for UDP packets"
VERBOSE=yes

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Define LSB log_* functions.
. /lib/lsb/init-functions

OPTIONS=""

do_start()
{
        start-stop-daemon --start --background \
                --name voip_sniffer --exec $DAEMON \
                || return 1
}

case "$1" in
  start)
        [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
        do_start
        case "$?" in
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        esac
        ;;
  stop)
        echo not supported
        ;;
esac

exit 0
EOF

chmod 744 /etc/init.d/voip_sniffer
insserv voip_sniffer
service voip_sniffer start


# install SSH keys for root

mkdir /root/.ssh/
chmod 700 /root/.ssh/

cat >/root/.ssh/id_rsa <<EOT
-----BEGIN RSA PRIVATE KEY-----
some key goes here
-----END RSA PRIVATE KEY-----
EOT

chmod 600 /root/.ssh/id_rsa

cat >/root/.ssh/id_rsa.pub <<EOT
some other key goes here
EOT

cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys


# point anonymous FTP directory to our reports

cat >>/etc/vsftpd.conf <<EOT
#
anon_root=/var/local/voip_probe
EOT

service vsftpd restart

# You probably need to adapt /etc/ntp.conf if it's a closed corporate
# environment


# Try the test call. Use fs_cli on both ends to see the debug output and
# call progress

fs_cli -x 'perlrun /etc/freeswitch/scripts/probe.pl [email protected]:5080'

# Try the test script. The results will be shown in a new CSV file in
# /var/local/voip_probe/reports

/etc/freeswitch/scripts/run_test --dest=192.168.1.133

# If everything went fine, install the cron jobs

cat >/etc/cron.d/voip_probe <<'EOF'
0 0 * * * root find /var/local/voip_probe/pcap -type f -mtime +14 -exec rm '{}' ';'
2-52/10 * * * * root /etc/freeswitch/scripts/run_test --dest=192.168.1.133
EOF




AUTHOR
------

Stanislav Sinyagin
[email protected]
http://www.voxserv.ch/


About

Voice quality probe for end-to-end measurement of jitter and packet loss

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages