Add voicemail parameter storage-dir-shared
If this is set to true (default false) we assume the storage-dir is shared, organized by realm/domain, with uses other than voicemail, so we adopt a directory structure of: <storage_dir>/<realm>/voicemail/<id>
This commit is contained in:
parent
b9a8583178
commit
a6c90763ec
|
@ -155,6 +155,7 @@ struct vm_profile {
|
|||
char *vmain_ext;
|
||||
char *tone_spec;
|
||||
char *storage_dir;
|
||||
switch_bool_t storage_dir_shared;
|
||||
char *callback_dialplan;
|
||||
char *callback_context;
|
||||
char *email_body;
|
||||
|
@ -629,6 +630,8 @@ vm_profile_t *profile_set_config(vm_profile_t *profile)
|
|||
&profile->tone_spec, "%(1000, 0, 640)", &profile->config_str_pool, NULL, NULL);
|
||||
SWITCH_CONFIG_SET_ITEM(profile->config[i++], "storage-dir", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
|
||||
&profile->storage_dir, "", &profile->config_str_pool, NULL, NULL);
|
||||
SWITCH_CONFIG_SET_ITEM(profile->config[i++], "storage-dir-shared", SWITCH_CONFIG_BOOL, CONFIG_RELOADABLE,
|
||||
&profile->storage_dir_shared, SWITCH_FALSE, NULL, NULL, NULL);
|
||||
SWITCH_CONFIG_SET_ITEM(profile->config[i++], "callback-dialplan", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
|
||||
&profile->callback_dialplan, "XML", &profile->config_str_pool, NULL, NULL);
|
||||
SWITCH_CONFIG_SET_ITEM(profile->config[i++], "callback-context", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
|
||||
|
@ -2608,9 +2611,16 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p
|
|||
} else if (!zstr(storage_dir)) {
|
||||
dir_path = switch_core_session_sprintf(session, "%s%s%s", storage_dir, SWITCH_PATH_SEPARATOR, myid);
|
||||
} else if (!zstr(profile->storage_dir)) {
|
||||
dir_path =
|
||||
switch_core_session_sprintf(session, "%s%s%s%s%s", profile->storage_dir, SWITCH_PATH_SEPARATOR, domain_name,
|
||||
SWITCH_PATH_SEPARATOR, myid);
|
||||
if (profile->storage_dir_shared) {
|
||||
dir_path =
|
||||
switch_core_session_sprintf(session, "%s%s%s%s%s%s%s", profile->storage_dir, SWITCH_PATH_SEPARATOR, domain_name,
|
||||
SWITCH_PATH_SEPARATOR, "voicemail",
|
||||
SWITCH_PATH_SEPARATOR, myid);
|
||||
} else {
|
||||
dir_path =
|
||||
switch_core_session_sprintf(session, "%s%s%s%s%s", profile->storage_dir, SWITCH_PATH_SEPARATOR, domain_name,
|
||||
SWITCH_PATH_SEPARATOR, myid);
|
||||
}
|
||||
} else {
|
||||
dir_path = switch_core_session_sprintf(session, "%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir,
|
||||
SWITCH_PATH_SEPARATOR,
|
||||
|
@ -2811,7 +2821,11 @@ static switch_status_t deliver_vm(vm_profile_t *profile,
|
|||
} else if (!zstr(storage_dir)) {
|
||||
dir_path = switch_mprintf("%s%s%s", storage_dir, SWITCH_PATH_SEPARATOR, myid);
|
||||
} else if (!zstr(profile->storage_dir)) {
|
||||
dir_path = switch_mprintf("%s%s%s%s%s", profile->storage_dir, SWITCH_PATH_SEPARATOR, domain_name, SWITCH_PATH_SEPARATOR, myid);
|
||||
if (profile->storage_dir_shared) {
|
||||
dir_path = switch_mprintf("%s%s%s%s%s%s%s", profile->storage_dir, SWITCH_PATH_SEPARATOR, domain_name, SWITCH_PATH_SEPARATOR, "voicemail", SWITCH_PATH_SEPARATOR, myid);
|
||||
} else {
|
||||
dir_path = switch_mprintf("%s%s%s%s%s", profile->storage_dir, SWITCH_PATH_SEPARATOR, domain_name, SWITCH_PATH_SEPARATOR, myid);
|
||||
}
|
||||
} else {
|
||||
dir_path = switch_mprintf("%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir,
|
||||
SWITCH_PATH_SEPARATOR,
|
||||
|
@ -3481,7 +3495,11 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p
|
|||
} else if (!zstr(storage_dir)) {
|
||||
dir_path = switch_core_session_sprintf(session, "%s%s%s", storage_dir, SWITCH_PATH_SEPARATOR, id);
|
||||
} else if (!zstr(profile->storage_dir)) {
|
||||
dir_path = switch_core_session_sprintf(session, "%s%s%s%s%s", profile->storage_dir, SWITCH_PATH_SEPARATOR, domain_name, SWITCH_PATH_SEPARATOR, id);
|
||||
if (profile->storage_dir_shared) {
|
||||
dir_path = switch_core_session_sprintf(session, "%s%s%s%s%s%s%s", profile->storage_dir, SWITCH_PATH_SEPARATOR, domain_name, SWITCH_PATH_SEPARATOR, "voicemail", SWITCH_PATH_SEPARATOR, id);
|
||||
} else {
|
||||
dir_path = switch_core_session_sprintf(session, "%s%s%s%s%s", profile->storage_dir, SWITCH_PATH_SEPARATOR, domain_name, SWITCH_PATH_SEPARATOR, id);
|
||||
}
|
||||
} else {
|
||||
dir_path = switch_core_session_sprintf(session, "%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir,
|
||||
SWITCH_PATH_SEPARATOR,
|
||||
|
|
Loading…
Reference in New Issue