]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add ced detection
authorkapil <kgupta@sangoma.com>
Tue, 14 Aug 2012 19:41:05 +0000 (15:41 -0400)
committerkapil <kgupta@sangoma.com>
Tue, 14 Aug 2012 19:41:05 +0000 (15:41 -0400)
src/mod/applications/mod_spandsp/mod_spandsp_fax.c
src/mod/endpoints/mod_media_gateway/media_gateway.c
src/mod/endpoints/mod_media_gateway/media_gateway_stack.h
src/mod/endpoints/mod_media_gateway/mod_media_gateway.c

index 975aca1fc863f1738fe35b3b44e61a4674fe4e1b..b79331ab15d5c5311b42fd56b970d1efdbcb269c 100644 (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)))) {
@@ -2218,8 +2221,9 @@ switch_status_t spandsp_fax_detect_session(switch_core_session_t *session,
                cont->bug_running = 0;
                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;
 }
index e3d9d7aafe909e02711161e60794d5d66bc78fbe..87201b4dbb315e7bd052157e6b3f714b0182e7d3 100644 (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");
         }
     }
     
index d06e796c541127259d840d37dea3d348ffe936ff..e603e2c531f5feaeea4264f9bb3024f448a26e17 100644 (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);
index 2afd7a778c30defe5bdfa8347429f01326a01cd7..a905a445e1d56323f80e467a63403390491085d6 100644 (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");
     }
 }