Merge branch 'nsg-4.3' of ssh://git.sangoma.com/smg_freeswitch into nsg-4.3

This commit is contained in:
Kapil Gupta 2012-08-10 11:11:56 -04:00
commit c347689465
3 changed files with 47 additions and 2 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);
@ -146,6 +147,10 @@ switch_status_t megaco_activate_termination(mg_termination_t *term)
switch_core_session_receive_event(session, &var_event);
if (term->u.rtp.t38_options) {
switch_channel_set_private(channel, "t38_options", term->u.rtp.t38_options);
}
switch_core_session_rwunlock(session);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sent refresh to channel [%s], for termination [%s]\n", term->uuid, term->name);
@ -169,6 +174,11 @@ switch_status_t megaco_activate_termination(mg_termination_t *term)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Termination [%s] successfully instanciated as [%s] [%s]\n", term->name, dialstring, switch_core_session_get_uuid(session));
channel = switch_core_session_get_channel(session);
switch_channel_set_private(channel, PVT_MG_TERM, term);
if (term->u.rtp.t38_options) {
switch_channel_set_private(channel, "t38_options", term->u.rtp.t38_options);
}
switch_core_event_hook_add_recv_dtmf(session, mg_on_dtmf);
if (term->type == MG_TERM_TDM) {

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

@ -40,7 +40,7 @@
#define kPTIME "ptime"
#define kPT "pt"
#define kRFC2833PT "rfc2833_pt"
#define kMODE "mode"
#define kMEDIATYPE "media_type"
#define kRATE "rate"
static struct {
@ -523,6 +523,20 @@ 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, kMEDIATYPE)) {
const char *newmode = switch_channel_get_variable(channel, kMEDIATYPE);
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, kMEDIATYPE, 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 +568,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])) {