<?xml version="1.0" encoding="utf-8"?>
<rss version='2.0' xmlns:lj='http://www.livejournal.org/rss/lj/1.0/'>
	<channel>
		<title>The Corelatus Blog - Entries tagged questions-from-customers</title>
		<description>Entries tagged questions-from-customers</description>
                <link>../../</link>

	
	<item>
		<title>SOX parameters for downsampling to 8kHz Alaw</title>
		<link>../../SOX_parameters_for_downsampling_to_8kHz_Alaw.html</link>
		<guid isPermaLink="true">../../SOX_parameters_for_downsampling_to_8kHz_Alaw.html</guid>
                <pubDate>Thu, 19 Feb 2009 16:50:16 GMT</pubDate>
		<description>&lt;p&gt; A technician working for an operator mailed me a few days ago
wondering why the recorded voice clips they use for their IVR sound so
bad, &quot;like they&#39;re coming from the bottom of a deep well&quot;. It turned
out that the clips actually sounded OK on a telephone, just not
through his laptop&#39;s speaker. He asked if I recommend any specific
filter parameters when converting audio from 44.1kHz wav to 8kHz Alaw
voice clips.
&lt;/p&gt;

&lt;h4&gt;An example&lt;/h4&gt;

&lt;p&gt;
I took this audio snippet from the introduction to an audio book. It
was originally a .ogg file. I converted it to a .wav file with a
44.1kHz sampling rate and 16 bits per sample. For my purposes any
artefacts from ogg vorbis are negligible.
&lt;/p&gt;

&lt;a href=&quot;http://www.corelatus.com/%7Ematthias/1_mono.wav&quot;&gt;1_mono.wav&lt;/a&gt; (44.1kHz, 16 bit linear samples)

