[asterisk-dev] Customizable Voicemail Menu

Giuseppe Sucameli brush.tyler at gmail.com
Fri May 29 20:23:57 CDT 2009


Hi,
I'm Giuseppe Sucameli and I'm taking part to GSoC 2009 for the Asterisk
Project.

My proposal is adding fully configurable menus to the Asterisk voicemail
application.

In the current app_voicemail the menu is built into the C code and difficult

to modify.
The alternative application minivm adds some degree of configurability,
but this has to go in the dialplan configuration file, which may not be
available to unprivileged users. In any case, mixing the voicemail and
dialplan
configuration is undesirable in terms of managing configuration files.

We can keep the voicemail configuration separate  from the dialplan,
so the dialplan writer will only have to dispatch the call, and the
voicemail
config will do the rest.
Then one can import/write/modify the voicemail config without having to
bother (or needing to have permission) to touch the dialplan itself.

Two file are attached (only text/plain files):
> brief.txt
               explain the voicemail_menu.conf file structure and its the
most
               important functionality

> voicemail_menu.conf.txt
               is an example of config file to customize the voicemail menu

I hope the explanation is average, maybe I have write too much or few :)
I wait for your questions and proposals.

Thanks for your attention.

-- 
Giuseppe Sucameli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-dev/attachments/20090530/4f369974/attachment-0001.htm 
-------------- next part --------------
=== VOICEMAIL_MENU.CONF FILE ===

A few notes on the proposed architecture for the new voicemail application.

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
        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

=== 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.

	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.

	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.
-------------- next part --------------
; 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                   = ast_vm  ; 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)
        ; set in FOLD var the working folder
    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)
        ; go to Change Folder Menu
    3 = call(menu_adv)
        ; 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(vm_setup_options)
        ; 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 

[menu_adv]
    init    = play(adv_opt_intro)
    default = play(vm_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)  ; 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. 

[menu_dialout]
    init    = play(dialout_instr)
    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

;-----------------------------------------------------------;
;
; 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(instruction_save_to_folder_menu)
    default = play(instruction_save_to_folder_menu)
    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)
    *       = 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]
    init    = play(instruction_change_folder)
    default = play(instruction_change_folder)
    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

;-----------------------------------------------------------;
;
; Voicemail Menu Options
; In this menu there are the voicemail manage operations as
; recording a welcome message or changing the password.


[vm_opt]
    init     = play(instruction_vm_opt)
    default  = play(instruction_vm_opt)
    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


More information about the asterisk-dev mailing list