提交 a6c90763 authored 作者: Travis Cross's avatar Travis Cross

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>
上级 b9a85831
...@@ -155,6 +155,7 @@ struct vm_profile { ...@@ -155,6 +155,7 @@ struct vm_profile {
char *vmain_ext; char *vmain_ext;
char *tone_spec; char *tone_spec;
char *storage_dir; char *storage_dir;
switch_bool_t storage_dir_shared;
char *callback_dialplan; char *callback_dialplan;
char *callback_context; char *callback_context;
char *email_body; char *email_body;
...@@ -629,6 +630,8 @@ vm_profile_t *profile_set_config(vm_profile_t *profile) ...@@ -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); &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, SWITCH_CONFIG_SET_ITEM(profile->config[i++], "storage-dir", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
&profile->storage_dir, "", &profile->config_str_pool, NULL, NULL); &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, SWITCH_CONFIG_SET_ITEM(profile->config[i++], "callback-dialplan", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
&profile->callback_dialplan, "XML", &profile->config_str_pool, NULL, NULL); &profile->callback_dialplan, "XML", &profile->config_str_pool, NULL, NULL);
SWITCH_CONFIG_SET_ITEM(profile->config[i++], "callback-context", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 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 ...@@ -2608,9 +2611,16 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p
} else if (!zstr(storage_dir)) { } else if (!zstr(storage_dir)) {
dir_path = switch_core_session_sprintf(session, "%s%s%s", storage_dir, SWITCH_PATH_SEPARATOR, myid); dir_path = switch_core_session_sprintf(session, "%s%s%s", storage_dir, SWITCH_PATH_SEPARATOR, myid);
} else if (!zstr(profile->storage_dir)) { } else if (!zstr(profile->storage_dir)) {
dir_path = if (profile->storage_dir_shared) {
switch_core_session_sprintf(session, "%s%s%s%s%s", profile->storage_dir, SWITCH_PATH_SEPARATOR, domain_name, dir_path =
SWITCH_PATH_SEPARATOR, myid); 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 { } else {
dir_path = switch_core_session_sprintf(session, "%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir, dir_path = switch_core_session_sprintf(session, "%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir,
SWITCH_PATH_SEPARATOR, SWITCH_PATH_SEPARATOR,
...@@ -2811,7 +2821,11 @@ static switch_status_t deliver_vm(vm_profile_t *profile, ...@@ -2811,7 +2821,11 @@ static switch_status_t deliver_vm(vm_profile_t *profile,
} else if (!zstr(storage_dir)) { } else if (!zstr(storage_dir)) {
dir_path = switch_mprintf("%s%s%s", storage_dir, SWITCH_PATH_SEPARATOR, myid); dir_path = switch_mprintf("%s%s%s", storage_dir, SWITCH_PATH_SEPARATOR, myid);
} else if (!zstr(profile->storage_dir)) { } 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 { } else {
dir_path = switch_mprintf("%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir, dir_path = switch_mprintf("%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir,
SWITCH_PATH_SEPARATOR, SWITCH_PATH_SEPARATOR,
...@@ -3481,7 +3495,11 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p ...@@ -3481,7 +3495,11 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p
} else if (!zstr(storage_dir)) { } else if (!zstr(storage_dir)) {
dir_path = switch_core_session_sprintf(session, "%s%s%s", storage_dir, SWITCH_PATH_SEPARATOR, id); dir_path = switch_core_session_sprintf(session, "%s%s%s", storage_dir, SWITCH_PATH_SEPARATOR, id);
} else if (!zstr(profile->storage_dir)) { } 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 { } else {
dir_path = switch_core_session_sprintf(session, "%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir, dir_path = switch_core_session_sprintf(session, "%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir,
SWITCH_PATH_SEPARATOR, SWITCH_PATH_SEPARATOR,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论