[asterisk-bugs] [JIRA] (ASTERISK-16777) several filename bugs in Record() application

Sean Bright (JIRA) noreply at issues.asterisk.org
Fri Aug 25 08:32:08 CDT 2017


     [ https://issues.asterisk.org/jira/browse/ASTERISK-16777?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sean Bright updated ASTERISK-16777:
-----------------------------------

    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 at 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 at 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.


  was:
Hi!

I discovered several issues:

1. %d is not always replaced by an int (maybe caused by special characters in the filename)

2. if filename is specify relative, the ast_mkdir fails as it is called with relative filename instead of absolute filename

3. documenation is wrong about RECORDED_FILE variable

4. IMO RECORDED_FILE is incomplete

****** ADDITIONAL INFORMATION ******

1. in some cases %d is not replaced with an integer, e.g:

OK:
    -- Executing [9 at record-app:3] Record("SIP/klaus-000002f0", "test-%d.wav,10,20,k") in new stack
    -- <SIP/klaus-000002f0> Playing 'beep.gsm' (language 'en')
    -- Executing [9 at record-app:4] DumpChan("SIP/klaus-000002f0", "") in new stack

Dumping Info For Channel: SIP/klaus-000002f0:
================================================================================
...
Variables:
RECORD_STATUS=DTMF
RECORDED_FILE=test-0

BAD:

    -- Executing [9 at record-app:3] Record("SIP/klaus-000002f2", "714-69911160036-2010-10-07T11:35:55+0200%d.wav,10,20,k") in new stack
    -- <SIP/klaus-000002f2> Playing 'beep.gsm' (language 'en')
    -- Executing [9 at record-app:4] DumpChan("SIP/klaus-000002f2", "") in new stack

Dumping Info For Channel: SIP/klaus-000002f2:
================================================================================
...
Variables:
RECORD_STATUS=SILENCE
RECORDED_FILE=714-69911160036-2010-10-07T11:35:55+02000



2. 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:

    -- Executing [9 at 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


BAD:

    -- Executing [9 at 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')
log added by klaus3000: 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

3. docs say:

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

But RECORDED_FILE is only set when %d is used in the filename. Either fix docs or behavior. IMO, RECORDED_FILE should always be set.

4. docs say:

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

That's not correct. RECORDED_FILE misses the file suffix (e.g. .wav). IMO 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.



> several filename bugs in Record() application
> ---------------------------------------------
>
>                 Key: ASTERISK-16777
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-16777
>             Project: Asterisk
>          Issue Type: Bug
>          Components: Applications/app_record
>            Reporter: klaus3000
>            Severity: Minor
>
> 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 at 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 at 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.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list