mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-10 19:52:41 +00:00
fix unclean reset from i/o error and add new span wide option to disable callerid detect
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@573 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
1 parent
bff3651b2d
commit
26b368810e
6 files changed
+48
-11
No files matched your search
@@ -87,6 +87,7 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_analog_configure_span)
|
||||
uint32_t max_dialstr = 11;
|
||||
const char *var, *val;
|
||||
int *intval;
|
||||
uint32_t flags = ZAP_ANALOG_CALLERID;
|
||||
|
||||
assert(sig_cb != NULL);
|
||||
|
||||
@@ -110,6 +111,16 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_analog_configure_span)
|
||||
break;
|
||||
}
|
||||
digit_timeout = *intval;
|
||||
} else if (!strcasecmp(var, "enable_callerid")) {
|
||||
if (!(val = va_arg(ap, char *))) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (zap_true(val)) {
|
||||
flags |= ZAP_ANALOG_CALLERID;
|
||||
} else {
|
||||
flags &= ~ZAP_ANALOG_CALLERID;
|
||||
}
|
||||
} else if (!strcasecmp(var, "max_dialstr")) {
|
||||
if (!(intval = va_arg(ap, int *))) {
|
||||
break;
|
||||
@@ -128,6 +139,7 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_analog_configure_span)
|
||||
}
|
||||
|
||||
span->start = zap_analog_start;
|
||||
analog_data->flags = flags;
|
||||
analog_data->digit_timeout = digit_timeout;
|
||||
analog_data->max_dialstr = max_dialstr;
|
||||
analog_data->sig_cb = sig_cb;
|
||||
@@ -691,9 +703,12 @@ static void *zap_analog_channel_run(zap_thread_t *me, void *obj)
|
||||
zap_buffer_destroy(&dt_buffer);
|
||||
}
|
||||
|
||||
zap_clear_flag(closed_chan, ZAP_CHANNEL_INTHREAD);
|
||||
if (zchan->state != ZAP_CHANNEL_STATE_DOWN) {
|
||||
zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_DOWN);
|
||||
}
|
||||
|
||||
zap_log(ZAP_LOG_DEBUG, "ANALOG CHANNEL thread ended.\n");
|
||||
zap_log(ZAP_LOG_DEBUG, "ANALOG CHANNEL %d:%d thread ended.\n", zchan->span_id, zchan->chan_id);
|
||||
zap_clear_flag(closed_chan, ZAP_CHANNEL_INTHREAD);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -725,7 +740,11 @@ static __inline__ zap_status_t process_event(zap_span_t *span, zap_event_t *even
|
||||
goto end;
|
||||
}
|
||||
if (!event->channel->ring_count && (event->channel->state == ZAP_CHANNEL_STATE_DOWN && !zap_test_flag(event->channel, ZAP_CHANNEL_INTHREAD))) {
|
||||
zap_set_state_locked(event->channel, ZAP_CHANNEL_STATE_GET_CALLERID);
|
||||
if (zap_test_flag(analog_data, ZAP_ANALOG_CALLERID)) {
|
||||
zap_set_state_locked(event->channel, ZAP_CHANNEL_STATE_GET_CALLERID);
|
||||
} else {
|
||||
zap_set_state_locked(event->channel, ZAP_CHANNEL_STATE_IDLE);
|
||||
}
|
||||
event->channel->ring_count = 1;
|
||||
zap_mutex_unlock(event->channel->mutex);
|
||||
locked = 0;
|
||||
|
||||
@@ -36,9 +36,20 @@
|
||||
#include "openzap.h"
|
||||
|
||||
typedef enum {
|
||||
ZAP_ANALOG_RUNNING = (1 << 0)
|
||||
ZAP_ANALOG_RUNNING = (1 << 0),
|
||||
ZAP_ANALOG_CALLERID = (1 << 1)
|
||||
} zap_analog_flag_t;
|
||||
|
||||
|
||||
struct zap_analog_data {
|
||||
uint32_t flags;
|
||||
uint32_t max_dialstr;
|
||||
uint32_t digit_timeout;
|
||||
zio_signal_cb_t sig_cb;
|
||||
};
|
||||
|
||||
|
||||
|
||||
static void *zap_analog_run(zap_thread_t *me, void *obj);
|
||||
typedef struct zap_analog_data zap_analog_data_t;
|
||||
|
||||
|
||||
@@ -44,6 +44,14 @@ typedef enum {
|
||||
ZAP_ANALOG_EM_RUNNING = (1 << 0)
|
||||
} zap_analog_em_flag_t;
|
||||
|
||||
|
||||
struct zap_analog_data {
|
||||
uint32_t flags;
|
||||
uint32_t max_dialstr;
|
||||
uint32_t digit_timeout;
|
||||
zio_signal_cb_t sig_cb;
|
||||
};
|
||||
|
||||
static void *zap_analog_em_run(zap_thread_t *me, void *obj);
|
||||
typedef struct zap_analog_data zap_analog_em_data_t;
|
||||
|
||||
|
||||
Reference in new issue
Block a user