[asterisk-dev] [svn-commits at lists.digium.com: [svn-commits] dhubbard: branch 1.4 r112689 - /branches/1.4/main/asterisk.c]

Tzafrir Cohen tzafrir.cohen at xorcom.com
Fri Apr 4 02:48:47 CDT 2008


In the changeset below: a test added to asterisk.c (if Asterisk is built
with zaptel support) if there is a valid timing source.

1. If no zaptel drivers available (failed to open /dev/zap/timer) - just
move on. We won't use Zaptel timing.

2. But if it is available and doesn't work as planned - exit Asterisk.


What I wonder is: what about temporary lack of timer?

A. Zaptel started, but module provideing the ting hasn't yet (either
ztdummy, or ztcfg was not run for a different module). This is indeed a
configuration error. But would be mostly harmless till now. 

B. Timing from a E1/T1 card that is not in sync but is listed to give
timing. It should be possible for me to restart Asterisk when the cable
to the card is disconnected or when the telco's side is misconfigured.


(A) is something that a user should indeed fix. (B) is not always
something the user can control.

----- Forwarded message from SVN commits to the Digium repositories <svn-commits at lists.digium.com> -----

To: asterisk-commits at lists.digium.com, svn-commits at lists.digium.com
Date: Thu, 03 Apr 2008 23:57:44 -0000
From: SVN commits to the Digium repositories <svn-commits at lists.digium.com>
Subject: [svn-commits] dhubbard: branch 1.4 r112689 -
	/branches/1.4/main/asterisk.c

Author: dhubbard
Date: Thu Apr  3 18:57:44 2008
New Revision: 112689

URL: http://svn.digium.com/view/asterisk?view=rev&rev=112689
Log:
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.

Modified:
    branches/1.4/main/asterisk.c

Modified: branches/1.4/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/asterisk.c?view=diff&rev=112689&r1=112688&r2=112689
==============================================================================
--- branches/1.4/main/asterisk.c (original)
+++ branches/1.4/main/asterisk.c Thu Apr  3 18:57:44 2008
@@ -124,6 +124,7 @@
 #include "asterisk/linkedlists.h"
 #include "asterisk/devicestate.h"
 #include "asterisk/module.h"
+#include "asterisk/zapata.h"
 
 #include "asterisk/doxyref.h"		/* Doxygen documentation */
 
@@ -2892,7 +2893,34 @@
 		printf(term_quit());
 		exit(1);
 	}
-
+#ifdef HAVE_ZAPTEL
+	{
+		int fd;
+		int x = 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) {
+				const char zaptel_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."
+				};
+				ast_log(LOG_ERROR, "%s\n", zaptel_timer_error);
+				exit(1);
+			}
+			close(fd);
+		}
+	}
+#endif
 	threadstorage_init();
 
 	astobj2_init();


_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--

svn-commits mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/svn-commits

----- End forwarded message -----

-- 
               Tzafrir Cohen
icq#16849755              jabber:tzafrir.cohen at xorcom.com
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com
http://www.xorcom.com  iax:guest at local.xorcom.com/tzafrir



More information about the asterisk-dev mailing list