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

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2024-08-20T14:22:56+02:00

core: helper function to forward request specifying message build mode

---

Modified: src/core/forward.c
Modified: src/core/forward.h

---

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

---

diff --git a/src/core/forward.c b/src/core/forward.c
index 0276f8a5a2e..1d2b1d5d650 100644
--- a/src/core/forward.c
+++ b/src/core/forward.c
@@ -482,14 +482,15 @@ int check_self_port(unsigned short port, unsigned short 
proto)
  *                 - send_info->send_flags is filled from the message
  *                 - if the send_socket member is null, a send_socket will be
  *                   chosen automatically
+ *   mbmode    - message build mode (for build_req_buf_from_sip_req())
  * WARNING: don't forget to zero-fill all the  unused members (a non-zero
  * random id along with proto==PROTO_TCP can have bad consequences, same for
  *   a bogus send_socket value)
  *
  * return: 0 (E_OK) on success; negative (E_*) on failure
  */
-int forward_request(struct sip_msg *msg, str *dst, unsigned short port,
-               struct dest_info *send_info)
+int forward_request_mode(struct sip_msg *msg, str *dst, unsigned short port,
+               struct dest_info *send_info, unsigned int mbmode)
 {
        unsigned int len;
        char *buf;
@@ -582,7 +583,7 @@ int forward_request(struct sip_msg *msg, str *dst, unsigned 
short port,
                        if(buf)
                                pkg_free(buf);
                        send_info->proto = proto;
-                       buf = build_req_buf_from_sip_req(msg, &len, send_info, 
0);
+                       buf = build_req_buf_from_sip_req(msg, &len, send_info, 
mbmode);
                        if(!buf) {
                                LM_ERR("building failed\n");
                                ret = E_OUT_OF_MEM; /* most probable */
@@ -686,6 +687,13 @@ int forward_request(struct sip_msg *msg, str *dst, 
unsigned short port,
 }
 
 
+int forward_request(struct sip_msg *msg, str *dst, unsigned short port,
+               struct dest_info *send_info)
+{
+       return forward_request_mode(msg, dst, port, send_info, 0);
+}
+
+
 int update_sock_struct_from_via(
                union sockaddr_union *to, struct sip_msg *msg, struct via_body 
*via)
 {
diff --git a/src/core/forward.h b/src/core/forward.h
index 7b51e1a5559..a90ce3446ce 100644
--- a/src/core/forward.h
+++ b/src/core/forward.h
@@ -80,6 +80,8 @@ int check_self(str *host, unsigned short port, unsigned short 
proto);
 int check_self_port(unsigned short port, unsigned short proto);
 int forward_request(struct sip_msg *msg, str *dst, unsigned short port,
                struct dest_info *send_info);
+int forward_request_mode(struct sip_msg *msg, str *dst, unsigned short port,
+               struct dest_info *send_info, unsigned int mbmode);
 int update_sock_struct_from_via(
                union sockaddr_union *to, struct sip_msg *msg, struct via_body 
*via);
 

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org

Reply via email to