app_record: Fix hangup handling before record loop#1790
app_record: Fix hangup handling before record loop#1790silverjoe wants to merge 1 commit intoasterisk:20from
Conversation
|
Per the AI policy you must disclose usage of it: |
I used AI to help improve the wording of the PR description, since English is not my native language. The issue analysis, debugging, and the actual code change were done by me and tested in my environment. |
There was a problem hiding this comment.
Attention! This pull request may contain issues that could prevent it from being accepted. Please review the checklist below and take the recommended action. If you believe any of these are not applicable, just add a comment and let us know.
- The PR description does not match the commit message body. This can cause confusion for reviewers and future maintainers. GitHub doesn't automatically update the PR description when you update the commit message so if you've updated the commit with a force-push, please update the PR description to match the new commit message body.
Documentation:
|
Workflow PRCheck failed |
|
cherry-pick-to: 22 |
InterLinked1
left a comment
There was a problem hiding this comment.
We should probably be handling the failure of ast_streamfile directly. Right now the code assumes the audio file didn't exist, but if a hangup occurred, that should probably be dealt with there.
Also, BYE is SIP terminology, so replace "BYE" with "hangup" in your commit message.
why not 20? |
|
The current supported branches: 20, 22, 23, and master This change will not go into 21. |
The audio file is created correctly. But no media frames arrive, actually no frames at all. So the loop just waits until ast_waitfor() finishes the waiting time.
Fixed. |
I updated my comment with "cherry-pick-to". |
So what does |
This PR is for branch 20. |
it should look like this because the pr is against master, and we also cherry-picking to other branches |
ast_waitstream returns the timeout value in milliseconds that we set in the maxduration argument. |
O, thank you! |
When a hangup is received while app_record is playing the initial beep (or immediately after it), but before entering the main recording loop, the application does not detect the hangup and continues running until timeout. This change adds an early hangup check before the ast_waitfor() loop to ensure the application exits immediately when the channel is already in a hung-up state.
4913bf7 to
7ae7de8
Compare
Um, no, that's not what it's supposed to return: asterisk/include/asterisk/file.h Lines 211 to 215 in c2ee154 Did you even read the documentation? My hunch is that some function that is already being called is returning -1 and we can simply catch that and abort, rather than doing an explicit check for hangup, which usually isn't needed. |
I are talking about the ast_waitfor() function.
I did not see any function returning -1 by the time the loop starts and the operation ms = ast_waitfor(chan, ms); is called. |
When a hangup is received while app_record is playing the
initial beep (or immediately after it), but before entering
the main recording loop, the application does not detect
the hangup and continues running until timeout.
This change adds an early hangup check before the
ast_waitfor() loop to ensure the application exits
immediately when the channel is already in a hung-up state.
Reproduction
Dialplan:
[incoming]
exten => h,1,Hangup(16)
exten => _.,1,Log(Verbose, Came the call from ${CALLERID(all)})
same => n,Playback(vm-intro)
same => n,Record(/tmp/test_vm.wav,10,60,k)
same => n,Log(Verbose, Status ${RECORD_STATUS})
same => n,Hangup(16)
Steps:
Expected behavior
The application should terminate immediately when the
channel is already in a hung-up state.
Fix
Add an early hangup check before the ast_waitfor() loop.