Summary:ASTERISK-05932: [patch] Add Auto-play option to VoicemailMain
Reporter:opsys (opsys)Labels:
Date Opened:2005-12-29 20:29:19.000-0600Date Closed:2006-01-12 12:46:30.000-0600
Versions:Frequency of
Environment:Attachments:( 0) app_voicemail-autoplay.diff
( 1) app_voicemail-r8019-6090.diff
( 2) M6090.txt
Description:As mentioned on the users list:

I want to create an extension that goes directly to my new messages
without having to press "1".  How do I do that?  I can call
VoiceMailMain but then I have to choose "1" from the menu.  I'd like it
to go there and play the first message or say "There are no new
messages" and hangup.  How can I do this?
Comments:By: Michiel van Baak (mvanbaak) 2005-12-30 04:00:28.000-0600

How about adding a parameter?
a for autoplay

By: Jason Parker (jparker) 2005-12-30 11:21:17.000-0600

If I may throw in my 2c here...

I was just thinking the other day how useful it would be to me, to be able to call VoicemailMain with a mailbox parameter.  1=Inbox, 2=Old, etc, so something like VoicemailMain(u6257|s1), would take you straight to the Inbox without requiring a password.

Would something like this solve part of your issue?

By: Jason Parker (jparker) 2005-12-30 13:25:09.000-0600

Patch uploaded - try it out.

Call VoicemailMain with a(0) for inbox, a(1) for old, etc, all the way through a(9) - VoicemailMain(6257|a(0))

I should probably add the option to the description...but I'll wait to do that until you test it, and agree that this is a good way to go.

As always, disclaimer on file.

By: opsys (opsys) 2005-12-30 13:52:23.000-0600

I LOVE options however we must use a bit of self control, or else VoiceMailMain may start looking like Dial!!! Too many things for one application to do. This may also be a good time to implement a template-like file to control the functions of Voicemail. Such as:

topmenu_read => 1
topmenu_changefolders => 2
topmenu_advopts => 3
topmenu_placecall => 4
topmenu_mboptions => 0
topmenu_help => *
topmenu_exit => #

duringmessageplayback_reply => 1
duringmessageplayback_callback => 2
duringmessageplayback_playenvelope => 3
duringmessageplayback_playprevious => 4
duringmessageplayback_repeatcurrent => 5
duringmessageplayback_playnext => 6
duringmessageplayback_deletecurrent => 7
duringmessageplayback_forward => 8
duringmessageplayback_savemessage = > 9
duringmessageplayback_rewind => *
duringmessageplayback_skipforward => #

options_recordunavail => 1
options_recordbusy => 2
options_recordname => 3
options_recordtempmessage => 4
options_changepasswd => 5
options_exit => #
options_help => *

By: Clod Patry (junky) 2005-12-30 19:35:00.000-0600

You can try that patch and let me know how it works for you.

You can use it like:
   -- Executing VoiceMailMain("SIP/10-5b13", "10@other|a") in new stack
   -- Playing 'vm-password' (language 'fr')
   -- Playing 'vm-first' (language 'fr')
   -- Playing 'vm-message' (language 'fr')
 == Parsing '/var/spool/asterisk/voicemail/other/10/INBOX/msg0000.txt': Found
   -- Playing 'vm-received' (language 'fr')

or combine the options a with the s to skip the authentication too like:
   -- Executing VoiceMailMain("SIP/10-71b5", "10@other|as") in new stack
   -- Playing 'vm-first' (language 'fr')
   -- Playing 'vm-message' (language 'fr')
 == Parsing '/var/spool/asterisk/voicemail/other/10/INBOX/msg0000.txt': Found
   -- Playing 'vm-received' (language 'fr')

that will bring u directly to the INBOX folder (new messages).

By: Clod Patry (junky) 2005-12-30 19:36:54.000-0600

just refresh the page and saw north already submitted a patch.

By: Robert La Ferla (rlaferla) 2005-12-30 22:54:19.000-0600

In thinking about this more, the auto-play option can be a quickie fix but a more complete implementation is needed:

Think about the scenario when checking your voicemail from an automobile or a crowded subway where you can't easily dial.   Wouldn't it be great if you could dial in to your * box and if there are no new messages, it tells you "Sorry, you have no new messages."  and the call is terminated.  If you have new messages, it plays ALL of them back to back without the need to press anything.  If you do press a key, it takes you to the standard menu where you have full navigation.  At the end of all the new messages, it hangs up.  This way you can, by default, hear all of your messages without having to navigate anything.  I can think of some additional options but this core functionality is a good start.

By: Jason Parker (jparker) 2005-12-31 00:12:05.000-0600

junky: I'm glad we're thinking alike. ;)  I was worried I was going about this part wrong.  This is almost exactly what I did in my patch.

- cmd = vm_intro(chan, &vms);
+ if ( autoplaynewmsgs ) {
+ cmd = 49;
+ } else {
+ cmd = vm_intro(chan, &vms);
+ }

By: Matt O'Gorman (mogorman) 2006-01-11 19:20:55.000-0600

Committed into trunk revision 7995.

By: Jason Parker (jparker) 2006-01-12 11:06:09.000-0600

0 through 9 are valid play_folder's.  The change that went in only allows 1-9.

Please revert patch - found a crash bug - will investigate.

By: Jason Parker (jparker) 2006-01-12 11:57:02.000-0600

Uploaded patch which "fixes" documentation, and an off by one error.

By: Matt O'Gorman (mogorman) 2006-01-12 12:29:07.000-0600

thanks again, fixed in trunk several little commits just update if it causes you problems

By: Matt O'Gorman (mogorman) 2006-01-12 12:46:22.000-0600

added error checking and what not works perfect now