&lt;p&gt;
Next, I converted it to 8kHz Alaw using &lt;a
href=&quot;http://sox.sourceforge.net/&quot;&gt;sox&lt;/a&gt;. 8kHz Alaw is what runs on
the fixed telephone network in most of the world.  (The US uses a
minor variant, &amp;#956;law):
&lt;/p&gt;

&lt;pre&gt;sox 1_mono.wav -A -r 8000 2_8kHz_alaw.wav&lt;/pre&gt;

&lt;a href=&quot;http://www.corelatus.com/%7Ematthias/2_8kHz_alaw.wav&quot;&gt;2_8kHz_alaw.wav&lt;/a&gt; (8kHz, 8 bit Alaw samples)

&lt;p&gt; That sounds a bit less clear than the original, but it&#39;s OK. It&#39;s
what you&#39;d expect coming out of a telephone. There&#39;s some weirdness
though. The audible difference between the two files varies from one
PC to another and even one playback program to another. Why? Because
laptop speakers vary in quality and because playback programs usually
quietly convert everything back to 48kHz or 44.1kHz sampling rates,
and they do it with different approaches. For fun, I resampled to
44.1kHz:
&lt;/p&gt;

&lt;pre&gt;sox 2_8kHz_alaw.wav -r 44100 -s 3_resampled.wav&lt;/pre&gt;

&lt;a href=&quot;http://www.corelatus.com/%7Ematthias/3_resampled.wav&quot;&gt;3_resampled.wav&lt;/a&gt; (44.1kHz, 16 bit linear samples)

&lt;p&gt; 2_8kHz_alaw.wav and 3_resampled.wav should sound almost the
same. But on some PCs they sound markedly different.  
&lt;/p&gt;

&lt;h5&gt;The GTH just plays octets (bytes)&lt;/h5&gt; 

&lt;p&gt;
The GTH has a simple approach to playing
back audio. It just copies the bytes you give it to the destination
timeslot. No format or rate conversion happens, though the GTH does
make sure the data is played out at the E1&#39;s frame rate (8000Hz). The
downside of that is that you have to convert all the files for your
IVR system before giving them to a GTH, e.g. using sox. The upside is
that it&#39;s simple. Nothing happens behind your back.
&lt;/p&gt;

&lt;h4&gt;What are the best SOX options to use?&lt;/h4&gt; 

&lt;p&gt;
I don&#39;t know. I used to suggest the following as a reasonable starting
point:
&lt;/p&gt;

&lt;pre&gt;sox original.wav -r 8000 -c 1 -A -t raw gth.raw resample -q&lt;/pre&gt;

&lt;p&gt;
As of a few years ago, sox improved and the &#39;resample&#39; effect got
deprecated. So now I suggest just letting sox do what it thinks is
best:
&lt;/p&gt;

&lt;pre&gt;sox original.wav -r 8000 -c 1 -A -t raw gth.raw&lt;/pre&gt;

&lt;p&gt; At the time of writing, it uses its &#39;rate&#39; effect with reasonable
default parameters for the bandwidth and filter characteristics. I
experimented a bit with the -m, -h, -v and -s switches for the &#39;rate&#39;
effect. I could not reliably hear a difference, let alone decide that
one sounded better.
&lt;/p&gt;

&lt;h4&gt;Why does the phone system use 8kHz anyway?&lt;/h4&gt;

&lt;p&gt;
There&#39;s a certain sound quality level expected in telephone networks,
and part of that is that the network carries everything up to about
3500Hz. Analog local loop specifications mention that, and pretty much
all digital telephone systems use an 8kHz sampling rate, which is what
you need to be able to carry audio up to 3.5kHz. Even the GSM and AMR
codecs start off with the assumption that the incoming audio is
limited to 3500Hz.
&lt;/p&gt;

&lt;p&gt;
So the bar is set pretty low. I haven&#39;t come across any systems which
set out to provide higher quality, e.g. even skype compresses the hell
out of the audio to save bandwidth. Even when both parties in a
conversation have huge amounts of it. Surprising, why not aim for VOIP
to sound much better than a regular telephone?
&lt;/p&gt;
</description>
	</item>
	
	<item>
		<title>The timestamp field in signalling headers</title>
		<link>../../The_timestamp_field_in_signalling_headers.html</link>
		<guid isPermaLink="true">../../The_timestamp_field_in_signalling_headers.html</guid>
                <pubDate>Mon, 23 Mar 2009 20:40:32 +0100</pubDate>
		<description>&lt;p&gt;
When the Corelatus GTH is used to monitor (sniff) signalling, it sends
each sniffed packet to your server over a TCP socket, along with a
header. For instance, for SS7 MTP-2 the header looks like this:
&lt;/p&gt;

&lt;pre&gt;
octet 0x00:  Length (16 bits)
octet 0x02:  Tag (16 bits)
octet 0x04:  Flags (16 bits)
octet 0x06: Timestamp (48 bits)
&lt;/pre&gt;

&lt;p&gt;
Every field is big-endian, i.e. the most significant byte comes
first. Here&#39;s an actual header from a GTH, octet by octet:
&lt;/p&gt;

&lt;pre&gt;
00 1c 00 00 00 00 01 20  34 ee fa 61 99 99 99 99 ...
&lt;/pre&gt;

&lt;p&gt;
The timestamp is thus 0x012034eefa61, or decimal 1237838658145. For
most applications, you just want to know which packet came first, so
the interpretation of that number doesn&#39;t matter much, though it&#39;s
useful to know that it&#39;s the number of &lt;strong&gt;milli&lt;/strong&gt;seconds
since the unix epoch. (wikipedia has a decent &lt;a
href=&quot;http://en.wikipedia.org/wiki/Unix_time&quot;&gt;article about unix
time&lt;/a&gt;)
&lt;/p&gt;

&lt;p&gt;
Sometimes, though, you want to represent that as a human-readable
time. Unix (and, most likely, Win32) provides functions to do that in
the C library, so, after throwing away the last three digits (the
milliseconds), this C program does it:
&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
&lt;span class=&quot;synPreProc&quot;&gt;#include &lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;&amp;lt;time.h&amp;gt;&lt;/span&gt;
&lt;span class=&quot;synPreProc&quot;&gt;#include &lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;

&lt;span class=&quot;synType&quot;&gt;int&lt;/span&gt; main() {
  &lt;span class=&quot;synType&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;synType&quot;&gt;time_t&lt;/span&gt; time_stamp = &lt;span class=&quot;synConstant&quot;&gt;1237838658&lt;/span&gt;;
  printf(&lt;span class=&quot;synConstant&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;%d&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt; corresponds to &lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;%s\n&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;&amp;quot;&lt;/span&gt;, time_stamp, ctime(&amp;amp;time_stamp));

  &lt;span class=&quot;synStatement&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt;;
}
&lt;/code&gt;&lt;/pre&gt;

The output agrees with what the clock on my wall says:
&lt;pre&gt;
1237838658 corresponds to Mon Mar 23 21:04:18 2009
&lt;/pre&gt;


&lt;h3&gt;Python&lt;/h3&gt;

&lt;p&gt;Since I&#39;ve been messing around with python, the same thing in python:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;span class=&quot;synPreProc&quot;&gt;import&lt;/span&gt; time
&amp;gt;&amp;gt;&amp;gt; time.ctime(&lt;span class=&quot;synConstant&quot;&gt;1237838658&lt;/span&gt;)
&lt;span class=&quot;synConstant&quot;&gt;&#39;Mon Mar 23 21:04:18 2009&#39;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Erlang&lt;/h3&gt;

&lt;p&gt;
Erlang doesn&#39;t have an interface to the &#39;ctime&#39; call, but you can use the gregorian calendar functions:
&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
&lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;gt;&lt;/span&gt; Epoch &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;calendar:datetime_to_gregorian_seconds&lt;/span&gt;({{&lt;span class=&quot;synConstant&quot;&gt;1970&lt;/span&gt;, &lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;, &lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;}, {&lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt;,&lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt;,&lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt;}})&lt;span class=&quot;synSpecial&quot;&gt;.&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;62167219200&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;calendar:gregorian_seconds_to_datetime&lt;/span&gt;(&lt;span class=&quot;synConstant&quot;&gt;1237838658&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;+&lt;/span&gt; Epoch)&lt;span class=&quot;synSpecial&quot;&gt;.&lt;/span&gt;
{{&lt;span class=&quot;synConstant&quot;&gt;2009&lt;/span&gt;,&lt;span class=&quot;synConstant&quot;&gt;3&lt;/span&gt;,&lt;span class=&quot;synConstant&quot;&gt;23&lt;/span&gt;},{&lt;span class=&quot;synConstant&quot;&gt;20&lt;/span&gt;,&lt;span class=&quot;synConstant&quot;&gt;4&lt;/span&gt;,&lt;span class=&quot;synConstant&quot;&gt;18&lt;/span&gt;}}
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Why use milliseconds?&lt;/h3&gt;

&lt;p&gt;
Why is the GTH timestamp in milliseconds instead of either seconds or
a &#39;timeval&#39;-like seconds + microseconds?
&lt;/p&gt;

&lt;p&gt;
We chose millisecond resolution for several reasons. Firstly, the
shortest possible useful packet in SS7 takes a bit more than a
millisecond to transmit at 64kbit/s. Secondly, the practical limit of
NTP time synchronisation over the internet is about one millisecond at
a typical site.
&lt;/p&gt;
</description>
	</item>
	
	<item>
		<title>Generating DTMF using a &amp;#039;player&amp;#039; on GTH</title>
		<link>../../Generating_DTMF_using_a___039_player__039__on_GTH.html</link>
		<guid isPermaLink="true">../../Generating_DTMF_using_a___039_player__039__on_GTH.html</guid>
                <pubDate>Tue, 9 Jun 2009 12:31:17 +0200</pubDate>
		<description>&lt;p&gt;
The GTH can &lt;em&gt;transmit&lt;/em&gt; in-band signalling tones on a
timeslot. That&#39;s useful for testing and for building active in-band
signalling systems.
&lt;/p&gt;

&lt;h3&gt;DTMF&lt;/h3&gt;

&lt;p&gt;
The tones transmitted when the subscriber presses a number key on
fixed or mobile handset are called DTMF. Wikipedia has an &lt;a
href=&quot;http://en.wikipedia.org/wiki/DTMF&quot;&gt;article&lt;/a&gt; about it. To
generate DTMF, all we really need to know is that there are 16
possible DTMF signals, that each signal is made up of two sine waves
of particular frequencies and that sending the signal for 100ms is a
reasonable thing to do.
&lt;/p&gt;

&lt;p&gt;
Here&#39;s a .zip file with &lt;a
href=&quot;http://www.corelatus.com/~matthias/blog/dtmf_tones.zip&quot;&gt;DTMF
tones&lt;/a&gt; in it. Each file is raw ALAW data, i.e. it&#39;s ready for the
GTH to play (transmit) on a timeslot.
&lt;/p&gt;

&lt;p&gt;
The GTH has two ways of playing tones. One way is to stream the audio
data in over a TCP socket each time we want to play it. I wrote a &lt;a
href=&quot;http://blog.corelatus.com/2009/03/06/gth-audio-streaming-why-stream-over-tcp/&quot;&gt;post
about that&lt;/a&gt; earlier. The other way is to store the sample data on
the GTH and command its playback whenever it&#39;s needed. Since there&#39;s a
small number of different tones (12, or 16 if you want to use the
A/B/C/D tones as well) and the tones are short, storing them on the
GTH makes sense. To store the tone:
&lt;/p&gt;

&lt;pre&gt;
&lt;code&gt;
&lt;span class=&quot;synIdentifier&quot;&gt;&amp;lt;new&amp;gt;&amp;lt;clip &lt;/span&gt;&lt;span class=&quot;synType&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;synConstant&quot;&gt;&#39;dtmf5&#39;&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;&amp;gt;&amp;lt;/new&amp;gt;&lt;/span&gt;
(and now send the 800 byte file)
&lt;/code&gt;
&lt;/pre&gt;

to play the tone later on:

&lt;pre&gt;
&lt;code&gt;
&lt;span class=&quot;synIdentifier&quot;&gt;&amp;lt;new&amp;gt;&amp;lt;player&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;synIdentifier&quot;&gt;&amp;lt;clip &lt;/span&gt;&lt;span class=&quot;synType&quot;&gt;id&lt;/span&gt;=&lt;span class=&quot;synConstant&quot;&gt;&#39;clip dtmf5&#39;&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;synIdentifier&quot;&gt;&amp;lt;pcm_sink &lt;/span&gt;&lt;span class=&quot;synType&quot;&gt;span&lt;/span&gt;=&lt;span class=&quot;synConstant&quot;&gt;&#39;3A&#39;&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt; &lt;/span&gt;&lt;span class=&quot;synType&quot;&gt;timeslot&lt;/span&gt;=&lt;span class=&quot;synConstant&quot;&gt;&#39;19&#39;&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span class=&quot;synIdentifier&quot;&gt;&amp;lt;/player&amp;gt;&amp;lt;/new&amp;gt;&lt;/span&gt; 
&lt;/code&gt;
&lt;/pre&gt;

&lt;h3&gt;Sequences of tones&lt;/h3&gt;

&lt;p&gt;
Sometimes you want to transmit a sequence of DTMF tones, for instance to simulate a subscriber dialling a number. The GTH lets you start a player with a sequence of tones like this:
&lt;/p&gt;

&lt;pre&gt;
&lt;code&gt;
&lt;span class=&quot;synIdentifier&quot;&gt;&amp;lt;new&amp;gt;&amp;lt;player&amp;gt;&lt;/span&gt;
   &lt;span class=&quot;synIdentifier&quot;&gt;&amp;lt;clip &lt;/span&gt;&lt;span class=&quot;synType&quot;&gt;id&lt;/span&gt;=&lt;span class=&quot;synConstant&quot;&gt;&#39;clip dtmf5&#39;&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;/&amp;gt;&amp;lt;clip &lt;/span&gt;&lt;span class=&quot;synType&quot;&gt;id&lt;/span&gt;=&lt;span class=&quot;synConstant&quot;&gt;&#39;clip dtmf6&#39;&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;/&amp;gt;&amp;lt;clip &lt;/span&gt;&lt;span class=&quot;synType&quot;&gt;id&lt;/span&gt;=&lt;span class=&quot;synConstant&quot;&gt;&#39;clip dtmf8&#39;&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;/&amp;gt;&lt;/span&gt;
   &lt;span class=&quot;synIdentifier&quot;&gt;&amp;lt;pcm_sink &lt;/span&gt;&lt;span class=&quot;synType&quot;&gt;span&lt;/span&gt;=&lt;span class=&quot;synConstant&quot;&gt;&#39;3A&#39;&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt; &lt;/span&gt;&lt;span class=&quot;synType&quot;&gt;timeslot&lt;/span&gt;=&lt;span class=&quot;synConstant&quot;&gt;&#39;19&#39;&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span class=&quot;synIdentifier&quot;&gt;&amp;lt;/player&amp;gt;&amp;lt;/new&amp;gt;&lt;/span&gt;
&lt;/code&gt;
&lt;/pre&gt;

&lt;p&gt;
But that isn&#39;t a valid sequence of DTMF tones. Why not? Because DTMF
expects a gap between tones. The cleanest way to handle that is to
define another clip consisting of just silence and putting it between
each tone. A good &#39;silence&#39; value on E1 lines is 0x54. 60ms (480
samples) is a reasonable length.
&lt;/p&gt;

