35 #include <sys/types.h>
40 #include <dahdi/user.h>
72 return open(
"/dev/dahdi/timer", O_RDWR);
84 unsigned int samples =
roundf((8000.0 / ((
float) rate)));
86 if (ioctl(handle, DAHDI_TIMERCONFIG, &samples)) {
87 ast_log(
LOG_ERROR,
"Failed to configure DAHDI timing fd for %u sample timer ticks\n",
97 return ioctl(handle, DAHDI_TIMERACK, &quantity) ? -1 : 0;
104 return ioctl(handle, DAHDI_TIMERPING, &flags) ? -1 : 0;
111 return ioctl(handle, DAHDI_TIMERPONG, &flags) ? -1 : 0;
119 res = ioctl(handle, DAHDI_GETEVENT, &event);
122 event = DAHDI_EVENT_TIMER_EXPIRED;
126 case DAHDI_EVENT_TIMER_PING:
128 case DAHDI_EVENT_TIMER_EXPIRED:
139 #define SEE_TIMING "For more information on Asterisk timing modules, including ways to potentially fix this problem, please see https://wiki.asterisk.org/wiki/display/AST/Timing+Interfaces\n"
146 fd = open(
"/dev/dahdi/timer", O_RDWR);
152 if (ioctl(fd, DAHDI_TIMERCONFIG, &x)) {
153 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);
159 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);
165 const char dahdi_timer_error[] = {
166 "Asterisk has detected a problem with your DAHDI configuration and will shutdown for your protection. You have options:"
167 "\n\t1. You only have to compile DAHDI support into Asterisk if you need it. One option is to recompile without DAHDI support."
168 "\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."
169 "\n\t3. If you need DAHDI services, you must correctly configure DAHDI."
Asterisk main include file. File version handling, generic pbx functions.
static struct ast_timing_interface dahdi_timing
static int dahdi_timer_disable_continuous(int handle)
static enum ast_timer_event dahdi_timer_get_event(int handle)
int ast_unregister_timing_interface(void *handle)
Unregister a previously registered timing interface.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
static int dahdi_timer_enable_continuous(int handle)
static void * timing_funcs_handle
static void dahdi_timer_close(int handle)
static int dahdi_timer_open(void)
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
static int dahdi_test_timer(void)
static int dahdi_timer_set_rate(int handle, unsigned int rate)
#define ast_register_timing_interface(i)
Register a set of timing functions.
static int dahdi_timer_ack(int handle, unsigned int quantity)
int ast_wait_for_input(int fd, int ms)
static int load_module(void)
static int unload_module(void)
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
static unsigned int dahdi_timer_get_max_rate(int handle)
Timing source management.
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.