[SR-Users] AVPs in Switch/Case
Henning Westerholt
hw at skalatan.de
Tue Jun 22 10:38:46 CEST 2021
Hello,
Did not tested it, but have you already tried this:
https://www.kamailio.org/wiki/cookbooks/5.4.x/pseudovariables#s_format_-_evaluate_dynamic_format
Cheers,
Henning
From: sr-users <sr-users-bounces at lists.kamailio.org> On Behalf Of Joel Serrano
Sent: Tuesday, June 22, 2021 10:29 AM
To: Kamailio (SER) - Users Mailing List <sr-users at lists.kamailio.org>
Subject: [SR-Users] AVPs in Switch/Case
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20210622/501c591f/attachment.htm>
More information about the sr-users
mailing list