add ced detection

This commit is contained in:
kapil 2012-08-14 15:41:05 -04:00
parent 94f0196a9e
commit 76edb0b94e
4 changed files with 14 additions and 5 deletions

View File

@ -2147,6 +2147,8 @@ switch_status_t spandsp_fax_detect_session(switch_core_session_t *session,
switch_media_bug_flag_t bflags = 0;
const char *var;
switch_codec_implementation_t read_impl = { 0 };
switch_bool_t set_private = SWITCH_TRUE;
switch_core_session_get_read_impl(session, &read_impl);
if (timeout) {
@ -2154,8 +2156,9 @@ switch_status_t spandsp_fax_detect_session(switch_core_session_t *session,
}
if (cont) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Max Tones Reached!\n");
return SWITCH_STATUS_FALSE;
//switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Max Tones Reached!\n");
set_private = SWITCH_FALSE;
cont = NULL;
}
if (!cont && !(cont = switch_core_session_alloc(session, sizeof(*cont)))) {
@ -2219,7 +2222,8 @@ switch_status_t spandsp_fax_detect_session(switch_core_session_t *session,
return status;
}
switch_channel_set_private(channel, "_fax_tone_detect_", cont);
if (set_private)
switch_channel_set_private(channel, "_fax_tone_detect_", cont);
return SWITCH_STATUS_SUCCESS;
}

View File

@ -184,6 +184,7 @@ switch_status_t megaco_activate_termination(mg_termination_t *term)
if (term->type == MG_TERM_TDM) {
switch_core_session_execute_application_async(session, "spandsp_start_fax_detect", "mg_notify cng 120 cng");
switch_core_session_execute_application_async(session, "spandsp_start_fax_detect", "mg_notify ced 120 ced");
}
}

View File

@ -168,6 +168,8 @@ switch_status_t mg_send_term_service_change(char *span_name, char *chan_number,
switch_status_t mg_send_t38_cng_notify(megaco_profile_t* mg_profile, const char* term_name);
switch_status_t mg_send_t38_ans_notify(megaco_profile_t* mg_profile, const char* term_name);
switch_status_t mg_send_t38_v21flag_notify(megaco_profile_t* mg_profile, const char* term_name);
switch_status_t sng_mgco_cfg(megaco_profile_t* profile);

View File

@ -39,7 +39,9 @@ SWITCH_STANDARD_APP(mg_notify_function)
if (!strcmp(data, "cng")) {
mg_send_t38_cng_notify(term->profile, term->name);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Sent CNG notify\n");
switch_channel_set_variable(channel, "mg_cng_detected", "true");
} else if (!strcmp(data, "ced")) {
mg_send_t38_ans_notify(term->profile, term->name);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Sent CED notify\n");
}
}