[asterisk-dev] Voicemail redisign
Matt O'Gorman
mogorman at digium.com
Wed Nov 1 08:54:36 MST 2006
I realize this has come up several times and thought of in different ways. Recently in getting all of the fun fun imap code working I have been thinking all this ifdef and statically defined options etc is the wrong way to do things. I think with one fairly well done chunk of code the rest of imap could be rewritten very simply.
First we need a generic storage api so main/storage This would not take to much work as the majority of work is already there inside of app_voicemail. Then we abstract each storage type into store/store_local, store/store_odbc, store/store_imap. also shouldnt be too difficult to move this code out of app_voicemail.
Then app_voicemail is just a handler for voicemail users and a loader of the default config file. voicemailmain and voicemail dialplan applications would just point to macros like this in your dial plan
[voicemail-default]
;;${ARG1} == User
;;${ARG2} == Context
;;${ARG3} == Password
;;${ARG4} == options
exten => s,1,playback(comedian-mail)
exten => s,2,VMAuthenticate(${ARG1}@${ARG2}|${ARG3}|${ARG4}) ;; vmauthenicate doesnt accept pass currently but it could.
exten => s,3,goto(voicemail-menu,s,1)
[voicemail-menu]
exten => s,1,background(press-1-for-new-messages)
exten => s,2,background(press-2-to-change-folders)
exten => s,3,background(press-0-for-mailbox-options)
exten => s,4,background(press-*-for-help)
exten => s,5,background(or-pound-to-exit)
exten => 1,1,goto(voicemail-playback-menu)
exten => 2,1,goto(voicemail-folder-choice-menu)
exten => 0,1,goto(voicemail-options-menu)
exten => *,1,playback(voicemail-help)
exten => *,2,goto(s,1)
exten => #,1,hangup
exten => t,1,goto(s,1)
exten => i,1,playback(invalid)
exten => i,2,goto(s,1)
[voicemail-playback-menu]
exten => s,1,set(MSGNUM=0)
exten => s,2,while($[$[${MSGNUM}] != -1])
exten => s,3,retrieve(IMAP| ${MSGNUM}| oldtonew | readunread)
exten => s,4,background(${CURRENTMESSAGE})
exten => s,5,endwhile()
exten => 4,1,set(MSGNUM = $[$[${MSGNUM}] - 1])
exten => 4,1,goto(s,3)
exten => 5,1,goto(s,3)
exten => 6,1,set(MSGNUM = $[$[${MSGNUM}] + 1])
exten => 6,2,goto(s,3)
exten => 7,1,markdelete(IMAP|${MSGNUM} |oldtonew| readunread)
exten => 8,1,goto(voicemail-foward-menu,s,1)
exten => 9,1,goto(voicemail-save-menu,s,1)
exten => t,1,goto(s,3)
exten => i,1,playback(invalid)
exten => i,2,goto(s,3)
etc etc
obviously not everyone will want to change to this new way of doing voicemail menus as it will tend to be pages of dialplan, probably a good bit shorter in ael. But I think we could give out a good set of defaults and people could do tweaks here and there. As well as making it easier for people to develop more storage methods for asterisk voicemail and making the world a generally better place.
what do you guys think?
Mog
More information about the asterisk-dev
mailing list