[svn-commits] russell: trunk r58321 - in /trunk: ./ channels/chan_zap.c configure configure.ac

svn-commits at lists.digium.com svn-commits at lists.digium.com
Wed Mar 7 18:06:01 MST 2007


Author: russell
Date: Wed Mar  7 19:06:00 2007
New Revision: 58321

URL: http://svn.digium.com/view/asterisk?view=rev&rev=58321
Log:
Merged revisions 58320 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r58320 | russell | 2007-03-07 19:01:46 -0600 (Wed, 07 Mar 2007) | 6 lines

If we receive ZT_EVENT_REMOVED, destroy the specified channel. 
(issue #7256, tzafrir)

Also, update the configure script to make sure that we don't try to build 
chan_zap if the installed version of zaptel does not include ZT_EVENT_REMOVED.

........

Modified:
    trunk/   (props changed)
    trunk/channels/chan_zap.c
    trunk/configure
    trunk/configure.ac

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_zap.c?view=diff&rev=58321&r1=58320&r2=58321
==============================================================================
--- trunk/channels/chan_zap.c (original)
+++ trunk/channels/chan_zap.c Wed Mar  7 19:06:00 2007
@@ -6866,6 +6866,24 @@
 	return NULL;
 }
 
+/* destroy a zaptel channel, identified by its number */
+static int zap_destroy_channel_bynum(int channel)
+{
+	struct zt_pvt *tmp = NULL;
+	struct zt_pvt *prev = NULL;
+
+	tmp = iflist;
+	while (tmp) {
+		if (tmp->channel == channel) {
+			destroy_channel(prev, tmp, 1);
+			return RESULT_SUCCESS;
+		}
+		prev = tmp;
+		tmp = tmp->next;
+	}
+	return RESULT_FAILURE;
+}
+
 static int handle_init_event(struct zt_pvt *i, int event)
 {
 	int res;
@@ -7056,6 +7074,12 @@
 				"polarity reversal on non-FXO (SIG_FXS) "
 				"interface %d\n", i->channel);
 		}
+	case ZT_EVENT_REMOVED: /* destroy channel */
+		ast_log(LOG_NOTICE, 
+				"Got ZT_EVENT_REMOVED. Destroying channel %d\n", 
+				i->channel);
+		zap_destroy_channel_bynum(i->channel);
+		break;
 	}
 	pthread_attr_destroy(&attr);
 	return 0;
@@ -10627,25 +10651,14 @@
 
 static int zap_destroy_channel(int fd, int argc, char **argv)
 {
-	int channel = 0;
-	struct zt_pvt *tmp = NULL;
-	struct zt_pvt *prev = NULL;
+	int channel;
 	
-	if (argc != 4) {
+	if (argc != 4)
 		return RESULT_SHOWUSAGE;
-	}
+	
 	channel = atoi(argv[3]);
 
-	tmp = iflist;
-	while (tmp) {
-		if (tmp->channel == channel) {
-			destroy_channel(prev, tmp, 1);
-			return RESULT_SUCCESS;
-		}
-		prev = tmp;
-		tmp = tmp->next;
-	}
-	return RESULT_FAILURE;
+	return zap_destroy_channel_bynum(channel);
 }
 
 static int setup_zap(int reload);

Modified: trunk/configure
URL: http://svn.digium.com/view/asterisk/trunk/configure?view=diff&rev=58321&r1=58320&r2=58321
==============================================================================
--- trunk/configure (original)
+++ trunk/configure Wed Mar  7 19:06:00 2007
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac Revision: 55077 .
+# From configure.ac Revision: 57557 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.60.
 #
@@ -35963,8 +35963,8 @@
 # Check for VLDTMF support
 
     if test "x${PBX_ZAPTEL_VLDTMF}" != "x1" -a "${USE_ZAPTEL_VLDTMF}" != "no"; then
-	{ echo "$as_me:$LINENO: checking for ZT_TONE_DTMF_BASE in zaptel/zaptel.h" >&5
-echo $ECHO_N "checking for ZT_TONE_DTMF_BASE in zaptel/zaptel.h... $ECHO_C" >&6; }
+	{ echo "$as_me:$LINENO: checking for ZT_EVENT_REMOVED in zaptel/zaptel.h" >&5
+echo $ECHO_N "checking for ZT_EVENT_REMOVED in zaptel/zaptel.h... $ECHO_C" >&6; }
 	saved_cppflags="${CPPFLAGS}"
 	if test "x${ZAPTEL_VLDTMF_DIR}" != "x"; then
 	    ZAPTEL_VLDTMF_INCLUDE= "-I${ZAPTEL_VLDTMF_DIR}/include"
@@ -35981,7 +35981,7 @@
 int
 main ()
 {
-int foo = ZT_TONE_DTMF_BASE;
+int foo = ZT_EVENT_REMOVED;
   ;
   return 0;
 }

Modified: trunk/configure.ac
URL: http://svn.digium.com/view/asterisk/trunk/configure.ac?view=diff&rev=58321&r1=58320&r2=58321
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Wed Mar  7 19:06:00 2007
@@ -923,7 +923,7 @@
 AST_C_DEFINE_CHECK([ZAPTEL], [ZT_DIAL_OP_CANCEL], [zaptel/zaptel.h], [90])
 
 # Check for VLDTMF support
-AST_C_DEFINE_CHECK([ZAPTEL_VLDTMF], [ZT_TONE_DTMF_BASE], [zaptel/zaptel.h])
+AST_C_DEFINE_CHECK([ZAPTEL_VLDTMF], [ZT_EVENT_REMOVED], [zaptel/zaptel.h])
 
 # Check for transcode support
 AST_C_DEFINE_CHECK([ZAPTEL_TRANSCODE], [ZT_TCOP_ALLOCATE], [zaptel/zaptel.h])



More information about the svn-commits mailing list