Module: kamailio
Branch: master
Commit: f3b977d39ca72e5787a5b97ee2cf154adbe7d0ca
URL:
https://github.com/kamailio/kamailio/commit/f3b977d39ca72e5787a5b97ee2cf154…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-08-16T10:42:43+02:00
core: store tcp connection id in sip msg and branch structure
- try to use it to identify outbound connection for stateless forward()
---
Modified: src/core/action.c
Modified: src/core/dset.h
Modified: src/core/parser/msg_parser.h
---
Diff:
https://github.com/kamailio/kamailio/commit/f3b977d39ca72e5787a5b97ee2cf154…
Patch:
https://github.com/kamailio/kamailio/commit/f3b977d39ca72e5787a5b97ee2cf154…
---
diff --git a/src/core/action.c b/src/core/action.c
index 45581ba312..8211cf00f7 100644
--- a/src/core/action.c
+++ b/src/core/action.c
@@ -383,10 +383,16 @@ int do_action(struct run_act_ctx* h, struct action* a, struct
sip_msg* msg)
init_dest_info(&dst);
if (a->type==FORWARD_UDP_T) dst.proto=PROTO_UDP;
#ifdef USE_TCP
- else if (a->type==FORWARD_TCP_T) dst.proto= PROTO_TCP;
+ else if (a->type==FORWARD_TCP_T) {
+ dst.proto= PROTO_TCP;
+ dst.id = msg->otcpid;
+ }
#endif
#ifdef USE_TLS
- else if (a->type==FORWARD_TLS_T) dst.proto= PROTO_TLS;
+ else if (a->type==FORWARD_TLS_T) {
+ dst.proto= PROTO_TLS;
+ dst.id = msg->otcpid;
+ }
#endif
#ifdef USE_SCTP
else if (a->type==FORWARD_SCTP_T) dst.proto=PROTO_SCTP;
diff --git a/src/core/dset.h b/src/core/dset.h
index 65b54c3104..96f31978a6 100644
--- a/src/core/dset.h
+++ b/src/core/dset.h
@@ -48,7 +48,7 @@ struct branch
char uri[MAX_URI_SIZE];
unsigned int len;
- /* Real destination of the request */
+ /* Real destination of the request */
char dst_uri[MAX_URI_SIZE];
unsigned int dst_uri_len;
@@ -74,6 +74,9 @@ struct branch
char location_ua[MAX_UA_SIZE + 1];
unsigned int location_ua_len;
+ /* tcp connection id */
+ int otcpid;
+
/* Branch flags */
flag_t flags;
};
diff --git a/src/core/parser/msg_parser.h b/src/core/parser/msg_parser.h
index 5dff970206..827c541086 100644
--- a/src/core/parser/msg_parser.h
+++ b/src/core/parser/msg_parser.h
@@ -378,6 +378,7 @@ typedef struct sip_msg {
unsigned int reg_id;
str ruid;
str location_ua;
+ int otcpid; /*!< outbound tcp connection id, if known */
/* structure with fields that are needed for local processing
* - not cloned to shm, reset to 0 in the clone */