[Home]

Summary:ASTERISK-16777: several filename bugs in Record() application
Reporter:klaus3000 (klaus3000)Labels:
Date Opened:2010-10-07 05:15:57Date Closed:2017-08-29 05:24:59
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Applications/app_record
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:I've discovered several issues with the {{Record()}} application:

# if a relative filename is specified, the {{ast_mkdir()}} fails as it is called with relative filename instead of absolute filename
# documentation is wrong about {{RECORDED_FILE}} variable
# In my opinion, {{RECORDED_FILE}} is incomplete

1. If the filename is specified, the default location (/var/lib/asterisk/sounds/) will be prefixed. But not during directory creation but only on file open. The prefix needs to be used for ast_mkdir() too!

OK:

{noformat}
-- Executing [9@record-app:3] Record("SIP/klaus-00000005", "/var/lib/asterisk/sounds/foobar22/714-69911160036-2010-10-07T12:12:24+0200.wav,10,20,k") in new stack
-- <SIP/klaus-00000005> Playing 'beep.gsm' (language 'en')
Creating directory /var/lib/asterisk/sounds/foobar22
{noformat}

BAD:
{noformat}
-- Executing [9@record-app:3] Record("SIP/klaus-00000004", "foobar22/714-69911160036-2010-10-07T12:03:15+0200.wav,10,20,k") in new stack
-- <SIP/klaus-00000004> Playing 'beep.gsm' (language 'en')
Creating directory foobar22
[Oct  7 12:03:15] WARNING[10068]: file.c:1146 ast_writefile: Unable to open file /var/lib/asterisk/sounds/foobar22/714-69911160036-2010-10-07T12:03:15+0200.wav: No such file or directory
[Oct  7 12:03:15] WARNING[10068]: app_record.c:316 record_exec: Could not create file foobar22/714-69911160036-2010-10-07T12:03:15+0200
{noformat}

2. The documentation says:

{quote}
$\{RECORDED_FILE}: Will be set to the final filename of the recording.
{quote}

But {{RECORDED_FILE}} is only set when {{%d}} is used in the filename. Either fix the documentation or the behavior. In my opinion, {{RECORDED_FILE}} should always be set.

3. The documentation says:

{quote}
$\{RECORDED_FILE}: Will be set to the final filename of the recording.
{quote}

That's not correct. {{RECORDED_FILE}} misses the file suffix (e.g. {{.wav}}). In my opinion, {{RECORDED_FILE}} should be the complete filename. I know this changes behavior, so if old behavior is still used it should be documented that {{RECORDED_FILE}} lacks the suffix.
Comments:By: Stefan Schmidt (schmidts) 2010-10-12 02:25:30

Hallo klaus ;)

i just want to say something about point 1 cause i didnt have looked at the other points but it looks ok in both cases:

test-%d.wav becomes
test-0

714-69911160036-2010-10-07T11:35:55+0200%d.wav becomes
714-69911160036-2010-10-07T11:35:55+02000

so i see the 0 after the filename which looks ok for me, or am i wrong?

best regards
stefan

By: klaus3000 (klaus3000) 2010-10-12 03:28:56

Uups. Thanks for the correction.

So, issue 1 was a false alarm.

By: Sean Bright (seanbright) 2017-08-25 12:31:57.143-0500

[~klaus3000], I'm sure you have long since moved past this issue considering it is 7 years old, but [I have a review up for on gerrit with a fix|https://gerrit.asterisk.org/#/c/6308/].

In your issue, you say:
{quote}
But RECORDED_FILE is only set when %d is used in the filename.
{quote}

I didn't find this to be the case. The channel variable is set whether {{%d}} is used or not. I've fixed the documentation to mention that {{RECORDED_FILE}} will not have an extension.

By: Friendly Automation (friendly-automation) 2017-08-29 05:25:00.966-0500

Change 6308 merged by Jenkins2:
app_record: Resolve some absolute vs. relative filename bugs

[https://gerrit.asterisk.org/6308|https://gerrit.asterisk.org/6308]

By: Friendly Automation (friendly-automation) 2017-08-29 05:50:03.497-0500

Change 6309 merged by Joshua Colp:
app_record: Resolve some absolute vs. relative filename bugs

[https://gerrit.asterisk.org/6309|https://gerrit.asterisk.org/6309]

By: Friendly Automation (friendly-automation) 2017-08-29 05:50:13.990-0500

Change 6310 merged by Joshua Colp:
app_record: Resolve some absolute vs. relative filename bugs

[https://gerrit.asterisk.org/6310|https://gerrit.asterisk.org/6310]

By: Friendly Automation (friendly-automation) 2017-08-29 05:59:11.701-0500

Change 6311 merged by Jenkins2:
app_record: Resolve some absolute vs. relative filename bugs

[https://gerrit.asterisk.org/6311|https://gerrit.asterisk.org/6311]