aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_voicemail.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/app_voicemail.c')
-rw-r--r--apps/app_voicemail.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 4cf6895d1..85afac465 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -4117,7 +4117,11 @@ static int forward_message(struct ast_channel *chan, char *context, struct vm_st
if (flag==1) {
struct leave_vm_options leave_options;
char mailbox[AST_MAX_EXTENSION * 2 + 2];
- snprintf(mailbox, sizeof(mailbox), "%s@%s", username, context);
+ /* Make sure that context doesn't get set as a literal "(null)" (or else find_user won't find it) */
+ if (context)
+ snprintf(mailbox, sizeof(mailbox), "%s@%s", username, context);
+ else
+ ast_copy_string(mailbox, username, sizeof(mailbox));
/* Send VoiceMail */
memset(&leave_options, 0, sizeof(leave_options));