OK so:
1- @Henning Westerholt <hw(a)kamailio.org>rg>: I wasn't aware of $_s(format),
very useful, thanks for the pointer! (I tested it :P, and although it
doesn't work for *this* case, it's one of those good-to-know things)
2- @Daniel-Constantin Mierla <miconda(a)gmail.com>om>: you are correct, it only
works with constants, I tried all combinations (even AVP inside REGEX,
etc), and they all give an error (matching what you said).
In this case I need to use AVPs not constants, so I've switched from
"switch/case" to "if/elseif/else", but I've learned something new
:-)
Thank you both for your help!
Joel.
On Tue, Jun 22, 2021 at 2:24 AM Daniel-Constantin Mierla <miconda(a)gmail.com>
wrote:
Hello,
case values have to be constants, not variables, based on a quick look at
the code, as I haven't implemented it. But this is anyhow the common for
switch/case statements. The core cookbook also has the example only with
constants.
Cheers,
Daniel
On 22.06.21 10:29, Joel Serrano wrote:
Hi guys,
Quick question, are AVPs valid in "switch" as "case"'s?
Example:
$avp(var1) = "101";
$avp(var2) = "201";
switch($rU) {
case "$avp(var1)":
...
break;
case "$avp(var2)":
...
break;
default:
send_reply("403", "Forbidden");
exit;
}
For some reason I can't get the case to match, and I'm thinking it's not
using the actual value of $avp(var1) and instead it's using literally
"$avp(var1)" as a string.
NOTE: I also tried without putting the AVPs in quotes, but Kamailio
complains and doesn't start.
Is this doable or do I need to use if..else if..else if..else for this?
Thanks,
Joel.
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
* sr-users(a)lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
*
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla --
www.asipto.comwww.twitter.com/miconda --
www.linkedin.com/in/miconda