<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Helvetica;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Aptos;
        panose-1:2 11 0 4 2 2 2 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:10.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt">Without seeing the specific exact code, I can’t say what is causing that error. It seems like it may be a syntax issue. For example, in your email you are missing the semicolon after the line setting the count.
 I don’t know if it is that way in your config script. I recommend double checking all your syntax, and if you still get the error please provide the exact code from your script for review.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">For #2, I can’t really be very specific there because I don’t know all of your logic, nor am I very knowledgeable about the registrar module. My first thought is to not do any filtering/checking in the request
 route. Just allow the registrar module to load all contacts in branches, but arm a branch_route. Then perform the check in the branch route for each branch. If the Contact for the branch doesn’t match what you want, you can drop the branch [1].<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">[1] <a href="https://www.opensips.org/Documentation/Script-Routes-3-2#toc2">
https://www.opensips.org/Documentation/Script-Routes-3-2#toc2</a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">Ben Newlin</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<div id="mail-editor-reference-message-container">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;font-family:"Aptos",sans-serif;color:black">From:
</span></b><span style="font-size:12.0pt;font-family:"Aptos",sans-serif;color:black">Users <users-bounces@lists.opensips.org> on behalf of Sasmita Panda <spanda@3clogic.com><br>
<b>Date: </b>Friday, October 27, 2023 at 6:17 AM<br>
<b>To: </b>OpenSIPS users mailling list <users@lists.opensips.org><br>
<b>Subject: </b>Re: [OpenSIPS-Users] I need some help in attr matching while forming the Branch .<o:p></o:p></span></p>
</div>
<div>
<div>
<div>
<table class="MsoNormalTable" border="1" cellspacing="0" cellpadding="0" style="border-collapse:collapse;border:none">
<tbody>
<tr>
<td style="border:solid #B60000 1.0pt;background:white;padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><b><span style="font-size:12.0pt;color:#B60000"> EXTERNAL EMAIL - Please use caution with links and attachments <o:p></o:p></span></b></p>
</td>
</tr>
</tbody>
</table>
</div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:Helvetica;color:black"><o:p> </o:p></span></p>
<div class="MsoNormal" align="center" style="text-align:center"><span style="font-size:11.0pt">
<hr size="1" width="100%" align="center">
</span></div>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt">Ahhh , Ok . <o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">Now it's very  complicated . When you said a loop that's looping in my mind . Sorry for the bad joke . <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">In case , the number of elements in each Invite won't be fixed . So the number of loops will vary from one Invite to another . <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">I was thinking of counting the number of elements first , then as the index starts from 0 I will loop till
<b>count-1</b> to fetch every element properly . <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">Example : <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">$var(count) = $(hdr(Call-Info){csv.count})    ## if the number is 3 then loop will be for 3 times starting from 0 to 2 <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> $var(i) = 0;<br>
    while($var(i) < $var(count) )<br>
    {<br>
        xlog("counter: $var(i)\n");<br>
        $var(i) = $var(i) + 1;<br>
    }<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">This was my initial thought . But while finding the count it gave me an error . <b> $var(count) = $(hdr(Call-Info){csv.count})  Is this not in the correct format ? </b><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><b><span style="font-size:11.0pt">parse error in /usr/local/etc/opensips/opensips-p2p.cfg:267:26-55: unknown script variable</span></b><span style="font-size:11.0pt"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><b><span style="font-size:11.0pt">As I have earlier mentioned my header will look like . </span></b><span style="font-size:11.0pt"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><b><span style="font-size:11.0pt">Call-Info: sales,en,level20,en (this can be anything but format will be like this . )  . How do I count the number of values ?</span></b><span style="font-size:11.0pt"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><b><span style="font-size:11.0pt">2. As I am doing this matching to filter out contacts, where should I do this ? If I am doing this while giving a call to the contacts , for the 1st transaction it is doing the comparison , after that for
 the next branch it processes the call without matching . Which is not right . For every contact this comparison should loop </span></b><span style="font-size:11.0pt"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><b><span style="font-size:11.0pt"><br clear="all">
</span></b><span style="font-size:11.0pt"><o:p></o:p></span></p>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><b><i><span style="font-size:11.0pt">Thanks & Regards</span></i></b><span style="font-size:11.0pt"><o:p></o:p></span></p>
<div>
<p class="MsoNormal"><i><span style="font-size:11.0pt">Sasmita Panda</span></i><span style="font-size:11.0pt"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><i><span style="font-size:11.0pt">Senior Network Testing and Software Engineer</span></i><span style="font-size:11.0pt"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><i><span style="font-size:11.0pt">3CLogic , ph:07827611765</span></i><span style="font-size:11.0pt"><o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">On Thu, Oct 26, 2023 at 7:19 PM Ben Newlin <</span><a href="mailto:Ben.Newlin@genesys.com"><span style="font-size:11.0pt">Ben.Newlin@genesys.com</span></a><span style="font-size:11.0pt">> wrote:<o:p></o:p></span></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">Sasmita,<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">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:<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">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.<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">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.<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">The best options for looping on the header are probably s.select [1] or the csv tranformations [2].<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">[1] </span><a href="https://www.opensips.org/Documentation/Script-Tran-3-2#toc7" target="_blank" title="https://www.opensips.org/Documentation/Script-Tran-3-2#toc7"><span style="font-size:11.0pt">https://www.opensips.org/Documentation/Script-Tran-3-2#toc7</span></a><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">[2] </span><a href="https://www.opensips.org/Documentation/Script-Tran-3-2#toc82" target="_blank" title="https://www.opensips.org/Documentation/Script-Tran-3-2#toc82"><span style="font-size:11.0pt">https://www.opensips.org/Documentation/Script-Tran-3-2#toc82</span></a><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> <o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;color:black">Ben Newlin</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</body>
</html>