]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FSCORE-531 + fix bogus UNPROTECT_INTERFACE
authorMathieu Rene <mrene@avgs.ca>
Thu, 21 Jan 2010 02:34:06 +0000 (02:34 +0000)
committerMathieu Rene <mrene@avgs.ca>
Thu, 21 Jan 2010 02:34:06 +0000 (02:34 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16427 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_ivr_originate.c

index e5fd8c6ebfa3916a4deaedde9ba75c7918aaac59..736726cc6a782d777762a1b1613b893f8db3c2d9 100644 (file)
@@ -142,6 +142,7 @@ static void *SWITCH_THREAD_FUNC collect_thread_run(switch_thread_t *thread, void
        switch_channel_t *channel = switch_core_session_get_channel(collect->session);
        char buf[10] = SWITCH_BLANK_STRING;
        char *p, term;
+       switch_application_interface_t *application_interface = NULL;
 
        if (collect->session) {
                if (switch_core_session_read_lock(collect->session) != SWITCH_STATUS_SUCCESS) {
@@ -155,7 +156,6 @@ static void *SWITCH_THREAD_FUNC collect_thread_run(switch_thread_t *thread, void
        
        if (!strcasecmp(collect->key, "exec")) {
                char *data;
-               switch_application_interface_t *application_interface;
                char *app_name, *app_data;
 
                if (!(data = collect->file)) {
@@ -171,7 +171,6 @@ static void *SWITCH_THREAD_FUNC collect_thread_run(switch_thread_t *thread, void
                if ((application_interface = switch_loadable_module_get_application_interface(app_name)) == 0) {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(collect->session), SWITCH_LOG_ERROR, "Invalid Application %s\n", app_name);
                        switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
-                       UNPROTECT_INTERFACE(application_interface);
                        goto wbreak;
                }
 
@@ -198,10 +197,12 @@ static void *SWITCH_THREAD_FUNC collect_thread_run(switch_thread_t *thread, void
                memset(buf, 0, sizeof(buf));
 
                if (collect->file) {
+                       switch_status_t status;
                        switch_input_args_t args = { 0 };
                        args.buf = buf;
                        args.buflen = sizeof(buf);
-                       if (switch_ivr_play_file(collect->session, NULL, collect->file, &args) != SWITCH_STATUS_SUCCESS) {
+                       status = switch_ivr_play_file(collect->session, NULL, collect->file, &args);
+                       if (!SWITCH_READ_ACCEPTABLE(status)) {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(collect->session), SWITCH_LOG_ERROR, "%s Error Playing File!", switch_channel_get_name(channel));
                                switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
                        }
@@ -219,7 +220,7 @@ static void *SWITCH_THREAD_FUNC collect_thread_run(switch_thread_t *thread, void
  wbreak:
 
        switch_core_session_rwunlock(collect->session);
-
+       UNPROTECT_INTERFACE(application_interface);     
        return NULL;
 }