Summary:ASTERISK-29391: VoiceMail does not cancel recording on rerecord hangup
Reporter:N A (InterLinked)Labels:
Date Opened:2021-04-13 14:31:52Date Closed:2021-11-08 11:28:22.000-0600
Versions:18.3.0 Frequency of
Environment:Debian 10Attachments:( 0) debug.txt
Description:I believe this is a bug, because I can't see how this is intentionally desired behavior:

If I call into a voicemail box and begin leaving a message, then press #, I get additional options. If I press the option to re-record the message, but I hang up *BEFORE* it starts recording the redo, Asterisk processes this event as if a voicemail was left (when the user was actually trying to back out).

Asterisk sends an email that begins like this:
You were just left a 0:00 long message (number 1) in mailbox...

Additionally, my message waiting lamps come on.

At the time of hangup, this is in the CLI:
[2021-04-13 15:28:37] WARNING[7865][C-00000b64]: app.c:1647 __ast_play_and_record: No audio available on Local/..........-000009c4;2??
[Apr 13 15:28:37]     -- User hung up

When I retrieve the message, or attempt to retrieve it, this happens:

[Apr 13 15:23:27]     -- <SIP/ATAxLA1-0000039f> Playing '/var/spool/asterisk/voicemail/......../INBOX/msg0000.slin' (language 'en')
[2021-04-13 15:23:27] WARNING[7598][C-00000b60]: app_voicemail.c:8988 play_message: Playback of message /var/spool/asterisk/voicemail/......../INBOX/msg0000 failed

So there isn't even a 0:00 second message. The message just doesn't exist in the first place. At least, the audio for it doesn't, but all the properties of this message do, so I can delete the message which will get rid of it and then my message waiting lamps turn off.

The original message is discarded, which is good, but this seems to be undesired behavior, perhaps an edge case not accounted for? I believe Asterisk should be discarding the message if a user hangs up before rerecording starts, but it seems to go through anyways.
Comments:By: Asterisk Team (asteriskteam) 2021-04-13 14:31:53.599-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

Please note that by submitting data, code, or documentation to Sangoma through JIRA, you accept the Terms of Use present at [https://www.asterisk.org/terms-of-use/|https://www.asterisk.org/terms-of-use/].

By: Kevin Harwell (kharwell) 2021-04-13 15:51:49.415-0500

Please post your _voicemail.conf_ configuration used, and if possible a [debug log|https://wiki.asterisk.org/wiki/display/AST/Collecting+Debug+Information] of an occurrence

By: N A (InterLinked) 2021-04-13 16:51:35.388-0500

Here is everything from my voicemail.conf except the mailboxes and any commented lines. Keeping mind the conf files is from when I first installed Asterisk on 13.something and I've just been copying it over since.

format = wav49|wav
serveremail = redacted
attach = yes
skipms = 3000
silencethreshold = 128
maxlogins = 3
fromstring=CENTREX Voicemail
emailsubject=[Voicemail]: New message ${VM_MSGNUM} in mailbox ${VM_MAILBOX}
emailbody=Dear ${VM_NAME},\n\tYou were just left a ${VM_DUR} long message (number ${VM_MSGNUM}) in mailbox ${VM_MAILBOX} from ${VM_CALLERID}, on ${VM_DATE}.\n\n\t--Your CENTREX Voicemail System\n
pagerfromstring=CENTREX Voicemail
pagersubject=New VM
pagerbody=New ${VM_DUR} long msg in box ${VM_MAILBOX} from ${VM_CALLERID}, on ${VM_DATE}
emaildateformat = %A, %B %d, %Y at %r
pagerdateformat = %A, %B %d, %Y at %r
saydurationm=2        ; Specify the minimum duration to say. Default is 2 minutes
sendvoicemail = yes  ; Allow the user to compose and send a voicemail while inside VoiceMailMain() [option 5 from mailbox's advanced menu]. If set to 'no', option 5 will not be listed.
review=yes              ; Allow sender to review/rerecord their message before saving it [OFF by default
minpassword = 4  ; Enforce minimum password length
pacific = America/Los_Angeles|'vm-received' Q 'digits/at' IMp
mountain = America/Denver|'vm-received' Q 'digits/at' IMp
eastern = America/New_York|'vm-received' Q 'digits/at' IMp
central = America/Chicago|'vm-received' Q 'digits/at' IMp
central24 = America/Chicago|'vm-received' q 'digits/at' H N 'hours'
military = Zulu|'vm-received' q 'digits/at' H N 'hours' 'phonetic/z_p'
european = Europe/Copenhagen|'vm-received' a d b 'digits/at' HM

The actual mailbox in question looks like this:
1234=> 1234,John Smith,email@example.com,,tz=central|attach=no

By: N A (InterLinked) 2021-04-13 17:02:36.918-0500

Attached is a debug log of both leaving the problematic "message" and retrieving and deleting it.

By: Kevin Harwell (kharwell) 2021-04-14 12:37:51.835-0500

Okay this is fairly easy to replicate. So yeah it does indeed leave an "empty" message if one hangs up while still at the prompt, or really anytime prior to the record "beep". I agree too that if one hangs up during "review" then no message should be left.

By: Friendly Automation (friendly-automation) 2021-11-08 11:28:23.505-0600

Change 16682 merged by George Joseph:
app_voicemail: Fix phantom voicemail bug on rerecord


By: Friendly Automation (friendly-automation) 2021-11-08 11:28:38.732-0600

Change 16683 merged by George Joseph:
app_voicemail: Fix phantom voicemail bug on rerecord


By: Friendly Automation (friendly-automation) 2021-11-08 11:28:59.894-0600

Change 16631 merged by George Joseph:
app_voicemail: Fix phantom voicemail bug on rerecord


By: Friendly Automation (friendly-automation) 2021-11-08 11:29:14.647-0600

Change 16681 merged by George Joseph:
app_voicemail: Fix phantom voicemail bug on rerecord