]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix issue where file isn't in database and move zstr check into switch_file_exists
authorBrian West <brian@freeswitch.org>
Thu, 6 May 2010 21:25:23 +0000 (16:25 -0500)
committerBrian West <brian@freeswitch.org>
Thu, 6 May 2010 21:25:41 +0000 (16:25 -0500)
src/mod/applications/mod_voicemail/mod_voicemail.c
src/switch_apr.c

index b919b17c58a1fad596119a807c5935d6cf9f0ea5..859710870e4e0d7fb3e03ee8d5b15b0b0ef04c4e 100644 (file)
@@ -1445,7 +1445,9 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t
                        *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 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p
 
                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));
                        }
index 360974af9535e1181d8c4437943a1f13097b1877..d579999356374e98f72ba20d80fd900115415c77 100644 (file)
@@ -507,15 +507,17 @@ SWITCH_DECLARE(switch_status_t) switch_file_exists(const char *filename, switch_
        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) {