[asterisk-commits] brushtyler: branch brushtyler/voicemail_menu_branch r206936 - in /team/brusht...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 16 17:49:07 CDT 2009


Author: brushtyler
Date: Thu Jul 16 17:49:03 2009
New Revision: 206936

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=206936
Log:
fixed bugs, corrected the conf file to reproduce actual behaviour

Added:
    team/brushtyler/voicemail_menu_branch/apps/myvm/voicemail_menu-actual.conf   (contents, props changed)
      - copied, changed from r206866, team/brushtyler/voicemail_menu_branch/apps/myvm/voicemail_menu-actual_0.conf
Removed:
    team/brushtyler/voicemail_menu_branch/apps/myvm/voicemail_menu-actual_0.conf
    team/brushtyler/voicemail_menu_branch/apps/myvm/voicemail_menu-actual_1.conf
Modified:
    team/brushtyler/voicemail_menu_branch/apps/newvoicemail.c

Copied: team/brushtyler/voicemail_menu_branch/apps/myvm/voicemail_menu-actual.conf (from r206866, team/brushtyler/voicemail_menu_branch/apps/myvm/voicemail_menu-actual_0.conf)
URL: http://svn.asterisk.org/svn-view/asterisk/team/brushtyler/voicemail_menu_branch/apps/myvm/voicemail_menu-actual.conf?view=diff&rev=206936&p1=team/brushtyler/voicemail_menu_branch/apps/myvm/voicemail_menu-actual_0.conf&r1=206866&p2=team/brushtyler/voicemail_menu_branch/apps/myvm/voicemail_menu-actual.conf&r2=206936
==============================================================================
--- team/brushtyler/voicemail_menu_branch/apps/myvm/voicemail_menu-actual_0.conf (original)
+++ team/brushtyler/voicemail_menu_branch/apps/myvm/voicemail_menu-actual.conf Thu Jul 16 17:49:03 2009
@@ -5,12 +5,7 @@
 ; This configuration file replicates the exact behaviour of
 ; the original app_voicemail.c with the following exceptions:
 ; 
-; 1. if you press '4', '5', '6', '7', '8' or '9' when you are in 
-;    the first menu (start_menu), the default action are executed 
-;    because no actions are specified in the instructions for this 
-;    keys. The voicemail_menu-actual_1.conf replies this behaviour
-;    instead.
-; 2. ... /* TODO */
+; 1. ... /* TODO */
 ;
 ; The voicemail is organized as a set of submenus, where the user
 ; can navigate through explicit input or via timeouts.
@@ -85,7 +80,11 @@
 ; of the voice mailbox
 
 [start_menu]
-    init  = SET(VM_MB=${VM_MB_NUMBER}@${VM_MB_CONTEXT}),
+    init  = ${VM_MENU_TYPE} ? call(start_menu_intro)
+          ; enabled if a type is setted, play intro and instructions
+    init  = SET(VM_MENU_TYPE=init),
+          ; enabled when enter in the voicemail the first time
+    init += SET(VM_MB=${VM_MB_NUMBER}@${VM_MB_CONTEXT}),
           ; VM_MB conteins number at context
     init += SET(VM_NEW_MSGS=${VMCOUNT(${VM_MB},INBOX)}), 
           ; VM_NEW_MSG conteins the number of new messages
@@ -104,22 +103,43 @@
     default = call(start_menu_instruction)
             ; play instructions
 
-    1  = ${VM_MSG_IS_SELECTED} ? call(play_mess_menu)
-       ; if a message is selected, go to Play Message Menu
-    2  = call(change_to_folder_menu),
+    1  = ${VM_MSG_IS_SELECTED} ? SET(VM_MENU_TYPE=play), jump(start_menu)
+       ; if there are new messages, go to the new messages folder, 
+       ; else open the old messages folder and go to Play Messages Menu
+    2  = SET(VM_MENU_TYPE=init), call(change_to_folder_menu)
+    2 += play(vm-${VM_FOLDER}), play(vm-messages)
        ; go to Change Folder Menu
-    2 += play(vm-${VM_FOLDER}), play(vm-messages)
-       ; and when return play the selected folder name
-    3  = call(adv_menu)
+    3  = SET(VM_MENU_TYPE=init), call(adv_menu)
        ; go to Advanced Menu Options
