add a Zaptel timer check to verify the timer is responding when Zaptel support is compiled into Asterisk and Zaptel drivers are loaded. This will help people not waste their valuable time debugging side effects.
@ -3184,7 +3185,34 @@ int main(int argc, char *argv[])
printf("%s",term_quit());
exit(1);
}
#ifdef HAVE_ZAPTEL
{
intfd;
intx=160;
fd=open("/dev/zap/timer",O_RDWR);
if(fd>=0){
if(ioctl(fd,ZT_TIMERCONFIG,&x)){
ast_log(LOG_ERROR,"You have Zaptel built and drivers loaded, but the Zaptel timer test failed to set ZT_TIMERCONFIG to \'%d\'.\n",x);
exit(1);
}
if((x=ast_wait_for_input(fd,300))<0){
ast_log(LOG_ERROR,"You have Zaptel built and drivers loaded, but the Zaptel timer could not be polled during the Zaptel timer test.\n");
exit(1);
}
if(!x){
constcharzaptel_timer_error[]={
"Asterisk has detected a problem with your Zaptel configuration and will shutdown for your protection. You have options:"
"\n\t1. You only have to compile Zaptel support into Asterisk if you need it. One option is to recompile without Zaptel support."
"\n\t2. You only have to load Zaptel drivers if you want to take advantage of Zaptel services. One option is to unload zaptel modules if you don't need them."
"\n\t3. If you need Zaptel services, you must correctly configure Zaptel."