[sr-dev] [kamailio/kamailio] Setting notifier_processes to 1 or more seems to cause memory leak (#2733)

2021-05-10 Thread Amit Nir
Hello,
We use Kamailio with KAZOO. We have set notifier_processes as follows:

modparam("presence", "notifier_processes", 1)

A value  of 1 or greater seems to be required to avoid race conditions when 
multiple notify's need to be sent.
We've noticed noticed what seems to be a memory leak in Kamailio process. After 
several days, Kamailio will crash after consuming all system memory.
I have not found any other reports of this happening to others.
Does this seem familiar to anyone?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2733___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] ims_ipsec_pcscf: more algorithms, SA improvements (#2731)

2021-05-10 Thread riccardv
@riccardv commented on this pull request.



> -// for Reply and TCP sends from P-CSCF server port, for Reply and 
> UDP sends from P-CSCF client port
-src_port = dst_proto == PROTO_TCP ? s->port_ps : s->port_pc;
+// Check send socket
+struct socket_info * client_sock = grep_sock_info(via_host.af == 
AF_INET ? _listen_addr : _listen_addr6, src_port, dst_proto);
+if(client_sock) {
+// for Reply and TCP sends from P-CSCF server port, for Reply and 
UDP sends from P-CSCF client port
+src_port = dst_proto == PROTO_TCP ? s->port_ps : s->port_pc;
 
-// for Reply and TCP sends to UE client port, for Reply and UDP sends 
to UE server port
-dst_port = dst_proto == PROTO_TCP ? s->port_uc : s->port_us;
+// for Reply and TCP sends to UE client port, for Reply and UDP 
sends to UE server port
+dst_port = dst_proto == PROTO_TCP ? s->port_uc : s->port_us;
+}
+else
+{
+src_port = s->port_pc;
+dst_port = s->port_us;
+}

Welcome!

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2731#discussion_r629372001___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] ims_ipsec_pcscf: more algorithms, SA improvements (#2731)

2021-05-10 Thread alexyosifov
@alexyosifov commented on this pull request.



> +// cipher_null, des,  des3_ede, aes
 strcpy(l_enc_algo->alg_name,"cipher_null");
+if (strncasecmp(r_ealg.s,"aes-cbc",r_ealg.len) == 0) {
+LM_DBG("Creating security associations: AES\n");
+strcpy(l_enc_algo->alg_name,"aes");
+l_enc_algo->alg_key_len = ck.len * 4;
+string_to_key(l_enc_algo->alg_key, ck);
+}
+else if (strncasecmp(r_ealg.s,"des-ede3-cbc",r_ealg.len) == 0) {
+LM_DBG("Creating security associations: DES, ck.len=%d\n",ck.len);
+strcpy(l_enc_algo->alg_name,"des3_ede");
+str ck1;
+ck1.s = pkg_malloc (128);
+strncpy(ck1.s,ck.s,32);
+strncat(ck1.s,ck.s,16);
+ck1.len=32+16;
+
+l_enc_algo->alg_key_len = ck1.len * 4;
+string_to_key(l_enc_algo->alg_key, ck1);
+
+pkg_free(ck1.s);
+}

OK, Thanks!

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2731#discussion_r629355503___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] ims_ipsec_pcscf: more algorithms, SA improvements (#2731)

2021-05-10 Thread alexyosifov
@alexyosifov commented on this pull request.



> -// for Reply and TCP sends from P-CSCF server port, for Reply and 
> UDP sends from P-CSCF client port
-src_port = dst_proto == PROTO_TCP ? s->port_ps : s->port_pc;
+// Check send socket
+struct socket_info * client_sock = grep_sock_info(via_host.af == 
AF_INET ? _listen_addr : _listen_addr6, src_port, dst_proto);
+if(client_sock) {
+// for Reply and TCP sends from P-CSCF server port, for Reply and 
UDP sends from P-CSCF client port
+src_port = dst_proto == PROTO_TCP ? s->port_ps : s->port_pc;
 
-// for Reply and TCP sends to UE client port, for Reply and UDP sends 
to UE server port
-dst_port = dst_proto == PROTO_TCP ? s->port_uc : s->port_us;
+// for Reply and TCP sends to UE client port, for Reply and UDP 
sends to UE server port
+dst_port = dst_proto == PROTO_TCP ? s->port_uc : s->port_us;
+}
+else
+{
+src_port = s->port_pc;
+dst_port = s->port_us;
+}

I agree. Thanks for the clarification!

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2731#discussion_r629355293___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] ims_ipsec_pcscf: more algorithms, SA improvements (#2731)

2021-05-10 Thread riccardv
@riccardv commented on this pull request.



> +// cipher_null, des,  des3_ede, aes
 strcpy(l_enc_algo->alg_name,"cipher_null");
+if (strncasecmp(r_ealg.s,"aes-cbc",r_ealg.len) == 0) {
+LM_DBG("Creating security associations: AES\n");
+strcpy(l_enc_algo->alg_name,"aes");
+l_enc_algo->alg_key_len = ck.len * 4;
+string_to_key(l_enc_algo->alg_key, ck);
+}
+else if (strncasecmp(r_ealg.s,"des-ede3-cbc",r_ealg.len) == 0) {
+LM_DBG("Creating security associations: DES, ck.len=%d\n",ck.len);
+strcpy(l_enc_algo->alg_name,"des3_ede");
+str ck1;
+ck1.s = pkg_malloc (128);
+strncpy(ck1.s,ck.s,32);
+strncat(ck1.s,ck.s,16);
+ck1.len=32+16;
+
+l_enc_algo->alg_key_len = ck1.len * 4;
+string_to_key(l_enc_algo->alg_key, ck1);
+
+pkg_free(ck1.s);
+}

I simply add the algorithm in the original code, nothing more

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2731#discussion_r629336886___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] ims_ipsec_pcscf: more algorithms, SA improvements (#2731)

2021-05-10 Thread riccardv
@riccardv commented on this pull request.



> -// for Reply and TCP sends from P-CSCF server port, for Reply and 
> UDP sends from P-CSCF client port
-src_port = dst_proto == PROTO_TCP ? s->port_ps : s->port_pc;
+// Check send socket
+struct socket_info * client_sock = grep_sock_info(via_host.af == 
AF_INET ? _listen_addr : _listen_addr6, src_port, dst_proto);
+if(client_sock) {
+// for Reply and TCP sends from P-CSCF server port, for Reply and 
UDP sends from P-CSCF client port
+src_port = dst_proto == PROTO_TCP ? s->port_ps : s->port_pc;
 
-// for Reply and TCP sends to UE client port, for Reply and UDP sends 
to UE server port
-dst_port = dst_proto == PROTO_TCP ? s->port_uc : s->port_us;
+// for Reply and TCP sends to UE client port, for Reply and UDP 
sends to UE server port
+dst_port = dst_proto == PROTO_TCP ? s->port_uc : s->port_us;
+}
+else
+{
+src_port = s->port_pc;
+dst_port = s->port_us;
+}

Hi @alexyosifov ,

without the patch the ports in case of TCP are always:
src_port = s->port_ps
dst_port = s->port_uc
That are the ones used in case the user agent open the connection.

A pre check is necessary because if this socket is not already open, the use 
the ports:
src_port = s->port_pc;
dst_port = s->port_us;
that are the port from Proxy Client (pc) -> User Server (us).
Is a attempt to fallback to the other opened socket.

This case can be happens when INVITE transaction is very long due to long 
Ringing time phase.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2731#discussion_r629336057___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] ims_ipsec_pcscf: more algorithms, SA improvements (#2731)

2021-05-10 Thread riccardv
@riccardv commented on this pull request.



> @@ -100,8 +100,15 @@ static void string_to_key(char* dst, const str 
> key_string)
 }
 }
 