-    0  = call(opts_menu)
+    4  = ${VM_MSG_IS_FIRST} ? play(vm-nomore)
+    4  = SET(VM_MENU_TYPE=play), 
+    4 += set_msg(-1), jump(start_menu)
+       ; play previous message
+    5  = jump(start_menu)
+       ; play current message
+    6  = ${VM_MSG_IS_LAST} ? play(vm-nomore)
+    6  = SET(VM_MENU_TYPE=play), 
+    6 += set_msg(+1), jump(start_menu)
+       ; play next message
+    7  = ${VM_MSG_IS_DELETED}=0 ? SET(VM_MENU_TYPE=play), 
+    7 += delete(), play(vm-deleted)
+       ; mark selected message for deletion
+    7  = ${VM_MSG_IS_DELETED} ? SET(VM_MENU_TYPE=play), 
+    7 += undelete(), play(vm-undeleted)
+       ; unmark a previous marked message for deletion
+    8  = forward_message()
+       ; forward a message
+    9  = SET(VM_MENU_TYPE=init), call(save_to_folder_menu)
+       ; go to Save To Folder Menu
+    0  = SET(VM_MENU_TYPE=init), call(opts_menu)
        ; go to Voicemail Menu Options
-    *  = ; help
+    *  = ${VM_MENU_TYPE}=play ? SET(VM_MENU_TYPE=full)
+       ; help
     _# = exit()
        ; exit
 
-
 [start_menu_intro]  ; play the start_menu intro
+    init  = ${VM_MENU_TYPE}=play ? jump(start_menu_play_intro)
     init  = ${VM_NEW_MSGS} & ${VM_OLD_MSGS} ? jump(start_menu_intro_newold)
           ; if there are both new and old messages, play the right intro
     init  = play(vm-youhave), 
@@ -127,7 +147,6 @@
     init += ${IF(${VM_MSGS}?play(vm-${VM_FOLDER}))}, 
     init += ${IF($[${VM_MSGS}=1]?play(vm-message):play(vm-messages))}, 
     init += jump(start_menu_instruction)
-
 
 [start_menu_intro_newold]   ; play the start_menu intro when there are 
                             ; new either old messages
@@ -140,8 +159,9 @@
     init += ${IF($[${VM_OLD_MSGS}=1]?play(vm-message):play(vm-messages))}, 
     init += jump(start_menu_instruction)
 
-
 [start_menu_instruction]    ; play the start_menu instructions
+    init  = ${VM_MENU_TYPE}=full ? jump(start_menu_full_instruction)
+    init  = ${VM_MENU_TYPE}=play ? jump(start_menu_play_instruction)
     init  = ${IF(${VM_MSG_IS_SELECTED}?play(vm-onefor))}, 
     init += ${IF(${VM_MSG_IS_SELECTED}?play(vm-${VM_FOLDER}))}, 
     init += ${IF(${VM_MSG_IS_SELECTED}?play(vm-messages))}, 
@@ -149,53 +169,7 @@
     init += play(vm-helpexit), 
     init += return(1)
 
-;-----------------------------------------------------------;
-;
-; Full Main Menu
-
-[start_menu_full]
-    init    = call(start_menu_full_instruction)
-    default = call(start_menu_full_instruction)
-            ; play instructions
-
-    1  = ${VM_MSG_IS_SELECTED} ? jump(play_mess_menu)
-       ; go to the Play Message Menu
-    2  = jump(change_to_folder_menu),
-       ; go to Change Folder Menu
-    2 += play(vm-${VM_FOLDER}), play(vm-messages)
-       ; and when return play the selected message folder name
-    3  = jump(adv_menu)
-       ; go to Advanced Menu Options
-    4  = ${VM_MSG_IS_FIRST} ? play(vm-nomore)
-       ; if the selected message are the first, 
-       ; there is no previous message
-    4  = set_msg(-1), jump(play_mess_menu)
-       ; select the previous message and play it
-    5  = jump(play_mess_menu)
-       ; play the current message
-    6  = ${VM_MSG_IS_LAST} ? play(vm-nomore)
-       ; if the selected message are the last, 
-       ; there is no next message
-    6  = set_msg(+1), jump(play_mess_menu)
-       ; select the next message and play it
-    7  = ${VM_MSG_IS_DELETED}=0 ? delete_msg(), play(vm-deleted)
-       ; if the selected message is not already marked for deletion, 
-       ; mark it
-    7  = ${VM_MSG_IS_DELETED} ? undelete_msg(), play(vm-undeleted)
-       ; if the selected message is marked for deletion, 
-       ; unmark it
-    8  = jump(forward_menu)
-       ; go to Forward Menu
-    9  = jump(save_to_folder_menu)
-       ; go to Save To Folder Menu
-    0  = jump(opts_menu)
-       ; go to Voicemail Menu Options
-    *  = ; help
-    _# = exit()
-       ; exit
-
-
-[start_menu_full_instruction]   ; play the start_menu_full instructions
+[start_menu_full_instruction]
     init  = ${IF(${VM_MSG_IS_SELECTED}?play(vm-onefor))}, 
     init += ${IF(${VM_MSG_IS_SELECTED}?play(vm-${VM_FOLDER}))}, 
     init += ${IF(${VM_MSG_IS_SELECTED}?play(vm-messages))}, 
