]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-3399 --resolve
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 5 Apr 2012 18:15:45 +0000 (13:15 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 5 Apr 2012 18:15:45 +0000 (13:15 -0500)
src/switch_ivr_play_say.c

index b4178e9e85fcfecb622d18457816dc7eb5794ece..a29f4c6f22adc6a84ed1d6dd6bfa4a09ccc4549a 100644 (file)
@@ -2181,6 +2181,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session
                }
        }
 
+       switch_channel_audio_sync(channel);
+
        ilen = len;
        for (;;) {
                switch_event_t *event;
@@ -2346,7 +2348,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session
                                }
                        }
                }
-
        }
 
  done:
@@ -2377,8 +2378,12 @@ SWITCH_DECLARE(void) switch_ivr_clear_speech_cache(switch_core_session_t *sessio
                if (cache_obj->timer.interval) {
                        switch_core_timer_destroy(&cache_obj->timer);
                }
-               switch_core_speech_close(&cache_obj->sh, &flags);
-               switch_core_codec_destroy(&cache_obj->codec);
+               if (&cache_obj->sh && cache_obj->sh.speech_interface) {
+                       switch_core_speech_close(&cache_obj->sh, &flags);
+               }
+               if (&cache_obj->codec) {
+                       switch_core_codec_destroy(&cache_obj->codec);
+               }
                switch_channel_set_private(channel, SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME, NULL);
        }
 }
@@ -2412,7 +2417,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses
        timer = &ltimer;
 
        if ((var = switch_channel_get_variable(channel, SWITCH_CACHE_SPEECH_HANDLES_VARIABLE)) && switch_true(var)) {
-               if ((cache_obj = switch_channel_get_private(channel, SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME))) {
+               if ((cache_obj = (cached_speech_handle_t *) switch_channel_get_private(channel, SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME))) {
                        need_create = 0;
                        if (!strcasecmp(cache_obj->tts_name, tts_name)) {
                                need_alloc = 0;
@@ -2422,7 +2427,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses
                }
 
                if (!cache_obj) {
-                       cache_obj = switch_core_session_alloc(session, sizeof(*cache_obj));
+                       cache_obj = (cached_speech_handle_t *) switch_core_session_alloc(session, sizeof(*cache_obj));
                }
                if (need_alloc) {
                        switch_copy_string(cache_obj->tts_name, tts_name, sizeof(cache_obj->tts_name));