Module: kamailio
Branch: master
Commit: 69b4380222121321412afc70dfafe39961551f41
URL: 
https://github.com/kamailio/kamailio/commit/69b4380222121321412afc70dfafe39961551f41

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2024-08-27T12:38:25+02:00

tm: new headers_mode flag 2

- statelss uac-style forwarding of CANCEL

---

Modified: src/modules/tm/t_fwd.c
Modified: src/modules/tm/t_msgbuilder.c
Modified: src/modules/tm/t_msgbuilder.h

---

Diff:  
https://github.com/kamailio/kamailio/commit/69b4380222121321412afc70dfafe39961551f41.diff
Patch: 
https://github.com/kamailio/kamailio/commit/69b4380222121321412afc70dfafe39961551f41.patch

---

diff --git a/src/modules/tm/t_fwd.c b/src/modules/tm/t_fwd.c
index cf30afedfa7..9568b6adb1b 100644
--- a/src/modules/tm/t_fwd.c
+++ b/src/modules/tm/t_fwd.c
@@ -61,6 +61,7 @@
 
 extern int tm_failure_exec_mode;
 extern int tm_dns_reuse_rcv_socket;
+extern int tm_headers_mode;
 static int goto_on_branch = 0, branch_route = 0;
 
 /* E2E_CANCEL_HOP_BY_HOP - cancel hop by hop */
@@ -1902,7 +1903,11 @@ int t_forward_cancel(struct sip_msg *p_msg, struct 
proxy_l *proxy, int proto,
 #endif
                                /* dst->send_sock not set, but forward_request
                                 * will take care of it */
-                               ret = forward_request(p_msg, &host, port, &dst);
+                               if(tm_headers_mode & TM_CANCEL_FORWARD_UAC) {
+                                       ret = forward_request_uac(p_msg, &host, 
port, &dst);
+                               } else {
+                                       ret = forward_request(p_msg, &host, 
port, &dst);
+                               }
                                goto end;
                        } else {
                                init_dest_info(&dst);
@@ -1910,7 +1915,11 @@ int t_forward_cancel(struct sip_msg *p_msg, struct 
proxy_l *proxy, int proto,
                                proxy2su(&dst.to, proxy);
                                /* dst->send_sock not set, but forward_request
                                 * will take care of it */
-                               ret = forward_request(p_msg, 0, 0, &dst);
+                               if(tm_headers_mode & TM_CANCEL_FORWARD_UAC) {
+                                       ret = forward_request_uac(p_msg, &host, 
port, &dst);
+                               } else {
+                                       ret = forward_request(p_msg, 0, 0, 
&dst);
+                               }
                                goto end;
                        }
                }
diff --git a/src/modules/tm/t_msgbuilder.c b/src/modules/tm/t_msgbuilder.c
index 49c801d2e8f..9adc4613421 100644
--- a/src/modules/tm/t_msgbuilder.c
+++ b/src/modules/tm/t_msgbuilder.c
@@ -70,7 +70,6 @@
                (_d) += (_len);             \
        } while(0)
 
-#define TM_CANCEL_HEADERS_COPY 1
 extern int tm_headers_mode;
 
 /* Build a local request based on a previous request; main
diff --git a/src/modules/tm/t_msgbuilder.h b/src/modules/tm/t_msgbuilder.h
index c06d1e6adf6..f6ad810d377 100644
--- a/src/modules/tm/t_msgbuilder.h
+++ b/src/modules/tm/t_msgbuilder.h
@@ -28,6 +28,9 @@
 #include "h_table.h"
 #include "t_reply.h"
 
+#define TM_CANCEL_HEADERS_COPY (1)
+#define TM_CANCEL_FORWARD_UAC (1 << 1)
+
 char *build_local(struct cell *Trans, unsigned int branch, unsigned int *len,
                char *method, int method_len, str *to, sip_msg_t *imsg,
                struct cancel_reason *reason);

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to [email protected]

Reply via email to