openzap: disable dtmf app and cmd line option

This commit is contained in:
Moises Silva committed 2010-05-25 17:41:49 -04:00
1 parent e1b60b4ca3
commit fb4b7f7a30
3 files changed
+101 -25

No files matched your search

@@ -585,7 +585,7 @@ static ZIO_COMMAND_FUNCTION(wanpipe_command)
{
err=sangoma_tdm_enable_hwec(zchan->sockfd, &tdm_api);
if (err) {
snprintf(zchan->last_error, sizeof(zchan->last_error), "HWEC Enable Failed");
snprintf(zchan->last_error, sizeof(zchan->last_error), "HWEC Enable Failed");
return ZAP_FAIL;
}
}
@@ -594,12 +594,41 @@ static ZIO_COMMAND_FUNCTION(wanpipe_command)
{
err=sangoma_tdm_disable_hwec(zchan->sockfd, &tdm_api);
if (err) {
snprintf(zchan->last_error, sizeof(zchan->last_error), "HWEC Disable Failed");
snprintf(zchan->last_error, sizeof(zchan->last_error), "HWEC Disable Failed");
return ZAP_FAIL;
}
}
break;
case ZAP_COMMAND_ENABLE_LOOP:
case ZAP_COMMAND_ENABLE_DTMF_DETECT:
{
#ifdef WP_API_FEATURE_DTMF_EVENTS
err = sangoma_tdm_enable_dtmf_events(zchan->sockfd, &tdm_api);
if (err) {
zap_log(ZAP_LOG_WARNING, "Enabling of Sangoma HW DTMF failed\n");
snprintf(zchan->last_error, sizeof(zchan->last_error), "HW DTMF Enable Failed");
return ZAP_FAIL;
}
zap_log(ZAP_LOG_DEBUG, "Enabled DTMF events on chan %d:%d\n", zchan->span_id, zchan->chan_id);
#else
return ZAP_NOTIMPL;
#endif
}
break;
case ZAP_COMMAND_DISABLE_DTMF_DETECT:
{
#ifdef WP_API_FEATURE_DTMF_EVENTS
err = sangoma_tdm_disable_dtmf_events(zchan->sockfd, &tdm_api);
if (err) {
zap_log(ZAP_LOG_WARNING, "Disabling of Sangoma HW DTMF failed\n");
snprintf(zchan->last_error, sizeof(zchan->last_error), "HW DTMF Disable Failed");
return ZAP_FAIL;
}
zap_log(ZAP_LOG_DEBUG, "Disabled DTMF events on chan %d:%d\n", zchan->span_id, zchan->chan_id);
#else
return ZAP_NOTIMPL;
#endif
}
break;
{
#ifdef WP_API_FEATURE_LOOP
err=sangoma_tdm_enable_loop(zchan->sockfd, &tdm_api);
+9 -21
View File
@@ -1629,35 +1629,23 @@ OZ_DECLARE(zap_status_t) zap_channel_command(zap_channel_t *zchan, zap_command_t
{
/* if they don't have thier own, use ours */
if (!zap_channel_test_feature(zchan, ZAP_CHANNEL_FEATURE_DTMF_DETECT)) {
zap_tone_type_t tt = ZAP_COMMAND_OBJ_INT;
if (tt == ZAP_TONE_DTMF) {
teletone_dtmf_detect_init (&zchan->dtmf_detect, zchan->rate);
zap_set_flag_locked(zchan, ZAP_CHANNEL_DTMF_DETECT);
zap_set_flag_locked(zchan, ZAP_CHANNEL_SUPRESS_DTMF);
GOTO_STATUS(done, ZAP_SUCCESS);
} else {
snprintf(zchan->last_error, sizeof(zchan->last_error), "invalid command");
GOTO_STATUS(done, ZAP_FAIL);
}
teletone_dtmf_detect_init (&zchan->dtmf_detect, zchan->rate);
zap_set_flag_locked(zchan, ZAP_CHANNEL_DTMF_DETECT);
zap_set_flag_locked(zchan, ZAP_CHANNEL_SUPRESS_DTMF);
GOTO_STATUS(done, ZAP_SUCCESS);
}
}
break;
case ZAP_COMMAND_DISABLE_DTMF_DETECT:
{
if (!zap_channel_test_feature(zchan, ZAP_CHANNEL_FEATURE_DTMF_DETECT)) {
zap_tone_type_t tt = ZAP_COMMAND_OBJ_INT;
if (tt == ZAP_TONE_DTMF) {
teletone_dtmf_detect_init (&zchan->dtmf_detect, zchan->rate);
zap_clear_flag(zchan, ZAP_CHANNEL_DTMF_DETECT);
zap_clear_flag(zchan, ZAP_CHANNEL_SUPRESS_DTMF);
GOTO_STATUS(done, ZAP_SUCCESS);
} else {
snprintf(zchan->last_error, sizeof(zchan->last_error), "invalid command");
GOTO_STATUS(done, ZAP_FAIL);
}
teletone_dtmf_detect_init (&zchan->dtmf_detect, zchan->rate);
zap_clear_flag(zchan, ZAP_CHANNEL_DTMF_DETECT);
zap_clear_flag(zchan, ZAP_CHANNEL_SUPRESS_DTMF);
GOTO_STATUS(done, ZAP_SUCCESS);
}
}
break;
case ZAP_COMMAND_SET_PRE_BUFFER_SIZE:
{
int val = ZAP_COMMAND_OBJ_INT;