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

noreply at bugs.digium.com noreply at bugs.digium.com
Thu Dec 13 14:09:56 CST 2007


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:                 fixed
Fixed in Version:           
====================================================================== 
Date Submitted:             12-13-2007 13:38 CST
Last Modified:              12-13-2007 14:09 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 - 12-13-07 14:09  
---------------------------------------------------------------------- 
In the help text for Playback (which you referenced), you'll note that it
does explain to not use extension.  I'll update Background to do the same.

Adding this would be a new feature - however, if you would like to help
clean up the documentation to make this clear (which would then all have to
be changed again if this is added), please feel free to. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
12-13-07 14:09  qwell          Status                   assigned => resolved
12-13-07 14:09  qwell          Resolution               reopened => fixed   
12-13-07 14:09  qwell          Note Added: 0075356                          
======================================================================




More information about the asterisk-bugs mailing list