+static uint choose_nlmsg_seq (void)

Hi @henningw ,
I choose the 1 micro seconds granulation due to the commit comment:
"improve nlmsg_seq choice for concurrent multi UEs Registrations at same time"

The reason is the previous choice of time(NULL) return a time value on seconds 
and it can be too large in presence of multiple UE access in the same time. In 
high load condition it can be happens.
IPsec Security Association must have this parameter as a unique identifier, 
since kamailio can be configured to listen on single local ip:port for IPsec, 
it can be a problem, resulting in a failure on activation of SA, and then a 
failure on VoLTE SIP REGISTRATION.

A time based choice is a good choice, but 1 second is not enough, so I propose 
the choice of 1 micro second granularity that can be protect the registrations 
in a reasonable way.

Regarding other platforms that don't have the funtion, feel free to add a pre 
processor condition on the function

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2731#discussion_r629325968___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] ims_ipsec_pcscf: more algorithms, SA improvements (#2731)

2021-05-10 Thread alexyosifov
@alexyosifov approved this pull request.



> -// for Reply and TCP sends from P-CSCF server port, for Reply and 
> UDP sends from P-CSCF client port
-src_port = dst_proto == PROTO_TCP ? s->port_ps : s->port_pc;
+// Check send socket
+struct socket_info * client_sock = grep_sock_info(via_host.af == 
AF_INET ? _listen_addr : _listen_addr6, src_port, dst_proto);
+if(client_sock) {
+// for Reply and TCP sends from P-CSCF server port, for Reply and 
UDP sends from P-CSCF client port
+src_port = dst_proto == PROTO_TCP ? s->port_ps : s->port_pc;
 
-// for Reply and TCP sends to UE client port, for Reply and UDP sends 
to UE server port
-dst_port = dst_proto == PROTO_TCP ? s->port_uc : s->port_us;
+// for Reply and TCP sends to UE client port, for Reply and UDP 
sends to UE server port
+dst_port = dst_proto == PROTO_TCP ? s->port_uc : s->port_us;
+}
+else
+{
+src_port = s->port_pc;
+dst_port = s->port_us;
+}

