33 #include <sys/types.h> 38 #include <dahdi/user.h> 78 if (!(timer =
ast_calloc(1,
sizeof(*timer)))) {
82 if ((timer->
fd = open(
"/dev/dahdi/timer", O_RDWR)) < 0) {
106 samples = (
unsigned int)
roundf((8000.0 / ((
float) rate)));
108 if (ioctl(timer->
fd, DAHDI_TIMERCONFIG, &samples)) {
109 ast_log(
LOG_ERROR,
"Failed to configure DAHDI timing fd for %d sample timer ticks\n",
121 return ioctl(timer->
fd, DAHDI_TIMERACK, &quantity) ? -1 : 0;
129 return ioctl(timer->
fd, DAHDI_TIMERPING, &flags) ? -1 : 0;
137 return ioctl(timer->
fd, DAHDI_TIMERPONG, &flags) ? -1 : 0;
146 res = ioctl(timer->
fd, DAHDI_GETEVENT, &event);
149 event = DAHDI_EVENT_TIMER_EXPIRED;
153 case DAHDI_EVENT_TIMER_PING:
155 case DAHDI_EVENT_TIMER_EXPIRED:
173 #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" 180 fd = open(
"/dev/dahdi/timer", O_RDWR);
186 if (ioctl(fd, DAHDI_TIMERCONFIG, &x)) {
187 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);
193 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);
199 const char dahdi_timer_error[] = {
200 "Asterisk has detected a problem with your DAHDI configuration and will shutdown for your protection. You have options:" 201 "\n\t1. You only have to compile DAHDI support into Asterisk if you need it. One option is to recompile without DAHDI support." 202 "\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." 203 "\n\t3. If you need DAHDI services, you must correctly configure DAHDI."
static int dahdi_timer_enable_continuous(void *data)
Asterisk main include file. File version handling, generic pbx functions.
static struct ast_timing_interface dahdi_timing
int ast_unregister_timing_interface(void *handle)
Unregister a previously registered timing interface.
static void dahdi_timer_close(void *data)
static int dahdi_timer_set_rate(void *data, unsigned int rate)
static int dahdi_timer_disable_continuous(void *data)
static enum ast_timer_event dahdi_timer_get_event(void *data)
static void * timing_funcs_handle
static int dahdi_timer_ack(void *data, unsigned int quantity)
static int dahdi_timer_fd(void *data)
static void * dahdi_timer_open(void)
static int dahdi_test_timer(void)
#define ast_calloc(num, len)
A wrapper for calloc()
Module has failed to load, may be in an inconsistent state.
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
static unsigned int dahdi_timer_get_max_rate(void *data)
#define ast_register_timing_interface(i)
Register a set of timing functions.
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.
static struct ast_timer * timer
Asterisk module definitions.
Timing source management.