[Asterisk-Users] help needed with read()

Steven Critchfield critch at basesys.com
Wed Jun 23 09:03:29 MST 2004


On Wed, 2004-06-23 at 10:12, Sathya wrote:
> asterisk*CLI>
>   -= Info about application 'Read' =-
>  
> [Synopsis]:
> Read a variable
>  
> [Description]:
>   Read(variable[|filename]):  Reads a '#' terminated string of digits from
> the user, optionally playing a given filename first.  Returns -1 on hangup or
> error and 0 otherwise.
>  
> I need to collect a variable length digit string terminated by # and
> then pass those digits  to an agi script. I can do this as follows
> (when I know the length of the string).
>  
> exten => s,1,BackGround(please-enter-the-fourdigit-pin)
> exten => s,2,DigitTimeout,5
> exten => s,3,ResponseTimeout,10
> exten => _XXXX,1, agi, agiscript.agi
> I would like to use Read() here, like
>  
> exten => s,1,BackGround(please-enter-the-pin)
> exten => s,2,Background(followed-by-pound)
> exten => s,3,DigitTimeout,5
> exten => s,4,ResponseTimeout,10
> exten => s,5,Read(${EXTEN})
> exten => ???????/

First, if you are going to be going to AGI, why not just ask for the
digits inside of AGI? It seems like it is more appropriate that way.
Read is for when you can accomplish what you want without jumping to
AGI.

Also, be wary that Background will allow a user to interupt the prompt
with a digit press. This is the normal expected behavior. You would want
to use playback.

-- 
Steven Critchfield  <critch at basesys.com>




More information about the asterisk-users mailing list