@@ -214,46 +188,6 @@
     init += play(vm-helpexit), 
     init += return(1)
 
-
-;-----------------------------------------------------------;
-;
-; Play Messages Menu
-
-[play_mess_menu]
-    init    = call(play_mess_menu_intro)
-            ; play intro and instructions
-    default = call(play_mess_menu_instruction)
-            ; play instructions
-
-    3  = jump(adv_menu)
-       ; go to Advanced Menu Options
-    4  = ${VM_MSG_IS_FIRST} ? play(vm-nomore)
-       ; if the selected message are the first, 
-       ; there is no previous message
-    4  = set_msg(-1), jump(play_mess_menu)
-       ; select the previous message and play it
-    5  = jump(play_mess_menu)
-       ; play the current message
-    6  = ${VM_MSG_IS_LAST} ? play(vm-nomore)
-       ; if the selected message are the last, 
-       ; there is no next message
-    6  = set_msg(+1), jump(play_mess_menu)
-       ; select the next message and play it
-    7  = ${VM_MSG_IS_DELETED}=0 ? delete_msg(), play(vm-deleted)
-       ; if the selected message is not already marked for deletion, 
-       ; mark it
-    7  = ${VM_MSG_IS_DELETED} ? undelete_msg(), play(vm-undeleted)
-       ; if the selected message is marked for deletion, 
-       ; unmark it
-    8  = jump(forward_menu)
-       ; go to Forward Menu
-    9  = jump(save_to_folder_menu)
-       ; go to Save To Folder Menu
-    *  = jump(start_menu_full)
-       ; help
-    _# = exit()
-       ; exit
-
 [play_mess_menu_intro]  ; play the play_mess_menu intro
     init  = play_envelope(), 
           ; play additional message informations
@@ -261,7 +195,7 @@
           ; play the message
     init += jump(play_mess_menu_instruction)
 
-[play_mess_menu_instruction]    ; play the play_mess_menu instructions
+[start_menu_play_instruction]   ; play the play_mess_menu instructions
     init  = play(vm-advopts), 
     init += ${IF(${VM_MSG_IS_FIRST}?:play(vm-prev))}, 
     init += play(vm-repeat), 
@@ -272,7 +206,6 @@
     init += play(vm-savemessage), 
     init += play(vm-helpexit), 
     init += return(1)
-
 
 ;-----------------------------------------------------------;
 ;
@@ -615,7 +548,7 @@
             ; go to Record Exec Menu to record a message
 
     default = ${msg_exists(rec)} ? play(vm-review)
-    dafault = play(vm-torerecord)
+    default = play(vm-torerecord)
             ; play instructions
 
     1  = ${msg_exists(rec)} ? 
@@ -638,9 +571,10 @@
 
 
 [record_exec_menu]
-    init  = ${IF(${ISNULL(${VM_REC_GREET})}?play(beep):play(vm-rec-${VM_REC_GREET}))}, 
+    init  = ${IF(${ISNULL(${VM_REC_GREET})}?:play(vm-rec-${VM_REC_GREET}))}, 
           ; if we want to record a greeting, play the right greeting sound,
-          ; else play a beep
+    init += play(beep),
+          ; then play a beep
     init += record_msg(), return(1)
           ; record the message and return
 

Propchange: team/brushtyler/voicemail_menu_branch/apps/myvm/voicemail_menu-actual.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/brushtyler/voicemail_menu_branch/apps/myvm/voicemail_menu-actual.conf
------------------------------------------------------------------------------
    svn:keywords = brushtyler 2009-06-29