Why you have to check "send socket" here? You perform the check with zero 
src_port and dst_proto.
The "send socket" always is present. If you scroll down at row 877 there is the 
same check and if "send socket" is not present the function returns an error.
I do not see value from this change and I am not sure this will work properly.
Correct me if I am wrong.

> +// cipher_null, des,  des3_ede, aes
 strcpy(l_enc_algo->alg_name,"cipher_null");
+if (strncasecmp(r_ealg.s,"aes-cbc",r_ealg.len) == 0) {
+LM_DBG("Creating security associations: AES\n");
+strcpy(l_enc_algo->alg_name,"aes");
+l_enc_algo->alg_key_len = ck.len * 4;
+string_to_key(l_enc_algo->alg_key, ck);
+}
+else if (strncasecmp(r_ealg.s,"des-ede3-cbc",r_ealg.len) == 0) {
+LM_DBG("Creating security associations: DES, ck.len=%d\n",ck.len);
+strcpy(l_enc_algo->alg_name,"des3_ede");
+str ck1;
+ck1.s = pkg_malloc (128);
+strncpy(ck1.s,ck.s,32);
+strncat(ck1.s,ck.s,16);
+ck1.len=32+16;
+
+l_enc_algo->alg_key_len = ck1.len * 4;
+string_to_key(l_enc_algo->alg_key, ck1);
+
+pkg_free(ck1.s);
+}

Is it a good idea cipher algorithm to be optional? Just add a new value in 
_cflags parameter in int ipsec_create(struct sip_msg* m, udomain_t* d, int 
_cflags) method.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2731#pullrequestreview-655573226___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] ims_ipsec_pcscf: more algorithms, SA improvements (#2731)

2021-05-10 Thread alexyosifov
@alexyosifov approved this pull request.

Added some comments

> @@ -846,11 +846,20 @@ int ipsec_forward(struct sip_msg* m, udomain_t* d, int 
> _cflags)
 // for Reply get the dest proto from the received request
 dst_proto = req->rcv.proto;
 
