Hello,

probably you can leverage $T_branch_index in a branch_route (or falure_route).

Cheers,
Daniel

On 17.06.25 17:08, Sergio Charrua via sr-users wrote:
Just having a function that returns the current route from the RTJson object would be enough for me.... once I get it, I can parse the json object, modify/remove headers as needed and then relay the call.

If there is no function/method/static variable available in the module, wouldn't that make sense to have it? just asking....


Atenciosamente / Kind Regards / Cordialement / Un saludo,


Sérgio Charrua



On Tue, Jun 17, 2025 at 3:43 PM Alex Balashov via sr-users <sr-users@lists.kamailio.org> wrote:
It sounds like your use-case might require going outside the boundaries of the `rtjson` formula, and perhaps retrieving and consuming a JSON route set manually.

> On Jun 17, 2025, at 10:06 AM, Sergio Charrua via sr-users <sr-users@lists.kamailio.org> wrote:
>
> Hi all!
>
> doing some integrations with RTJson module for Kamailio 5.8.4, calling a REST API to return the RTJson's JSON object with 1 or multiple route elements.
> Kamailio converts the whole SIP headers to JSON using a Javascript function, executed by APP_JDST module, and POSTing the resulting object to the REST API via http_async module.
>
> I couldn't find a way to get the current selected route, from the RTJson object, once Kamailio iterates through the JSON object (i.e: using rtjson_push_routes or  rtjson_next_route).
>
> When the RTJson module iterates through the different routes of the JSON object, is there a way to get the JSON part that defines the route currently being used by RTJson?
>
> The goal is to return some custom properties set in each route element of the route array.
> Once those properties are returned, Kamailio should process them.
> For example, RTJson supports From and To headers modification and appending new headers with the "extras" element, but there is no way that I know of to modify other headers or remove headers depending on the route.
>
> Does anyone know how:
> 1 - to return current route element from the routes array of the RTJson object ?
> 2 - to modify / remove headers other than the From and To headers, according to the custom values set in the RTJson returned from a REST API ?
>
> Thanks in advance!
>
> Atenciosamente / Kind Regards / Cordialement / Un saludo,
>
> Sérgio Charrua
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions -- sr-users@lists.kamailio.org
> To unsubscribe send an email to sr-users-leave@lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to the sender!

--
Alex Balashov
Principal Consultant
Evariste Systems LLC
Web: https://evaristesys.com, https://www.csrpswitch.com
Tel: +1-706-510-6800

__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions -- sr-users@lists.kamailio.org
To unsubscribe send an email to sr-users-leave@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!

__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions -- sr-users@lists.kamailio.org
To unsubscribe send an email to sr-users-leave@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!
-- 
Daniel-Constantin Mierla (@ asipto.com)
twitter.com/miconda -- linkedin.com/in/miconda
Kamailio Consultancy, Training and Development Services -- asipto.com
Kamailio Scalability Training - Online, June 16-19, 2025 -- asipto.com