[asterisk-dev] [Code Review]: Incorrect Voicemail duration reported in messages containing silence (take 2)
mjordan
reviewboard at asterisk.org
Tue Sep 20 16:46:56 CDT 2011
> On Sept. 20, 2011, 4:19 p.m., rmudgett wrote:
> > /branches/1.8/apps/app_voicemail.c, lines 13290-13294
> > <https://reviewboard.asterisk.org/r/1443/diff/1/?file=20700#file20700line13290>
> >
> > I don't think pointing sound_duration to duration is a good thing here. The actual value set could be unexpectedly changed if the order of setting duration and sound_duration is changed in the ast_play_and_record_full() function.
> >
> > Since this is an internal function, the callers can be changed to always pass in the sound_duration value.
>
> mjordan wrote:
> I'd prefer not to require people to pass in pointers that they don't intend to use. The other option is I could check for sound_duration before using it - there aren't too many places that read / write it.
Disregard that. I actually was thinking you were commenting on a different location - in general, this really isn't needed in app_voicemail since the lower layer will handle this. I'll remove it.
- mjordan
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1443/#review4413
-----------------------------------------------------------
On Sept. 16, 2011, 3:48 p.m., mjordan wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1443/
> -----------------------------------------------------------
>
> (Updated Sept. 16, 2011, 3:48 p.m.)
>
>
> Review request for Asterisk Developers and rmudgett.
>
>
> Summary
> -------
>
> This is a different take on a solution that was previously proposed here: https://reviewboard.asterisk.org/r/1403/ - which I've now closed out.
>
> The problem is still the same: The patch for ASTERISK-2234 is viewed as a regression in ASTERISK-16981. ASTERISK-2234 changed the way voicemail duration is calculated in the presence of silence. Instead of the duration being the length of the voicemail minus whatever silence accumulates at the end of a call (when that call ends in silence), the duration calculation was changed to include only the time in the audio stream that was not considered to be silence. Consider a voicemail system set up to ensure a message has a minimum duration of 4 seconds, and a silence cutoff of 6 seconds. This patch solved the following situation:
> 1. A person begins recording with 4 seconds of silence
> 2. Person says "hello?", taking 1 second
> 3. Person waits for 6 seconds and is hung up on
>
> Prior to this patch, the voicemail's duration would be calculated at 5 seconds and would be allowed through; post-patch the duration would be calculated at 1 second and would be discarded.
>
> The previous patch simply rolled out ASTERISK-2234. After some discussion, this patch takes a different approach.
>
> This patch keeps the previous approach of calculating the silence throughout the duration of the voicemail, but also records the duration of the actual file. The functions in app.c responsible for this mechanism report both durations back up to the caller. A caller of the method must supply a pointer for the duration; it does not have to supply a pointer for the sound-only duration. Those applications (app_voicemail, app_minivm) that make calculations as to whether or not they will keep a message can use either duration (with this patch, they will use the sound-only duration), but will report externally to users the duration of the entire message.
>
> This fixes the bug with the e-mail notifications, while keeping the behavior intended by ASTERISK-2234.
>
>
> This addresses bugs ASTERISK-16981 and ASTERISK-2234.
> https://issues.asterisk.org/jira/browse/ASTERISK-16981
> https://issues.asterisk.org/jira/browse/ASTERISK-2234
>
>
> Diffs
> -----
>
> /branches/1.8/apps/app_dial.c 336232
> /branches/1.8/apps/app_followme.c 336232
> /branches/1.8/apps/app_meetme.c 336232
> /branches/1.8/apps/app_minivm.c 336232
> /branches/1.8/apps/app_voicemail.c 336232
> /branches/1.8/include/asterisk/app.h 336232
> /branches/1.8/main/app.c 336232
>
> Diff: https://reviewboard.asterisk.org/r/1443/diff
>
>
> Testing
> -------
>
> Tested using 1.8 and the following:
>
> minsecs = 4
> silencethreshold = 128
> maxsilence = 10
>
> * Leaving voicemails with silence in the beginning, punctuated by audio, followed by 10 seconds of silence (message kept with correct duration)
> * Leaving voicmeails that consisted of all silence (message dropped)
> * Leaving voicemails of silence ended by '#' (message dropped)
> * Leaving voicemail with silence, audio, silence, audio, silence, followed by '#' (message kept with correct duration)
>
> Also tested with the Asterisk TestSuite's leave voicemail tests.
>
>
> Thanks,
>
> mjordan
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20110920/785e3c9f/attachment-0001.htm>
More information about the asterisk-dev
mailing list