This post should be written some 10(?) years ago when I really needed this feature at my work, but since from time to time people ask about this and how to use it with packETH, here are some instructions.
At my former job working for verification department there was always some argument with the developers of VoIP hardware regarding the voice quality. Sometimes there was no voice at all coming out of VoIP phones, sometimes the quality was bad. Since packETH is sort of packet generator I came to the idea, to send the RTP packets that actually carry some real voice inside. There were already some tools available for this purpose but adding this feature to packETH wouldn’t be to hard. Especially because at that time I just finished the Wireshark plugin (Ethereal at that time) doing the opposite, extracting and reproducing the voice information from RTP stream captured, the knowledge gained there would make all the development at packETH much easier.
Implementation itself shouldn’t be to difficult. RTP packets are UDP packets with some additional RTP header, the only question is what to put as voice data. Cutting some real voice data from a file would be one option, but finally I decided that all the packets should have the same payload and inserting the SIN frequency is the simplest option. Here we go:
We open the packETH window, fill in the MAC and IP addresses and UDP ports (note that RTP protocols don’t use specific port numbers, normally this is negotiated inside the signal protocol).
Next step it to press Select payload button where another window opens, currently offering only RTP tab. Here you can specify what codec will be used and all the other parameters. For our test we leave all the parameters with default values. RTP payload is what the real VoIP data will be inserted. You can manually insert some custom data or you can let packETH create this payload for you. Options you have here:
- use g.711 alaw or ulaw codec/data
- specify frequency between 0-4000Hz
- select Amplitude level (Low, Mid, High)
- specify the length of the payload
Regarding the length, it depends on what voice data you want to simulate. If your RTP stream will simulate VoIP packets with 10ms packetization then the length for payload should be 80 (sampling rate is 8kHz, each sample is 1byte long for g.711 and carries 125ms of voice data, so 80*0,125ms = 10ms). Alternative you should put 160 for 20ms packetization and 240 for 30ms packetization.
In our example we set 1000Hz as frequency with low amplitude and length of 240 (30ms packetization).
As last step you press Apply into payload and then OK. The data should be visible in the UDP payload box.
As you can see, it starts with some RTP header continuing with some repeating patters that are nothing else but voice of exact 1000Hz frequency. If you select an interface now and send this packet, there will go 294 bytes on the link.
Now it is time to send this packet as real RTP stream. We open the Gen-b page and set how many packets we want to send (at 30ms packetization 33 packets are sent per second). Next important step is to set delay between packets at 30ms. Lastly we need to change some parameters while sending: if we want to simulate real RTP stream sequence number should be increased for every packet and also timestamp. Among all the options we select “RTP seq nr increase by 1 and timestamp increase by 30ms” (note that the look of this window changed with version 1.8). Finally, because UDP data will be changed, we need to update the UDP checksum, so we check the “Correct the UDP checksum” button. Now we are ready to send the stream!
Finally we want to check if this is real RTP stream what packETH is sending. For this to check we open Wireshark and capture the packets that are sent by packETH. Because packETH doesn’t send any signalling info Wireshark does not now this are actually RTP packets and displays them as UDP. We have to select one packet, right press and select the option “Decode as” and choose RTP.
After we do this packets are decoded as RTP packets. Wireshark has a nice feature analysing RTP streams that can be found under Statistics->RTP. If we have only one RTP stream we can directly choose Stream analysis that goes through all the RTP packets belonging to our stream (same SSRC and I think CSRC as well (It’s been a long time since I have been working on this, maybe it changed lately)).
If we want to listen to this stream we choose the “Save payload” button and select “Forward channel” (because we have only one way voice data) and “.au” format. After we save this into a file we can listen to it (caution: 1KHz voice is annoying 🙂 ).
We can also make some spectrum analysis, the Audacity application can do this easily. We can see, that the frequency of this voice data, that was sent with packETH and captured with Wireshark is in reality 1kHz (plus some higher harmonics).
I don’t know if this feature is still useful for someone, but it is inside packETH and this is the explanation on how to use it.
If you have any question, I’ll be glad to answer them.