openzap: callwaiting disable
This commit is contained in:
parent
6c8f0d499f
commit
e1b60b4ca3
|
@ -2107,6 +2107,7 @@ static switch_status_t load_config(void)
|
|||
char *hold_music = NULL;
|
||||
char *fail_dial_regex = NULL;
|
||||
const char *enable_callerid = "true";
|
||||
int callwaiting = 1;
|
||||
|
||||
uint32_t span_id = 0, to = 0, max = 0;
|
||||
zap_span_t *span = NULL;
|
||||
|
@ -2136,6 +2137,8 @@ static switch_status_t load_config(void)
|
|||
max_digits = val;
|
||||
} else if (!strcasecmp(var, "hotline")) {
|
||||
hotline = val;
|
||||
} else if (!strcasecmp(var, "callwaiting")) {
|
||||
callwaiting = switch_true(var) ? 1 : 0;
|
||||
} else if (!strcasecmp(var, "enable-analog-option")) {
|
||||
analog_options = enable_analog_option(val, analog_options);
|
||||
}
|
||||
|
@ -2186,8 +2189,9 @@ static switch_status_t load_config(void)
|
|||
"tonemap", tonegroup,
|
||||
"digit_timeout", &to,
|
||||
"max_dialstr", &max,
|
||||
"hotline", hotline,
|
||||
"hotline", hotline ? hotline : "",
|
||||
"enable_callerid", enable_callerid,
|
||||
"callwaiting", &callwaiting,
|
||||
TAG_END) != ZAP_SUCCESS) {
|
||||
zap_log(ZAP_LOG_ERROR, "Error starting OpenZAP span %d\n", span_id);
|
||||
continue;
|
||||
|
|
|
@ -330,7 +330,8 @@ typedef enum {
|
|||
ZAP_CHANNEL_FEATURE_CODECS = (1 << 2),
|
||||
ZAP_CHANNEL_FEATURE_INTERVAL = (1 << 3),
|
||||
ZAP_CHANNEL_FEATURE_CALLERID = (1 << 4),
|
||||
ZAP_CHANNEL_FEATURE_PROGRESS = (1 << 5)
|
||||
ZAP_CHANNEL_FEATURE_PROGRESS = (1 << 5),
|
||||
ZAP_CHANNEL_FEATURE_CALLWAITING = (1 << 6)
|
||||
} zap_channel_feature_t;
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -114,6 +114,8 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_analog_configure_span)
|
|||
const char *var, *val;
|
||||
int *intval;
|
||||
uint32_t flags = ZAP_ANALOG_CALLERID;
|
||||
int callwaiting = 1;
|
||||
unsigned i = 0;
|
||||
|
||||
assert(sig_cb != NULL);
|
||||
|
||||
|
@ -157,6 +159,11 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_analog_configure_span)
|
|||
break;
|
||||
}
|
||||
hotline = val;
|
||||
} else if (!strcasecmp(var, "callwaiting")) {
|
||||
if (!(intval = va_arg(ap, int *))) {
|
||||
break;
|
||||
}
|
||||
callwaiting = *intval;
|
||||
} else {
|
||||
snprintf(span->last_error, sizeof(span->last_error), "Unknown parameter [%s]", var);
|
||||
return ZAP_FAIL;
|
||||
|
@ -171,6 +178,12 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_analog_configure_span)
|
|||
if ((max_dialstr < 1 && !strlen(hotline)) || max_dialstr > MAX_DTMF) {
|
||||
max_dialstr = MAX_DTMF;
|
||||
}
|
||||
|
||||
if (callwaiting) {
|
||||
for (i = 1; i <= span->chan_count; i++) {
|
||||
zap_channel_set_feature(span->channels[i], ZAP_CHANNEL_FEATURE_CALLWAITING);
|
||||
}
|
||||
}
|
||||
|
||||
span->start = zap_analog_start;
|
||||
analog_data->flags = flags;
|
||||
|
|
|
@ -1287,7 +1287,7 @@ OZ_DECLARE(zap_status_t) zap_channel_open(uint32_t span_id, uint32_t chan_id, za
|
|||
zap_status_t status = ZAP_FAIL;
|
||||
zap_span_t *span = NULL;
|
||||
|
||||
zap_mutex_unlock(globals.mutex);
|
||||
zap_mutex_lock(globals.mutex);
|
||||
zap_span_find(span_id, &span);
|
||||
|
||||
if (!span || !zap_test_flag(span, ZAP_SPAN_CONFIGURED) || chan_id >= ZAP_MAX_CHANNELS_SPAN) {
|
||||
|
@ -1313,11 +1313,12 @@ OZ_DECLARE(zap_status_t) zap_channel_open(uint32_t span_id, uint32_t chan_id, za
|
|||
*zchan = NULL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
status = ZAP_FAIL;
|
||||
|
||||
if (zap_test_flag(check, ZAP_CHANNEL_READY) && (!zap_test_flag(check, ZAP_CHANNEL_INUSE) ||
|
||||
(check->type == ZAP_CHAN_TYPE_FXS && check->token_count == 1))) {
|
||||
status = ZAP_FAIL;
|
||||
if ((!zap_test_flag(check, ZAP_CHANNEL_INUSE)) ||
|
||||
(check->type == ZAP_CHAN_TYPE_FXS &&
|
||||
check->token_count == 1 &&
|
||||
zap_channel_test_feature(check, ZAP_CHANNEL_FEATURE_CALLWAITING))) {
|
||||
if (!zap_test_flag(check, ZAP_CHANNEL_OPEN)) {
|
||||
status = check->zio->open(check);
|
||||
if (status == ZAP_SUCCESS) {
|
||||
|
|
Loading…
Reference in New Issue