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;
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);
}
"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;
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 {
const char *var, *val;
int *intval;
uint32_t flags = ZAP_ANALOG_CALLERID;
+ int callwaiting = 1;
+ unsigned i = 0;
assert(sig_cb != NULL);
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;
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;
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) {
*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) {