Applies to VoipNow 3 and higher!

The current article describes various timing modules and explains how to eliminate audio issues triggered by the way Asterisk timing is configured in VoipNow.

What is timing

Timing affects the RTP flow in calls that use RTP (SIP, H.323, MGCP). Since the RTP system is normally clocked on incoming packets, in some situations you may reach a standstill. That's when internal timing takes over, forcing Asterisk to send packets based on the loaded module and not on the incoming flow.

A standstill occurs when both systems are waiting for a packet to arrive and neither of them is sending anything.

Timing interfaces

On older Asterisk versions (1.4.x), if the Asterisk system required internal timing, the only source acceptable was DAHDI. Starting with Asterisk 1.6.1, there is a new timing API, which allows various timing modules to be used.

Here are the timing modules included in Asterisk:

res_timing_dahdi

res_timing_timerfd

res_timing_pthread

VoipNow behavior

By default, in VoipNow, Asterisk builds and loads all the timing interfaces set in the /etc/asterisk/modules.conf file; res_timing_pthread is the first module to get loaded and it is followed by res_timing_dahdi;

If you want to change timing, you need to edit the modules.conf file as explained below:

Step 1: Replace the modules.conf.

Replace:
 
[modules]
 preload => res_timing_pthread.so
 preload => res_timing_dahdi.so
 
With:
 
[modules]
preload => res_timing_dahdi.so
preload => res_timing_pthread.so

Step 2: Restart Asterisk.

A piece of advice

To better understand how Asterisk timing works, it would probably be best to read more about it here.

However, if you already used Dahdi timing interfaces and didn't encounter any timing issues, it is better to stick to this approach. If not, we recommend that you use the res_timing_timerfd interface.

If using res_timing_dahdi and res_timing_timerfd leads to timing bugs, it is recommended that you try the res_timing_pthread interface.

Resources

Asterisk Wiki
Asterisk Doc

Related articles