Revision
17501
Author
brian
Date
2010-05-06 16:25:41 -0500 (Thu, 06 May 2010)

Log Message

 fix issue where file isn't in database and move zstr check into switch_file_exists

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c (17500 => 17501)


--- freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c	2010-05-06 20:25:30 UTC (rev 17500)
+++ freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c	2010-05-06 21:25:41 UTC (rev 17501)
@@ -1445,7 +1445,9 @@
 			*cc.buf = '\0';
 			memset(&fh, 0, sizeof(fh));
 			cc.fh = &fh;
-			TRY_CODE(switch_ivr_play_file(session, &fh, cbt->file_path, &args));
+			if (switch_file_exists(cbt->file_path, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
+				TRY_CODE(switch_ivr_play_file(session, &fh, cbt->file_path, &args));
+			}
 		}
 
 		if (!*cc.buf && (profile->play_date_announcement == VM_DATE_LAST)) {
@@ -3005,11 +3007,11 @@
 
 		switch_ivr_sleep(session, 100, SWITCH_TRUE, NULL);
 
-		if (!zstr(greet_path)) {
+		if (switch_file_exists(greet_path, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
 			memset(buf, 0, sizeof(buf));
 			TRY_CODE(switch_ivr_play_file(session, NULL, greet_path, &args));
 		} else {
-			if (!zstr(cbt.name_path)) {
+			if (switch_file_exists(cbt.name_path, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
 				memset(buf, 0, sizeof(buf));
 				TRY_CODE(switch_ivr_play_file(session, NULL, cbt.name_path, &args));
 			}

Modified: freeswitch/trunk/src/switch_apr.c (17500 => 17501)


--- freeswitch/trunk/src/switch_apr.c	2010-05-06 20:25:30 UTC (rev 17500)
+++ freeswitch/trunk/src/switch_apr.c	2010-05-06 21:25:41 UTC (rev 17501)
@@ -507,15 +507,17 @@
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	apr_finfo_t info = { 0 };
 
+	if (zstr(filename)) {
+		return status;
+	}
+
 	if (!pool) {
 		switch_core_new_memory_pool(&our_pool);
 	}
 
-	if (filename) {
-		apr_stat(&info, filename, wanted, pool ? pool : our_pool);
-		if (info.filetype != APR_NOFILE) {
-			status = SWITCH_STATUS_SUCCESS;
-		}
+	apr_stat(&info, filename, wanted, pool ? pool : our_pool);
+	if (info.filetype != APR_NOFILE) {
+		status = SWITCH_STATUS_SUCCESS;
 	}
 
 	if (our_pool) {