On 10.10.23 12:15, Barry Flanagan via sr-users wrote: > On Fri, 6 Oct 2023, at 18:55, Alex Balashov via sr-users wrote: >>> On 6 Oct 2023, at 10:39, Barry Flanagan via sr-users >>> <[email protected]> wrote: >>> >>> On 06/10/2023 15:23, Alex Balashov via sr-users wrote: >>>> Hello, >>>> >>>> If you can't key by R-URI, perhaps then just store a list of routes in a >>>> database table or similar? >>> Thanks. The routes are received via an API call, and are dynamic. Trying to >>> avoid the overhead of a database. >> Ah. Then the easiest approach is probably to buffer them into an XAVP >> array and just iterate through them. R-URI can be one attribute of >> each, while the destination URI/next-hop can be another. >> >> $var(i) = 0; >> >> while(defined $xavp(route_set[$var(i)])) { >> $ru = $xavp(route_set[$var(i)]=>ruri); >> $du = $xavp(route_set[$var(i)]=>duri); >> >> $var(i) = $var(i) + 1; >> } > Yes, but I also need to first sort the list by weight and priority (q-value). > For the life of me I can't find any way to sort an array in Kamailio. Will I > have to use KEMI for that?
Have you tried to push to branches (e.g., with $sbranch(...), see also pv module for corresponding functions) then use tm for serial forking with those branches? - https://www.kamailio.org/docs/modules/stable/modules/tm.html#tm.serial_forking Otherwise, as suggested in other replies, I would rather make the api to return the right order, or, as you pointed, use KEMI for sorting -- app_jsdt has no external dependency, its js interpreter is embedded in kamailio module. Cheers, Daniel -- Daniel-Constantin Mierla (@ asipto.com) twitter.com/miconda -- linkedin.com/in/miconda Kamailio Consultancy and Development Services Kamailio Advanced Training - Online - Nov 14-16, 2023 -- asipto.com __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to [email protected] Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
