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:
parent
7b3195511a
commit
f91b93dc43
|
@ -16,6 +16,7 @@
|
|||
<param name="max-digits" value="11"/>
|
||||
<param name="dialplan" value="XML"/>
|
||||
<param name="context" value="default"/>
|
||||
<param name="enable-callerid" value="true"/>
|
||||
<!-- regex to stop dialing when it matches -->
|
||||
<!--<param name="dial-regex" value="5555"/>-->
|
||||
<!-- regex to stop dialing when it does not match -->
|
||||
|
|
|
@ -1547,6 +1547,8 @@ static switch_status_t load_config(void)
|
|||
char *dial_regex = NULL;
|
||||
char *hold_music = NULL;
|
||||
char *fail_dial_regex = NULL;
|
||||
char *enable_callerid = "true";
|
||||
|
||||
uint32_t span_id = 0, to = 0, max = 0;
|
||||
zap_span_t *span = NULL;
|
||||
analog_option_t analog_options = ANALOG_OPTION_NONE;
|
||||
|
@ -1565,6 +1567,8 @@ static switch_status_t load_config(void)
|
|||
dialplan = val;
|
||||
} else if (!strcasecmp(var, "dial-regex")) {
|
||||
dial_regex = val;
|
||||
} else if (!strcasecmp(var, "enable-callerid")) {
|
||||
enable_callerid = val;
|
||||
} else if (!strcasecmp(var, "fail-dial-regex")) {
|
||||
fail_dial_regex = val;
|
||||
} else if (!strcasecmp(var, "hold-music")) {
|
||||
|
@ -1621,6 +1625,7 @@ static switch_status_t load_config(void)
|
|||
"tonemap", tonegroup,
|
||||
"digit_timeout", &to,
|
||||
"max_dialstr", &max,
|
||||
"enable_callerid", enable_callerid,
|
||||
TAG_END) != ZAP_SUCCESS) {
|
||||
zap_log(ZAP_LOG_ERROR, "Error starting OpenZAP span %d\n", span_id);
|
||||
continue;
|
||||
|
|
|
@ -458,13 +458,6 @@ struct zap_sigmsg {
|
|||
};
|
||||
|
||||
|
||||
struct zap_analog_data {
|
||||
uint32_t flags;
|
||||
uint32_t max_dialstr;
|
||||
uint32_t digit_timeout;
|
||||
zio_signal_cb_t sig_cb;
|
||||
};
|
||||
|
||||
struct zap_span {
|
||||
zap_data_type_t data_type;
|
||||
char *name;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue