Hi, Greatly appreciate if some one help me with the application read(). asterisk*CLI> show application read 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 => ???????/ This will read the digits but I do not know how to proceed after the reading. Thanks a bunch Sathya -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20040623/6b4504cf/attachment.htm
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@basesys.com>
yes that worked, also if I want that to be sent to an agi> exten => 1234,2,agi,myagi.agi|${testvar}thanks> -----Original Message----- > From: asterisk-users-admin@lists.digium.com > [mailto:asterisk-users-admin@lists.digium.com]On Behalf Of Philipp von > Klitzing > Sent: Wednesday, June 23, 2004 6:04 PM > To: asterisk-users@lists.digium.com > Subject: RE: [Asterisk-Users] help needed with read() > > > Hi! > > > > Back to my question, lets say I want to use the digits > collected by read() > > > to dial out an extension. how do I do that ? > > exten => 1234,1,Read(testvar) > exten => 1234,2,Dial(SIP/${testvar}) > > Cheers, Philipp > > >
On Wed, 2004-06-23 at 17:12, Sathya wrote:> Hi, > > Greatly appreciate if some one help me with the application read().I have added a feature to reload asterisk from a phone... it uses 'read' to get a 3 digit password.... I was using '#' to end the sequence until I realised I could specify the number should be only three digits long... My voice prompts (posix-...) are described in the "text" comments... ; 307 = Restart Asterisk exten => 307,1,DigitTimeout(4) ; Set Digit Timeout 4 seconds exten => 307,2,ResponseTimeout(5) ; Set Response Timeout 5 sec exten => 307,3,Read(Secret,posix-pass-restart-ast,3) ; "to restart type the passwd" exten => 307,4,NoOp(${Secret}) exten => 307,5,Gotoif($[${Secret} = 123]?6:9) exten => 307,6,Playback(posix-restarting) ; "Restarting asterisk" exten => 307,7,Wait(1) exten => 307,8,System(/usr/sbin/asterisk -rx reload) exten => 307,9,Hangup -- . . ___. .__ Posix Systems - Sth Africa /| /| / /__ mje@posix.co.za - Mark J Elkins, Cisco CCIE / |/ |ARK \_/ /__ LKINS Tel: +27 12 807 0590 Cell: +27 82 601 0496