RESOLVED - Help with GotoIf statement evaluation of ">" and "<"

I have a problem that I need help with. I am trying to route calls based on the length of their caller id name or caller id number. No matter what I did I could not get a GotoIf statement to properly evaluate the whether the length of one number is larger than a specified number. I finally created a simple small test dialplan that has a GotoIf statement that evaluates if 1 is larger than 2 (1 > 2). GotoIf is evaluating this as if 1 is larger than 2. I have included the entire test dialplan and the associated log. Can anyone tell me why this is happening?

The entire dialplan:

[localsets]
exten => 300,1,Verbose(STARTING DIALPLAN))
	same => n,Answer
	same => n,GotoIf([1 > 2]?label1,1:Label2,1)
	same => n,Hangup()

exten => label1 ,1,Verbose(GOTOIF WAS TRUE)
	same => n,Hangup()
exten => Label2,1,Verbose(GOTOIF WAS FALSE)
	same => n,Hangup()

The Associate log (verbose is set to 5). I put line spaces before and after the section of the log that shows the GotoIf statement.

[Nov 26 22:07:17] VERBOSE[1482][C-00000006] sig_analog.c: [Nov 26 22:07:17]     -- Starting simple switch on 'DAHDI/4-1'
[Nov 26 22:07:21] VERBOSE[1482][C-00000006] pbx.c: [Nov 26 22:07:21]     -- Executing [300@localsets:1] Verbose("DAHDI/4-1", "STARTING DIALPLAN)") in new stack
[Nov 26 22:07:21] VERBOSE[1482][C-00000006] app_verbose.c: [Nov 26 22:07:21] STARTING DIALPLAN)
[Nov 26 22:07:21] VERBOSE[1482][C-00000006] pbx.c: [Nov 26 22:07:21]     -- Executing [300@localsets:2] Answer("DAHDI/4-1", "") in new stack

[Nov 26 22:07:21] VERBOSE[1482][C-00000006] pbx.c: [Nov 26 22:07:21]     -- Executing [300@localsets:3] GotoIf("DAHDI/4-1", "[1 > 2]?label1,1:Label2,1") in new stack
[Nov 26 22:07:21] VERBOSE[1482][C-00000006] pbx.c: [Nov 26 22:07:21]     -- Goto (localsets,label1,1)

[Nov 26 22:07:21] VERBOSE[1482][C-00000006] pbx.c: [Nov 26 22:07:21]     -- Executing [label1@localsets:1] Verbose("DAHDI/4-1", "GOTOIF WAS TRUE") in new stack
[Nov 26 22:07:21] VERBOSE[1482][C-00000006] app_verbose.c: [Nov 26 22:07:21] GOTOIF WAS TRUE
[Nov 26 22:07:21] VERBOSE[1482][C-00000006] pbx.c: [Nov 26 22:07:21]     -- Executing [label1@localsets:2] Hangup("DAHDI/4-1", "") in new stack
[Nov 26 22:07:21] VERBOSE[1482][C-00000006] pbx.c: [Nov 26 22:07:21]   == Spawn extension (localsets, label1, 2) exited non-zero on 'DAHDI/4-1'
[Nov 26 22:07:21] VERBOSE[1482][C-00000006] sig_analog.c: [Nov 26 22:07:21]     -- Hanging up on 'DAHDI/4-1'
[Nov 26 22:07:21] VERBOSE[1482][C-00000006] chan_dahdi.c: [Nov 26 22:07:21]     -- Hungup 'DAHDI/4-1'

There is a $ missing before the [.

1 Like

to david551
That did it. Thanks.