[OpenSIPS-Users] I need some help in attr matching while forming the Branch .

Ben Newlin Ben.Newlin at genesys.com
Thu Oct 26 13:46:00 UTC 2023


Sasmita,

Apologies, I replied yesterday but the message is being held by the list as the quoted replies have made it too large. I’ve removed some of the quoted replies and I’m copying my response below:

Yes, a substring match means the exact complete string exists somewhere in the string being searched . In your example, the $avp(attr) does not contain any substring that matches $hdr(Call-Info), so it is correctly failing.

If you want to check for the presence of each element, you need to loop through the elements in $hdr(Call-Info) and check for each one in the $avp(attr) using the s.index mechanism.

The best options for looping on the header are probably s.select [1] or the csv tranformations [2].

[1] https://www.opensips.org/Documentation/Script-Tran-3-2#toc7
[2] https://www.opensips.org/Documentation/Script-Tran-3-2#toc82

Ben Newlin

From: Users <users-bounces at lists.opensips.org> on behalf of Sasmita Panda <spanda at 3clogic.com>
Date: Thursday, October 26, 2023 at 8:46 AM
To: OpenSIPS users mailling list <users at lists.opensips.org>
Subject: Re: [OpenSIPS-Users] I need some help in attr matching while forming the Branch .
 EXTERNAL EMAIL - Please use caution with links and attachments

________________________________
Is there any update on this ?

On Wed, 25 Oct 2023, 19:27 Sasmita Panda, <spanda at 3clogic.com<mailto:spanda at 3clogic.com>> wrote:
Hi Ben ,

Please correct me if I am wrong .

$avp(attr) : sales,level20,en,true
$hdr(Call-Info) : sales,en

 if ($(avp(attr){s.index, $hdr(Call-Info)}) != NULL)
                          {
                               xlog("found $hdr(Call-Info)  in $avp(attr) \n");
                                if (next_branches()){
                                        t_on_failure("1");
                                }
                          }
                         else {
                               sl_send_reply(500,"Unable to load contacts");
                                exit;

                         }

In this case , although $hdr(Call-Info) is a substring of $avp(attr) still it's going in the else block and giving me 500  Unable to load contacts  .

Does the substring must contain continuous values ?




Thanks & Regards
Sasmita Panda
Senior Network Testing and Software Engineer
3CLogic , ph:07827611765
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20231026/78db6056/attachment.html>


More information about the Users mailing list