freetdm: enable DTMF app

This commit is contained in:
Moises Silva 2010-05-26 11:17:47 -04:00
parent 3c95106e9f
commit e00d2af95e
1 changed files with 20 additions and 0 deletions

View File

@ -3473,6 +3473,25 @@ SWITCH_STANDARD_API(ft_function)
return SWITCH_STATUS_SUCCESS;
}
SWITCH_STANDARD_APP(enable_dtmf_function)
{
private_t *tech_pvt;
if (!switch_core_session_check_interface(session, freetdm_endpoint_interface)) {
ftdm_log(FTDM_LOG_ERROR, "This application is only for FreeTDM channels.\n");
return;
}
tech_pvt = switch_core_session_get_private(session);
if (switch_test_flag(tech_pvt, TFLAG_DEAD)) {
switch_channel_hangup(switch_core_session_get_channel(session), SWITCH_CAUSE_LOSE_RACE);
return;
}
ftdm_channel_command(tech_pvt->ftdmchan, FTDM_COMMAND_ENABLE_DTMF_DETECT, NULL);
ftdm_log(FTDM_LOG_INFO, "DTMF detection enabled in channel %d:%d\n", ftdm_channel_get_id(tech_pvt->ftdmchan), ftdm_channel_get_span_id(tech_pvt->ftdmchan));
}
SWITCH_STANDARD_APP(disable_dtmf_function)
{
private_t *tech_pvt;
@ -3552,6 +3571,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_freetdm_load)
SWITCH_ADD_APP(app_interface, "disable_ec", "Disable Echo Canceller", "Disable Echo Canceller", disable_ec_function, "", SAF_NONE);
SWITCH_ADD_APP(app_interface, "disable_dtmf", "Disable DTMF Detection", "Disable DTMF Detection", disable_dtmf_function, "", SAF_NONE);
SWITCH_ADD_APP(app_interface, "enable_dtmf", "Enable DTMF Detection", "Enable DTMF Detection", enable_dtmf_function, "", SAF_NONE);
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;