Hello,

 

I probably failed to understand your scenario completely.

 

But basically, if you want to just forward REGISTER message from one Kamailio to the other, you can use “forward()” or “r_relay()” for stateless respectively stateful forwarding.

 

The path extension was designed to take the same way routing e.g. an INVITE to an user agent as it came through your infrastructure. It will work automatically by setting the destination URI if it path is set and you are using the “lookup(..)” function.

 

Cheers,

 

Henning

 

 

--

Henning Westerholt – https://skalatan.de/blog/

Kamailio services – https://gilawa.com

 

 

 

From: Jawaid Bazyar via sr-users <sr-users@lists.kamailio.org>
Sent: Mittwoch, 25. Oktober 2023 21:54
To: sr-users@lists.kamailio.org
Cc: Jawaid Bazyar <bazyar@gmail.com>
Subject: [SR-Users] Registrar / Path

 

Hi,

 

I have a scenario where I have an edge proxy (named RS), which locally stores registrations from Endpoints in its USRLOC, but which then also forward's REGISTER requests on to another proxy (named CN), which stores registrations in its USRLOC. (which then does DMQ with another CN like it).

 

Both RS and CN are storing Path information, for example:

 

kamctl ul show displays on both RS and CN:

  "Path": "sip:vs-rs01.blah.foo.bar;lr;received=sip:3.4.5.6:33577",

 

So I know the path info is in there.

 

I want CN , when presented with an INVITE, to reply with a 302 Redirect.

 

Right now I have this:

 

if (!lookup("location",sip:$tU@nodomain)) {

}

reg_fetch_contacts("location", "$tu", "called");

xlog("location info $ulc(called=>path)");

sl_send_reply("302","Redirect");

 

and the xlog does display the path. Good, so I have it being sent all the way through RS and CN and into CN’s USRLOC.

 

but this isn’t complete.

 

I am now faced with two issues.

 

One, I need to mangle the Path into a Contact header for the Redirect.

Two, I need to delete the Contact header that sl_send_reply is putting on there, which is the Contact as RS sees it from the endpoint. This needs to be removed and replaced with a Contact of only the RS server.

 

It feels like there ought to be a simpler way to do this than parsing the Path string and reassembling a Contact from it, but if there is it's not readily apparent. Both Google and chatgpt have failed me :)

 

Thanks in advance,

 

Jawaid