Fix a bug with app_voicemail when trying to use app_directory to leave messages
[asterisk/asterisk.git] / apps / app_voicemail.c
index 9952d40..c6520ec 100644 (file)
@@ -3864,13 +3864,15 @@ static int forward_message(struct ast_channel *chan, char *context, struct vm_st
                        
                        app = pbx_findapp("Directory");
                        if (app) {
                        
                        app = pbx_findapp("Directory");
                        if (app) {
-                               /* make mackup copies */
+                               char vmcontext[256];
+                               /* make backup copies */
                                memcpy(old_context, chan->context, sizeof(chan->context));
                                memcpy(old_exten, chan->exten, sizeof(chan->exten));
                                old_priority = chan->priority;
                                
                                /* call the the Directory, changes the channel */
                                memcpy(old_context, chan->context, sizeof(chan->context));
                                memcpy(old_exten, chan->exten, sizeof(chan->exten));
                                old_priority = chan->priority;
                                
                                /* call the the Directory, changes the channel */
-                               res = pbx_exec(chan, app, context ? context : "default");
+                               sprintf(vmcontext, "%s||v", context ? context : "default");
+                               res = pbx_exec(chan, app, vmcontext);
                                
                                ast_copy_string(username, chan->exten, sizeof(username));
                                
                                
                                ast_copy_string(username, chan->exten, sizeof(username));