[sr-dev] [kamailio/kamailio] $xavi(...) (#2337)

2020-05-26 Thread Victor Seva




 Pre-Submission Checklist



- [x] Commit message has the format required by CONTRIBUTING guide
- [x] Commits are split per component (core, individual modules, libs, utils, 
...)
- [x] Each component has a single commit (if not, squash them into one commit)
- [x] No commits to README files for modules (changes must be done to docbook 
files
in `doc/` subfolder, the README file is autogenerated)

 Type Of Change
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)

 Checklist:

- [ ] PR should be backported to stable branches
- [x] Tested changes locally

 Description

This change introduces a new type of variable $xavi - eXtended Attribute Value 
Insensitive case.
It's like a $xavp but keys are case insensitive:

```
$xavi(WhatEver=>fOo) = 1;

if($xavi(whatever[0]=>foo) == 1) {

}
```
You can view, comment on, or merge this pull request online at:

  https://github.com/kamailio/kamailio/pull/2337

-- Commit Summary --

  * core: xavi api - like xavp but with insensitive case names
  * core: pv - define xavi types
  * core: receive - reset xavi list after message processing
  * tm: process xavi list in transaction contexts
  * pv: $xavi(...) config variables implementation

-- File Changes --

M src/core/pvar.h (4)
M src/core/receive.c (1)
M src/core/xavp.c (987)
M src/core/xavp.h (43)
M src/modules/pv/pv.c (539)
M src/modules/pv/pv_xavp.c (416)
M src/modules/pv/pv_xavp.h (7)
M src/modules/tm/h_table.c (12)
M src/modules/tm/h_table.h (3)
M src/modules/tm/t_hooks.c (6)
M src/modules/tm/t_reply.c (7)

-- Patch Links --

https://github.com/kamailio/kamailio/pull/2337.patch
https://github.com/kamailio/kamailio/pull/2337.diff

-- 
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/2337
___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:2a920bde: modules: readme files regenerated - corex ... [skip ci]

2020-05-26 Thread Kamailio Dev
Module: kamailio
Branch: master
Commit: 2a920bde45b78d7f31942590ed76a3e7b509213e
URL: 
https://github.com/kamailio/kamailio/commit/2a920bde45b78d7f31942590ed76a3e7b509213e

Author: Kamailio Dev 
Committer: Kamailio Dev 
Date: 2020-05-26T16:01:15+02:00

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

---

Modified: src/modules/corex/README

---

Diff:  
https://github.com/kamailio/kamailio/commit/2a920bde45b78d7f31942590ed76a3e7b509213e.diff
Patch: 
https://github.com/kamailio/kamailio/commit/2a920bde45b78d7f31942590ed76a3e7b509213e.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:35319cb5: corex: docs for dns_cache parameter

2020-05-26 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: 35319cb5c0cac7fd656d86e7419dbd3e497fcd92
URL: 
https://github.com/kamailio/kamailio/commit/35319cb5c0cac7fd656d86e7419dbd3e497fcd92

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2020-05-26T15:59:01+02:00

corex: docs for dns_cache parameter

---

Modified: src/modules/corex/doc/corex_admin.xml

---

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

---

diff --git a/src/modules/corex/doc/corex_admin.xml 
b/src/modules/corex/doc/corex_admin.xml
index f9572b54f0..203ada5d2f 100644
--- a/src/modules/corex/doc/corex_admin.xml
+++ b/src/modules/corex/doc/corex_admin.xml
@@ -93,6 +93,60 @@
 modparam("corex", "alias_subdomains", "kamailio.org")
 modparam("corex", "alias_subdomains", "udp:sip-router.org:5060")
 ...
