<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><div>Hi Guys,</div><div><br></div><div>Hope all are well?</div><div><br></div><div>sorry to post but Im just trying to get something working where Im trying to convert a php function script into the kamailio.cfg.</div><div><br></div><div>Im getting there but wonder how I can group results of sets of avps with another avp.</div><div><br></div><div>Say I have these variables;</div><div><br></div><div>$(avp(NTgrp)) = 'SB100_000361@1.2.3.4|SB100_000213@1.2.3.5|SB100_000225@1.2.3.6|SB100_000361@1.2.3.7|SB100_000213@1.2.3.8';</div><div>$(avp(Prio)) = '1|1|1|2|2';</div><div>$(avp(Wgt)) = '10000|10000|80000|30000|70000';</div><div>$(avp(CInc)) = '0|0|1|0|1';</div><div>$(avp(WTot))= '100000|100000|100000|100000|100000';</div><div> </div><div>I then run a while script to split up their variables via the delimiter | in user;</div><div><br></div><div>$var(j)=0;</div><div>while($var(j)<$var(count)) {</div><div>$(avp(NTgrpP))=$(avp(NTgrp){s.select,$var(j),|});</div><div>$(avp(PrioP))=$(avp(Prio){s.select,$var(j),|});</div><div>$(avp(WgtP))=$(avp(Wgt){s.select,$var(j),|});</div><div>$(avp(CIncP))=$(avp(CInc){s.select,$var(j),|});</div><div>$(avp(WTotP))=$(avp(WTot){s.select,$var(j),|});</div><div>xlog("L_INFO"," Now Each time we have $(avp(NTgrpP)) $(avp(PrioP)) $(avp(WgtP)) $(avp(CIncP)) $(avp(WTotP))\n");</div><div>$var(j)=$var(j)+1;</div><div>}</div><div><br></div><div>This then results in;</div><div>INFO: <script>:  Now Each time we have SB100_000223@1.2.3.4 1 10000 0 100000</div><div>INFO: <script>:  Now Each time we have SB100_000225@1.2.3.5 1 10000 0 100000</div><div>INFO: <script>:  Now Each time we have SB100_000386@1.2.3.6 1 80000 0 100000</div><div>INFO: <script>:  Now Each time we have SB100_000213@1.2.3.7 2 30000 0 100000</div><div>INFO: <script>:  Now Each time we have SB100_000361@1.2.3.8 2 70000 0 100000</div><div><br></div><div>Now what Id like to do is group them via priorities so I can do some further functional checks on them when in same priority group, as you can see there are 3 results at priority 1 and 2 at priority 2.</div><div><br></div><div>Is there away I can create something of a multi-array using the AVP $(avp(PrioP)) I just created so I can group by priority?</div><div><br></div><div>As in php I would do something like;</div><div><br></div><div>$multi_arr[$prio_arr[$p]][] = array(</div><div>      "ntgrp" => $ntgrp_arr[$p],</div><div>      "prio"  => $prio_arr[$p],</div><div>      "wght"  => $wght_arr[$p],</div><div>      "cinc"  => $cinc_arr[$p],</div><div>      "wtot"  => $wtot_arr[$p],</div><div>    );</div><div>  }</div><div><br></div><div>Any help would be great.</div><div><br></div><div>Many thanks</div><div><br></div><div>Jon</div><div><br></div>                                           </div></body>
</html>