-
Notifications
You must be signed in to change notification settings - Fork 13
/
README
210 lines (148 loc) · 5.5 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
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 moh@192.168.1.133: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
ssinyagin@k-open.com
http://www.voxserv.ch/