add some t38 vars

This commit is contained in:
Mathieu Rene 2012-08-10 07:08:47 -04:00
parent 24e363d6f5
commit 116a09e854
3 changed files with 38 additions and 1 deletions

View File

@ -127,7 +127,8 @@ switch_status_t megaco_activate_termination(mg_termination_t *term)
switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, kCODEC, term->u.rtp.codec);
switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, kMEDIATYPE, mg_media_type2str(term->u.rtp.media_type));
switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "fax_enable_t38", "true");
switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "rtp_execute_on_image", "t38_gateway peer nocng");
} else if (term->type == MG_TERM_TDM) {
switch_snprintf(dialstring, sizeof dialstring, "tdm/%s", term->name);

View File

@ -39,6 +39,7 @@ 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");
}
}

View File

@ -523,6 +523,21 @@ static switch_status_t channel_receive_event(switch_core_session_t *session, swi
switch_channel_set_variable(channel, kRFC2833PT, szpt);
switch_rtp_set_telephony_event(tech_pvt->rtp_session, pt);
}
if (compare_var(event, channel, kMODE)) {
const char *newmode = switch_channel_get_variable(channel, kMODE);
const char *mode = switch_channel_get_variable(channel, kMODE);
if (!strcmp(newmode, "image")) {
switch_channel_set_variable(tech_pvt->channel, "has_t38", "true");
switch_channel_set_app_flag_key("T38", tech_pvt->channel, CF_APP_T38);
switch_channel_execute_on(tech_pvt->channel, "rtp_execute_on_image");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Got IMAGE description\n");
}
switch_channel_set_variable(channel, kMODE, newmode);
}
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Received unknown command [%s] in event.\n", !command ? "null" : command);
}
@ -554,6 +569,26 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
assert(tech_pvt != NULL);
switch (msg->message_id) {
case SWITCH_MESSAGE_INDICATE_UDPTL_MODE:
{
switch_t38_options_t *t38_options = switch_channel_get_private(tech_pvt->channel, "t38_options");
if (!t38_options) {
goto end;
}
switch_rtp_udptl_mode(tech_pvt->rtp_session);
break;
}
case SWITCH_MESSAGE_INDICATE_T38_DESCRIPTION:
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "SWITCH_MESSAGE_INDICATE_T38_DESCRIPTION\n");
break;
}
case SWITCH_MESSAGE_INDICATE_REQUEST_IMAGE_MEDIA:
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "SWITCH_MESSAGE_INDICATE_REQUEST_IMAGE_MEDIA\n");
break;
}
case SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO:
{
if (switch_rtp_ready(tech_pvt->rtp_session) && !zstr(msg->string_array_arg[0]) && !zstr(msg->string_array_arg[1])) {