]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add some t38 vars
authorMathieu Rene <mrene@avgs.ca>
Fri, 10 Aug 2012 11:08:47 +0000 (07:08 -0400)
committerMathieu Rene <mrene@avgs.ca>
Fri, 10 Aug 2012 11:08:47 +0000 (07:08 -0400)
src/mod/endpoints/mod_media_gateway/media_gateway.c
src/mod/endpoints/mod_media_gateway/mod_media_gateway.c
src/mod/endpoints/mod_sofia/rtp.c

index 8409cdc0e18b413d923ec9a40f5e7d7c46f4db60..bd9401b419229c96f4bfb52d756cf0b1fb1cb792 100644 (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);
         
index 66b91072b46a088793dd079e79e59b9e0f244e2a..2afd7a778c30defe5bdfa8347429f01326a01cd7 100644 (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");
     }
 }
 
index 3a41065fe30a0afcfd113f640e10f143ee36fe61..279e5a5ac157dbb0dd119b419b8d410c6225434b 100644 (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])) {