Summary:ASTERISK-20076: The command stream_file in Perl-AGI returns weird numbers that nobody pressed
Reporter:Private Name (falves11)Labels:
Date Opened:2012-06-29 09:43:03Date Closed:2012-06-29 09:57:32
Versions: Frequency of
Environment:RHEL 6.2Attachments:( 0) agi-bug.txt
Description:The manual says that if I execute this Perl code, $dialstatus=$AGI->stream_file($filename, '34'); I should get either a 3 or 4 on the  variable. Anything else should be ignored. It turns out I get weird numbers that nobody pressed. I am uploading the trace.
Comments:By: Private Name (falves11) 2012-06-29 09:44:58.740-0500

I pressed several times 1 and 2, and they were correctly ignored. Then I pressed 3, and the playback terminated, again, correctly. Then my variable should be "3", not 51.

By: Clod Patry (junky) 2012-06-29 09:51:50.550-0500

That's not a bug, STREAM FILE returns the ASCII value (3 in ASCII is 51).
Just convert it before using it.

You can read it:
Usage: STREAM FILE <filename> <escape digits> [sample offset]
       Send the given file, allowing playback to be interrupted by the given
digits, if any. Use double quotes for the digits if you wish none to be
permitted. If sample offset is provided then the audio will seek to sample
offset before play starts.  Returns 0 if playback completes without a digit
being pressed, or the ASCII numerical value of the digit if one was pressed,
or -1 on error or if the channel was disconnected. Remember, the file
extension must not be included in the filename.

By: Richard Mudgett (rmudgett) 2012-06-29 09:53:14.657-0500

51 is the ASCII code for the character '3'.

By: Private Name (falves11) 2012-06-29 09:57:32.369-0500

Not a bug