[SOLVED] Issue with variable substitution

Hi,

from this dialplan code:

TRUNKCC=+49                 ; trunk country code

[normalize-callerid]
; normalize inbound caller id subroutine
; changes CALLERID(num) and (all)
exten = s,1,NoOp("Normalize callerid ${CALLERID(all)}")
 ; anonymous call?
 same = n,GotoIf($["${CALLERID(num)}"="anonymous"]?anonymous)
 same = n,GotoIf($["${CALLERID(num)}"=""]?anonymous)
 same = n,GotoIf($["${CALLERID(num):0:${LEN(${TRUNKCC})}}"!="${TRUNKCC}"]?intcall)
 ; replace local country code with 0
 same = n,Set(CALLERID(num)=0${CALLERID(num):${LEN(${TRUNKCC})})
[...]

I’m harvesting a new? warning with Asterisk 16.4.1, that I haven’t seen before (with ealier versions, IIRC):

[Jul 29 17:34:43]     -- Executing [+491234567890@inbound-dongle:1] NoOp("Dongle/dongle0-0100000000", ""Incoming mobile call from +491234567890"") in new stack
[Jul 29 17:34:43]     -- Executing [+491234567890@inbound-dongle:2] Gosub("Dongle/dongle0-0100000000", "normalize-callerid,s,1") in new stack
[Jul 29 17:34:43]     -- Executing [s@normalize-callerid:1] NoOp("Dongle/dongle0-0100000000", ""Normalize callerid "dongle0" <+491234567890>"") in new stack
[Jul 29 17:34:43]     -- Executing [s@normalize-callerid:2] GotoIf("Dongle/dongle0-0100000000", "0?anonymous") in new stack
[Jul 29 17:34:43]     -- Executing [s@normalize-callerid:3] GotoIf("Dongle/dongle0-0100000000", "0?anonymous") in new stack
[Jul 29 17:34:43]     -- Executing [s@normalize-callerid:4] GotoIf("Dongle/dongle0-0100000000", "0?intcall") in new stack
[2019-07-29 17:34:43] WARNING[4368][C-0000000c]: pbx_variables.c:719 pbx_substitute_variables_helper_full: Error in extension logic (missing '}')

Any idea, why and where it is missing the ‘}’, and how it is avoided best?

TIA,
Pete

At the end of ${CALLERID(num)....

Count them.

Hmm

"${CALLERID(num):0:${LEN(${TRUNKCC})}}"!="${TRUNKCC}"
  1                 2     3       3 21     1       1

Still don’t see, where it is unbalanced?!?

Probably, I’m beaten with blindness…

same = n,Set(CALLERID(num)=0${CALLERID(num):${LEN(${TRUNKCC})})
                             1               2     3       3 2

Thanks @david551, as I told you, beaten with blindness…

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.