;;;;;;;;;;;;;;THIS APPEARS TO BE A BUG:::::::::::::::::::
;CALLING EXTENSION LOOKS LIKE THIS
;[outbound_callers]
;exten => 77,1,goto(gototest,Marc,1)
;exten => 88,1,goto(gototest,s,1)
[gototest]
;WORKS
exten => Marc,1,set(__CLEANER[1]=NoOne)
exten => Marc,2,noop(${CLEANER[1]} is the value. Print "correct" if nothing is terribly wrong)
exten => Marc,3,gotoif($["${CLEANER[1]}" = "Marc"]?4:5) ;did we just pick him?
exten => Marc,4,noop(something is terribly wrong)
exten => Marc,5,noop(correct)
exten => Marc,6,hangup()
;DOESNT WORK!!!!!!!!!!!!!!!!!
;who are the roommates?
exten => s,1,set(__ROOMMATE[1]=Brad)
exten => s,2,set(__MATEWEIGHT[1]=25)
exten => s,3,set(__WINNERS=0) ;at first we have no winners
exten => s,4,set(__CLEANER[1]=NoOne) ;and we'll use a new counter
exten => s,5,while($[${WINNERS} < 2]) ;while we dont have two winners...
exten => s,6,goto(Brad,1) ;go to an extension based on roommate name below
exten => s,7,endwhile
;;;;;;;;Go to exten brad, and use his weight to "draw" for a "win";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
exten => Brad,1,random(${MATEWEIGHT[1]},Brad,3) ;jump to three if we have a winner
exten => Brad,2,goto(s,5) ;or else draw again.
exten => Brad,3,gotoif($["${CLEANER[1]}" = "Brad"]?5) ;did we just pick him?
exten => Brad,5,set(__WINNERS=$[${WINNERS}+1]) ;if not we have a winner
exten => Brad,6,set(__CLEANER[${WINNERS}]=${ROOMMATE[1]}) ;and we set the CLEANER variable
exten => Brad,7,goto(s,5) ;and draw again
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
exten => s,8,noop(${CLEANER[1]} and ${CLEANER[1]})
***************************************C L I O U T P U T******************************************************
-- Executing Goto("SIP/Brian-ec15", "gototest|Marc|1") in new stack
-- Goto (gototest,Marc,1)
-- Executing Set("SIP/Brian-ec15", "__CLEANER[1]=NoOne") in new stack
-- Executing NoOp("SIP/Brian-ec15", "NoOne is the value. Print "correct" if nothing is terribly wrong") in new stack
-- Executing GotoIf("SIP/Brian-ec15", "0?4:5") in new stack
-- Goto (gototest,Marc,5)
-- Executing NoOp("SIP/Brian-ec15", "correct") in new stack
-- Executing Hangup("SIP/Brian-3ec2", "") in new stack
== Spawn extension (gototest, Marc, 6) exited non-zero on 'SIP/Brian-3ec2'
(THE OTHER CASE BELOW)
-- Executing Goto("SIP/Brian-3b32", "gototest|s|1") in new stack
-- Goto (gototest,s,1)
-- Executing Set("SIP/Brian-3b32", "__ROOMMATE[1]=Brad") in new stack
-- Executing Set("SIP/Brian-3b32", "__MATEWEIGHT[1]=25") in new stack
-- Executing Set("SIP/Brian-3b32", "__WINNERS=0") in new stack
-- Executing Set("SIP/Brian-3b32", "__CLEANER[1]=NoOne") in new stack
-- Executing While("SIP/Brian-3b32", "1") in new stack
-- Executing Goto("SIP/Brian-3b32", "Brad|1") in new stack
-- Goto (gototest,Brad,1)
-- Executing Random("SIP/Brian-3b32", "25|Brad|3") in new stack
Apr 17 15:56:47 WARNING[13701]: pbx.c:6455 ast_parseable_goto: Goto requires an argument (optional context|optional extension|priority)
-- Random branches to (gototest,Brad,2)