[asterisk-users] READ application

John Millican jmillican at sentinelcommunications.com
Wed Jul 9 22:18:58 CDT 2008


Tilghman Lesher wrote:
> On Wednesday 09 July 2008 09:08:50 John Millican wrote:
>> Can anybody tell me what I am doing wrong or why the Read application
>> does not accept the # key as input?  My read statement:
>> exten => s,n,Read(uchoice|thankyouforcalling|3||1|1);
>>
>> In the prompt thankyouforcalling it says press pound for a company
>> directory along with some press this digit for blah blah.  If the caller
>> presses # the read applications exits and says that the user entered
>> nothing. Really strange that the app hears the DTMF, since it stops the
>> prompt, but does nothing with it.  Is it because Read exits with a #
>> terminated string so it sees ## and just ignores it?
>> If this is the case then maybe Background is the answer. But I am unable
>> to get Background to accept more than a single digit and I need to be
>> able to grab up to 3 digits or the # key.  My background statement:
>> exten => s,n,Background(thankyouforcalling|m||macro-jm-closed)
>> I have tried this wityh and with out the m option, same results.
>>
>> Both of these are run in a macro.
> 
> Anything running in a Macro matches new extensions in the place where the
> Macro was called from.  Background always matches new extensions, as opposed
> to Read, which collects DTMF for a variable.  If Background is only matching
> single-digit extensions, then you only have single-digit extensions in the
> calling context.
> 

Thank you Jared and Tilghman

I do have single digit and multiple digit extensions in the macro and
from "core show application background" I found that by using the
context option:
exten => s,n,Background(thankyouforcalling|||macro-jm-closed)
					      ^^^^^^^^^^^^^^^
when calling background it will return to the macro from which it was
called, which it does as i can get to the defined single digit extens
such as
exten => 3,1,do something
exten => 4,1,do something
which are ONLY defined in the macro
but not the extensions defined such as:
exten => _2XX,1,do something
for my three digit internal phone extensions


So, next try. Since Read resets the value of the variable to an empty
string after the timeout if the caller does nothing or if the caller
presses #, is there a way to test if the caller pressed # in Read to
cause it to terminate or if the application simply timed out. If I can
test for this i would be able to tell if the user pressed # or not since
any other key press will insert a value into the variable.  Problem is
that if they do nothing or press # I get the empty variable so I cant
simply use LEN and a GoToIf.

Thanks again
JohnM






More information about the asterisk-users mailing list