-// for Reply and TCP sends from P-CSCF server port, for Reply and UDP 
sends from P-CSCF client port
-src_port = dst_proto == PROTO_TCP ? s->port_ps : s->port_pc;
+// Check send socket

Why you have to check "send socket" here? You perform the check with zero 
src_port and dst_proto.
The "send socket" always is present. If you scroll down at row 877 there is the 
same check and if "send socket" is not present the function returns an error.
I do not see value from this change and I am not sure this will work properly.
Correct me if I am wrong.

>  strcpy(l_enc_algo->alg_name,"cipher_null");
+if (strncasecmp(r_ealg.s,"aes-cbc",r_ealg.len) == 0) {

Is it a good idea cipher algorithm to be optional? Just add a new value in 
_cflags parameter in int ipsec_create(struct sip_msg* m, udomain_t* d, int 
_cflags) method.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2731#pullrequestreview-64158___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] ims_ipsec_pcscf: more algorithms, SA improvements (#2731)

2021-05-10 Thread Henning Westerholt
@henningw commented on this pull request.

Thanks for the pull request, i have added one comment regarding the time 
handling. Are there module any documentation updates necessary as well?

> @@ -100,8 +100,15 @@ static void string_to_key(char* dst, const str 
> key_string)
 }
 }
 
+static uint choose_nlmsg_seq (void)

Any particular reason why you choose to implement this function instead of the 
previous time(0) call? The clock_gettime() function is not available at Mac OS, 
and probably need a wrapper around it as e.g. in the cdp module. If not 
necessary, we should probably stay with the previous way.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2731#pullrequestreview-655517861___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] is_first_hop() support for FQDN in RR header in a case of reply (#2732)

2021-05-10 Thread Igor Olhovskiy
Daniel, thanks for the clarification, really missed the option it's working 
only with IP addresses. Then it's definitely not a bug.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2732#issuecomment-836554546___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] ims_ipsec_pcscf: more algorithms, SA improvements (#2731)

2021-05-10 Thread Daniel-Constantin Mierla
@alexyosifov - given that you contributed recently to this module, do you have 
any comment on this PR?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2731#issuecomment-836553802___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] when use pcscf_unregister behind nat (#2729)

2021-05-10 Thread Daniel-Constantin Mierla
Do not give links to screenshots (nor embed screenshots) if they are to show 
log messages. Simply copy and paste the log messages here, because it makes it 
easier to search for them in the source code.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2729#issuecomment-836551458___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] is_first_hop() not processing FQDN in RR header in a case of reply (#2732)

2021-05-10 Thread Daniel-Constantin Mierla
For replies, the function `is_first_hop()` is a best effort attempt to figure 
out if the proxy is the node next to the callee and cannot detect spirals. See 
the readme explaining what it does for a reply.

The parsing of the IP in the record route header is needed to match the source 
IP and detect loops, this is by design and needed for the expected behaviour.

A new function (or parameter) can be added to control if one needs to detect 
loops or not, based on how its SIP routing is designed through the proxy.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2732#issuecomment-836548588___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] [kamailio/kamailio] is_first_hop() not processing FQDN in RR header in a case of reply (#2732)

2021-05-10 Thread Igor Olhovskiy
### Description

In the case of using FQDN in 
`listen = ... advertise ... `
FQDN is populated in the `Record-Route` header. In this case `is_first_hop()` 
function is not returning true even if `FQDN == myself` in replies.

 Reproduction

Add FQND in advertise and check `is_first_hop()` result in a case of reply

 Log Messages

```
siputils [sipops.c:185]: is_first_hop(): uri host is not an ip address
```

### Possible Solutions

Not use `is_first_hop()` in the case of reply/FQDN in advertising.

### Additional Information

version: kamailio 5.4.4 (x86_64/linux) e16352
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, 
USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, 
DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, 
USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, 
BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: e16352 
compiled on 09:50:10 May  7 2021 with gcc 4.8.5


