[asterisk-dev] voicemail_menu_branch [was: Re: [svn-commits] brushtyler: branch brushtyler/voicemail_menu_branch r199855 - in /team/brusht...]
Tzafrir Cohen
tzafrir.cohen at xorcom.com
Thu Jun 11 04:40:42 CDT 2009
Hi
Good to see some SoC branches with some initial code already.
However as stated previously on the list, I don't like the whole idea
and think it should be implemented in the dialplan (minivm).
Thus see the inline comments below. There are a bunch of them (I
decided to quote brief.txt and the sample config file fully to give some
context for now).
On Wed, Jun 10, 2009 at 02:51:14PM -0000, SVN commits to the Digium repositories wrote:
> Author: brushtyler
> Date: Wed Jun 10 09:51:11 2009
> New Revision: 199855
>
> URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=199855
> Log:
> Added some code and vmmenu example
>
> Added:
> team/brushtyler/voicemail_menu_branch/apps/app_myvm.c (with props)
> team/brushtyler/voicemail_menu_branch/apps/myvm/
> team/brushtyler/voicemail_menu_branch/apps/myvm/brief.txt (with props)
> team/brushtyler/voicemail_menu_branch/apps/myvm/voicemail_menu.conf.sample (with props)
> team/brushtyler/voicemail_menu_branch/apps/newvoicemail.c (with props)
>
> Added: team/brushtyler/voicemail_menu_branch/apps/app_myvm.c
> URL: http://svn.asterisk.org/svn-view/asterisk/team/brushtyler/voicemail_menu_branch/apps/app_myvm.c?view=auto&rev=199855
> ==============================================================================
> --- team/brushtyler/voicemail_menu_branch/apps/myvm/brief.txt (added)
> +++ team/brushtyler/voicemail_menu_branch/apps/myvm/brief.txt Wed Jun 10 09:51:11 2009
> @@ -1,0 +1,145 @@
> +=== VOICEMAIL_MENU.CONF FILE ===
> +
> +A few notes on the proposed architecture for the new voicemail application.
There are two "applications" that take their data from voicemail.conf.
The other one is Directory. Should the menu be limited to the voicemail?
> +
> +The idea is that the entire behaviour of the voicemail is configurable
> +through a config file. The file contains multiple sections,representing
> +individual submenus that can be linked together using special commands.
> +Within each section, users can bind individual keypresses (or sequences),
> +or timeouts, to specific actions, including playback or recording of
> +messages, manipulation of list of messages, jumps or "gosub" to a different
> +section, dialplan functions.
> +All bindings can use variables so they are highly configurable.
> +
> +The starting point of each individual voicemail can be set explicitly, so
> +it is extremely easy to use existing templates or implement brand-new
> +behaviours on a per-user base.
> +
> +An example of the configuration file is given below.
> +
> +Users can use voicemail_menu.conf file to set the voicemail behavior.
> +This file is divided into sections, each of these is a menu. There are
> +also a global section that contains the general working params.
> +
> +=== Global Section ===
> +The global section is special and contain global variables and other
> +directives used by the voicemail system.
> +
> + [general]
> + start = menu_name
> + ; specifies the name of the voicemail start menu. A 'menu_name'
> + ; section must exist in the voicemail_menu.conf
> + authentication_required = yes|no
> + ; set this flag to 'no' if you want skip the autentication, 'yes'
> + ; otherwise
> + max_retries = n
> + ; number of maximum failed authentication before Asterisk closes
> + ; the communication channel
Why is that relevant to the menu? Shoudn't that affect VMAuthenticate
as well?
> + forward_key = #
> + ; set the key to forward the playing message
> + reverse_key = *
> + ; set the key to reverse the playing message
> + pause_key = 0
> + ; set the key to pause the playing message
> + stop_key = 2
> + ; set the key to stop the playing message
> + restart_key = 1
> + ; set the key to restart the playing message
Such global settings seem to me against the spirit of the dialplan.
How can you override it locally?
* Multi-tennant setup (per-context setup)
* Some users have different phones / terminals (per device? per user?)
> +
> +=== Menu Sections ===
> +In general each menu section contains a number of '<pattern> = <actions>'
> +lines, where <pattern> matches a sequence of keypresses.
> +
> +Some <pattern>'s are special and used to indicate options that
> +are valid within the menu itself and not preserved across
> +calls or jumps to different menus.
> +
> +The general menu section structure is the following:
> + [menu_name]
> + ; 'init' and 'default' are the only two special pattern names
> + init = actions
> + ; init actions are executed when enter in this menu
> + default = actions
> + ; default actions are executed when the user input doesn't
> + ; matches with any patterns
> +
> + ; other patterns are used to match keypresses.
> + ; the match is done using the same mechanism used in the
> + ; dialplan, so refer to that to know about special characters,
> + ; wildcards, and how overlapping patterns are matched.
> + ; Is used a interdigit timer and the pattern are evaluted just
> + ; when the timer expires
> + <pattern> = <actions>
> +
> +
> +=== Actions ===
> +Each pattern can be associated to multiple actions, which are
> +executed in sequence.
> +Links between menus are implemented with 'jump actions'.
> +Other actions are normally executing user commands, setting variables,
> +and so on.
> +
> +An action list can be preceded by a conditional statement.
> + <pattern> = [IF(conditions),] action1[, action2, ...]
> +If the conditions are not verified, the system behaves as if
> +the pattern did not match.
> +
> +Actions
> +There are 2 action types: jump actions and function actions. The jump actions
> +is used to navigate throught menus, the function actions are the real actions
> +will be made by voicemail application.
> +
> +Jump Actions
> + call(menu_name)
> + ; make a jump from a menu to another keeping trace of the caller menu.
> + ; The arg is the menu name to call. This function keep the history of
> + ; visited menus so you can return to a previous menu.
> +
> + return(n)
> + ; return to a previous visited menu. The arg is the number of menus you
> + ; want come back, is optional and if omitted is implicitly 1.
> +
> + jump(menu_name)
> + ; likewise call, make a jump from a menu to another but don't keep any
> + ; trace of previous menu.
> +
> +Function Actions
> + play_msg(current|previous|next)
> + ; start the playing of a voice message. The arg is the message we want
> + ; to playing and is optional (if omitted will play the current message).
> +
> + change_to(folder_name)
> + ; with this function user can change the actual selected folder. The
> + ; arg is the folder name in which go
> +
> + play(file)
> + ; this function playing an audio file and is used to play the menus
> + ; instructions. The arg is the file name.
> +
> + delete()
> + undelete()
> + ; The first function mark for deletion the selected message, the second
> + ; function instead unmark previous marked messages. The real deletion
> + ; of marked messages occurs when voicemail are correctly terminated.
> +
> + dialout()
> + ; permit users to make an external call using as phone number the typed
> + ; pattern. Before calling, Asterisk will terminate the voicemail
> + ; application.
Hmm... why is that needed?
Aren't we reinventing the dialplan?
> +
> + callback()
> + ; make a call to the selected message sender phone number. The
> + ; voicemail application remain active and after calling user can return
> + ; to interact with the voicemail.
Likewise
> +
> + envelope()
> + ; playing the additional message informations (date and time of
> + ; receipt, sender information).
> +
> + leave_mess()
> + ; user can record a message in own mailbox.
> +
> + save_msg(folder)
> + ; store the selected message in a different folder. The arg is the
> + ; folder name into store the message.
> +
>
> URL: http://svn.asterisk.org/svn-view/asterisk/team/brushtyler/voicemail_menu_branch/apps/myvm/voicemail_menu.conf.sample?view=auto&rev=199855
> ==============================================================================
> --- team/brushtyler/voicemail_menu_branch/apps/myvm/voicemail_menu.conf.sample (added)
> +++ team/brushtyler/voicemail_menu_branch/apps/myvm/voicemail_menu.conf.sample Wed Jun 10 09:51:11 2009
> @@ -1,0 +1,162 @@
> +; Voice Mail Menu' configuration file
> +;
> +; In this configuration the menu is considered as organized
> +; in more parts named "menu_name" the behaviour of the menu
> +; is set by tha association 'digit = actions', where 'digits'
> +; is a pattern present in the dialplan by the user, and
> +; 'actions' is a list of "function(arguments)" separated by
> +; 'comma. Comments are precedeed by ';'.
> +;
> +;------------------- global settings -----------------------;
> +
> +[general]
> + start = vm_menu ; starting menu name
> + authentication_required = yes ; login required
> + max_retries = 3 ; max number of login fails
> + forward_key = # ; playing command
> + reverse_key = *
> + pause_key = 0
> + stop_key = 2
> + restart_key = 1
> +
> +;--------------------- menu section ------------------------;
> +;
> +; Main Menu
> +; In the init action is used the VMCOUNT dialplan function
> +; to get the number of messages stored in a mailbox folder;
> +; if there are new messages, new messages folder is stored
> +; into the FOLD channel var, otherwise old messages folder
> +; is stored. This permit to set a quick key to access these
> +; messages. The 'play(vm_intro)' action play an audio file
> +; containing menu instructions.
> +;
> +; note that some of the actions associated to digits are conditional,
> +; so that they are enabled or disabled depending on the status
> +; of the voice mailbox
> +
> +[vm_menu]
> + init = SET(FOLD=${IF(${VMCOUNT(id at mb,INBOX)}?NEW_FOLDER:OLD_FOLDER)}),play(vm_intro)
As ugly as the dialplan itself at its worse.
By limiting the condition to a single line you leave the sysadmin no
option to break a long calcualtion to shorter and more readable steps.
Let's see if I parsed it correctly:
If you have messages from user 'id' on box 'mb' (are those plain
strings or some magic names?) jump into 'NEW_FOLDER', else - jump into
'OLD_FOLDER'.
> + ; set in FOLD var the working folder
I missed it. It just sets a variable.
> + default = play(vm_intro)
> + ; play instructions
> +
> + 1 = change_to(${FOLD})
> + ; if there are new messages, go to the new messages folder,
> + ; else open the old messages folder
> + 2 = call(change_folder_menu)
> + ; go to Change Folder Menu
> + 3 = call(adv_menu)
> + ; go to Advanced Menu Options
> + 4 = IF(${NOT_FIRST_MSG}),play_msg(previous)
> + ; play previous message
> + 5 = IF(${MSG_SELECTED}),play_msg()
> + ; play current message
> + 6 = IF(${NOT_LAST_MSG}),play_msg(next)
> + ; play next message
> + 7 = IF(${MSG_SELECTED && VMU_NOT_DELETED}),delete()
> + ; mark selected message for deletion
> + 7 = IF(${MSG_SELECTED && VMU_DELETED}),undelete()
> + ; unmark a previous marked message for deletion
> + 8 = IF(${MSG_SELECTED}),forward_message()
> + ; forward a message
> + 9 = IF(${MSG_SELECTED}),call(save_to_folder_menu)
> + ; go to Save To Folder Menu
> + 0 = call(opts_menu)
> + ; go to Voicemail Menu Options
> + * = play(vm_intro)
> + ; play instructions
> + # = exit()
> + ; exit from voicemail application
> +
> +;-----------------------------------------------------------;
> +;
> +; Advanced Menu Options
> +; Contains the message advanced operations o user operation
> +; related to a message
> +
> +[adv_menu]
> + init = play(vm_adv_intro)
> + default = play(vm_adv_intro)
> + 1 = IF(${MSG_SELECTED}),reply() ; reply to sender
> + 2 = IF(${VMU_CALLBACK}),callback() ; call the sender
> + 3 = IF(${MSG_SELECTED}),envelope() ; play additional
> + ; message information
> + 4 = IF(${VMU_DIALOUT}),call(dialout_menu) ; make an external call
> + 5 = IF(${VMU_LEAVEMESS}),leave_mess() ; leave a message
> + * = return(1) ; return to Main Menu
> +
> +;-----------------------------------------------------------;
> +;
> +; Dialout Menu
> +; In this menu, the user input pattern is used as phone
> +; number to call.
> +
> +[dialout_menu]
> + init = play(vm_dialout_intro)
> + default = return(1) ; when timer elapsed without
> + ; pressing of any digit,
> + ; return to Main Menu
> +
> + _X. = dialout() ; make a call
> + * = return(1) ; return to Main Menu
This means you're really adding a complete fourth dialplan format (in
addition (in addition to extensions.conf, AEL2 and Lua). Do we really
need it?
> +
> +;-----------------------------------------------------------;
> +;
> +; Save To Folder Menu
> +; By this menu user can store a message in another folder:
> +; the played audio file explain to users the folder related
> +; to each pattern. After changing or typing '*', user can
> +; return to Main Menu.
> +
> +[save_to_folder_menu]
> + init = play(vm_save_to_folder_intro)
> + default = play(vm_save_to_folder_intro)
> + 1 = save_msg(work), return(1)
> + 2 = save_msg(family), return(1)
> + 3 = save_msg(friends), return(1)
> + 4 = save_msg(cust1), return(1)
> + 5 = save_msg(cust2), return(1)
> + 6 = save_msg(cust2), return(1)
> + 7 = save_msg(cust3), return(1)
> + 8 = save_msg(cust4), return(1)
> + 9 = save_msg(cust5), return(1)
Can lines 4--9 be implemented with more code reuse?
> + * = return(1) ; return Main Menu
> +
> +;-----------------------------------------------------------;
> +;
> +; Change Folder Menu
> +; By this menu user can change his actual working folder:
> +; the played audio file explain to users the folder related
> +; to each pattern. After changing or typing '*', user can
> +; return to Main Menu.
> +
> +[change_folder_menu]
> + init = play(vm_change_folder_intro)
> + default = play(vm_change_folder_intro)
> + 1 = change_to(work), return(1)
> + 2 = change_to(family), return(1)
> + 3 = change_to(friends), return(1)
> + 4 = change_to(cust1), return(1)
> + 5 = change_to(cust2), return(1)
> + 6 = change_to(cust2), return(1)
> + 7 = change_to(cust3), return(1)
> + 8 = change_to(cust4), return(1)
> + 9 = change_to(cust5), return(1)
> + * = return(1) ; return Main Menu
Again, sriking similarity to previous menu. If your motivation not to
use minivm is to avoid boilerplate code, ask yourself why you get so much
boilerplate code here. E.g. 'return(1)'.
> +
> +;-----------------------------------------------------------;
> +;
> +; Voicemail Menu Options
> +; In this menu there are the voicemail manage operations as
> +; recording a welcome message or changing the password.
> +
> +
> +[opts_menu]
> + init = play(vm_opts_intro)
> + default = play(vm_opts_intro)
> + 1 = record(unavailable) ; record a unavailable message
> + 2 = record(busy) ; record a busy message
> + 3 = record(name) ; record a welcome message
> + 4 = changepassword() ; change the user password
> + * = return(1) ; return Main Menu
> +
--
Tzafrir Cohen
icq#16849755 jabber:tzafrir.cohen at xorcom.com
+972-50-7952406 mailto:tzafrir.cohen at xorcom.com
http://www.xorcom.com iax:guest at local.xorcom.com/tzafrir
More information about the asterisk-dev
mailing list