[asterisk-bugs] [Asterisk 0011837]: Patch: ability to sent to multiple recipients.

noreply at bugs.digium.com noreply at bugs.digium.com
Mon Jan 28 19:43:07 CST 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=11837 
====================================================================== 
Reported By:                travishein
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   11837
Category:                   Applications/app_voicemail
Reproducibility:            N/A
Severity:                   feature
Priority:                   normal
Status:                     new
Asterisk Version:           1.4.17 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             01-24-2008 11:47 CST
Last Modified:              01-28-2008 19:43 CST
====================================================================== 
Summary:                    Patch: ability to sent to multiple recipients.
Description: 
for the menu option 3 (advanced), 5 (leave voice message to a recipient)

we came across the need to allow a user to be able to enter more than one
extension to send a message to (instead of the leave a message for just one
extension at a time as the current implementation was).

To make this work the logic is now
1- user presses 3, 5 to get to the leave voicemail prompt.
2- the existing prompt to enter the extension is played.
3- the user enters the extension for which to send the voicemail to
4- (NEW): the system play a message :press 1 to send message, press 2 to
add another recipient.
  if user presses 2  on this new prompt, the system returns to the step 3,
to prompt and process of entering  the extension.
  if the user presses 1 on this new prompt, the system continues to the
"please say your message" as it used to before.
5- system plays the please say your message when finished hang up.
prompt.
6- user sais their message, and hangs up, or preses pound key.

In order to realize this, we changed input gathering function so that the
char[] buffer that stores the target recipient is larger, as long as the
max receiver string. The operation of adding more recipients now builds the
delimited recipient string that leave_voicemail() understands and expects,
mainly
 extension at context&extension at context
There is also boundary checking so that if the user tries to enter more
exensions than is room in the char[] array, the system will play a (new)
vm-forward-multiple-too-many message to indicate the user is attempting to
forward the message to too many recipients.

So in addition to the attached patch file, there are two new sound audio
prompts that the system must find in the sound prompts folder, so that it
can of course play these when needed.

vm-forward-multiple : "Press 1 to enter an send message, press 2 add
another recipient"
vm-forward-multiple-too-many  : when the user has attempted to enter too
many exensions to leave a message to.


====================================================================== 

---------------------------------------------------------------------- 
 putnopvut - 01-28-08 19:43  
---------------------------------------------------------------------- 
Thanks for the patch. The ability to send messages to multiple recipients
is a great idea. The patch you have provided has some problems, though.

1. There is some code in this patch for something completely unrelated
(VM_MOVEHEARD).

2. The patch was not made against trunk, but was made against the 1.4
branch.

3. When compiling, there are two warnings generated. One for mixed
declarations and code, and one for passing an int where a size_t is
expected.

4. There is a very arbitrary check to see if the current length of the
recipients buffer + 40 is greater than its maximum length. Using 40 is not
a good idea since the majority of mailbox names are going to be shorter
than this. Even worse is the fact that you set aside space for 162
characters for the mailbox + @ + extension. Think of a case where you want
to add a 160 character mailbox and extension to the buffer, but it only has
50 characters of space left. Your patch would allow for a buffer overflow.
What you should do is build the mailbox string and then see if it will fit
inside the buffer.

5. Contexts are not handled gracefully in this implementation. The context
argument for forward_message could be NULL, but you append it to the
mailbox no matter what. Luckily, this is handled by the rest of the code,
but you should probably check to be sure if the context is non-NULL before
appending to the mailbox.

6. You went to extra effort to be sure that forwarding a message would not
allow specifying multiple recipients. Why?

7. There are a lot of debug messages in the patch that should either be
removed or at least only be displayed at a high debug level. Furthermore,
most of the code that you commented out should instead just be removed.

8. Certain variables can be optimized away. num_receivers, for instance,
is used only for debugging purposes and can be removed.

9. Regarding coding guidelines: there are several places here where you
violate coding guidelines (for instance, an else should be on the same line
as a } of a preceding if) but also there are many places in the code where
you changed something that was within the coding guidelines to something
that does not follow the guidelines (for instance adding {} to a
single-line if statement). Please review the CODING-GUIDELINES document in
the doc/ directory.

I encourage you to make the above changes. There may be other problems,
too, but the ones above were the most glaring problems. Thanks for
contributing, and I look forward to seeing your next patch! 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
01-28-08 19:43  putnopvut      Note Added: 0081304                          
======================================================================




More information about the asterisk-bugs mailing list