[asterisk-commits] mmichelson: trunk r179937 - in /trunk: doc/timing.txt res/res_timing_dahdi.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Mar 3 14:59:40 CST 2009
Author: mmichelson
Date: Tue Mar 3 14:59:16 2009
New Revision: 179937
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=179937
Log:
Add documentation for timing modules used in Asterisk
This document specifies the timing modules available in Asterisk beginning
with Asterisk 1.6.1. The document goes into detail about the differences
between each and gives a general overview of what timing is used for in
Asterisk. There is also a section which can be used to help customize
your setup or to troubleshoot timing issues you may have.
I also added messages to the DAHDI timing test used in res_timing_dahdi.c
that points to this new documentation if people experience problems.
Big thanks to all who contributed comments on this.
(closes issue #14490)
Reported by: mmichelson
Patches:
timing.txt uploaded by mmichelson (license )
Review: http://reviewboard.digium.com/r/164/
Added:
trunk/doc/timing.txt (with props)
Modified:
trunk/res/res_timing_dahdi.c
Added: trunk/doc/timing.txt
URL: http://svn.digium.com/svn-view/asterisk/trunk/doc/timing.txt?view=auto&rev=179937
==============================================================================
--- trunk/doc/timing.txt (added)
+++ trunk/doc/timing.txt Tue Mar 3 14:59:16 2009
@@ -1,0 +1,90 @@
+Asterisk Timing Interfaces
+-------------------------------------
+In the past, if internal timing were desired for an Asterisk system, then the
+only source acceptable was from DAHDI. Beginning with Asterisk 1.6.1, a new
+timing API was introduced which allows for various timing modules to be used.
+Included with Asterisk are the following timing modules:
+
+res_timing_pthread.so
+res_timing_dahdi.so
+res_timing_timerfd.so (Beginning with Asterisk 1.6.2)
+
+res_timing_pthread uses the POSIX pthreads library in order to provide timing.
+Since the code uses a commonly-implemented set of functions, res_timing_pthread
+is portable to many types of systems. In fact, this is the only timing source
+currently usable on a non-Linux system. Due to the fact that a single userspace
+thread is used to provide timing for all users of the timer, res_timing_pthread
+is also the least efficient of the timing sources and has been known to lose
+its effectiveness in a heavily-loaded environment.
+
+res_timing_dahdi uses timing mechanisms provided by DAHDI. This method of
+timing was previously the only means by which Asterisk could receive timing. It
+has the benefit of being efficient, and if a system is already going to use
+DAHDI hardware, then it makes good sense to use this timing source. If,
+however, there is no need for DAHDI other than as a timing source, this timing
+source may seem unattractive. For people who are upgrading from 1.4 and are used
+to the old ztdummy timing interface, res_timing_dahdi provides the interface
+to dahdi_dummy, which is ztdummy's replacement.
+
+res_timing_timerfd uses a timing mechanism provided directly by the Linux
+kernel. This timing interface is only available on Linux systems using a kernel
+version at least 2.6.25 and a glibc version at least 2.8. This interface has
+the benefit of being very efficient, but at the time this is being written,
+it is a relatively new feature on Linux, meaning that its availability is not
+widespread.
+
+What Asterisk does with the Timing Interfaces
+---------------------------------------------
+By default, Asterisk will build and load all of the timing interfaces. These
+timing interfaces are "ordered" based on a hard-coded priority number defined
+in each of the modules. As of the time of this writing, the preferences for the
+modules is the following: res_timing_timerfd.so, res_timing_dahdi.so,
+res_timing_pthread.so.
+
+The only functionality that requires internal timing is IAX2 trunking. It may
+also be used when generating audio for playback, such as from a file. Even
+though internal timing is not a requirement for most Asterisk functionality,
+it may be advantageous to use it since the alternative is to use timing based
+on incoming frames of audio. If there are no incoming frames or if the incoming
+frames of audio are from an unreliable or jittery source, then the
+corresponding outgoing audio will also be unreliable, or even worse,
+nonexistent. Using internal timing prevents such unreliability.
+
+Customizations/Troubleshooting
+---------------------------------------------
+Now that you know Asterisk's default preferences for timing modules, you may
+decide that you have a different preference. Maybe you're on a timerfd-capable
+system but you would prefer to get your timing from DAHDI since you already are
+using DAHDI to drive your hardware.
+
+Alternatively, you may have been directed to this document due to an error you
+are currently experiencing with Asterisk. If you receive an error message
+regarding timing not working correctly, then you can use one of the following
+suggestions to disable a faulty timing module.
+
+1. Don't build the timing modules you know you will not use. You can disable
+the compilation of any of the timing modules using menuselect. The modules are
+listed in the "Resource Modules" section. Note that if you have already built
+Asterisk and have received an error about a timing module not working properly,
+it is not sufficient to disable it from being built. You will need to remove
+the module from your modules directory (by default, /usr/lib/asterisk/modules)
+to make sure that it does not get loaded again.
+
+2. Build, but do not load the timing modules you know you will not use. You can
+edit modules.conf using "noload" lines to disable the loading of specific
+timing modules by default. Based on the note in the section above, you may
+realize that your Asterisk setup does not require internal timing at all. If
+this is the case, you can safely noload all timing modules.
+
+Important Notes
+----------------------------------------------
+Some confusion has arisen regarding the fact that non-DAHDI timing interfaces
+are available now. One common misconception which has arisen is that since
+timing can be provided elsewhere, DAHDI is no longer required for using the
+MeetMe application. Unfortunately, this is not the case. In addition to
+providing timing, DAHDI also provides a conferencing engine which the MeetMe
+application requires.
+
+Starting with Asterisk 1.6.2, however, there will be a new application,
+ConfBridge, which will be capable of conference bridging without the use
+of DAHDI's built-in mixing engine.
Propchange: trunk/doc/timing.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/doc/timing.txt
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: trunk/doc/timing.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: trunk/res/res_timing_dahdi.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/res/res_timing_dahdi.c?view=diff&rev=179937&r1=179936&r2=179937
==============================================================================
--- trunk/res/res_timing_dahdi.c (original)
+++ trunk/res/res_timing_dahdi.c Tue Mar 3 14:59:16 2009
@@ -137,6 +137,8 @@
return 1000;
}
+#define SEE_TIMING "For more information on Asterisk timing modules, including ways to potentially fix this problem, please see doc/timing.txt\n"
+
static int dahdi_test_timer(void)
{
int fd;
@@ -149,13 +151,13 @@
}
if (ioctl(fd, DAHDI_TIMERCONFIG, &x)) {
- ast_log(LOG_ERROR, "You have DAHDI built and drivers loaded, but the DAHDI timer test failed to set DAHDI_TIMERCONFIG to %d.\n", x);
+ ast_log(LOG_ERROR, "You have DAHDI built and drivers loaded, but the DAHDI timer test failed to set DAHDI_TIMERCONFIG to %d.\n" SEE_TIMING, x);
close(fd);
return -1;
}
if ((x = ast_wait_for_input(fd, 300)) < 0) {
- ast_log(LOG_ERROR, "You have DAHDI built and drivers loaded, but the DAHDI timer could not be polled during the DAHDI timer test.\n");
+ ast_log(LOG_ERROR, "You have DAHDI built and drivers loaded, but the DAHDI timer could not be polled during the DAHDI timer test.\n" SEE_TIMING);
close(fd);
return -1;
}
@@ -167,7 +169,7 @@
"\n\t2. You only have to load DAHDI drivers if you want to take advantage of DAHDI services. One option is to unload DAHDI modules if you don't need them."
"\n\t3. If you need DAHDI services, you must correctly configure DAHDI."
};
- ast_log(LOG_ERROR, "%s\n", dahdi_timer_error);
+ ast_log(LOG_ERROR, "%s\n" SEE_TIMING, dahdi_timer_error);
usleep(100);
close(fd);
return -1;
More information about the asterisk-commits
mailing list