Asterisk Command GotoIf

Hi

I have a requirement to match DTMF key pressed by the user and then execute the rest of the dial plan accordingly. Below is the snippet of my dial plan:

exten => auto,n,Read(keytone,indra-autoattend,1)
exten => auto,n,GotoIf($[${keytone}=1]?here:1,1)
exten => auto,n(next),Background(if-u-know-ext-dial)

In the above, variable “keytone” needs to be matched with “1”. If it is “1” then control should go to priority:“here” and if not then go to context,priority (1,1).

The main problem here is that the condition in GotoIf is always true and going to priority “here”, whether i press 1 or 2.

The below is the Asterisk CLI output : Case for user press 1.
Executing [auto@sip_proxy:2] Read(“SIP/5002-0198a000”, “keytone,indra-autoattend,1”) in new stack
– Accepting a maximum of 1 digits.
– <SIP/5002-0198a000> Playing ‘indra-autoattend.gsm’ (language ‘en’)
– User entered ‘1’
– Executing [auto@sip_proxy:8] GotoIf(“SIP/5002-0198a000”, “5.447509531062001e-315?here:1,1”) in new stack
– Goto (sip_proxy,auto,9)

And when the User enters ‘2’:

Executing [auto@sip_proxy:2] Read(“SIP/5002-0198a000”, “keytone,indra-autoattend,1”) in new stack
– Accepting a maximum of 1 digits.
– <SIP/5002-0198a000> Playing ‘indra-autoattend.gsm’ (language ‘en’)
– User entered ‘2’
– Executing [auto@sip_proxy:8] GotoIf(“SIP/5002-0198a000”, “5.447509531062001e-315?here:1,1”) in new stack
– Goto (sip_proxy,auto,9)
Please do help me on this. I tried a lot but still not getting how to implement the GotoIf().

Looks like you are getting the mininum possible floating point number, rather than zero. That has to be a bug. Is there something unusual about the platform on which you are running Asterisk? Which version are you using? What tool chain are you using to build it?

Incidentally, the examples in the book (The Future of Telelphony) tend to simply put the call into an appropriate context, then treat the dialed digit as a called number.

the 1,1 that you want to be context,priority (1,1) is seen as extension, priority, not (context, priority). the “here” is looking for a priority “here” but since you are not showing all the relevant parts of the dial plan, not sure what other impact this has.

are there lines in this context that are in the form:

exten => auto,n(here)…

exten => 1,1,…

Hi

The Asterisk server is running on Net BSD 3.0 with power pc as the processor. Yes there seems to be a floating point problem but whatever it is i get the same number. My Asterisk version is 1.6. The other places in the dial plan where GotoIf is used does not compare any variable with a constant value. This is only place where this scenario is taking place.

The Dial Plan is like:

exten=> 1,1,Directory(default,sip_proxy,f);DIAL_BY_NAME1

.


exten => auto,1,Wait(2)
exten => auto,n,Set(keytone=0,g)
exten => auto,n,Read(keytone,indra-autoattend,1)
exten => auto,n,NoOp(-----keytone=${keytone}----)
exten => auto,n,GotoIf($[${keytone}=1]?here:1,1)
exten => auto,n(here),NoOp(-----keytone=${keytone}----)
exten => auto,n(next),Background(if-u-know-ext-dial)
exten => auto,n,Set(TIMEOUT(digit)=15)
exten => auto,n,Set(TIMEOUT(response)=30)
exten => auto,n,WaitExten

I can implement the same with Goto ( ${keytone},1) but then my manager wants it to be done with GotoIf{} only.

Sorry for the trouble, Is there any possible solution for this problem.

[quote]exten => auto,n,Read(keytone,indra-autoattend,1)
exten => auto,n,GotoIf($["${keytone}"=“1”]?here,s,1)
exten => auto,n(next),Background(if-u-know-ext-dial)

[here]
exten => s,1,Answer()[/quote]

Reply us, whatever is your status.

-Urmi

This is most likely a bug in your C compiler. I would check that you have the latest bug fixes for it.

If not a compiler problem, you should raise it as a bug report on issues.asterisk.org, but be prepared to prove it isn’t a compiler problem.

The constraint to use GotoIf here is unreasonable. Expect to get told to work round it by using the standard menu mechanisms.