Hi,
Yes, that's exactly what those functions enable.
When you receive the REGISTER request, you use set_contact_alias() / add_contact_alias() to add an `;alias` parameter to the Contact, which reflects the client's external IP/port/transport. You then pass that REGISTER request onto the registrar.
When you get an incoming request from the registrar to the client, you use handle_ruri_alias() to read the `;alias` parameter and load the IP/port/transport values into the destination set ($du), while stripping the `;alias` parameter off the RURI. You then t_relay() the request, which will follow $du to the next hop read from the `;alias` parameter.
-- Alex
> On Jul 11, 2025, at 4:28 PM, Antonio <satskiy.a@gmail.com> wrote:
>
> Thanks for the reply
>
> I want to use Kamailio as a proxy, but a smart one.
> It doesn't store anything, but:
> • Modifies REGISTER requests → adds the client's IP/port to Contact
> • So when the PBX sends an INVITE back, Kamailio reads this data from the R-URI and forwards the call to the client
>
> Hope it makes sense.
>
>
> On Fri, Jul 11, 2025 at 10:14 PM Alex Balashov via sr-users <sr-users@lists.kamailio.org> wrote:
> Hi,
>
> The set_contact_alias() / handle_ruri_alias() functions from the `nathelper` module[1] are quite ready-made for this use-case, though you may need a more sophisticated approach if the upstream registrar does not support Path[2][3].
>
> -- Alex
>
> [1] https://kamailio.org/docs/modules/6.0.x/modules/nathelper.html
>
> [2] https://datatracker.ietf.org/doc/html/rfc3327
>
> [3] https://kamailio.org/docs/modules/6.0.x/modules/path.html#path.f.add_path
>
> > On Jul 11, 2025, at 6:19 AM, Antonio via sr-users <sr-users@lists.kamailio.org> wrote:
> >
> > Hi everyone,
> > Do we have a ready-to-use Kamailio role or configuration for:
> >
> > “Kamailio as a Stateless Smart SIP Proxy”,
> > Specifically one that uses Contact Header Encoding?
> >
> > That is — a proxy where Kamailio does not store registration state,
> > but encodes the client’s IP and port into the Contact header during REGISTER,
> > and later decodes it from the INVITE to forward the call back to the client.
> > Thanks in advance!
> > --
> >
> > Antony
> > satskiy.a@gmail.com
> > __________________________________________________________
> > 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!
>
>
> --
>
> Antony
> satskiy.a@gmail.com
--
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!
Antony |