Sorry for the simple question, but I’ve been trying different ways of approaching this for half an hour and I must be missing something:
I have a variable that has a forward slash (/ symbol) in it. I need to use that variable to resolve the name of another variable.
In the example below, ${desiredpeer} is equal to SIP/ATAxLB2 -
I need to get the value of the variable {calledsubscriberheldSIP/ATAxLB2holder}. Usually, the way I would do this is by having an expression resolve to the variable name, like so: {[calledsubscriber{desiredpeer}holder]}
I’ve done this thousands of times before, but never with a forward slash in the expression apparently. When I do this in this scenario, I get a bunch of errors about (as below). Clearly, Asterisk thinks I am trying to do division when I am just trying to concatenate strings and resolve them.
I tried surrounding them with quotes (in some of the later examples below) in a few different ways, and I get close, but the quotes still upset the parser. I don’t see anything about forward slashes here: Parameter Quoting - Asterisk Project - Asterisk Project Wiki or any notes about them in the expression pages on the wiki: Expressions - Asterisk Project - Asterisk Project Wiki
What would be the proper way to resolve the variable name / escape the forward slash if necessary?
I also tried resolving the variables and concatenating separately in one step and then plugging into an expression, but this also fails.
[2021-02-01 14:45:31] WARNING[9094][C-00000ce3]: ast_expr2.y:1495 op_div: non-numeric argument
[Feb 1 14:45:31] -- Executing [s@ATA-dial:117] Set("Local/28@from-internal-00000c52;2", "channel2=") in new stack
[2021-02-01 14:45:31] WARNING[9094][C-00000ce3]: ast_expr2.fl:470 ast_yyerror: ast_yyerror(): syntax error: syntax error, unexpected '<token>', expecting $end; Input:
calledsubscriberheld$\{desiredpeer}holder
^
[2021-02-01 14:45:31] WARNING[9094][C-00000ce3]: ast_expr2.fl:474 ast_yyerror: If you have questions, please refer to https://wiki.asterisk.org/wiki/display/AST/Channel+Variables
[Feb 1 14:45:31] -- Executing [s@ATA-dial:118] Set("Local/28@from-internal-00000c52;2", "channel2=") in new stack
[2021-02-01 14:45:31] WARNING[9094][C-00000ce3]: ast_expr2.y:1495 op_div: non-numeric argument
[Feb 1 14:45:31] -- Executing [s@ATA-dial:119] Set("Local/28@from-internal-00000c52;2", "channel2=") in new stack
[2021-02-01 14:45:31] WARNING[9094][C-00000ce3]: ast_expr2.fl:470 ast_yyerror: ast_yyerror(): syntax error: syntax error, unexpected '<token>', expecting $end; Input:
calledsubscriberheld"SIP/ATAxLB1"holder
^
[2021-02-01 14:45:31] WARNING[9094][C-00000ce3]: ast_expr2.fl:474 ast_yyerror: If you have questions, please refer to https://wiki.asterisk.org/wiki/display/AST/Channel+Variables
[Feb 1 14:45:31] -- Executing [s@ATA-dial:120] Set("Local/28@from-internal-00000c52;2", "channel2=") in new stack
[Feb 1 14:45:31] -- Executing [s@ATA-dial:121] Set("Local/28@from-internal-00000c52;2", "channel2=") in new stack
[2021-02-01 14:45:31] WARNING[9094][C-00000ce3]: ast_expr2.fl:470 ast_yyerror: ast_yyerror(): syntax error: syntax error, unexpected '<token>', expecting $end; Input:
"calledsubscriberheld""SIP/ATAxLB1""holder""
^
[2021-02-01 14:45:31] WARNING[9094][C-00000ce3]: ast_expr2.fl:474 ast_yyerror: If you have questions, please refer to https://wiki.asterisk.org/wiki/display/AST/Channel+Variables
[Feb 1 14:45:31] -- Executing [s@ATA-dial:122] Set("Local/28@from-internal-00000c52;2", "channel2=") in new stack
[Feb 1 14:45:31] -- Remote UNIX connection
[Feb 1 14:45:31] -- Remote UNIX connection disconnected
[Feb 1 14:45:31] -- Executing [s@ATA-dial:123] Set("Local/28@from-internal-00000c52;2", "redirect2=Usage: confbridge kick <conference> <channel>
[Feb 1 14:45:31] -- Kicks a channel out of the conference bridge.
[Feb 1 14:45:31] -- (all to kick everyone, participants to kick non-admins).
[Feb 1 14:45:31] -- ") in new stack
same => n,Set(channel2=${$[calledsubscriberheld${desiredpeer}holder]})
same => n,Set(channel2=${$[calledsubscriberheld$\{desiredpeer}holder]})
same => n,Set(channel2=${$[calledsubscriberheld\${desiredpeer}holder]})
same => n,Set(channel2=${$[calledsubscriberheld"${desiredpeer}"holder]})
same => n,Set(channel2=${$["calledsubscriberheld${desiredpeer}holder"]})
same => n,Set(channel2=${$["calledsubscriberheld""${desiredpeer}""holder""]})