&lt;h3&gt;Other in-band tones&lt;/h3&gt;

&lt;p&gt;
DTMF in-band signalling is used in pretty much all handsets
(telephones), mostly for dialling, but also to navigate menus in IVR
systems. But before SS7 became popular, in-band signalling in the form
of CAS and SS5 was even used to communicate call setup information
between exchanges. GTH can also generate those tones, but that can be
the subject of another post.
&lt;/p&gt;
</description>
	</item>
	
	<item>
		<title>Capturing SS7 with wireshark or tshark</title>
		<link>../../Capturing_SS7_with_wireshark_or_tshark.html</link>
		<guid isPermaLink="true">../../Capturing_SS7_with_wireshark_or_tshark.html</guid>
                <pubDate>Mon, 10 Aug 2009 20:40:39 +0200</pubDate>
		<description>&lt;p&gt;
I often use wireshark to look at SS7 signalling on E1 links. Up until
today, I&#39;ve always done that by capturing the signalling (from a GTH),
then converting the captured data to libpcap format and finally
loading the file into wireshark.
&lt;/p&gt;

&lt;p&gt;
Someone showed me a better way today: wireshark can read from a pipe
or from standard input. That lets me see and filter the packets in
wireshark in real time. Here&#39;s how to do it, using the save_to_pcap
demo program (included in &lt;a
href=&quot;http://www.corelatus.com/gth/api/gth_c_examples.zip&quot;&gt;gth_c_examples&lt;/a&gt;):
&lt;/p&gt;

&lt;pre&gt;
&gt; ./save_to_pcap gth21 1A 2A 16 - | wireshark -k -i -
capturing packets, press ^C to abort
saving capture to stdout
&lt;/pre&gt;

The same thing works for tshark:

&lt;pre&gt;
 &gt;./save_to_pcap gth21 1A 2A 16 - | tshark -V -i -
capturing packets, press ^C to abort
saving capture to stdout
Capturing on -
Frame 1 (15 bytes on wire, 15 bytes captured)
    Arrival Time: Aug 10, 2009 20:38:29.388000000
...
   Message Transfer Part Level 2
    .000 1101 = Backward sequence number: 13
    1... .... = Backward indicator bit: 1
    .011 1000 = Forward sequence number: 56
    1... .... = Forward indicator bit: 1
    ..00 0000 = Length Indicator: 0
    00.. .... = Spare: 0
...
&lt;/pre&gt;

&lt;h3&gt;Works on *nix and Windows&lt;/h3&gt;

&lt;p&gt;
Piping standard output to wireshark/tshark works on all the *nixes,
i.e. linux, BSD, OSX, Solaris. On Windows, things are a bit different,
you have to use &#39;named pipes&#39; instead, like this:
&lt;pre&gt;
 start save_to_pcap 172.16.1.10 1A 2A 16 \\.\pipe\ss7.1
 wireshark -k -i \\.\pipe\ss7.1
&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;
On some older (as of August 2009) versions of wireshark, possibly in
combination with older libraries, the &quot;-i -&quot; switch doesn&#39;t work, at
least according to google, even though the tshark version works.
&lt;/p&gt;
</description>
	</item>
	
	<item>
		<title>How does TCP behave on an interrupted network?</title>
		<link>../../How_does_TCP_behave_on_an_interrupted_network_.html</link>
		<guid isPermaLink="true">../../How_does_TCP_behave_on_an_interrupted_network_.html</guid>
                <pubDate>Thu, 27 Aug 2009 23:24:22 GMT</pubDate>
		<description>&lt;p&gt;
GTH E1/T1 modules are always controlled by a general-purpose server,
usually some sort of unix machine. The server and GTH are connected by
ethernet and communicate using TCP sockets. Normally, that ethernet
connection is chosen to be simple and reliable, for instance by
putting the server and the GTH in the same rack, connected to the same
ethernet switch.
&lt;/p&gt;

&lt;p&gt;
I experimented a bit to see what happens when that network gets
interrupted. I interrupted the network in a reproduceable way by
disabling and re-enabling the server&#39;s ethernet port for a known
length of time while running a &amp;lt;recorder&amp;gt;. (A &amp;lt;recorder&amp;gt;
sends all the data, typically someone talking, from an E1 timeslot to
the server over a TCP socket, 8000 octets per second.)
&lt;/p&gt;

&lt;h3&gt;Capturing the ethernet packets&lt;/h3&gt;

&lt;p&gt;
Here&#39;s what I did to capture traffic and interrupt the ethernet:
&lt;/p&gt;

  &lt;pre&gt;
  tcpdump -w /tmp/capture.pcap -s 0 not port 22
  sudo ifconfig eth0 down; sleep 5; sudo ifconfig eth0 up
  &lt;/pre&gt;

&lt;h3&gt;A trace where traffic recovers in time to prevent an overrun&lt;/h3&gt;

&lt;p&gt;
The GTH buffers about two seconds of timeslot traffic. So a &#39;sleep&#39; of
about a second won&#39;t result in an overrun. Here&#39;s what it looks like
in wireshark:
&lt;/p&gt;

&lt;table&gt;
&lt;tr&gt;&lt;td&gt;Packet&lt;/td&gt;&lt;td&gt;Time&lt;/td&gt;&lt;td&gt;Direction&lt;/td&gt;&lt;td&gt;Flags&lt;/td&gt;&lt;td&gt;Seq. #&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;5&quot;&gt;&lt;hr /&gt;&lt;/td&gt;

&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;133 &lt;/td&gt;&lt;td&gt;  7.596 &lt;/td&gt;&lt;td&gt;  GTH -&amp;gt; server&lt;/td&gt;&lt;td&gt; [PSH, ACK] &lt;/td&gt;&lt;td&gt;59393&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;134 &lt;/td&gt;&lt;td&gt;  7.633 &lt;/td&gt;&lt;td&gt;  server -&amp;gt; GTH&lt;/td&gt;&lt;td&gt; [ACK]      &lt;/td&gt;&lt;td&gt;1    &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;135 &lt;/td&gt;&lt;td&gt;  7.724 &lt;/td&gt;&lt;td&gt;  GTH -&amp;gt; server&lt;/td&gt;&lt;td&gt; [PSH, ACK] &lt;/td&gt;&lt;td&gt;60417&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;136 &lt;/td&gt;&lt;td&gt;  7.761 &lt;/td&gt;&lt;td&gt;  server -&amp;gt; GTH&lt;/td&gt;&lt;td&gt; [ACK]      &lt;/td&gt;&lt;td&gt;1	       &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;137 &lt;/td&gt;&lt;td&gt;  7.852 &lt;/td&gt;&lt;td&gt;  GTH -&amp;gt; server&lt;/td&gt;&lt;td&gt; [PSH, ACK] &lt;/td&gt;&lt;td&gt;61441&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;138 &lt;/td&gt;&lt;td&gt;  7.889 &lt;/td&gt;&lt;td&gt;  server -&amp;gt; GTH&lt;/td&gt;&lt;td&gt; [ACK] &lt;/td&gt;&lt;td&gt;1	       &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;139 &lt;/td&gt;&lt;td&gt;  7.980 &lt;/td&gt;&lt;td&gt;  GTH -&amp;gt; server&lt;/td&gt;&lt;td&gt; [PSH, ACK] &lt;/td&gt;&lt;td&gt;62465&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;140 &lt;/td&gt;&lt;td&gt;  8.017 &lt;/td&gt;&lt;td&gt;  server -&amp;gt; GTH&lt;/td&gt;&lt;td&gt; [ACK] &lt;/td&gt;&lt;td&gt;1	       &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;141 &lt;/td&gt;&lt;td&gt;  8.108 &lt;/td&gt;&lt;td&gt;  GTH -&amp;gt; server&lt;/td&gt;&lt;td&gt; [PSH, ACK] &lt;/td&gt;&lt;td&gt;63489&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;142 &lt;/td&gt;&lt;td&gt;  8.145 &lt;/td&gt;&lt;td&gt;  server -&amp;gt; GTH&lt;/td&gt;&lt;td&gt; [ACK] &lt;/td&gt;&lt;td&gt;1	       &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;143 &lt;/td&gt;&lt;td&gt;  8.236 &lt;/td&gt;&lt;td&gt;  GTH -&amp;gt; server&lt;/td&gt;&lt;td&gt; [PSH, ACK] &lt;/td&gt;&lt;td&gt;64513&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;144 &lt;/td&gt;&lt;td&gt;  8.273 &lt;/td&gt;&lt;td&gt;  server -&amp;gt; GTH&lt;/td&gt;&lt;td&gt; [ACK] &lt;/td&gt;&lt;td&gt;1	       &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;145 &lt;/td&gt;&lt;td&gt;  8.364 &lt;/td&gt;&lt;td&gt;  GTH -&amp;gt; server&lt;/td&gt;&lt;td&gt; [PSH, ACK] &lt;/td&gt;&lt;td&gt;65537&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;146 &lt;/td&gt;&lt;td&gt;  8.401 &lt;/td&gt;&lt;td&gt;  server -&amp;gt; GTH&lt;/td&gt;&lt;td&gt; [ACK] &lt;/td&gt;&lt;td&gt;1	       &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;147 &lt;/td&gt;&lt;td&gt; 10.151 &lt;/td&gt;&lt;td&gt;  GTH -&amp;gt; server&lt;/td&gt;&lt;td&gt; [PSH, ACK] &lt;/td&gt;&lt;td&gt;66561&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;148 &lt;/td&gt;&lt;td&gt; 10.151 &lt;/td&gt;&lt;td&gt;  server -&amp;gt; GTH&lt;/td&gt;&lt;td&gt; [ACK] &lt;/td&gt;&lt;td&gt;1	       &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;149 &lt;/td&gt;&lt;td&gt; 10.151 &lt;/td&gt;&lt;td&gt;  GTH -&amp;gt; server&lt;/td&gt;&lt;td&gt; [ACK] &lt;/td&gt;&lt;td&gt;67585     &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;150 &lt;/td&gt;&lt;td&gt; 10.151 &lt;/td&gt;&lt;td&gt;  server -&amp;gt; GTH&lt;/td&gt;&lt;td&gt; [ACK] &lt;/td&gt;&lt;td&gt;1         &lt;/td&gt;&lt;/tr&gt;

&lt;/table&gt;

&lt;p&gt;
Everything up to packet 146 is normal: the GTH (172.16.2.5) sends 8000
octets every second and the server (172.16.2.1) acks them. It happens
to be in chunks of 1024 octets about eight times per second. After
packet 146, about 8.4 seconds after the capture started, the ethernet
interface went down and stayed down for 1s. The TCP stream started up
again after about 1.5s and then &#39;caught up&#39; by sending many packets in
quick succession.
&lt;/p&gt;

&lt;h3&gt;A trace where traffic didn&#39;t recover&lt;/h3&gt;

&lt;p&gt;
I took a second trace similar to the first one, except this time, I
disabled ethernet for about five seconds:
&lt;/p&gt;

&lt;pre&gt;
Packet Time     Source IP     Dest IP    SPort   DPort
----------------------------------------------------------------------
 28   1.040083  172.16.2.5 -&amp;gt; 172.16.2.1 54271 &amp;gt; 45195 [PSH, ACK] Seq=7169
 29   1.040095  172.16.2.1 -&amp;gt; 172.16.2.5 45195 &amp;gt; 54271 [ACK] Seq=1
 30   1.168065  172.16.2.5 -&amp;gt; 172.16.2.1 54271 &amp;gt; 45195 [PSH, ACK] Seq=8193
 31   1.168078  172.16.2.1 -&amp;gt; 172.16.2.5 45195 &amp;gt; 54271 [ACK] Seq=1 
 32   1.296067  172.16.2.5 -&amp;gt; 172.16.2.1 54271 &amp;gt; 45195 [PSH, ACK] Seq=9217
 33   1.296079  172.16.2.1 -&amp;gt; 172.16.2.5 45195 &amp;gt; 54271 [ACK] Seq=1 
 34   1.424068  172.16.2.5 -&amp;gt; 172.16.2.1 54271 &amp;gt; 45195 [PSH, ACK] Seq=10241
 35   1.424081  172.16.2.1 -&amp;gt; 172.16.2.5 45195 &amp;gt; 54271 [ACK] Seq=1
 36   7.782851  172.16.2.5 -&amp;gt; 172.16.2.1 54271 &amp;gt; 45195 [PSH, ACK] Seq=11265
 37   7.782863  172.16.2.1 -&amp;gt; 172.16.2.5 45195 &amp;gt; 54271 [ACK] Seq=1
 38   7.783406  172.16.2.5 -&amp;gt; 172.16.2.1 54271 &amp;gt; 45195 [ACK] Seq=12289
 39   7.783413  172.16.2.1 -&amp;gt; 172.16.2.5 45195 &amp;gt; 54271 [ACK] Seq=1
 40   7.783569  172.16.2.5 -&amp;gt; 172.16.2.1 54271 &amp;gt; 45195 [ACK] Seq=13737
...
 50   7.784962  172.16.2.5 -&amp;gt; 172.16.2.1 54271 &amp;gt; 45195 [FIN, PSH, ACK] Seq=23873
 51   7.784972  172.16.2.1 -&amp;gt; 172.16.2.5 45195 &amp;gt; 54271 [ACK] Seq=1
 52   7.785026  172.16.2.1 -&amp;gt; 172.16.2.5 45195 &amp;gt; 54271 [FIN, ACK] Seq=1
 53   7.785348  172.16.2.5 -&amp;gt; 172.16.2.1 54271 &amp;gt; 45195 [ACK] Seq=25322
&lt;/pre&gt;

&lt;p&gt; Everything is normal up to packet 35. Then, ethernet is suspended
for five seconds and TCP takes a further second to recover, which
causes a buffer overrun on the GTH (172.16.2.5). The GTH closes the
socket at packet 50 and also sends an overrun event to the application
so that it knows why the socket was closed.
&lt;/p&gt;

&lt;h3&gt;Bottom line&lt;/h3&gt;

&lt;p&gt;
GTH uses IP for control and traffic. It is important that the IP link
between the GTH and the server is simple and reliable. Ideally the GTH
and server should be in the same rack and be connected by an ethernet
switch.
&lt;/p&gt;

&lt;p&gt; It&#39;s possible for a system to survive a short interruption (less
than a second) to the ethernet traffic without pre-recorded calls
getting interrupted. For longer interruptions, all bets are off.  &lt;/p&gt;

&lt;p&gt; (Interruptions aren&#39;t the only type of network problem, e.g. radio
networks such as 802.11 can suffer significant packet loss, which can
trigger TCP congestion avoidance. But that&#39;s another
topic.) &lt;/p&gt;
</description>
	</item>
	
        </channel>
</rss>

