Module: kamailio
Branch: master
Commit: 0829a30a6ba81d23007fa6f3ea4b4467620fef6d
URL: 
https://github.com/kamailio/kamailio/commit/0829a30a6ba81d23007fa6f3ea4b4467620fef6d

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2025-07-18T09:35:59+02:00

tm: add t_relay_to_proxy("proto:addr:port")

- alternative function with support for variables in the parameter

---

Modified: src/modules/tm/tm.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/0829a30a6ba81d23007fa6f3ea4b4467620fef6d.diff
Patch: 
https://github.com/kamailio/kamailio/commit/0829a30a6ba81d23007fa6f3ea4b4467620fef6d.patch

---

diff --git a/src/modules/tm/tm.c b/src/modules/tm/tm.c
index 8997abe983b..e62c85d74af 100644
--- a/src/modules/tm/tm.c
+++ b/src/modules/tm/tm.c
@@ -137,6 +137,7 @@ static int w_t_relay_to_sctp_uri(struct sip_msg *, char *, 
char *);
 #endif
 static int w_t_relay_to_avp(struct sip_msg *msg, char *str, char *);
 static int w_t_relay_to(struct sip_msg *msg, char *str, char *);
+static int w_t_relay_to_proxy(struct sip_msg *msg, char *str, char *);
 static int w_t_replicate_uri(struct sip_msg *p_msg,
                char *uri, /* sip uri as string or variable */
                char *_foo /* nothing expected */);
@@ -325,6 +326,8 @@ static cmd_export_t cmds[] = {
                        REQUEST_ROUTE | FAILURE_ROUTE},
        {"t_relay_to", w_t_relay_to, 2, fixup_t_relay_to, 0,
                        REQUEST_ROUTE | FAILURE_ROUTE},
+       {"t_relay_to_proxy", w_t_relay_to_proxy, 1, fixup_spve_null,
+                       fixup_free_spve_null, REQUEST_ROUTE | FAILURE_ROUTE},
        {"t_forward_nonack", w_t_forward_nonack, 2, fixup_hostport2proxy, 0,
                        REQUEST_ROUTE},
        {"t_forward_nonack_uri", w_t_forward_nonack_uri, 0, 0, 0,
@@ -3265,6 +3268,21 @@ static int ki_t_relay_to_proxy(sip_msg_t *msg, str 
*sproxy)
        return ki_t_relay_to_proxy_flags(msg, sproxy, 0);
 }
 
+/**
+ *
+ */
+static int w_t_relay_to_proxy(sip_msg_t *msg, char *paddr, char *bar)
+{
+       str addr = STR_NULL;
+
+       if(fixup_get_svalue(msg, (gparam_t *)paddr, &addr) != 0) {
+               LM_ERR("invalid proxy address parameter\n");
+               return -1;
+       }
+
+       return ki_t_relay_to_proxy_flags(msg, &addr, 0);
+}
+
 /**
  *
  */

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to