Summary:ASTERISK-02729: [patch] STREAM FILE supports a timeout in res_agi.c
Reporter:Clod Patry (junky)Labels:
Date Opened:2004-11-02 12:15:43.000-0600Date Closed:2011-06-07 14:05:17
Versions:Frequency of
Environment:Attachments:( 0) res_agi.diff.txt
Description:This patch add the possibility to STREAM FILE with a timeout of msec.


This works as follows:

In your AGIs just use something like:
STREAM FILE blah/E_0 \"01234\"
for the regular STREAM FILE
STREAM FILE blah/E_2 \"*12\" t=10000"
for the complete STREAM with digits *, 1 or 2 to escape the STREAM. After the full stream, the system will wait for 10 seconds for entering any digits if none acceptable were entered. The wait will only takes *, 1 or 2 for acceptable value.

I've added an output in the CLI for the STREAM FILE, cause there was nothing for this, and this is the output in the CLI:

   -- Playing 'E_0' (timeout 0)
   -- Playing 'E_2' (timeout 10000)

This change nothing for the existing code without t, cause it sets to 0 by default.

The advantage of this within the STREAM FILE versus the GET DATA is it continue to stream even if we press a wrong dtmf. Cause, with GET DATA file 10000 1, it stops after the first digit was entered.

Please test it and report anything wrong.
Comments:By: Mark Spencer (markster) 2004-11-02 14:46:12.000-0600

What's wrong with the "Get Data" command?

By: Clod Patry (junky) 2004-11-02 15:00:21.000-0600

it stops streaming the file when the max_digits is reached.
Which sometime we don't want it, cause it could be non-wanted digits.

with the stream file, we're sure, if the function exits, it's caused by the enters of wanted DTMFs or 0 (the user didn't press a key). So it keeps the AGI code smaller, cause we can check for only 0 (nothing) or just the escape digits entered in the stream file command.

By: Mark Spencer (markster) 2004-11-06 10:18:18.000-0600

I don't think I understand the concern.  Maybe you can find me on IRC?

By: Clod Patry (junky) 2004-11-07 14:37:28.000-0600

the concept is pretty easy.
i wanna stream a file and when i press 1 digit, the play stops, but only when a specific digit is specified. With the GET DATA, it doesn't allow me to continue the stream if the digit presssed isn't valid. Cause if the stream finish and the user didn't press a valid key, i need to check that (if the key is valid), and if it is not, i need to restart the GET DATA. With the timeout in the STREAM FILE, it save code, cause we're sure the key is valid if it's different from 0.

So this patch allow a stream until a VALID digit is pressed to stops the stream and it waits x msec after the end of the stream to accept a valid digit specified in the "escape digits" of the STREAM.

With that, it saves some code in our AGIs. Based on the fact that if the stream is returning 0, it's cause it stream the full file, and it waits x msec after it, and the user didn't press a key.

In other word, it just like the timeout of the GET DATA. It allow the system to wait upto x msec for the user can press a key after a STREAM FILE.

By: Clod Patry (junky) 2004-11-12 09:45:56.000-0600

after some discussions with Mark,
that patch won't be in the CVS. We'll create a new AGI command probably called GET OPTION.
That command will be done in a near future.

By: Brian West (bkw918) 2004-11-12 09:46:45.000-0600

closed at the request of the reporter.