Asterisk Transcoding, PLC, and jitter buffer


I have setup an asterisk server to accept ILBC calls and G711 calls through SIP. The call flow is as follows, an ATA makes an ILBC call through asterisk to a PSTN line, so what ends up happening is that ILBC packets are being sent to asterisk to the ATA, and G711 packets are being sent back and forth to the PSTN line.

What seems to happen is that for every 20 ms ILBC packet that is sent to asterisk, a corresponding 20 ms G711 packet is sent to the PSTN line. In the G711 RTP packet, the sequence # is incremented by one and the timestamp is incremeted by 160.

Problems occur if we introduce missing packets into the ilbc stream. Say for example, the ILBC sequence numbers are as follows: 9, 10, 12, 13, etc. (no 11). Coming out the other side, G711 packets will be 9,10, 11, 12. There is no indication that a packet has been lost or any relevant timestamp information. This will result in clock skew on the PSTN line, and this is not correct.

So my question is if I need to configure something else in asterisk for this to work properly, or is this just wrong? I have read that there is a jitter buffer but it only seems to be able to be enabled for IAX calls.

I imagine if the jitter buffer was enabled, PLC frames would be transcoded to G711 and then be sent to the PSTN line continually. I think I can hack asterisk to at least give a gap in sequence numbers in the outgoing direction so the PSTN line could at least have some idea that something is missing but I wanted to check if anyone had any thoughts.

-Tim Powell
Vocal Technologies

Hi, I don’t mean to bother you, but how did you manage to use asterisk’s ilbc implementation on 20ms mode? I’ve only been able to use it on 30ms mode, even if I use allow=ilbc:20 in sip.conf it doesn’t work…

Sorry to ask you something instead of helping…


We had to modify the code to make it work. Out of the box asterisk would only do 30 ms. You could compile it with 20 ms turned on only. It doesn’t recognize the attribute fmtp coming and adjust dynamically.


Thanks, I hope you get an answer to your problem…

You should try the IRC channel, there’s very good people there too