mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-06-08 05:54:45 +00:00
mod_voicemail: Make sure vm_fsdb api create the user directory before trying to move file into it
This commit is contained in:
parent
771819c430
commit
d7002351d7
@ -4895,6 +4895,8 @@ SWITCH_STANDARD_API(vm_fsdb_pref_greeting_set_function)
|
|||||||
profile->name, SWITCH_PATH_SEPARATOR, domain, SWITCH_PATH_SEPARATOR, id);
|
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);
|
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 (file_path) {
|
||||||
if (switch_file_exists(file_path, pool) != SWITCH_STATUS_SUCCESS) {
|
if (switch_file_exists(file_path, pool) != SWITCH_STATUS_SUCCESS) {
|
||||||
stream->write_function(stream, "-ERR Filename doesn't exist\n");
|
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);
|
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);
|
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) {
|
if (switch_file_exists(file_path, pool) != SWITCH_STATUS_SUCCESS) {
|
||||||
stream->write_function(stream, "-ERR Filename doesn't exist\n");
|
stream->write_function(stream, "-ERR Filename doesn't exist\n");
|
||||||
profile_rwunlock(profile);
|
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);
|
switch_file_rename(file_path, final_file_path, pool);
|
||||||
|
|
||||||
if (atoi(res) == 0) {
|
if (atoi(res) == 0) {
|
||||||
sql = switch_mprintf("INSERT INTO voicemail_prefs (username, domain, name_path) VALUES('%q', '%q', '%q')", id, domain, final_file_path);
|
sql = switch_mprintf("INSERT INTO voicemail_prefs (username, domain, name_path) VALUES('%q', '%q', '%q')", id, domain, final_file_path);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user