Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use AGI native RECORD FILE command instead of Exec Record
- Loading branch information
Showing
1 changed file
with
15 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0444c69
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to use
RECORD FILE
instead of theRecord
app?0444c69
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the biggest problem is that the
Record
app's arguments and behavior changes between versions of Asterisk. In 1.6 and later the Record app (by default) deletes the file if the user hangs up without terminating the recording. There's also the bug in some versions of Asterisk that if the caller hangs up before terminating the recording and a "%d" replacement is in use, the RECORDED_FILE channel variable does not get set and the filename cannot be returned. These problems are mitigated by moving that logic into Adhearsion.One side benefit to this approach is that we can also specify the audio prompt to be played immediately before recording begins, although we are not exposing that functionality today.
In general my preference is to use AGI primitives instead of applications where possible as there is more stability across versions.
0444c69
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the implementation of the options parsing in 1.4's
Record
app, it looks like passing thek
argument by default shouldn't break existing behavior.It may require a little bit of extra work to be able to fetch the
RECORDED_FILE
after theHangup
has been raised, but it shouldn't be that hard (I wonder if just catching the exception and doing the variable call would work).0444c69
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem isn't the Hangup exception, it's that in some versions of Asterisk (not exactly sure which versions, or even if it has been fixed yet) the RECORDED_FILE channel var isn't accessible after hangup. It either isn't set (maybe) or can't be retrieved from a dead channel (probably).
You might be able to work around that by using AMI to listen for the event that is fired when the channel var is set, but that breaks if you have AMI disabled or if you are receiving AGI commands from multiple Asterisk servers.
My opinion is that if we can't get a reasonable solution to the %d problem, we should deprecate its usage entirely prior to releasing Adhearsion 1.0.