From: Marc Olivier Chouinard Date: Fri, 16 May 2014 21:18:17 +0000 (-0400) Subject: CID:1210789 Make return value of a function available from the another calling functi... X-Git-Tag: v1.4.4~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=29e2263442ab03672665ff4a11ee9440527a772d;p=thirdparty%2Ffreeswitch.git CID:1210789 Make return value of a function available from the another calling function. Also add a small status check. --- diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index a5a32c744d..f085413f5f 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1420,20 +1420,30 @@ end: return status; } -static void playback_array(switch_core_session_t *session, const char *str) { +static switch_status_t playback_array(switch_core_session_t *session, const char *str) { + switch_status_t status = SWITCH_STATUS_FALSE; if (str && !strncmp(str, "ARRAY::", 7)) { char *i = (char*) str + 7, *j = i; while (1) { if ((j = strstr(i, "::"))) { *j = 0; } - switch_ivr_play_file(session, NULL, i, NULL); + status = switch_ivr_play_file(session, NULL, i, NULL); + if (status == SWITCH_STATUS_FALSE /* Invalid Recording */ && SWITCH_READ_ACCEPTABLE(status)) { + /* Sadly, there doesn't seem to be a return to switch_ivr_play_file that tell you the file wasn't found. FALSE also mean that the channel got switch to BRAKE state, so we check for read acceptable */ + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Couldn't play file '%s'\n", i); + } else if (!SWITCH_READ_ACCEPTABLE(status)) { + break; + } + if (!j) break; i = j + 2; } } else { - switch_ivr_play_file(session, NULL, str, NULL); + status = switch_ivr_play_file(session, NULL, str, NULL); } + + return status; } static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *thread, void *obj)