mod_voicemail: Make sure vm_fsdb api create the user directory before trying to move file into it

This commit is contained in:
Marc Olivier Chouinard 2012-05-25 07:18:55 -04:00
parent 771819c430
commit d7002351d7

View File

@ -4895,6 +4895,8 @@ SWITCH_STANDARD_API(vm_fsdb_pref_greeting_set_function)
profile->name, SWITCH_PATH_SEPARATOR, domain, SWITCH_PATH_SEPARATOR, id);
char *final_file_path = switch_core_sprintf(pool, "%s%sgreeting_%d.%s", dir_path, SWITCH_PATH_SEPARATOR, slot, profile->file_ext);
switch_dir_make_recursive(dir_path, SWITCH_DEFAULT_DIR_PERMS, pool);
if (file_path) {
if (switch_file_exists(file_path, pool) != SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "-ERR Filename doesn't exist\n");
@ -4989,6 +4991,8 @@ SWITCH_STANDARD_API(vm_fsdb_pref_recname_set_function)
profile->name, SWITCH_PATH_SEPARATOR, domain, SWITCH_PATH_SEPARATOR, id);
char *final_file_path = switch_core_sprintf(pool, "%s%srecorded_name.%s", dir_path, SWITCH_PATH_SEPARATOR, profile->file_ext);
switch_dir_make_recursive(dir_path, SWITCH_DEFAULT_DIR_PERMS, pool);
if (switch_file_exists(file_path, pool) != SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "-ERR Filename doesn't exist\n");
profile_rwunlock(profile);
@ -4996,6 +5000,7 @@ SWITCH_STANDARD_API(vm_fsdb_pref_recname_set_function)
}
switch_file_rename(file_path, final_file_path, pool);
if (atoi(res) == 0) {
sql = switch_mprintf("INSERT INTO voicemail_prefs (username, domain, name_path) VALUES('%q', '%q', '%q')", id, domain, final_file_path);
} else {