]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-3619 --resolve approach 1
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 19 Oct 2011 12:47:37 +0000 (07:47 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 19 Oct 2011 12:47:37 +0000 (07:47 -0500)
src/mod/applications/mod_spandsp/mod_spandsp_fax.c

index 23cb9031bf7afd66f36f7a770145ba6cf8db4aaf..499b16e0d3ce2877322b1cad35186293e2548276 100644 (file)
@@ -2018,17 +2018,22 @@ switch_status_t spandsp_fax_stop_detect_session(switch_core_session_t *session)
 }
 
 switch_status_t spandsp_fax_detect_session(switch_core_session_t *session,
-                                                                                                                  const char *flags, time_t timeout,
+                                                                                                                  const char *flags, int timeout,
                                                                                                                   int hits, const char *app, const char *data, switch_tone_detect_callback_t callback)
 {
        switch_channel_t *channel = switch_core_session_get_channel(session);
        switch_status_t status;
+       time_t to = 0;
        spandsp_fax_tone_container_t *cont = switch_channel_get_private(channel, "_fax_tone_detect_");
        switch_media_bug_flag_t bflags = 0;
        const char *var;
        switch_codec_implementation_t read_impl = { 0 };
        switch_core_session_get_read_impl(session, &read_impl);
 
+       if (timeout) {
+               to = switch_epoch_time_now(NULL) + timeout;
+       }
+
        if (cont) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Max Tones Reached!\n");
                return SWITCH_STATUS_FALSE;
@@ -2089,7 +2094,7 @@ switch_status_t spandsp_fax_detect_session(switch_core_session_t *session,
 
 
        if ((status = switch_core_media_bug_add(session, "fax_tone_detect", "",
-                                                                                       tone_detect_callback, cont, timeout, bflags, &cont->bug)) != SWITCH_STATUS_SUCCESS) {
+                                                                                       tone_detect_callback, cont, to, bflags, &cont->bug)) != SWITCH_STATUS_SUCCESS) {
                cont->bug_running = 0;
                return status;
        }