+
+   
+   
+   
+   dns_cache (string)
+   
+   Add A or  records to internal DNS cache at startup. It can 
be set
+   many times to add more than one record.
+   
+   
+   The format of the value follows the SIP params style:
+   "attr1=val1;attr2=val2;...". The attributes can be:
+   
+   
+   
+   
+   type - it can be "A" (IPv4) or 
"" (IPv6)
+   
+   
+   
+   
+   name - the domain name
+   
+   
+   
+   
+   addr - the IP address
+   
+   
+   
+   
+   ttl - TTL value
+   
+   
+   
+   
+   flags - can be: 1 - the domain is 
unresolvable
+   (like blacklisted); 2 - the record is permanent (never 
times out,
+   never deleted, never overwritten)
+   
+   
+   
+   
+   
+   Default value is NULL.
+   
+   
+   
+   Set dns_cache parameter
+   
+...
+modparam("corex", "dns_cache", 
"type=A;name=kamailio.org;addr=193.22.119.66;ttl=360;flags=0")
+modparam("corex", "dns_cache", 
"type=;name=kamailio.org;addr=2a00:d60:0:400::2;ttl=360;flags=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:12b8bf9a: corex: new param dns_cache to add values to internal dns cache

2020-05-26 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: 12b8bf9a9c6e84d9b1dadaa08195a9c56b24cbe4
URL: 
https://github.com/kamailio/kamailio/commit/12b8bf9a9c6e84d9b1dadaa08195a9c56b24cbe4

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2020-05-26T15:45:10+02:00

corex: new param dns_cache to add values to internal dns cache

- it can be set many times
- the value is a param-like string with the prototype
  "type=rectype;name=domain;addr=ip;ttl=ival;flags=ival"
- type valye can be 'A' (IPv4) or '' (IPv6)
- flags can be:
  1 - the domain is unresolvable (like blacklisted)
  2 - the record is permanent (never times out, never deleted, never 
overwritten)

---

Modified: src/modules/corex/corex_mod.c

---

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

---

diff --git a/src/modules/corex/corex_mod.c b/src/modules/corex/corex_mod.c
index c0759e6ded..1f9abd497c 100644
--- a/src/modules/corex/corex_mod.c
+++ b/src/modules/corex/corex_mod.c
@@ -31,7 +31,9 @@
 #include "../../core/pvar.h"
 #include "../../core/fmsg.h"
 #include "../../core/kemi.h"
+#include "../../core/dns_cache.h"
 #include "../../core/parser/parse_uri.h"
+#include "../../core/parser/parse_param.h"
 
 #include "corex_lib.h"
 #include "corex_rpc.h"
@@ -67,6 +69,7 @@ static int w_is_faked_msg(sip_msg_t *msg, char *p1, char *p2);
 static int fixup_file_op(void** param, int param_no);
 
 int corex_alias_subdomains_param(modparam_t type, void *val);
+int corex_dns_cache_param(modparam_t type, void *val);
 
 static int  mod_init(void);
 static int  child_init(int);
@@ -141,6 +144,8 @@ static cmd_export_t cmds[]={
 static param_export_t params[]={
{"alias_subdomains",STR_PARAM|USE_FUNC_PARAM,
(void*)corex_alias_subdomains_param},
+   {"dns_cache",   PARAM_STR|USE_FUNC_PARAM,
+   (void*)corex_dns_cache_param},
{"nio_intercept",   INT_PARAM, &nio_intercept},
{"nio_min_msg_len", INT_PARAM, &nio_min_msg_len},
{"nio_msg_avp", PARAM_STR, &nio_msg_avp_param},
@@ -304,9 +309,88 @@ int corex_alias_subdomains_param(modparam_t type, void 
*val)
return corex_add_alias_subdomains((char*)val);
 error:
return -1;
+}
+
+int corex_dns_cache_param(modparam_t type, void *val)
+{
+   str sval;
+   param_t* params_list = NULL;
+   param_hooks_t phooks;
+   param_t *pit=NULL;
+   str dns_name = STR_NULL;
+   str dns_addr = STR_NULL;
+   unsigned short dns_type = 0;
+   int dns_ttl = 0;
+   int dns_flags = 0;
+
+   if(val==NULL) {
+   LM_ERR("invalid parameter\n");
+   goto error;
+   }
+   sval = *((str*)val);
+   if(sval.s==NULL || sval.len<=0) {
+   LM_ERR("invalid parameter value\n");
+   goto error;
+   }
+
+   if(sval.s[sval.len-1]==';') {
+   sval.len--;
+   }
+   if (parse_params(&sval, CLASS_ANY, &phooks, ¶ms_list)<0) {
+   return -1;
+   }
+
+   for (pit = params_list; pit; pit=pit->next) {
+   if (pit->name.len==4
+   && strncasecmp(pit->name.s, "name", 4)==0) {
+   dns_name = pit->body;
+   } else if (pit->name.len==4
+   && strncasecmp(pit->name.s, "addr", 4)==0) {
+   dns_addr = pit->body;
+   } else if (pit->name.len==4
+   && strncasecmp(pit->name.s, "type", 4)==0) {
+   if((pit->body.len == 1) && ((pit->body.s[0]=='a')
+   || (pit->body.s[0]=='A'))) {
+   dns_type = T_A;
+   } else if((pit->body.len == 4)
+   && strncasecmp(pit->name.s, "", 
4)==0) {
+   dns_type = T_;
+   }
+   } else if(pit->name.len==3
+   && strncasecmp(pit->name.s, "ttl", 3)==0) {
+   if(dns_ttl==0) {
+   if (str2sint(&pit->body, &dns_ttl) < 0) {
+   LM_ERR("invalid ttl: %.*s\n", 
pit->body.len, pit->body.s);
+   return -1;
+   }
+   }
+   } else if(pit->name.len==5
+   && strncasecmp(pit->name.s, "flags", 5)==0) {
+   if(dns_flags==0) {
+   if (str2sint(&pit->body, &dns_flags) < 0) {
+   LM_ERR("invalid flags: %.*s\n", 
pit->body.len, pit->body.s);
+   return -1;
+   }
+   }
+   }
+

[sr-dev] git:master:d2906da9: tls: better log messages when failing to create ssl ctx

2020-05-26 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: d2906da97d2429bfdff089203f933de2d282a86d
URL: 
https://github.com/kamailio/kamailio/commit/d2906da97d2429bfdff089203f933de2d282a86d

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2020-05-26T15:05:15+02:00

tls: better log messages when failing to create ssl ctx

---

Modified: src/modules/tls/tls_domain.c

---

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

---

diff --git a/src/modules/tls/tls_domain.c b/src/modules/tls/tls_domain.c
index 3932141f0e..a8859c4a31 100644
--- a/src/modules/tls/tls_domain.c
+++ b/src/modules/tls/tls_domain.c
@@ -1036,7 +1036,11 @@ static int ksr_tls_fix_domain(tls_domain_t* d, 
tls_domain_t* def)
d->ctx[i] = 
SSL_CTX_new((SSL_METHOD*)ssl_methods[d->method - 1]);
}
if (d->ctx[i] == NULL) {
-   ERR("%s: Cannot create SSL context\n", 
tls_domain_str(d));
+   unsigned long e = 0;
+   e = ERR_peek_last_error();
+   ERR("%s: Cannot create SSL context [%d] (%lu: %s / 
%s)\n",
+   tls_domain_str(d), i, e, 
ERR_error_string(e, NULL),
+   ERR_reason_error_string(e));
return -1;
}
if(d->method>TLS_USE_TLSvRANGE) {
@@ -1046,7 +1050,11 @@ static int ksr_tls_fix_domain(tls_domain_t* d, 
tls_domain_t* def)
/* libssl >= 1.1.0 */
d->ctx[i] = SSL_CTX_new(sr_tls_methods[d->method - 
1].TLSMethod);
if (d->ctx[i] == NULL) {
-   ERR("%s: Cannot create SSL context\n", 
tls_domain_str(d));
+   unsigned long e = 0;
+   e = ERR_peek_last_error();
+   ERR("%s: Cannot create SSL context [%d] (%lu: %s / 
%s)\n",
+   tls_domain_str(d), i, e, 
ERR_error_string(e, NULL),
+   ERR_reason_error_string(e));
return -1;
}
if(d->method>TLS_USE_TLSvRANGE) {


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


[sr-dev] git:master:8893e6f2: core: async task logging on no callback

2020-05-26 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: 8893e6f2b30577b065f11a406faf5c5935714f78
URL: 
https://github.com/kamailio/kamailio/commit/8893e6f2b30577b065f11a406faf5c5935714f78

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2020-05-26T09:24:17+02:00

core: async task logging on no callback

---

Modified: src/core/async_task.c

---

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

---

diff --git a/src/core/async_task.c b/src/core/async_task.c
index ee50412790..1045e0ab41 100644
--- a/src/core/async_task.c
+++ b/src/core/async_task.c
@@ -280,6 +280,8 @@ int async_task_run(int idx)
LM_DBG("task executed [%p] (%p/%p)\n", (void*)ptask,
(void*)ptask->exec, 
(void*)ptask->param);
ptask->exec(ptask->param);
+   } else {
+   LM_DBG("task with no callback function - ignoring\n");
}
shm_free(ptask);
}


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


[sr-dev] git:master:3e7278f2: tls: Makefile - option to link against libssl static libs

2020-05-26 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: 3e7278f28c43b830a197e2f7b212ec6f06e5acbf
URL: 
https://github.com/kamailio/kamailio/commit/3e7278f28c43b830a197e2f7b212ec6f06e5acbf

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2020-05-26T14:56:47+02:00

tls: Makefile - option to link against libssl static libs

---

Modified: src/modules/tls/Makefile

---

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

---

diff --git a/src/modules/tls/Makefile b/src/modules/tls/Makefile
index 1505bc64ea..f3c15bb724 100644
--- a/src/modules/tls/Makefile
+++ b/src/modules/tls/Makefile
@@ -8,6 +8,13 @@ include ../../Makefile.defs
 auto_gen=
 NAME=tls.so
 
+# set to yes when wanting to link with static libraries
+LIBSSL_STATIC ?= no
+# set to yes when wanting to link with static libraries compiled from source
+LIBSSL_STATIC_SRCLIB ?= no
+# set to the path of the folder with static libraries compiled from source
+LIBSSL_STATIC_SRCPATH ?= /usr/local/src/openssl
+
 ifeq ($(CROSS_COMPILE),)
 SSL_BUILDER=$(shell \
if pkg-config --exists libssl; then \
@@ -16,8 +23,21 @@ SSL_BUILDER=$(shell \
 endif
 
 ifneq ($(SSL_BUILDER),)
+ifneq ($(LIBSSL_STATIC),yes)
DEFS += $(shell $(SSL_BUILDER) --cflags)
LIBS += $(shell $(SSL_BUILDER) --libs)
+else
+ifneq ($(LIBSSL_STATIC_SRCLIB),yes)
+   ## when static libs (*.a) from packages are compiled with -fPIC
+   DEFS += $(shell $(SSL_BUILDER) --cflags)
+   LIBS += $(shell $(SSL_BUILDER) --libs-only-L)
+   LIBS += -l:libssl.a -l:libcrypto.a -l:libz.a -l:libdl.a
+else
+   ## when linking against static libs compiled from sources
+   DEFS += -I$(LIBSSL_STATIC_SRCPATH)/include
+   LIBS += $(LIBSSL_STATIC_SRCPATH)/libssl.a 
$(LIBSSL_STATIC_SRCPATH)/libcrypto.a
+endif # ifneq ($(LIBSSL_STATIC_SRCLIB),yes)
+endif # ifneq ($(LIBSSL_STATIC),yes)
 else
DEFS += -I$(LOCALBASE)/ssl/include
LIBS += -L$(LOCALBASE)/lib -L$(LOCALBASE)/ssl/lib \


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


[sr-dev] [kamailio/kamailio] dispatcher: add attrs param to rpc 'add' call (#2336)

2020-05-26 Thread Federico Cabiddu




 Pre-Submission Checklist



- [x] Commit message has the format required by CONTRIBUTING guide
- [x] Commits are split per component (core, individual modules, libs, utils, 
...)
- [x] Each component has a single commit (if not, squash them into one commit)
- [x] No commits to README files for modules (changes must be done to docbook 
files
in `doc/` subfolder, the README file is autogenerated)

 Type Of Change
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)

 Checklist:

- [ ] PR should be backported to stable branches
- [x] Tested changes locally
- [ ] Related to issue # (replace  with an open issue number)

 Description

Expands the rpc 'add' command allowing to specify the "attrs" 
body.
You can view, comment on, or merge this pull request online at:

  https://github.com/kamailio/kamailio/pull/2336

-- Commit Summary --

  * dispatcher: add attrs param to rpc 'add' call

-- File Changes --

M src/modules/dispatcher/dispatch.c (11)
M src/modules/dispatcher/dispatch.h (2)
M src/modules/dispatcher/dispatcher.c (5)
M src/modules/dispatcher/doc/dispatcher_admin.xml (6)

-- Patch Links --

https://github.com/kamailio/kamailio/pull/2336.patch
https://github.com/kamailio/kamailio/pull/2336.diff

-- 
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/2336
___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev