Hi Alex and guys, Are there any further examples of XAVPs used in this manner? So associate a number of variables by another variable? I am trying with a number of scenarios but the penny is yet to drop! Sorry! Jon
From: hunter...@hotmail.com To: sr-users@lists.sip-router.org Date: Fri, 23 Oct 2015 17:13:47 +0000 Subject: [SR-Users] Multi-Array with AVPs Alex, Thanks for the fast response! I dont like hard mode, my lifes tough enough :) Will try the XAVPs. Thanks Jon > To: sr-users@lists.sip-router.org > From: abalas...@evaristesys.com > Date: Fri, 23 Oct 2015 13:07:27 -0400 > Subject: Re: [SR-Users] Multi-Array with AVPs > > Jon, > > For complex, nonscalar structures where members can be other AVP > nonscalars, you might wish to consider XAVPs instead: > > http://www.kamailio.org/wiki/cookbooks/4.3.x/pseudovariables#xavp_id_-_xavps > > Otherwise, you're playing life on hard mode. ;-) > > -- Alex > > On 10/23/2015 01:00 PM, Jonathan Hunter wrote: > > > Hi Guys, > > > > Hope all are well? > > > > sorry to post but Im just trying to get something working where Im > > trying to convert a php function script into the kamailio.cfg. > > > > Im getting there but wonder how I can group results of sets of avps with > > another avp. > > > > Say I have these variables; > > > > $(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'; > > $(avp(Prio)) = '1|1|1|2|2'; > > $(avp(Wgt)) = '10000|10000|80000|30000|70000'; > > $(avp(CInc)) = '0|0|1|0|1'; > > $(avp(WTot))= '100000|100000|100000|100000|100000'; > > I then run a while script to split up their variables via the delimiter > > | in user; > > > > $var(j)=0; > > while($var(j)<$var(count)) { > > $(avp(NTgrpP))=$(avp(NTgrp){s.select,$var(j),|}); > > $(avp(PrioP))=$(avp(Prio){s.select,$var(j),|}); > > $(avp(WgtP))=$(avp(Wgt){s.select,$var(j),|}); > > $(avp(CIncP))=$(avp(CInc){s.select,$var(j),|}); > > $(avp(WTotP))=$(avp(WTot){s.select,$var(j),|}); > > xlog("L_INFO"," Now Each time we have $(avp(NTgrpP)) $(avp(PrioP)) > > $(avp(WgtP)) $(avp(CIncP)) $(avp(WTotP))\n"); > > $var(j)=$var(j)+1; > > } > > > > This then results in; > > INFO: <script>: Now Each time we have SB100_000223@1.2.3.4 1 10000 0 100000 > > INFO: <script>: Now Each time we have SB100_000225@1.2.3.5 1 10000 0 100000 > > INFO: <script>: Now Each time we have SB100_000386@1.2.3.6 1 80000 0 100000 > > INFO: <script>: Now Each time we have SB100_000213@1.2.3.7 2 30000 0 100000 > > INFO: <script>: Now Each time we have SB100_000361@1.2.3.8 2 70000 0 100000 > > > > 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. > > > > 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? > > > > As in php I would do something like; > > > > $multi_arr[$prio_arr[$p]][] = array( > > "ntgrp" => $ntgrp_arr[$p], > > "prio" => $prio_arr[$p], > > "wght" => $wght_arr[$p], > > "cinc" => $cinc_arr[$p], > > "wtot" => $wtot_arr[$p], > > ); > > } > > > > Any help would be great. > > > > Many thanks > > > > Jon > > > > > > > > _______________________________________________ > > SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list > > sr-users@lists.sip-router.org > > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users > > > > > -- > Alex Balashov | Principal | Evariste Systems LLC > 303 Perimeter Center North, Suite 300 > Atlanta, GA 30346 > United States > > Tel: +1-800-250-5920 (toll-free) / +1-678-954-0671 (direct) > Web: http://www.evaristesys.com/, http://www.csrpswitch.com/ > > _______________________________________________ > SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list > sr-users@lists.sip-router.org > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users