Propchange: team/brushtyler/voicemail_menu_branch/apps/myvm/voicemail_menu-actual.conf
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: team/brushtyler/voicemail_menu_branch/apps/myvm/voicemail_menu-actual.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: team/brushtyler/voicemail_menu_branch/apps/newvoicemail.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/brushtyler/voicemail_menu_branch/apps/newvoicemail.c?view=diff&rev=206936&r1=206935&r2=206936
==============================================================================
--- team/brushtyler/voicemail_menu_branch/apps/newvoicemail.c (original)
+++ team/brushtyler/voicemail_menu_branch/apps/newvoicemail.c Thu Jul 16 17:49:03 2009
@@ -2508,7 +2508,7 @@
 	cmd = ast_play_and_wait(chan, "vm-passchanged");
     return 0;
 }
-
+#define debug 1
 static int exec_function(struct ast_channel *chan, struct vm_state* vms, struct ast_vm_user *vmu, 
     struct exec_main_var* vm_var, int r_level, const char *function, char** result, int depth, struct exec_result* res)
 {
@@ -2564,7 +2564,7 @@
             aftercond = ast_skip_blanks(s);
         }
 	} else {
-        *result = action;
+        *result = ast_strdup(function);
         if (res) res->code = VMM_CONTINUE;
         return 0;
     }
@@ -2577,12 +2577,19 @@
 
     if (*result == NULL)
         *result = "";
+    else {
+        char *r = ast_strdupa(*result); 
+        ast_free((void *)*result);
+        *result = r;
+    }
 
     buf[0] = '\0';
     pbx_substitute_variables_helper(chan, *result, buf, sizeof(buf)-1);
 #if debug
     ast_log(LOG_NOTICE, "pbx_substitute_variables_helper - in: %s - out: %s\n", *result, buf);
 #endif
+
+    ast_log(LOG_NOTICE, "name: %s - args: %s\n", name, buf);
 
     *result = NULL;
 
@@ -2663,7 +2670,7 @@
 #endif
         *result = buf;
     } else {
-        *result = ast_strdupa(function);
+        *result = ast_strdup(function);
         if (res)
             res->code = VMM_CONTINUE;
         return 0;
@@ -2683,10 +2690,11 @@
         action[strlen(action)-2] = '\0';    /* remove "${" from the string */
         closepar++;     /* remove the "}" from the string */
         sprintf(app, "%s%s%s", action, *result, closepar);
-#if debug
-		ast_log(LOG_NOTICE, "Recursive Call: %s\n", app);
-#endif
-        return exec_function(chan, vms, vmu, vm_var, r_level, app, result, depth, res);
+
+        if (res)    /* exec an action from the actionlist within the menu */
+            return exec_function(chan, vms, vmu, vm_var, r_level, app, result, depth, res);
+        else        /* exec an action to test a condition */
+            *result = ast_strdup(app);
     } else  /* only execution, no results needed */
         *result = NULL;
 
@@ -2694,7 +2702,7 @@
         res->code = VMM_CONTINUE;
     return digit;
 }
-
+#define debug 0
 /*! \brief determine if an entry is enabled.
  * look in the body for an if(...) statement at the beginning.
  * If not available, then return success (marked as -1)
@@ -2779,21 +2787,27 @@
 	s = ast_skip_blanks(s);
 
     if (exec_function(chan, vms, vmu, vm_var, 0, s, &result, 0, NULL) < 0)
+        return 0;   /* condition is false */
+
+    if (result != NULL) {
+        char *a = ast_strdupa(result);
+        ast_free((void *)result);
+        result = a;
+    }
+
+    if (result == NULL || !ast_strlen_zero(result))   /* result is an empty string */
         return 0;
-
-    if (result == NULL)
-        result = "";
 
     /* tests the condition using dialplan */
     sprintf(buf, "$[%s]", result);
-    pbx_substitute_variables_helper(chan, &buf[0], s_eval, sizeof(s_eval)-1);
+    pbx_substitute_variables_helper(chan, buf, s_eval, sizeof(s_eval)-1);
 #if 1
     ast_log(LOG_NOTICE, "enabler condition - in: %s -> out: %s\n", s, s_eval);
 #endif
 
 	if (ast_strlen_zero(s_eval) || !strcmp(s_eval, "0"))
-		return 0;
-	return 1;
+		return 0;   /* condition is false */
+	return 1;   /* condition is true */
 }
 
 /*
@@ -3223,6 +3237,10 @@
 
         if (exec_function(chan, vms, vmu, vm_var, 0, action, &result, depth, &res) < 0)
             return res;
+
+        if (result != NULL) {
+            ast_free((void *)result);
+        }
 
         if (res.code == VMM_CONTINUE)
             continue;




More information about the asterisk-commits mailing list