aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-03-08 01:01:46 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-03-08 01:01:46 +0000
commita97792f32c909455ebb8b9ccbaaf529d95709b6b (patch)
tree4efc65d665f0936a9aefc85a26fafeb09e6988f0
parent4a2bb0f4fb55ce6e5500b3199918cab7b0c044ff (diff)
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. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@58320 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--channels/chan_zap.c43
-rwxr-xr-xconfigure8
-rw-r--r--configure.ac4
3 files changed, 34 insertions, 21 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index 4a1066020..cee849520 100644
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -6496,6 +6496,24 @@ static void *ss_thread(void *data)
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;
@@ -6685,6 +6703,12 @@ static int handle_init_event(struct zt_pvt *i, int event)
"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;
@@ -9670,25 +9694,14 @@ static struct ast_cli_entry zap_pri_cli[] = {
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);
diff --git a/configure b/configure
index 675b7b3b3..594d27de2 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.ac Revision: 55052 .
+# From configure.ac Revision: 57556 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.60.
#
@@ -33328,8 +33328,8 @@ echo "$as_me: *** including --without-zaptel." >&6;}
fi
if test "${PBX_ZAPTEL}" = 1; 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_DIR}" != "x"; then
CPPFLAGS="${CPPFLAGS} -I${ZAPTEL_DIR}/include"
@@ -33345,7 +33345,7 @@ cat >>conftest.$ac_ext <<_ACEOF
int
main ()
{
-int foo = ZT_TONE_DTMF_BASE;
+int foo = ZT_EVENT_REMOVED;
;
return 0;
}
diff --git a/configure.ac b/configure.ac
index 03b34a803..fd166fc88 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1026,7 +1026,7 @@ if test "${USE_ZAPTEL}" != "no"; then
fi
if test "${PBX_ZAPTEL}" = 1; then
- AC_MSG_CHECKING(for ZT_TONE_DTMF_BASE in zaptel/zaptel.h)
+ AC_MSG_CHECKING(for ZT_EVENT_REMOVED in zaptel/zaptel.h)
saved_cppflags="${CPPFLAGS}"
if test "x${ZAPTEL_DIR}" != "x"; then
CPPFLAGS="${CPPFLAGS} -I${ZAPTEL_DIR}/include"
@@ -1035,7 +1035,7 @@ if test "${PBX_ZAPTEL}" = 1; then
[
AC_LANG_PROGRAM(
[#include <zaptel/zaptel.h>],
- [int foo = ZT_TONE_DTMF_BASE;])
+ [int foo = ZT_EVENT_REMOVED;])
],
[ AC_MSG_RESULT(yes)
ac_cv_zaptel_vldtmf="yes"