[asterisk-users] dialplan issue - 1& 0 should be evaluated false

Melcon Moraes levelz at terra.com.br
Thu Oct 26 23:03:32 MST 2006


Maybe a missing space between expr1 and the & sign on extension s
priority 3 ?


[]'s
MM

 -----Original Message-----
From:   "Esteban Guana-Jarrin" <egua5261 at hotmail.com>
To:     asterisk-users at lists.digium.com
Cc:     
Sent:  Fri, 27 Oct 2006 15:11:33 +1000
Delivered:  Fri,  27 Oct 2006 01:51:20 
Subject:[asterisk-users] dialplan issue - 1& 0 should be evaluated  false

Helo List,

Sorry I missed the rest of my email in my previous post. Please see below.

I'm having an issue using the AND (&) operator evaluation in the code of my 
dialplan. The dial plan is coded to detect inbound DTMF digits from callers. 
key "1" is equivalent to "yes" and key "2" is equivalent to "no" in two 
diferent contexts in the dial plan. When a caller presses 1, yes is passed 
as a value in a varialble and same when 2 is pressed a "no" is passed.

When the values are both set to "yes" from previous contexts in the 
dialplan; the evaluation of the AND operation in the following expression is 
true and works fine jumping to the correct priority within the context,

exten => s,3,Gotoif($[${test11} = yes]& $[${test12} = yes]?7:4)

Debug output

-- Goto (test-check,s,1)
    -- Executing NoOp("SIP/123-e131", "yes") in new stack
    -- Executing NoOp("SIP/123-e131", "yes") in new stack
    -- Executing GotoIf("SIP/123-e131", "1& 1?7:4") in new stack
    -- Goto (test-check,s,7)
    -- Executing System("SIP/123-e131", "mail -s "Test=Yes" 
egua5261 at hotmail.com") in new stack
    -- Executing Goto("SIP/123-e131", "14") in new stack
    -- Goto (test-check,s,14)
    -- Executing Playback("SIP/123-e131", "end") in new stack

The issue occurs when the values are passed with different values. For 
instance when the variables test11 and test12, shown below, are set with 
values yes and no respectively. The AND operation is evaluated as true, as 
seen in the debug output below, it jumps to priority 7 within the context 
instead of jumping to priority 4 as it should be the case when evaluated as 
false as it should,

exten => s,3,Gotoif($[${test11} = yes]& $[${test12} = yes]?7:4)
exten => s,4,Gotoif($[${test11} = yes] & $[${test12} = no]?9:5)

Debug output:

-- Executing NoOp("SIP/123-1c20", "yes") in new stack
    -- Executing NoOp("SIP/123-1c20", "no") in new stack
    -- Executing GotoIf("SIP/123-1c20", "1& 0?7:4") in new stack
    -- Goto (test-check,s,7)
    -- Executing System("SIP/123-1c20", "mail -s "Test=Yes" 
egua5261 at hotmail.com") in new stack
    -- Executing Goto("SIP/123-1c20", "14") in new stack
    -- Goto (test-check,s,14)
    -- Executing Playback("SIP/123-1c20", "end") in new stack

Following is the rest of code for the context processing the AND operations,

[test-check]
exten => s,1,NoOp(${test11})
exten => s,2,NoOp(${test12})
exten => s,3,Gotoif($[${test11} = yes]& $[${test12} = yes]?7:4)
exten => s,4,Gotoif($[${test11} = yes] & $[${test12} = no]?9:5)
exten => s,5,Gotoif($[${test11} = no] & $[${test12} = no]?11:6)
exten => s,6,Gotoif($[${test11} = yes] & $[${test12} = yes]?13:15)
exten => s,7,System(mail -s "Test=Yes" estebang at exetel.com.au)
exten => s,8,Goto(14)
exten => s,9,System(mail -s "Test=yes,no" estebang at exetel.com.au)
exten => s,10,Goto(14)
exten => s,11,System(mail -s "Test=no" estebang at exetel.com.au)
exten => s,12,Goto(14)
exten => s,13,System(mail -s "Test=no,yes" estebang at exetel.com.au)
exten => s,14,Playback(ExetelIVR/end)
exten => s,15,Goto(ack-message,s,1)
exten => t,1,Playback(vm-goodbye)
exten => t,2,Hangup

Can someone please assist and explain how the AND operation works in 
Asterisk?

Regards,

Paul

_________________________________________________________________
See Jet live in LA. Download music for a chance to win!  
http://ninemsn.com.au/share/redir/adTrack.asp?mode=click&clientID=721&referral=hotmailtagline&URL=http://music.ninemsn.com.au/section.aspx?sectionid=2465&sectionname=artistfeature&subsectionid=5692&subsectionname=jet

_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

E-mail classificado pelo Identificador de Spam Inteligente Terra.
Para alterar a categoria classificada, visite
http://mail.terra.com.br/protected_email/imail/imail.cgi?+_u=levelz&_l=1,1161926110.740128.31141.ambrose.hst.terra.com.br,6820,Des15,Des15

 --Original Message Ends--

-- 
Melcon Moraes <melcon.moraes at terra.com.br>



More information about the asterisk-users mailing list