[asterisk-dev] [Code Review] Incorrect Voicemail duration reported in messages containing silence (take 2)

mjordan reviewboard at asterisk.org
Tue Sep 20 16:54:01 CDT 2011

This is an automatically generated e-mail. To reply, visit:

(Updated Sept. 20, 2011, 4:54 p.m.)

Review request for Asterisk Developers and rmudgett.


Removed assignment of sound_duration pointer to duration in play_record_review.  Fixed spacing issue.

Reran through Asterisk test suite, no failures.


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.

Diffs (updated)

  /branches/1.8/apps/app_dial.c 337061 
  /branches/1.8/apps/app_followme.c 337061 
  /branches/1.8/apps/app_meetme.c 337061 
  /branches/1.8/apps/app_minivm.c 337061 
  /branches/1.8/apps/app_voicemail.c 337061 
  /branches/1.8/include/asterisk/app.h 337061 
  /branches/1.8/main/app.c 337061 

Diff: https://reviewboard.asterisk.org/r/1443/diff


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.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20110920/e40814ec/attachment.htm>

More information about the asterisk-dev mailing list