[asterisk-users] What is my syntax error here?
A J Stiles
asterisk_list at earthshod.co.uk
Wed Jul 24 09:47:37 CDT 2013
On Wednesday 24 July 2013, James B. Byrne wrote:
> Additional data:
>
> Arch = x86_64
> OS = CentOS-6.4 (freepbx)
> Asterisk = 11.4
> FreePBX = 2.11.0.4
>
>
> -------------------------- Original Message --------------------------
> Subject: What is my syntax error here?
> From: "James B. Byrne" <byrnejb at harte-lyne.ca>
> Date: Wed, July 24, 2013 10:08
> To: asterisk-users at lists.digium.com
> ----------------------------------------------------------------------
>
> I have thsi code in a dial plan. The purpose of which is to set
> distinctive ring tones for internal and transferred calls.
>
>
> exten => _.,1,Noop(CALLERID_ALL=${CALLERID(all)})
>
> exten => _.,n,Set(CallerIDNum=${CALLERID(num)})
>
> ; This just shows a list of interesting variables and their values
> ; Comment it out when finished debugging
> ;include => macro-dumpvars
> ;exten => _.,n,Macro(dumpvars)
>
> exten => _417XX,n,Set(AlertSnom=<http://www.notused.com>\;info=)
>
> ; alert-external, alert-group and alert-internal are
> ; Snom predefined values.
> exten => _417XX,n,Set(AlertExternalCall=alert-external)
>
> ; alert_internal_call and alert_internal_transfer are
> ; locally customised values
> exten => _417XX,n,Set(AlertInternalCall=alert_internal_call)
>
> exten => _417XX,n,Set(AlertInternalTransfer=alert_internal_transfer)
>
> exten => _417XX,n,Set(__ALERT_INFO=${AlertSnom}${AlertInternalTransfer})
>
> exten => _417XX,n,GotoIf(
> $[$["${CallerIDNum}" > "41799"] |
> $["${CallerIDNum}" < "41700"]]?notfromlocal:)
>
> exten => _417XX,n,Set(__ALERT_INFO=${AlertSnom}${AlertInternalCall})
>
>
> This works for internal calls but not transfers and it only works at
> all only because of the fall through structure. It contains this
> error that I do not understand:
>
> -- Executing [41720 at from-internal:1] NoOp("SIP/41712-00000548",
> "CALLERID_ALL="James B Byrne" <41712>") in new stack
>
> -- Executing [41720 at from-internal:2] Set("SIP/41712-00000548",
> "CallerIDNum=41712") in new stack
>
> -- Executing [41720 at from-internal:3] Set("SIP/41712-00000548",
> "AlertSnom=<http://www.notused.com>;info=") in new stack
>
> -- Executing [41720 at from-internal:4] Set("SIP/41712-00000548",
> "AlertExternalCall=alert-external") in new stack
>
> -- Executing [41720 at from-internal:5] Set("SIP/41712-00000548",
> "AlertInternalCall=alert_internal_call") in new stack
>
> -- Executing [41720 at from-internal:6] Set("SIP/41712-00000548",
> "AlertInternalTransfer=alert_internal_transfer") in new stack
>
> -- Executing [41720 at from-internal:7] Set("SIP/41712-00000548",
> "__ALERT_INFO=<http://www.notused.com>;info=alert_internal_transfer")
> in new stack
>
> -- Executing [41720 at from-internal:8] GotoIf("SIP/41712-00000548",
> "") in new stack
>
> == Extension Changed 41712[ext-local] new state InUse for Notify
> User 41714
>
>
>
> [2013-07-24 09:50:42] WARNING[10630][C-00006b44]: pbx.c:11544
> pbx_builtin_gotoif: Ignoring, since there is no variable to check
>
> [2013-07-24 09:50:42] WARNING[10630][C-00006b44]: pbx.c:11544
> pbx_builtin_gotoif: Ignoring, since there is no variable to check
>
>
>
> -- Executing [41720 at from-internal:9] Set("SIP/41712-00000548",
> "__ALERT_INFO=<http://www.notused.com>;info=alert_internal_call")
> in new stack
>
> -- Executing [41720 at from-internal:10] Goto("SIP/41712-00000548",
> "from-internal-original-override,41720,1") in new stack
> -- Goto (from-internal-original-override,41720,1)
>
> So my question is simple. What error in syntax have I committed here?
> I expect that CallerIDNum == 41712 in the check:
>
> exten => _417XX,n,GotoIf(
> $[$["${CallerIDNum}" > "41799"] |
> $["${CallerIDNum}" < "41700"]]?notfromlocal:)
I think that bitwise-or | should be a boolean-or ||. And you may have one too
many $[] constructs there. The way to check would be with a few NoOp() lines
just above that one:
exten => _417XX,n,NoOp($["${CallerIDNum}" > "41799"])
exten => _417XX,n,NoOp($["${CallerIDNum}" < "41700"])
exten => _417XX,n,NoOp($["${CallerIDNum}" > "41799"] | $["${CallerIDNum}" <
"41700"])
exten => _417XX,n,NoOp($["${CallerIDNum}" > "41799"] | $["${CallerIDNum}" <
"41700"])
exten => _417XX,n,NoOp($[$["${CallerIDNum}" > "41799"] || $["${CallerIDNum}" <
"41700"]])
exten => _417XX,n,NoOp($[$["${CallerIDNum}" > "41799"] || $["${CallerIDNum}" <
"41700"]])
Note that 0 or an empty string is "false"; anything else is "true".
But why do you even need to set things based on ${CallerIDNum} anyway? What's
wrong with just using separate contexts for internal and inbound external
calls, and hard-coding the setting of the alert there?
--
AJS
Answers come *after* questions.
More information about the asterisk-users
mailing list