From 4b30a810425940015da49c0de6a6cb48b8489ef7 Mon Sep 17 00:00:00 2001 From: Martin Paterson Date: Wed, 16 Dec 2020 11:36:43 +0000 Subject: [PATCH] [mod_voicemail] Fix API, allow greeting deletion (Issue #977) --- src/mod/applications/mod_voicemail/mod_voicemail.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 6ef8bf37e7..fdda004522 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -5104,7 +5104,7 @@ SWITCH_STANDARD_API(vm_fsdb_pref_greeting_set_function) if (argv[4]) file_path = argv[4]; - if (!profile_name || !domain || !id || !slot) { + if (!profile_name || !domain || !id || slot == -1) { stream->write_function(stream, "-ERR Missing Arguments\n"); goto done; } @@ -5112,6 +5112,10 @@ SWITCH_STANDARD_API(vm_fsdb_pref_greeting_set_function) if (!(profile = get_profile(profile_name))) { stream->write_function(stream, "-ERR Profile not found\n"); goto done; + } if (slot == 0) { + sql = switch_mprintf("UPDATE voicemail_prefs SET greeting_path = NULL WHERE username = '%q' AND domain = '%q'", id, domain); + vm_execute_sql(profile, sql, profile->mutex); + switch_safe_free(sql); } else { char *dir_path = switch_core_sprintf(pool, "%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir, SWITCH_PATH_SEPARATOR,