[asterisk-bugs] [Asterisk 0011539]: ast_streamfile expects filename argument to have extension removed

noreply at bugs.digium.com noreply at bugs.digium.com
Tue Jan 15 13:28:59 CST 2008


The following issue has been RESOLVED. 
====================================================================== 
http://bugs.digium.com/view.php?id=11539 
====================================================================== 
Reported By:                a3ulafia
Assigned To:                qwell
====================================================================== 
Project:                    Asterisk
Issue ID:                   11539
Category:                   Core/FileFormatInterface
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     resolved
Asterisk Version:            1.4.8  
SVN Branch (only for SVN checkouts, not tarball releases): N/A  
SVN Revision (number only!):  
Disclaimer on File?:        N/A 
Request Review:              
Resolution:                 suspended
Fixed in Version:           
====================================================================== 
Date Submitted:             12-13-2007 13:38 CST
Last Modified:              01-15-2008 13:28 CST
====================================================================== 
Summary:                    ast_streamfile expects filename argument to have
extension removed
Description: 
All applications that expect a filename argument must have the string
truncated. Failure to do this returns a very confusing error from Asterisk.
For example:

$ ls /tmp/myfilename.wav
/tmp/myfilename.wav

In extensions.conf:

exten => s,1,Playback(/tmp/myfilename.wav)

In Asterisk error log:

[Dec 12 15:54:11] VERBOSE[21242] logger.c:     -- Executing
[ivr at arcalls:8] Playback("SIP/arconnect-09831bb0", "/tmp/myfilename.wav")
in new stack
[Dec 12 15:54:11] WARNING[21242] file.c: File /tmp/myfilename.wav does not
exist in any format
[Dec 12 15:54:11] WARNING[21242] file.c: Unable to open
/tmp/myfilename.wav (format 0x4 (ulaw)): No such file or directory
[Dec 12 15:54:11] WARNING[21242] pbx.c: ast_streamfile failed on
SIP/arconnect-09831bb0 for /tmp/myfilename.wav

This error message contradicts the requirement of ast_streamfile to have a
truncated filename, since the error message prints out the non-truncated
filename. This creates a mysterious situation while debugging since
Asterisk claims that a file with a valid path and correct permissions does
not exist.

I can't find any previous discussion of this as a bug. I believe it should
be classified as one. I never understood why the author of the dialplan
should be expected to remove what is seemingly an arbitrary string from the
end of a filename for it to playback properly. My unfamiliarity with the
Asterisk source made it difficult to trace this bug back to the function
that is doing the truncating.

I can see two solutions to this bug. 

1) Add a condition to first search for the literal string before
truncating. This will keep the error messages consistent with the
underlying filesystem and maintain backwards compatibility
2) Change the error logging to represent the truncated string. This will
prevent the user from viewing a contradictory error message.
====================================================================== 

---------------------------------------------------------------------- 
 qwell - 01-15-08 13:28  
---------------------------------------------------------------------- 
Please reopen if you come up with a patch for this. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
01-15-08 13:28  qwell          Status                   assigned => resolved
01-15-08 13:28  qwell          Resolution               reopened => suspended
01-15-08 13:28  qwell          Note Added: 0076987                          
======================================================================




More information about the asterisk-bugs mailing list