* **Operating System**:

```
# uname -a
Linux fe-0513-2-dev 3.10.0-1160.21.1.el7.x86_64 #1 SMP Tue Mar 16 18:28:22 UTC 
2021 x86_64 x86_64 x86_64 GNU/Linux

```
https://github.com/kamailio/kamailio/blob/02240711239149e2f5c4890a70ab158d10fa8187/src/modules/siputils/sipops.c#L183

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2732___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:cc2a9518: modules: readme files regenerated - uac ... [skip ci]

2021-05-10 Thread Kamailio Dev
Module: kamailio
Branch: master
Commit: cc2a9518207e36b7b18aef5c8714f0c21da3dd95
URL: 
https://github.com/kamailio/kamailio/commit/cc2a9518207e36b7b18aef5c8714f0c21da3dd95

Author: Kamailio Dev 
Committer: Kamailio Dev 
Date: 2021-05-10T09:46:22+02:00

modules: readme files regenerated - uac ... [skip ci]

---

Modified: src/modules/uac/README

---

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


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:ec600414: uac: docs for reg_use_domain parameter

2021-05-10 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: ec600414a3ba01e641beda6c11201b7185c879db
URL: 
https://github.com/kamailio/kamailio/commit/ec600414a3ba01e641beda6c11201b7185c879db

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2021-05-10T09:39:16+02:00

uac: docs for reg_use_domain parameter

---

Modified: src/modules/uac/doc/uac_admin.xml

---

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

---

diff --git a/src/modules/uac/doc/uac_admin.xml 
b/src/modules/uac/doc/uac_admin.xml
index 52362af1e3..b6184a6daa 100644
--- a/src/modules/uac/doc/uac_admin.xml
+++ b/src/modules/uac/doc/uac_admin.xml
@@ -582,6 +582,24 @@ modparam("uac", "reg_active", 0)

 ...
 modparam("uac", "reg_gc_interval", 60)
+...
+   
+   
+   
+   
+   reg_use_domain (int)
+   
+   If set to 1, domain part of URIs is used by 
functions doing
+   lookup on user name.
+   
+   
+   Default value is 
0.
+   
+   
+   Set reg_use_domain 
parameter
+   
+...
+modparam("uac", "reg_use_domain", 1)
 ...


@@ -647,8 +665,6 @@ end
  


-  
-  

 



___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:cd2abf6e: uac: exposed reg_use_domain via modparam

2021-05-10 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: cd2abf6e278539b31ebfd355acf841faf6121e25
URL: 
https://github.com/kamailio/kamailio/commit/cd2abf6e278539b31ebfd355acf841faf6121e25

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2021-05-10T09:34:47+02:00

uac: exposed reg_use_domain via modparam

- control if the lookup over username uses also domain

---

Modified: src/modules/uac/uac.c
Modified: src/modules/uac/uac_reg.c

---

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

---

diff --git a/src/modules/uac/uac.c b/src/modules/uac/uac.c
index 46503bf592..50873ef557 100644
--- a/src/modules/uac/uac.c
+++ b/src/modules/uac/uac.c
@@ -114,6 +114,7 @@ static int child_init(int rank);
 
 extern int reg_timer_interval;
 extern int _uac_reg_gc_interval;
