GoToIf Context Question

Good morning… total noob here but I am learning and appreciate everyone help!

I am working on building an application that is driven by an external mysql DB for determining the configuration and call flow for a given DID. At a high level what I am doing is when a call comes in I look up that configuration and determine the call flow type.

My extension conf is using wildcard logic for the extensions since I want to add them in the database layer and not be editing text files.

What I am looking for help with is how to handle the Gotoif with the wildcard / pattern matching logic. I am using an AGI to set the variable DIDTYPE and then I have a condition in the handler

exten => _X!,n,GotoIf($["${DIDTYPE}" = “FORWARD”]?FORWARD)

basically if the DIDTYPE = FORWARD I wan to move to the FORWARD label of the call flow. The problem I am having is that is that I can’t figure out how to make the goto work with labels and the pattern matching extension logic. Here is the console output I receive when executing the goto logic when calling the DID 5203912123

[Sep 12 15:22:43] NOTICE[17060][C-00000001]: pbx.c:2959 pbx_extension_helper: No such label 'FORWARD' in extension '5203912123' in context 'from-trunk'


exten => _X!,1,Set(CALLGUID=${RAND(1,9999999)}_${RAND(2,999999)}_${RAND(3,9992229)}_${RAND(4,89999)}_${RAND(5,9999)}_${RAND(6,999999(9)})

exten => _X!,n,AGI(/var/lib/asterisk/agi-bin/pagi/CallStart.php,${CALLERID(ani)},${CALLERID(dnid)},${CALLGUID})

exten => _X!,n,Monitor(wav,${CALLGUID})
exten => _X!,n,Ringing
exten => _X!,n,Wait(4)
exten => _X!,n,Answer()

exten => _X!,n,AGI(/var/lib/asterisk/agi-bin/pagi/DetermineFlow.php,${CALLERID(ani)},${CALLERID(dnid)},${CALLGUID})
exten => _X!,n,GotoIf($["${DIDTYPE}" = "FORWARD"]?FORWARD)
exten => _X!,n,GotoIf($["${DIDTYPE}" = "IVR"]?IVR)

;exten => _X!,n,(IVR)NoOp(EXECUTING IVR LOGIC)

exten => _X!,n(dial),Dial(SIP/vitel-outbound/1${DEFAULTDID},300,r)
exten => _X!,n(hangup),Hangup()

exten => h,1,AGI(/var/lib/asterisk/agi-bin/pagi/CallEnd.php,${CALLGUID})

it should be

notice where the label name and comma are

1 Like

Thank you so much!!! Ugh! I appreciate it!