Module: kamailio Branch: master Commit: a6a3bd088368fbf65c283ae27e999d315db0844b URL: https://github.com/kamailio/kamailio/commit/a6a3bd088368fbf65c283ae27e999d31...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2022-06-01T18:15:43+02:00
ims_ipsec_pcscf: new option for ipsec_forward() to set trasport for tcp dst uri
---
Modified: src/modules/ims_ipsec_pcscf/cmd.c
---
Diff: https://github.com/kamailio/kamailio/commit/a6a3bd088368fbf65c283ae27e999d31... Patch: https://github.com/kamailio/kamailio/commit/a6a3bd088368fbf65c283ae27e999d31...
---
diff --git a/src/modules/ims_ipsec_pcscf/cmd.c b/src/modules/ims_ipsec_pcscf/cmd.c index 5aa208d334..6f6c15e21b 100644 --- a/src/modules/ims_ipsec_pcscf/cmd.c +++ b/src/modules/ims_ipsec_pcscf/cmd.c @@ -90,6 +90,8 @@ extern struct tm_binds tmb; #define IPSEC_NODSTURI_RESET (1<<5) /* if set - use user equipment client port as target for requests over TCP */ #define IPSEC_TCPPORT_UEC (1<<6) +/* if set - build new dst uri with transport parameter for TCP */ +#define IPSEC_SETDSTURI_FULL (1<<7)
/* if set - delete unused tunnels before every registration */ #define IPSEC_CREATE_DELETE_UNUSED_TUNNELS 0x01 @@ -947,8 +949,14 @@ int ipsec_forward(struct sip_msg *m, udomain_t *d, int _cflags)
if(!(_cflags & IPSEC_NODSTURI_RESET)) { char buf[1024]; - int buf_len = snprintf(buf, sizeof(buf) - 1, "sip:%.*s:%d", ci.via_host.len, - ci.via_host.s, dst_port); + int buf_len; + if((_cflags & IPSEC_SETDSTURI_FULL) && (dst_proto == PROTO_TCP)) { + buf_len = snprintf(buf, sizeof(buf) - 1, "sip:%.*s:%d;transport=tcp", + ci.via_host.len, ci.via_host.s, dst_port); + } else { + buf_len = snprintf(buf, sizeof(buf) - 1, "sip:%.*s:%d", ci.via_host.len, + ci.via_host.s, dst_port); + }
if((m->dst_uri.s = pkg_malloc(buf_len + 1)) == NULL) { LM_ERR("Error allocating memory for dst_uri\n");