+extern int _uac_reg_use_domain;
 
 static pv_export_t mod_pvs[] = {
{ {"uac_req", sizeof("uac_req")-1}, PVT_OTHER, pv_get_uac_req, 
pv_set_uac_req,
@@ -184,7 +185,8 @@ static param_export_t params[] = {
{"reg_random_delay",INT_PARAM,  
_random_delay  },
{"reg_active",  INT_PARAM,  _active_param  
},
{"reg_gc_interval", INT_PARAM,  &_uac_reg_gc_interval   
},
-   {"reg_hash_size",   INT_PARAM,  
_htable_size  },
+   {"reg_hash_size",   INT_PARAM,  _htable_size  },
+   {"reg_use_domain",  PARAM_INT,  &_uac_reg_use_domain  },
{"default_socket",  PARAM_STR, _default_socket},
{"event_callback",  PARAM_STR,  _event_callback},
{0, 0, 0}
diff --git a/src/modules/uac/uac_reg.c b/src/modules/uac/uac_reg.c
index c36ee8ac82..1ea1b62135 100644
--- a/src/modules/uac/uac_reg.c
+++ b/src/modules/uac/uac_reg.c
@@ -116,7 +116,7 @@ static reg_ht_t *_reg_htable = NULL;
 static reg_ht_t *_reg_htable_gc = NULL;
 static gen_lock_t *_reg_htable_gc_lock = NULL;
 
-int reg_use_domain = 0;
+int _uac_reg_use_domain = 0;
 int reg_timer_interval = 90;
 int reg_retry_interval = 0;
 int reg_htable_size = 4;
@@ -1630,7 +1630,7 @@ int  uac_reg_lookup(struct sip_msg *msg, str *src, 
pv_spec_t *dst, int mode)
LM_ERR("failed to parse uri\n");
return -2;
}
-   reg = reg_ht_get_byuser(, 
(reg_use_domain)?:NULL);
+   reg = reg_ht_get_byuser(, 
(_uac_reg_use_domain)?:NULL);
if(reg==NULL)
{
LM_DBG("no user: %.*s\n", src->len, src->s);
@@ -1673,7 +1673,7 @@ int uac_reg_status(struct sip_msg *msg, str *src, int 
mode)
LM_ERR("failed to parse uri\n");
return -1;
}
-   reg = reg_ht_get_byuser(, 
(reg_use_domain)?:NULL);
+   reg = reg_ht_get_byuser(, 
(_uac_reg_use_domain)?:NULL);
if(reg==NULL)
{
LM_DBG("no user: %.*s\n", src->len, src->s);
@@ -1717,7 +1717,7 @@ int uac_reg_request_to(struct sip_msg *msg, str *src, 
unsigned int mode)
reg = reg_ht_get_byuuid(src);
break;
case 1:
-   if(reg_use_domain)
+   if(_uac_reg_use_domain)
{
if (parse_uri(src->s, src->len, )!=0)
{


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:ea3ca819: uac: renamed parameter for kemi uac_reg_lookup_uri()

2021-05-10 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: ea3ca819bc07fed6b40bd6cc8f6f147dac66d9ca
URL: 
https://github.com/kamailio/kamailio/commit/ea3ca819bc07fed6b40bd6cc8f6f147dac66d9ca

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2021-05-10T09:28:31+02:00

uac: renamed parameter for kemi uac_reg_lookup_uri()

- be suggestive of its purpose in the index docs

---

Modified: src/modules/uac/uac.c

---

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

---

diff --git a/src/modules/uac/uac.c b/src/modules/uac/uac.c
index c7e181dc7c..46503bf592 100644
--- a/src/modules/uac/uac.c
+++ b/src/modules/uac/uac.c
@@ -684,7 +684,7 @@ static int w_uac_reg_lookup_uri(struct sip_msg* msg, char* 
src, char* dst)
return uac_reg_lookup(msg, , dpv, 1);
 }
 
-static int ki_uac_reg_lookup_uri(sip_msg_t* msg, str* userid, str* sdst)
+static int ki_uac_reg_lookup_uri(sip_msg_t* msg, str* suri, str* sdst)
 {
pv_spec_t *dpv = NULL;
dpv = pv_cache_get(sdst);
@@ -692,7 +692,7 @@ static int ki_uac_reg_lookup_uri(sip_msg_t* msg, str* 
userid, str* sdst)
LM_ERR("cannot get pv spec for [%.*s]\n", sdst->len, sdst->s);
return -1;
}
-   return uac_reg_lookup(msg, userid, dpv, 1);
+   return uac_reg_lookup(msg, suri, dpv, 1);
 }
 
 static int w_uac_reg_status(struct sip_msg* msg, char* src, char* p2)


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev