[sr-dev] git:5.7:d411c6ea: dialog: don't send the BYE if dialog is in deleted state (#3714)

2024-01-16 Thread Federico Cabiddu via sr-dev
Module: kamailio
Branch: 5.7
Commit: d411c6ea4358e6d9dd367349e877ed5f5bf4bb2f
URL: 
https://github.com/kamailio/kamailio/commit/d411c6ea4358e6d9dd367349e877ed5f5bf4bb2f

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2024-01-16T09:51:14+01:00

dialog: don't send the BYE if dialog is in deleted state (#3714)

(cherry picked from commit 695f155f3a127f0bbe220a6b44a0fc3887e1e4be)

---

Modified: src/modules/dialog/dlg_req_within.c

---

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

---

diff --git a/src/modules/dialog/dlg_req_within.c 
b/src/modules/dialog/dlg_req_within.c
index aab22da3c64..fb5f2e51e32 100644
--- a/src/modules/dialog/dlg_req_within.c
+++ b/src/modules/dialog/dlg_req_within.c
@@ -383,6 +383,14 @@ static inline int send_bye(struct dlg_cell *cell, int dir, 
str *hdrs)
dlg_iuid_t *iuid = NULL;
str lhdrs;
 
+   /* dialog is already in deleted state, nothing to do */
+   if(cell->state == DLG_STATE_DELETED) {
+   LM_WARN("dlg [%u:%u] with callid %.*s already in deleted state, 
BYE "
+   "not sent.\n",
+   cell->h_entry, cell->h_id, cell->callid.len, 
cell->callid.s);
+   return 0;
+   }
+
/* Send Cancel or final response for non-confirmed dialogs */
if(cell->state != DLG_STATE_CONFIRMED_NA
&& cell->state != DLG_STATE_CONFIRMED) {

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


[sr-dev] Re: [kamailio/kamailio] dialog: don't send the BYE if dialog is in deleted state (PR #3714)

2024-01-16 Thread Federico Cabiddu via sr-dev
Merged #3714 into master.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3714#event-11495736901
You are receiving this because you are subscribed to this thread.

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


[sr-dev] [kamailio/kamailio] dialog: don't send the BYE if dialog is in deleted state (PR #3714)

2024-01-15 Thread Federico Cabiddu via sr-dev
!-- Kamailio Pull Request Template --

!--
IMPORTANT:
  - for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
  - pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
  - backports to stable branches must be done with git cherry-pick -x 
...
  - code is contributed under BSD for core and main components (tm, sl, auth, 
tls)
  - code is contributed GPLv2 or a compatible license for the other components
  - GPL code is contributed with OpenSSL licensing exception
--

 Pre-Submission Checklist
!-- Go over all points below, and after creating the PR, tick all the 
checkboxes that apply --
!-- All points should be verified, otherwise, read the CONTRIBUTING 
guidelines from above--
!-- If youre unsure about any of these, dont hesitate to ask on 
sr-dev mailing list --
- [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
- [X] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)

 Checklist:
!-- Go over all points below, and after creating the PR, tick the 
checkboxes that apply --
- [X] PR should be backported to stable branches
- [X] Tested changes locally
- [ ] Related to issue # (replace  with an open issue number)

 Description
!-- Describe your changes in detail --
Weve recently been exeperiencing a core dump in dialog module. The core 
dump was caused by trying to terminate via rpc command a dialog that had just 
been terminated by one of the parties sending a BYE. Thats because 
send_bye threats a deleted dialog as a non confimed one 
(https://github.com/kamailio/kamailio/blob/404b47791678c4eaccd4cfc7a83e0bb97a29b5d3/src/modules/dialog/dlg_req_within.c#L387)
 and tries then to access a transaction that does not exist anymore 
(https://github.com/kamailio/kamailio/blob/404b47791678c4eaccd4cfc7a83e0bb97a29b5d3/src/modules/dialog/dlg_req_within.c#L391)
 and crashes. 
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * dialog: dont send the BYE if dialog is in deleted state

-- File Changes --

M src/modules/dialog/dlg_req_within.c (7)

-- Patch Links --

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

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3714
You are receiving this because you are subscribed to this thread.

Message ID: kamailio/kamailio/pull/3...@github.com
___
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org


[sr-dev] [kamailio/kamailio] http_async_client: exit mod_init if tm is not loaded (PR #3706)

2024-01-09 Thread Federico Cabiddu via sr-dev
!-- Kamailio Pull Request Template --

!--
IMPORTANT:
  - for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
  - pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
  - backports to stable branches must be done with git cherry-pick -x 
...
  - code is contributed under BSD for core and main components (tm, sl, auth, 
tls)
  - code is contributed GPLv2 or a compatible license for the other components
  - GPL code is contributed with OpenSSL licensing exception
--

 Pre-Submission Checklist
!-- Go over all points below, and after creating the PR, tick all the 
checkboxes that apply --
!-- All points should be verified, otherwise, read the CONTRIBUTING 
guidelines from above--
!-- If youre unsure about any of these, dont hesitate to ask on 
sr-dev mailing list --
- [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
- [X] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)

 Checklist:
!-- Go over all points below, and after creating the PR, tick the 
checkboxes that apply --
- [X] PR should be backported to stable branches
- [X] Tested changes locally
- [ ] Related to issue # (replace  with an open issue number)

 Description
!-- Describe your changes in detail --

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

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

-- Commit Summary --

  * http_async_client: exit mod_init if tm is not loaded

-- File Changes --

M src/modules/http_async_client/http_async_client_mod.c (2)

-- Patch Links --

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

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3706
You are receiving this because you are subscribed to this thread.

Message ID: kamailio/kamailio/pull/3...@github.com
___
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org


[sr-dev] [kamailio/kamailio] Makefile.groups: add dlgs and sworker to extra modules (PR #3684)

2023-12-20 Thread Federico Cabiddu via sr-dev
 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
- [X] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)

 Checklist:
!-- Go over all points below, and after creating the PR, tick the 
checkboxes that apply --
- [X] PR should be backported to stable branches
- [X] Tested changes locally
- [ ] Related to issue # (replace  with an open issue number)

 Description
Currently dlgs and sworker modules are not packaged. We propose with this PR to 
add them to the extra modules list.
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * Makefile.groups: add dlgs and sworker to extra modules

-- File Changes --

M src/Makefile.groups (2)

-- Patch Links --

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

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3684
You are receiving this because you are subscribed to this thread.

Message ID: kamailio/kamailio/pull/3...@github.com
___
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org


[sr-dev] git:master:ef2ea73f: tsilo: add new return code to ts_append and document it

2022-10-13 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: ef2ea73f044a1421b25734d4773bd2dacaab1165
URL: 
https://github.com/kamailio/kamailio/commit/ef2ea73f044a1421b25734d4773bd2dacaab1165

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2022-10-13T15:42:56+02:00

tsilo: add new return code to ts_append and document it

---

Modified: src/modules/tsilo/doc/tsilo_admin.xml
Modified: src/modules/tsilo/ts_append.c

---

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

---

diff --git a/src/modules/tsilo/doc/tsilo_admin.xml 
b/src/modules/tsilo/doc/tsilo_admin.xml
index 965c339156f..2a258ba15cb 100644
--- a/src/modules/tsilo/doc/tsilo_admin.xml
+++ b/src/modules/tsilo/doc/tsilo_admin.xml
@@ -139,7 +139,7 @@ modparam("tsilo", "use_domain", 1)
 if (is_method("INVITE")) {
 if (t_newtran()) {
 ts_store();
-# t_store("sip:alice@$td");
+# ts_store("sip:alice@$td");
 }
 }
 ...
@@ -170,6 +170,20 @@ if (is_method("INVITE")) {



+   Return codes:
+   
+   
+   
+   1 - branches added.
+   
+   
+   -1 - an internal error has 
produced (parsing error, memory error).
+   
+   
+  -2 - no records found for the r-uri.
+   
+   
+   

This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.

@@ -223,6 +237,20 @@ if (is_method("REGISTER")) {



+   Return codes:
+   
+   
+   
+   1 - branches added.
+   
+   
+   -1 - an internal error has 
produced (parsing error, memory error).
+   
+   
+  -2 - no records found for the r-uri.
+   
+   
+   

This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.

diff --git a/src/modules/tsilo/ts_append.c b/src/modules/tsilo/ts_append.c
index fece9b40970..dd01b0a7d3a 100644
--- a/src/modules/tsilo/ts_append.c
+++ b/src/modules/tsilo/ts_append.c
@@ -61,7 +61,7 @@ int ts_append(struct sip_msg* msg, str *ruri, str *contact, 
char *table) {
/* parse contact if given */
if(contact->s != NULL && contact->len != 0) {
if (parse_uri(contact->s, contact->len, _uri) < 0) {
-   LM_ERR("failed to parse contact %.*s\n", ruri->len, 
ruri->s);
+   LM_ERR("failed to parse contact %.*s\n", contact->len, 
contact->s);
return -1;
}
}
@@ -72,9 +72,9 @@ int ts_append(struct sip_msg* msg, str *ruri, str *contact, 
char *table) {
res = get_ts_urecord(t_uri, &_r);
 
if (res != 0) {
-   LM_ERR("failed to retrieve record for %.*s\n", t_uri->len, 
t_uri->s);
+   LM_DBG("no record for %.*s\n", t_uri->len, t_uri->s);
unlock_entry_by_ruri(t_uri);
-   return -1;
+   return -2;
}
 
/* cycle through existing transactions */


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


Re: [sr-dev] Info: sipexer v1.0.0 - sip cli tool

2022-02-16 Thread Federico Cabiddu
Very cool Daniel, thank you!

Federico

On Mon, Feb 14, 2022 at 3:02 PM Daniel-Constantin Mierla 
wrote:

> Hello,
>
> I want to announce the availability of sipexer v1.0.0 - a sip cli tool
> that can facilitate testing and monitoring of SIP signalling systems. It
> tries to have a modern approach, with a flexible templating system,
> supporting both IPv4 and IPv6 with all the common transport layers,
> respectively UDP, TCP, TLS and WebSocket (for WebRTC).
>
> The project can be found at:
>
>   * https://github.com/miconda/sipexer
>
> It is written in Go language for better portability, binaries for Linux,
> MacOS and Windows are made available for download in the release page:
>
>   * https://github.com/miconda/sipexer/releases/tag/v1.0.0
>
> Among its features:
>
>   *  send OPTIONS request (quick SIP ping to check if server is alive)
>   *  do registration and un-registration with customized expires value
> and contact URI
>   *  authentication with plain or HA1 passwords
>   *  set custom SIP headers
>   *  template system for building SIP requests
>   *  fields in the templates can be set via command line parameters or a
> JSON file
>   *  variables for setting field values (e.g., random number, data,
> time, environment variables, uuid, random string, …)
>   *  simulate SIP calls at signalling layer (INVITE-wait-BYE)
>   *  respond to requests coming during SIP calls (e.g., OPTIONS keepalives)
>   *  send instant messages with SIP MESSAGE requests
>   *  color output mode for easier troubleshooting
>   *  support for many transport layers: IPv4 and IPv6, UDP, TCP, TLS and
> WebSocket (for WebRTC)
>   *  send SIP requests of any type (e.g., INFO, SUBSCRIBE, NOTIFY, …)
>
> One usage example that could ease the testing of Kamailio is initiating
> registrations or simulating calls over WebSocket without the need of
> having a JavaScript soft phone application running in a web browser.
>
> Cheers,
> Daniel
>
> --
> Daniel-Constantin Mierla
> http://www.asipto.com
>
>
> ___
> Kamailio (SER) - Development Mailing List
> sr-dev@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
>
___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:5.4:c09e6453: core: tcp - add alias for cinfo dst IP

2021-10-24 Thread Federico Cabiddu
Module: kamailio
Branch: 5.4
Commit: c09e6453db91cc71b1d853b05601a53869718550
URL: 
https://github.com/kamailio/kamailio/commit/c09e6453db91cc71b1d853b05601a53869718550

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2021-10-24T11:12:17+02:00

core: tcp - add alias for cinfo dst IP

(cherry picked from commit 110200ce8e5c4cf7500e57e27a23f76e18044ad5)

---

Modified: src/core/tcp_main.c

---

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

---

diff --git a/src/core/tcp_main.c b/src/core/tcp_main.c
index 84fec376a3..f657b05571 100644
--- a/src/core/tcp_main.c
+++ b/src/core/tcp_main.c
@@ -1478,7 +1478,12 @@ inline static struct tcp_connection*  tcpconn_add(struct 
tcp_connection *c)
 * the second alias is for (peer_ip, peer_port, local_addr, 0) 
-- for
 *  finding any conenction to peer_ip, peer_port from 
local_addr 
 * the third alias is for (peer_ip, peer_port, local_addr, 
local_port) 
-*   -- for finding if a fully specified connection exists */
+*   -- for finding if a fully specified connection exists 
+* the fourth alias is for (peer_ip, peer_port, cinfo_addr, 0) 
-- for
+*  finding any connection to peer_ip, peer_port from address 
stored into cinfo (e.g. when proxy protocol is used)
+* the fifth alias is for (peer_ip, peer_port, cinfo_addr, 
cinfo_port) 
+*   -- for finding if a fully specified connection exists 
using address
+*  and port stored into cinfo*/
_tcpconn_add_alias_unsafe(c, c->rcv.src_port, _ip, 0,

new_conn_alias_flags);
if (likely(c->rcv.dst_ip.af && ! ip_addr_any(>rcv.dst_ip))){
@@ -1487,6 +1492,14 @@ inline static struct tcp_connection*  tcpconn_add(struct 
tcp_connection *c)
_tcpconn_add_alias_unsafe(c, c->rcv.src_port, 
>rcv.dst_ip,

c->rcv.dst_port, new_conn_alias_flags);
}
+   if (unlikely(c->cinfo.dst_ip.af && ! 
ip_addr_any(>cinfo.dst_ip) &&
+   ! 
ip_addr_cmp(>rcv.dst_ip, >cinfo.dst_ip))){
+   _tcpconn_add_alias_unsafe(c, c->rcv.src_port, 
>cinfo.dst_ip, 0,
+   
new_conn_alias_flags);
+   _tcpconn_add_alias_unsafe(c, c->rcv.src_port, 
>cinfo.dst_ip, c->cinfo.dst_port,
+   
new_conn_alias_flags);
+   }
+
/* ignore add_alias errors, there are some valid cases when one
 *  of the add_alias would fail (e.g. first add_alias for 2 
connections
 *   with the same destination but different src. ip*/
@@ -1604,7 +1617,8 @@ struct tcp_connection* _tcpconn_find(int id, struct 
ip_addr* ip, int port,
((l_port==0) || 
(l_port==a->parent->rcv.dst_port)) &&
(ip_addr_cmp(ip, 
>parent->rcv.src_ip)) &&
(is_local_ip_any ||
-   ip_addr_cmp(l_ip, 
>parent->rcv.dst_ip))
+   ip_addr_cmp(l_ip, 
>parent->rcv.dst_ip) ||
+   ip_addr_cmp(l_ip, 
>parent->cinfo.dst_ip))
   ) {
LM_DBG("found connection by peer address (id: 
%d)\n",
a->parent->id);


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


[sr-dev] git:5.5:e43ea4b3: core: tcp - add alias for cinfo dst IP

2021-10-24 Thread Federico Cabiddu
Module: kamailio
Branch: 5.5
Commit: e43ea4b3e011e410ec36bb470889170f836e93b5
URL: 
https://github.com/kamailio/kamailio/commit/e43ea4b3e011e410ec36bb470889170f836e93b5

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2021-10-24T11:12:03+02:00

core: tcp - add alias for cinfo dst IP

(cherry picked from commit 110200ce8e5c4cf7500e57e27a23f76e18044ad5)

---

Modified: src/core/tcp_main.c

---

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

---

diff --git a/src/core/tcp_main.c b/src/core/tcp_main.c
index 3b46026027..4338806ce6 100644
--- a/src/core/tcp_main.c
+++ b/src/core/tcp_main.c
@@ -1478,7 +1478,12 @@ inline static struct tcp_connection*  tcpconn_add(struct 
tcp_connection *c)
 * the second alias is for (peer_ip, peer_port, local_addr, 0) 
-- for
 *  finding any conenction to peer_ip, peer_port from 
local_addr 
 * the third alias is for (peer_ip, peer_port, local_addr, 
local_port) 
-*   -- for finding if a fully specified connection exists */
+*   -- for finding if a fully specified connection exists 
+* the fourth alias is for (peer_ip, peer_port, cinfo_addr, 0) 
-- for
+*  finding any connection to peer_ip, peer_port from address 
stored into cinfo (e.g. when proxy protocol is used)
+* the fifth alias is for (peer_ip, peer_port, cinfo_addr, 
cinfo_port) 
+*   -- for finding if a fully specified connection exists 
using address
+*  and port stored into cinfo*/
_tcpconn_add_alias_unsafe(c, c->rcv.src_port, _ip, 0,

new_conn_alias_flags);
if (likely(c->rcv.dst_ip.af && ! ip_addr_any(>rcv.dst_ip))){
@@ -1487,6 +1492,14 @@ inline static struct tcp_connection*  tcpconn_add(struct 
tcp_connection *c)
_tcpconn_add_alias_unsafe(c, c->rcv.src_port, 
>rcv.dst_ip,

c->rcv.dst_port, new_conn_alias_flags);
}
+   if (unlikely(c->cinfo.dst_ip.af && ! 
ip_addr_any(>cinfo.dst_ip) &&
+   ! 
ip_addr_cmp(>rcv.dst_ip, >cinfo.dst_ip))){
+   _tcpconn_add_alias_unsafe(c, c->rcv.src_port, 
>cinfo.dst_ip, 0,
+   
new_conn_alias_flags);
+   _tcpconn_add_alias_unsafe(c, c->rcv.src_port, 
>cinfo.dst_ip, c->cinfo.dst_port,
+   
new_conn_alias_flags);
+   }
+
/* ignore add_alias errors, there are some valid cases when one
 *  of the add_alias would fail (e.g. first add_alias for 2 
connections
 *   with the same destination but different src. ip*/
@@ -1604,7 +1617,8 @@ struct tcp_connection* _tcpconn_find(int id, struct 
ip_addr* ip, int port,
((l_port==0) || 
(l_port==a->parent->rcv.dst_port)) &&
(ip_addr_cmp(ip, 
>parent->rcv.src_ip)) &&
(is_local_ip_any ||
-   ip_addr_cmp(l_ip, 
>parent->rcv.dst_ip))
+   ip_addr_cmp(l_ip, 
>parent->rcv.dst_ip) ||
+   ip_addr_cmp(l_ip, 
>parent->cinfo.dst_ip))
   ) {
LM_DBG("found connection by peer address (id: 
%d)\n",
a->parent->id);


___
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] core: tcp - add alias for cinfo dst IP (PR #2888)

2021-10-22 Thread Federico Cabiddu
Thanks for merging Henning. Should we backport it also to stable branches?

-- 
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/2888#issuecomment-949314462___
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] core: tcp - add alias for cinfo dst IP (PR #2888)

2021-10-20 Thread Federico Cabiddu
Right, I've added a comment and force pushed.

-- 
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/2888#issuecomment-947476905___
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] core: tcp - add alias for cinfo dst IP (PR #2888)

2021-10-20 Thread Federico Cabiddu
@grumvalski pushed 1 commit.

86d897534d5c814de1f87744f8d5d6ca6a35f384  core: tcp - add alias for cinfo dst IP


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/kamailio/kamailio/pull/2888/files/3bd59bb17a575a4d369799887b98981b20ea076b..86d897534d5c814de1f87744f8d5d6ca6a35f384
___
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] core: tcp - add alias for cinfo dst IP (PR #2888)

2021-10-20 Thread Federico Cabiddu
Hi Henning, that's a good question. Currently the cinfo struct of the tcp 
connection is only filled by the proxy protocol parsing (oterwise is init to 
null) so the check when adding the alias gives the same results (we also chek 
that the dst IP there is different from the one stored in rcv, to not have 
duplicate aliases). I've chosen this approach in case that, for other reasons, 
in the future, we have cinfo != rcv in the connection struct.

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


Re: [sr-dev] TLS connection issue

2021-10-20 Thread Federico Cabiddu
Hi Lorenzo,
the question might be stupid, but do you have in your configuration a
listen directive (https://www.kamailio.org/wiki/cookbooks/5.5.x/core#listen)
on port 5061?
Cheers,

Federico

On Wed, Oct 20, 2021 at 8:03 AM Lorenzo Campo  wrote:

> Hi guys,
>
> We are quite newby about Kamailio and we are trying to use it as a load
> balancer. While installing certificates we started having problems.
>
> We use Kamailio (vers. 5.5) deployed on a VM (Ubuntu, 20.04 LTS).
>
> We cannot connect via TLS Kamailio VM with clients or other TCP VM.
>
> Our Kamailio currently exposes only port 5060 in UDP and TCP.
>
> Even doing a port scan on localhost, port 5061, used for the TLS protocol,
> is instead closed.
>
> There are 3 things worth noting:
>
> - All ports for all protocols are open on the firewall;
> - Before we set the disable_tcp option to "no", the 5060 was only
> reachable in UDP;
> - Even if you put a non-existent certificate, the system does not return
> an error so we cannot understand if the goodness of the certificates
> affects the opening of the door. Furthermore, we did not find any different
> behavior when switching from crt format (key for the private key) to PEM.
>
> If someone can help us would be very appreciated.
>
> Thank you very much
>
> Here is our tls configuration:
>
> kamailio.cfg
>
> #!define WITH_TLS 1
>
> ...
>
> disable_tcp=no
>
> auto_aliases=no
>
> ….
>
> loadmodule "sl.so"
>
> loadmodule "tls.so"
>
> ...
>
> modparam("tls", "private_key", "/etc/kamailio/key.pem")
>
> modparam("tls", "certificate", "/etc/kamailio/crt.pem")
>
> modparam("tls", "ca_list", "/etc/kamailio/ca.pem")
>
> enable_tls=yes
>
>
> tls.config
>
> [server:default]
>
> method = TLSv1.2+
>
> verify_certificate = no
>
> require_certificate = no
>
> private_key = /etc/kamailio/kamailio-selfsigned.key
>
> certificate = /etc/kamailio/kamailio-selfsigned.pem
>
> #ca_list = /etc/kamailio/tls/cacert.pem
>
> #crl = /etc/kamailio/tls/crl.pem
>
> [client:default]
>
> #method = TLSv1.2+
>
> verify_certificate = no
>
> require_certificate = no
>
> *Sent with Shift
> *
>
> ___
> Kamailio (SER) - Development Mailing List
> sr-dev@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
>
___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] [kamailio/kamailio] core: tcp - add alias for cinfo dst IP (PR #2888)

2021-10-19 Thread Federico Cabiddu
!-- Kamailio Pull Request Template --

!--
IMPORTANT:
  - for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
  - pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
  - backports to stable branches must be done with git cherry-pick -x 
...
  - code is contributed under BSD for core and main components (tm, sl, auth, 
tls)
  - code is contributed GPLv2 or a compatible license for the other components
  - GPL code is contributed with OpenSSL licensing exception
--

 Pre-Submission Checklist
!-- Go over all points below, and after creating the PR, tick all the 
checkboxes that apply --
!-- All points should be verified, otherwise, read the CONTRIBUTING 
guidelines from above--
!-- If youre unsure about any of these, dont hesitate to ask on 
sr-dev mailing list --
- [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
- [X] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)

 Checklist:
!-- Go over all points below, and after creating the PR, tick the 
checkboxes that apply --
- [X] PR should be backported to stable branches
- [X] Tested changes locally
- [ ] Related to issue # (replace  with an open issue number)

 Description
!-- Describe your changes in detail --
As I reported to developers mailing list 
(https://lists.kamailio.org/pipermail/sr-dev/2021-October/064243.html) if 
support for proxy protocol is enabled, kamailio is not able to match a tcp 
DEST_IP/DEST_PORT to an alias of an already existing tcp connection. 
This beacause the (local) destination ip on which the connection was initiated 
is overwritten by the destination IP and port carried by the proxy protocol 
header. Since the original connection info is saved when parsing the ortocol we 
can use that information to build a new alias and to use it to match outgoing 
tcp connection later.
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * https://github.com/kamailio/kamailio/pull/2888/commits/3bd59bb17a575a4d369799887b98981b20ea076b;>core:
 tcp - add alias for cinfo dst IP

-- File Changes --

M src/core/tcp_main.c (11)

-- Patch Links --

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


Re: [sr-dev] Proxy protocol issue

2021-10-18 Thread Federico Cabiddu
Hi Arsen and Sergey,
actually the protocol's specs say that the destination ip and port fields
of the protocol have to be considered as "the ones the server would get
using getsockname()", so Arsen is right and the implementation in kamailio
is strictly correct.
However, as I said, this implementation is preventing kamailio from
re-using the already established tcp connection for sending messages to the
connection initiator, e.g. in-dialog messages for a call.
I can force the tcp connection to be used for such messages by means of
tcp_set_otcipd (
https://kamailio.org/docs/modules/devel/modules/tcpops.html#tcpops.f.tcp_set_otcpid),
e.g. saving the tcp connection id into a Record-Route parameter to be
retrieved during loose routed messages handling, I think that a tcp alias
reflecting the original destination ip/port could be added to the aliases'
list, to make the re-usage transparent.
I'll prepare a PR for this.
Thanks for the feedback.

Federico



On Fri, Oct 15, 2021 at 2:25 PM Arsen Semenov  wrote:

> Hi Sergey,
> What Frederico talks about wouldn't lead to opening a new connection
> towards LB/HAproxy, instead Kamailio should find a connection by alias and
> re-use it.
>
> Frederico, I did not test with commenting the dst ip overwriting, in my
> tests I was trying to find a connection by using 0 for local_ip for calls
> originated from behind proxy protocol, it was working, but I'm not sure
> this is the best option here.
>
> I am wondering if there is anyone who actually uses proxy protocol in DSR
> scenarios?
> maybe really need to change it in order to make "sending msg back"
> working.
>
> On Fri, Oct 15, 2021 at 4:44 PM Sergey Safarov 
> wrote:
>
>> Hi Federico
>> Here is also another issue here.
>> I do know how to HAproxy UDP messages but let talk about TCP/TLS
>> connections.
>> Imagine you know which socket ned to use to establish a new connection.
>>
>> But you are not able to do it. Because HAproxy do not provide the ability
>> to establish a connection from the backend server to the client.
>> So real socket knowled do not help you. This do work with HAproxy servers.
>>
>> What you can, establish a direct connection from Kamailio to the client
>> using a different socket with a different "advertise" keyword.
>>
>> You anyway need another socket.
>> Any socket that you want.
>>
>> Maybe you need anycast Kamailio installation?
>>
>> Sergey
>>
>> On Fri, Oct 15, 2021 at 2:27 PM Federico Cabiddu <
>> federico.cabi...@gmail.com> wrote:
>>
>>> Hi Arsen,
>>> the issue is exactly that kamailio behind HA LB DON'T reuse the same
>>> connection because there is no tcp alias for CLIENT_IP/LOCAL_KAMAILIO_IP,
>>> because the kamailio local socket has been overwritten by the balancer IP.
>>> I've read the specification and nowhere is written that the load balancer
>>> IP must overwrite the local socket information. With the actual
>>> implementation it is impossible to send back a message (not a reply, a
>>> brand new one) to the client, because there is no matching tcp alias (I've
>>> done a quite deep debug). Proxy protocol was mainly taught for
>>> unidirectional flows (http), not for SIP. IMHO it is useless , if not
>>> dangerous, that the local socket is rewritten with an IP that doesn't
>>> belong to kamailio. Commenting the dst ip overwriting makes kamailio create
>>> the correct alias for the tcp connection and reuse it to send, in example,
>>> a BYE message from the callee to the caller.
>>>
>>> Cheers,
>>>
>>> Federico
>>>
>>> On Fri, Oct 15, 2021 at 12:40 PM Arsen Semenov 
>>> wrote:
>>>
>>>> Hi Federico,
>>>>
>>>> I was facing the same issues when I was playing with the proxy protocol
>>>> some time ago.
>>>> As per my understanding the way how proxy protocol(PP) is implemented
>>>> in Kamailio is outlined in the de-facto standard doc:
>>>> https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
>>>>
>>>> "
>>>> The PROXY protocol's goal is to fill the server's internal structures
>>>> with the
>>>> information collected by the proxy that the server would have been able
>>>> to get
>>>> by itself if the client was connecting directly to the server instead
>>>> of via a
>>>> proxy. The information carried by the protocol are the ones the server
>>>> would
>>>> get using getsockname() and getpeername() :
>>>>   - address family (AF_INET f

Re: [sr-dev] Proxy protocol issue

2021-10-15 Thread Federico Cabiddu
Hi Arsen,
the issue is exactly that kamailio behind HA LB DON'T reuse the same
connection because there is no tcp alias for CLIENT_IP/LOCAL_KAMAILIO_IP,
because the kamailio local socket has been overwritten by the balancer IP.
I've read the specification and nowhere is written that the load balancer
IP must overwrite the local socket information. With the actual
implementation it is impossible to send back a message (not a reply, a
brand new one) to the client, because there is no matching tcp alias (I've
done a quite deep debug). Proxy protocol was mainly taught for
unidirectional flows (http), not for SIP. IMHO it is useless , if not
dangerous, that the local socket is rewritten with an IP that doesn't
belong to kamailio. Commenting the dst ip overwriting makes kamailio create
the correct alias for the tcp connection and reuse it to send, in example,
a BYE message from the callee to the caller.

Cheers,

Federico

On Fri, Oct 15, 2021 at 12:40 PM Arsen Semenov  wrote:

> Hi Federico,
>
> I was facing the same issues when I was playing with the proxy protocol
> some time ago.
> As per my understanding the way how proxy protocol(PP) is implemented in
> Kamailio is outlined in the de-facto standard doc:
> https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
>
> "
> The PROXY protocol's goal is to fill the server's internal structures with
> the
> information collected by the proxy that the server would have been able to
> get
> by itself if the client was connecting directly to the server instead of
> via a
> proxy. The information carried by the protocol are the ones the server
> would
> get using getsockname() and getpeername() :
>   - address family (AF_INET for IPv4, AF_INET6 for IPv6, AF_UNIX)
>   - socket protocol (SOCK_STREAM for TCP, SOCK_DGRAM for UDP)
>   - layer 3 source and destination addresses
>   - layer 4 source and destination ports if any
> "
>
> So that internally Kamailio will have info of Client
> source_ip:source_port/LB_external_IP:LB_external_port
> You can confirm that by executing core.tcp_list command.
>
> For a call initiated by a client behind LB with proxy protocol, responses
> will re-use existing TCP connection and will reach the client. But for
> example if the call will be terminated from the callee side, (i.e new
> transaction) Kamailio will fail to find existing TCP connection since it
> does not know nothing about it and will try to open a new one, which, in
> turn will fail either because of LB reject - if so_useport is disabled, or
> if so_reuseport=yes because of the fact that in the OS there is already
> opened TCP connection with the same tuple (ie. between LB and Kamailio
> host)
> So the way to use proxy protocol in Kamailio is DSR (direct server return)
> scenarios.
>
> here you can find related conversation:
> https://github.com/kamailio/kamailio/issues/2103
>
>
> Regards,
>
> On Fri, Oct 15, 2021 at 2:43 PM Federico Cabiddu <
> federico.cabi...@gmail.com> wrote:
>
>> Hi all,
>> I've been recently testing kamailio support for proxy protocol which was
>> introduced by https://github.com/kamailio/kamailio/issues/1757. As
>> reported by others, even if kamailio is able to decode the proxy protocol
>> and get the client's original IP address, it is unable to send SIP messages
>> to the client which initiated the connection through the HA load balancer
>> (nginx in my case). After investigation I've found that there is no alias
>> added to the tcp connection aliases list for the tuple
>> CLIENT_IP:CLIENT_PORT/LOCAL_KAMAILIO_IP:KAMAILIO_PORT. This means that when
>> trying to forward a message to the originating client kamailio won't use
>> the existing connection with the load balancer/proxy but will try to
>> establish a new connection. The fact is that the function which parses the
>> proxy header overwrites the dst ip/port of the connection with the
>> "Destination IP" and "Destination Port" fields of the proxy header (
>> https://github.com/kamailio/kamailio/blob/f677dea597db6ceaa66a2755dd6e9e738855dc35/src/core/tcp_main.c#L989
>> for v2,
>> https://github.com/kamailio/kamailio/blob/f677dea597db6ceaa66a2755dd6e9e738855dc35/src/core/tcp_main.c#L1071
>> for v1). This fields contain the IP/port of the Load Balancer, not the
>> kamailio IP/Port, and kamailio will fail to find a tcp connection toward
>> the client's src IP since the Load Balancer IP is not a kamailio's local
>> socket.
>> I think that the destination IP of the connection shouldn't be rewritten
>> with the load balancer IP, unless I'm missing something.
>> Hopefully I've been clear enough explaining the issue :)
>> I

[sr-dev] Proxy protocol issue

2021-10-15 Thread Federico Cabiddu
Hi all,
I've been recently testing kamailio support for proxy protocol which was
introduced by https://github.com/kamailio/kamailio/issues/1757. As reported
by others, even if kamailio is able to decode the proxy protocol and get
the client's original IP address, it is unable to send SIP messages to the
client which initiated the connection through the HA load balancer (nginx
in my case). After investigation I've found that there is no alias added to
the tcp connection aliases list for the tuple
CLIENT_IP:CLIENT_PORT/LOCAL_KAMAILIO_IP:KAMAILIO_PORT. This means that when
trying to forward a message to the originating client kamailio won't use
the existing connection with the load balancer/proxy but will try to
establish a new connection. The fact is that the function which parses the
proxy header overwrites the dst ip/port of the connection with the
"Destination IP" and "Destination Port" fields of the proxy header (
https://github.com/kamailio/kamailio/blob/f677dea597db6ceaa66a2755dd6e9e738855dc35/src/core/tcp_main.c#L989
for v2,
https://github.com/kamailio/kamailio/blob/f677dea597db6ceaa66a2755dd6e9e738855dc35/src/core/tcp_main.c#L1071
for v1). This fields contain the IP/port of the Load Balancer, not the
kamailio IP/Port, and kamailio will fail to find a tcp connection toward
the client's src IP since the Load Balancer IP is not a kamailio's local
socket.
I think that the destination IP of the connection shouldn't be rewritten
with the load balancer IP, unless I'm missing something.
Hopefully I've been clear enough explaining the issue :)
If you agree with the analysis I can prepare a PR for it.

Have you all a great weekend,

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


[sr-dev] git:master:91c73d62: http_async_client: configure curl redirect per query

2021-03-31 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: 91c73d62bcb5e635aae4462393e3fe71b64657f1
URL: 
https://github.com/kamailio/kamailio/commit/91c73d62bcb5e635aae4462393e3fe71b64657f1

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2021-03-31T11:50:29+02:00

http_async_client: configure curl redirect per query

---

Modified: src/modules/http_async_client/async_http.c
Modified: src/modules/http_async_client/async_http.h
Modified: src/modules/http_async_client/doc/http_async_client_admin.xml
Modified: src/modules/http_async_client/hm_hash.h
Modified: src/modules/http_async_client/http_async_client_mod.c
Modified: src/modules/http_async_client/http_multi.c

---

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


___
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] http_async_client: add curl_follow_redirect parameter (#2694)

2021-03-30 Thread Federico Cabiddu
Merged #2694 into master.

-- 
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/2694#event-4527130108___
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] http_async_client: add curl_follow_redirect parameter (#2694)

2021-03-30 Thread Federico Cabiddu
I've started working on the per query implementation. Merging this for now, 
before the code freeze. Thanks again!

-- 
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/2694#issuecomment-810164910___
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] http_async_client: add curl_follow_redirect parameter (#2694)

2021-03-28 Thread Federico Cabiddu
Thank you! PR looks fine, documetation included. I was thinking that it would 
be nice to specify the parameter per query like it's done for other parameters. 
Could be done in this pull request or we can do it after.

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


Re: [sr-dev] git:master:e85a5a6a: http_async_client: disable HTTP/2 multiplexing

2021-03-23 Thread Federico Cabiddu
Just seen that you already did it, sorry!


On Tue, Mar 23, 2021 at 12:17 PM Federico Cabiddu <
federico.cabi...@gmail.com> wrote:

> Ops, I'll fix it!
>
> On Tue, Mar 23, 2021 at 11:16 AM Victor Seva <
> linuxman...@torreviejawireless.org> wrote:
>
>> Hi Federico!
>>
>> On 3/22/21 8:09 PM, Federico Cabiddu wrote:
>> > Module: kamailio
>> > Branch: master
>> > Commit: e85a5a6ae2ae01159ef4aeffd9f51f58c7bc844b
>> > URL:
>> https://github.com/kamailio/kamailio/commit/e85a5a6ae2ae01159ef4aeffd9f51f58c7bc844b
>> >
>> > Author: Federico Cabiddu 
>> > Committer: Federico Cabiddu 
>> > Date: 2021-03-22T20:09:12+01:00
>> >
>> > http_async_client: disable HTTP/2 multiplexing
>> >
>> > ---
>> >
>> > Modified: src/modules/http_async_client/http_multi.c
>> >
>> > ---
>> >
>> > Diff:
>> https://github.com/kamailio/kamailio/commit/e85a5a6ae2ae01159ef4aeffd9f51f58c7bc844b.diff
>> > Patch:
>> https://github.com/kamailio/kamailio/commit/e85a5a6ae2ae01159ef4aeffd9f51f58c7bc844b.patch
>> >
>> > ---
>> >
>> > diff --git a/src/modules/http_async_client/http_multi.c
>> b/src/modules/http_async_client/http_multi.c
>> > index 4f5cb30da8..c4351b1b94 100644
>> > --- a/src/modules/http_async_client/http_multi.c
>> > +++ b/src/modules/http_async_client/http_multi.c
>> > @@ -402,6 +402,7 @@ int init_http_multi(struct event_base *evbase,
>> struct http_m_global *wg)
>> >   curl_multi_setopt(g->multi, CURLMOPT_SOCKETDATA, g);
>> >   curl_multi_setopt(g->multi, CURLMOPT_TIMERFUNCTION,
>> multi_timer_cb);
>> >   curl_multi_setopt(g->multi, CURLMOPT_TIMERDATA, g);
>> > + curl_multi_setopt(g->multi, CURLMOPT_PIPELINING,
>> CURLPIPE_NOTHING);
>> >
>> >   return init_http_m_table(hash_size);
>> >  }
>> >
>>
>> Sadly CURLPIPE_NOTHING was introduced at 7.43.0 [0] so jessie and trusty
>> builds are broken right now
>>
>> [0] https://curl.se/libcurl/c/symbols-in-versions.html
>>
>> ___
>> Kamailio (SER) - Development Mailing List
>> sr-dev@lists.kamailio.org
>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
>>
>
___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] git:master:e85a5a6a: http_async_client: disable HTTP/2 multiplexing

2021-03-23 Thread Federico Cabiddu
Ops, I'll fix it!

On Tue, Mar 23, 2021 at 11:16 AM Victor Seva <
linuxman...@torreviejawireless.org> wrote:

> Hi Federico!
>
> On 3/22/21 8:09 PM, Federico Cabiddu wrote:
> > Module: kamailio
> > Branch: master
> > Commit: e85a5a6ae2ae01159ef4aeffd9f51f58c7bc844b
> > URL:
> https://github.com/kamailio/kamailio/commit/e85a5a6ae2ae01159ef4aeffd9f51f58c7bc844b
> >
> > Author: Federico Cabiddu 
> > Committer: Federico Cabiddu 
> > Date: 2021-03-22T20:09:12+01:00
> >
> > http_async_client: disable HTTP/2 multiplexing
> >
> > ---
> >
> > Modified: src/modules/http_async_client/http_multi.c
> >
> > ---
> >
> > Diff:
> https://github.com/kamailio/kamailio/commit/e85a5a6ae2ae01159ef4aeffd9f51f58c7bc844b.diff
> > Patch:
> https://github.com/kamailio/kamailio/commit/e85a5a6ae2ae01159ef4aeffd9f51f58c7bc844b.patch
> >
> > ---
> >
> > diff --git a/src/modules/http_async_client/http_multi.c
> b/src/modules/http_async_client/http_multi.c
> > index 4f5cb30da8..c4351b1b94 100644
> > --- a/src/modules/http_async_client/http_multi.c
> > +++ b/src/modules/http_async_client/http_multi.c
> > @@ -402,6 +402,7 @@ int init_http_multi(struct event_base *evbase,
> struct http_m_global *wg)
> >   curl_multi_setopt(g->multi, CURLMOPT_SOCKETDATA, g);
> >   curl_multi_setopt(g->multi, CURLMOPT_TIMERFUNCTION,
> multi_timer_cb);
> >   curl_multi_setopt(g->multi, CURLMOPT_TIMERDATA, g);
> > + curl_multi_setopt(g->multi, CURLMOPT_PIPELINING, CURLPIPE_NOTHING);
> >
> >   return init_http_m_table(hash_size);
> >  }
> >
>
> Sadly CURLPIPE_NOTHING was introduced at 7.43.0 [0] so jessie and trusty
> builds are broken right now
>
> [0] https://curl.se/libcurl/c/symbols-in-versions.html
>
> ___
> Kamailio (SER) - Development Mailing List
> sr-dev@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
>
___
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] Core dumps possibly related to #2616 or http_async_query (#2632)

2021-03-22 Thread Federico Cabiddu
If there is agreement I'll merge this one and backport it to stable branches.

-- 
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/2632#issuecomment-804259979___
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] Core dumps possibly related to #2616 or http_async_query (#2632)

2021-03-22 Thread Federico Cabiddu
@miconda: not sure that http_client is affected too, being the problem in 
http_async_client the fact tha a socket is bound to a specific easy handler and 
an event is attached to it via libevent. But I think @oej is better qualified 
to answer :)

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


[sr-dev] git:5.3:9d24f18f: http_async_client: disable HTTP/2 multiplexing

2021-03-22 Thread Federico Cabiddu
Module: kamailio
Branch: 5.3
Commit: 9d24f18fd529152d0a5ef4d0aed27bc488928be9
URL: 
https://github.com/kamailio/kamailio/commit/9d24f18fd529152d0a5ef4d0aed27bc488928be9

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2021-03-22T20:09:58+01:00

http_async_client: disable HTTP/2 multiplexing

---

Modified: src/modules/http_async_client/http_multi.c

---

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

---

diff --git a/src/modules/http_async_client/http_multi.c 
b/src/modules/http_async_client/http_multi.c
index cfe9ae9177..6c242032b3 100644
--- a/src/modules/http_async_client/http_multi.c
+++ b/src/modules/http_async_client/http_multi.c
@@ -410,6 +410,7 @@ int init_http_multi(struct event_base *evbase, struct 
http_m_global *wg)
curl_multi_setopt(g->multi, CURLMOPT_SOCKETDATA, g);
curl_multi_setopt(g->multi, CURLMOPT_TIMERFUNCTION, multi_timer_cb);
curl_multi_setopt(g->multi, CURLMOPT_TIMERDATA, g);
+   curl_multi_setopt(g->multi, CURLMOPT_PIPELINING, CURLPIPE_NOTHING);
 
return init_http_m_table(hash_size);
 }


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


[sr-dev] git:5.4:3ee9eb67: http_async_client: disable HTTP/2 multiplexing

2021-03-22 Thread Federico Cabiddu
Module: kamailio
Branch: 5.4
Commit: 3ee9eb6700ae61c0449b2c9568e67712b0e82f8f
URL: 
https://github.com/kamailio/kamailio/commit/3ee9eb6700ae61c0449b2c9568e67712b0e82f8f

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2021-03-22T20:09:37+01:00

http_async_client: disable HTTP/2 multiplexing

---

Modified: src/modules/http_async_client/http_multi.c

---

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

---

diff --git a/src/modules/http_async_client/http_multi.c 
b/src/modules/http_async_client/http_multi.c
index 9ed1b2dc92..69d847c891 100644
--- a/src/modules/http_async_client/http_multi.c
+++ b/src/modules/http_async_client/http_multi.c
@@ -403,6 +403,7 @@ int init_http_multi(struct event_base *evbase, struct 
http_m_global *wg)
curl_multi_setopt(g->multi, CURLMOPT_SOCKETDATA, g);
curl_multi_setopt(g->multi, CURLMOPT_TIMERFUNCTION, multi_timer_cb);
curl_multi_setopt(g->multi, CURLMOPT_TIMERDATA, g);
+   curl_multi_setopt(g->multi, CURLMOPT_PIPELINING, CURLPIPE_NOTHING);
 
return init_http_m_table(hash_size);
 }


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


[sr-dev] git:master:e85a5a6a: http_async_client: disable HTTP/2 multiplexing

2021-03-22 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: e85a5a6ae2ae01159ef4aeffd9f51f58c7bc844b
URL: 
https://github.com/kamailio/kamailio/commit/e85a5a6ae2ae01159ef4aeffd9f51f58c7bc844b

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2021-03-22T20:09:12+01:00

http_async_client: disable HTTP/2 multiplexing

---

Modified: src/modules/http_async_client/http_multi.c

---

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

---

diff --git a/src/modules/http_async_client/http_multi.c 
b/src/modules/http_async_client/http_multi.c
index 4f5cb30da8..c4351b1b94 100644
--- a/src/modules/http_async_client/http_multi.c
+++ b/src/modules/http_async_client/http_multi.c
@@ -402,6 +402,7 @@ int init_http_multi(struct event_base *evbase, struct 
http_m_global *wg)
curl_multi_setopt(g->multi, CURLMOPT_SOCKETDATA, g);
curl_multi_setopt(g->multi, CURLMOPT_TIMERFUNCTION, multi_timer_cb);
curl_multi_setopt(g->multi, CURLMOPT_TIMERDATA, g);
+   curl_multi_setopt(g->multi, CURLMOPT_PIPELINING, CURLPIPE_NOTHING);
 
return init_http_m_table(hash_size);
 }


___
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] Core dumps possibly related to #2616 or http_async_query (#2632)

2021-03-22 Thread Federico Cabiddu
@miconda: in this case we should also disable NPN negotiation: 
https://curl.se/libcurl/c/CURLOPT_SSL_ENABLE_NPN.html, or even disabling HTTP/2 
completely setting CURLOPT_HTTP_VERSION (current curl default value is 
CURLOPT_HTTP_VERSION_2TLS). I didn't want to be so extreme :)
@bjokax, thanks for testing it.

-- 
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/2632#issuecomment-804101356___
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] Core dumps possibly related to #2616 or http_async_query (#2632)

2021-03-21 Thread Federico Cabiddu
Hi, althought I have not been able to reproduce the crash, I think that the 
problem, as highlighted by @bjokax, is the not correct handling of HTTP/2 
multiplexing. The module was written before HTTP/2 was out so it has never been 
considered. Support for it would require some important refactoring of the 
module, I'll start seeing if I can work on it for the next major release.
Meanwhile we can disable multiplexing at all (this can also be backported to 
current stable branches while a refactor to support multiplexing wouldn't). 
I've pushed such fix in this branch 
https://github.com/kamailio/kamailio/tree/grumvalski/disable_http2_multiplexing.
 @amessina @bjokax : can you try it? Since I've not been able for now to 
reproduce the crash I don't know if it solves yours. Thank you.

-- 
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/2632#issuecomment-803621237___
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] Core dumps possibly related to #2616 or http_async_query (#2632)

2021-03-19 Thread Federico Cabiddu
Thank you for the report. I'll try to have a look on it in the next couple of 
days.

-- 
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/2632#issuecomment-802922909___
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] [Feature] RFC 8898 support (#2669)

2021-03-12 Thread Federico Cabiddu
Hi,
actually you can implement RFC 8898 in kamailio routing script, all the pieces 
are already there.
For the challenge you can easily reply 401/407 adding a "forged" 
WWW-Authenticate header with Bearer schema and authz-server.
For the token validation:
  - if it's a structured token you can validate the JWT and extract the claims 
using the jwt module and jansson module
  - if it's a reference token you can call the /inspect endpoint using 
http_client or http_async_client modules and parsing the response with jansson 
module
Basically all the RFC is here, being the claims and how they apply to the 
routing logic strictly domain/business logic dependent. 
A dedicated module would just wrap the token validation and challenge logics 
into some functions exposed to kemi/script.
I've though about this for some time but at the end I didn't started for lack 
of time and because the implemenation I've done using routing script is 
fullfilling our needs and running in production since several years.
But it would be probably nice to have :)
About the client, I'm not aware on any client actively working on implementing 
it, in my case I'm using a modified Linphone client for android/iOS. 


-- 
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/2669#issuecomment-797378574___
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] usrloc Stats are not compatible with Prometheus (xhttp_prom module) (#2644)

2021-02-22 Thread Federico Cabiddu
This has been fixed with PR https://github.com/kamailio/kamailio/pull/2304/.
It's included in 5.4 but not in 5.3, but could be easily cherry-picked.

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


Re: [sr-dev] Merry Christmas and Happy Holidays!

2020-12-25 Thread Federico Cabiddu
Merry Christmas to all this beautiful community.
And best wishes for 2021!

Federico

On Thu, 24 Dec 2020, 19:09 Daniel-Constantin Mierla, 
wrote:

> A year that was very tough for the entire world is getting close to its
> end, no doubt that was the most challenging in our life so far for many
> of us, however, with a distributed, friendly and collaborative
> community, Kamailio project continued to develop consistently, bringing
> out a new major release. I trust it helped people and companies world
> wide to to connect with the dear ones and build a better way of living.
>
> The season holidays are ahead, time to rest a bit, spend time with
> family and friends, being online or face to face.  As usual, I take this
> chance to express my thanks and greetings to all the friends,
> developers, supporting companies and community members that made 2020
> another great year for Kamailio project.
>
>
> Enjoy the holidays! Merry Christmas!
>
> Daniel
>
> * Santa is flying Kamailio! *
>
> --
> Daniel-Constantin Mierla -- www.asipto.com
> www.twitter.com/miconda -- www.linkedin.com/in/miconda
>
>
> ___
> Kamailio (SER) - Development Mailing List
> sr-dev@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
>
___
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] Dispatcher SNI support (#2591)

2020-12-17 Thread Federico Cabiddu
Did you check 'ping_from' 
(http://www.kamailio.org/docs/modules/devel/modules/dispatcher.html#dispatcher.ex.attributes)?
 Could it cover your needs?

-- 
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/2591#issuecomment-747688411___
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] nat_traversal: TCP transport support (#2564)

2020-11-28 Thread Federico Cabiddu
You can use tcpops tcp_enable_keepalive (
http://www.kamailio.org/docs/modules/devel/modules/tcpops.html#tcpops.f.tcp_keepalive_enable)
to enable tcp keepalive per connection.

On Sat, 28 Nov 2020, 16:47 sergey-safarov,  wrote:

> If the client does not send TCP keep-alive SIP message or TCP session
> timer on NAT router is too low then we have an issue.
>
> As a workaround, I can use the operation system keepalive on the
> server-side.
>
> net.ipv4.tcp_keepalive_time = 75
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> ,
> or unsubscribe
> 
> .
> ___
> Kamailio (SER) - Development Mailing List
> sr-dev@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
>
___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:8ab72a37: http_async_client: add http_time pseudovariable

2020-11-19 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: 8ab72a37565bbec503d825f48774a0627014f665
URL: 
https://github.com/kamailio/kamailio/commit/8ab72a37565bbec503d825f48774a0627014f665

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2020-11-19T10:34:13+01:00

http_async_client: add http_time pseudovariable

---

Modified: src/modules/http_async_client/async_http.c
Modified: src/modules/http_async_client/async_http.h
Modified: src/modules/http_async_client/doc/http_async_client_admin.xml
Modified: src/modules/http_async_client/hm_hash.h
Modified: src/modules/http_async_client/http_async_client_mod.c
Modified: src/modules/http_async_client/http_multi.c

---

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


___
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] Kamailio 5.4.1 - Crash on startup when TLS is enabled after upgrading from stretch to buster (#2466)

2020-09-09 Thread Federico Cabiddu
Closed #2466.

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


[sr-dev] git:5.3:794861c8: httpa_asyc_client: set curl memory callbacks in module initialization

2020-09-09 Thread Federico Cabiddu
Module: kamailio
Branch: 5.3
Commit: 794861c8db50846599118fe7583f522200195d8d
URL: 
https://github.com/kamailio/kamailio/commit/794861c8db50846599118fe7583f522200195d8d

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2020-09-09T12:49:03+02:00

httpa_asyc_client: set curl memory callbacks in module initialization

---

Modified: src/modules/http_async_client/http_async_client_mod.c
Modified: src/modules/http_async_client/http_multi.c

---

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

---

diff --git a/src/modules/http_async_client/http_async_client_mod.c 
b/src/modules/http_async_client/http_async_client_mod.c
index 7bfbb004c9..d0b99daecb 100644
--- a/src/modules/http_async_client/http_async_client_mod.c
+++ b/src/modules/http_async_client/http_async_client_mod.c
@@ -275,6 +275,8 @@ static int mod_init(void)
return -1;
}
 
+   set_curl_mem_callbacks();
+
/* init faked sip msg */
if(faked_msg_init()<0) {
LM_ERR("failed to init faked sip msg\n");
diff --git a/src/modules/http_async_client/http_multi.c 
b/src/modules/http_async_client/http_multi.c
index 948171b519..cfe9ae9177 100644
--- a/src/modules/http_async_client/http_multi.c
+++ b/src/modules/http_async_client/http_multi.c
@@ -392,7 +392,6 @@ void set_curl_mem_callbacks(void)
LM_ERR ("invalid memory manager: %d\n", 
curl_memory_manager);
break;
}
-
 }
 
 int init_http_multi(struct event_base *evbase, struct http_m_global *wg)
@@ -400,7 +399,6 @@ int init_http_multi(struct event_base *evbase, struct 
http_m_global *wg)
g = wg;
g->evbase = evbase;
 
-   set_curl_mem_callbacks();
 
g->multi = curl_multi_init();
LM_DBG("curl_multi %p initialized on global %p (evbase %p)\n", 
g->multi, g, evbase);


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


[sr-dev] git:5.4:4e0f9f88: httpa_asyc_client: set curl memory callbacks in module initialization

2020-09-09 Thread Federico Cabiddu
Module: kamailio
Branch: 5.4
Commit: 4e0f9f8869aaf364011413417ff6c95c032af16d
URL: 
https://github.com/kamailio/kamailio/commit/4e0f9f8869aaf364011413417ff6c95c032af16d

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2020-09-09T12:48:43+02:00

httpa_asyc_client: set curl memory callbacks in module initialization

---

Modified: src/modules/http_async_client/http_async_client_mod.c
Modified: src/modules/http_async_client/http_multi.c

---

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

---

diff --git a/src/modules/http_async_client/http_async_client_mod.c 
b/src/modules/http_async_client/http_async_client_mod.c
index 7bfbb004c9..d0b99daecb 100644
--- a/src/modules/http_async_client/http_async_client_mod.c
+++ b/src/modules/http_async_client/http_async_client_mod.c
@@ -275,6 +275,8 @@ static int mod_init(void)
return -1;
}
 
+   set_curl_mem_callbacks();
+
/* init faked sip msg */
if(faked_msg_init()<0) {
LM_ERR("failed to init faked sip msg\n");
diff --git a/src/modules/http_async_client/http_multi.c 
b/src/modules/http_async_client/http_multi.c
index b5c2e8d637..9ed1b2dc92 100644
--- a/src/modules/http_async_client/http_multi.c
+++ b/src/modules/http_async_client/http_multi.c
@@ -385,7 +385,6 @@ void set_curl_mem_callbacks(void)
LM_ERR ("invalid memory manager: %d\n", 
curl_memory_manager);
break;
}
-
 }
 
 int init_http_multi(struct event_base *evbase, struct http_m_global *wg)
@@ -393,7 +392,6 @@ int init_http_multi(struct event_base *evbase, struct 
http_m_global *wg)
g = wg;
g->evbase = evbase;
 
-   set_curl_mem_callbacks();
 
g->multi = curl_multi_init();
LM_DBG("curl_multi %p initialized on global %p (evbase %p)\n", 
g->multi, g, evbase);


___
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] Kamailio 5.4.1 - Crash on startup when TLS is enabled after upgrading from stretch to buster (#2466)

2020-09-09 Thread Federico Cabiddu
Thanks for testing Joey, the branch is now merged in master. I'll also
backport it to stable branches.

On Wed, Sep 9, 2020 at 11:57 AM Henning Westerholt 
wrote:

> Reopened #2466 .
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> , or
> unsubscribe
> 
> .
> ___
> Kamailio (SER) - Development Mailing List
> sr-dev@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
>
___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:66fea7c6: httpa_asyc_client: set curl memory callbacks in module initialization

2020-09-09 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: 66fea7c615e01b200b334d5255c90911cfb360fe
URL: 
https://github.com/kamailio/kamailio/commit/66fea7c615e01b200b334d5255c90911cfb360fe

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2020-09-08T15:05:37+02:00

httpa_asyc_client: set curl memory callbacks in module initialization

---

Modified: src/modules/http_async_client/http_async_client_mod.c
Modified: src/modules/http_async_client/http_multi.c

---

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

---

diff --git a/src/modules/http_async_client/http_async_client_mod.c 
b/src/modules/http_async_client/http_async_client_mod.c
index 7bfbb004c9..d0b99daecb 100644
--- a/src/modules/http_async_client/http_async_client_mod.c
+++ b/src/modules/http_async_client/http_async_client_mod.c
@@ -275,6 +275,8 @@ static int mod_init(void)
return -1;
}
 
+   set_curl_mem_callbacks();
+
/* init faked sip msg */
if(faked_msg_init()<0) {
LM_ERR("failed to init faked sip msg\n");
diff --git a/src/modules/http_async_client/http_multi.c 
b/src/modules/http_async_client/http_multi.c
index b5c2e8d637..9ed1b2dc92 100644
--- a/src/modules/http_async_client/http_multi.c
+++ b/src/modules/http_async_client/http_multi.c
@@ -385,7 +385,6 @@ void set_curl_mem_callbacks(void)
LM_ERR ("invalid memory manager: %d\n", 
curl_memory_manager);
break;
}
-
 }
 
 int init_http_multi(struct event_base *evbase, struct http_m_global *wg)
@@ -393,7 +392,6 @@ int init_http_multi(struct event_base *evbase, struct 
http_m_global *wg)
g = wg;
g->evbase = evbase;
 
-   set_curl_mem_callbacks();
 
g->multi = curl_multi_init();
LM_DBG("curl_multi %p initialized on global %p (evbase %p)\n", 
g->multi, g, evbase);


___
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] Kamailio 5.4.1 - Crash on startup when TLS is enabled after upgrading from stretch to buster (#2466)

2020-09-08 Thread Federico Cabiddu
Hi Joey, I've tried to investigate the issue with http_async_client 
initialization, but I've not been able to reproduce it in buster.
Anyway looking at the logs I've found something that might be not good, the 
place(s) where curl memory callbacks are set.
I've created a branch with a change on this 
https://github.com/kamailio/kamailio/tree/hac_curl_mem_callbacks, do you have 
any chance to try it?

-- 
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/2466#issuecomment-688854979___
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] [db_text] In a case of using dispatcher from db_text, only first entry in table is processed (#2465)

2020-09-02 Thread Federico Cabiddu
Which mode are you using for db_test? 
http://www.kamailio.org/docs/modules/devel/modules/db_text.html#idm136
If you're using the default 0 then the tables are only read once at startup so 
a dispatcher.reload would not have any effect.

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


[sr-dev] git:5.4:bf38c7b0: async: fix async_ms_route and export it to kemi

2020-08-20 Thread Federico Cabiddu
Module: kamailio
Branch: 5.4
Commit: bf38c7b04171e6f410ff885f10abe0f815d27de9
URL: 
https://github.com/kamailio/kamailio/commit/bf38c7b04171e6f410ff885f10abe0f815d27de9

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2020-08-20T15:35:04+02:00

async: fix async_ms_route and export it to kemi

(cherry picked from commit b787627819fc93dcc8c68a4950c9760d298ce555)

---

Modified: src/modules/async/async_mod.c

---

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

---

diff --git a/src/modules/async/async_mod.c b/src/modules/async/async_mod.c
index aae3c65500..3415d60224 100644
--- a/src/modules/async/async_mod.c
+++ b/src/modules/async/async_mod.c
@@ -404,7 +404,7 @@ static int w_async_ms_route(sip_msg_t *msg, char *rt, char 
*sec)
LM_ERR("no async interval value\n");
return -1;
}
-   return ki_async_route(msg, , s);
+   return ki_async_ms_route(msg, , s);
 }
 
 /**
@@ -505,6 +505,11 @@ static sr_kemi_t sr_kemi_async_exports[] = {
{ SR_KEMIP_STR, SR_KEMIP_INT, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
+   { str_init("async"), str_init("ms_route"),
+   SR_KEMIP_INT, ki_async_ms_route,
+   { SR_KEMIP_STR, SR_KEMIP_INT, SR_KEMIP_NONE,
+   SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+   },
{ str_init("async"), str_init("task_route"),
SR_KEMIP_INT, ki_async_task_route,
{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,


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


[sr-dev] git:5.3:3af15354: async: fix async_ms_route and export it to kemi

2020-08-20 Thread Federico Cabiddu
Module: kamailio
Branch: 5.3
Commit: 3af15354836f69ec2cbd6f107f860cfc1ffc334e
URL: 
https://github.com/kamailio/kamailio/commit/3af15354836f69ec2cbd6f107f860cfc1ffc334e

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2020-08-20T15:35:31+02:00

async: fix async_ms_route and export it to kemi

(cherry picked from commit b787627819fc93dcc8c68a4950c9760d298ce555)

---

Modified: src/modules/async/async_mod.c

---

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

---

diff --git a/src/modules/async/async_mod.c b/src/modules/async/async_mod.c
index aae3c65500..3415d60224 100644
--- a/src/modules/async/async_mod.c
+++ b/src/modules/async/async_mod.c
@@ -404,7 +404,7 @@ static int w_async_ms_route(sip_msg_t *msg, char *rt, char 
*sec)
LM_ERR("no async interval value\n");
return -1;
}
-   return ki_async_route(msg, , s);
+   return ki_async_ms_route(msg, , s);
 }
 
 /**
@@ -505,6 +505,11 @@ static sr_kemi_t sr_kemi_async_exports[] = {
{ SR_KEMIP_STR, SR_KEMIP_INT, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
+   { str_init("async"), str_init("ms_route"),
+   SR_KEMIP_INT, ki_async_ms_route,
+   { SR_KEMIP_STR, SR_KEMIP_INT, SR_KEMIP_NONE,
+   SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+   },
{ str_init("async"), str_init("task_route"),
SR_KEMIP_INT, ki_async_task_route,
{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,


___
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] async: fix async_ms_route and export it to kemi (#2450)

2020-08-20 Thread Federico Cabiddu
Merged #2450 into master.

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


[sr-dev] git:master:b7876278: async: fix async_ms_route and export it to kemi

2020-08-20 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: b787627819fc93dcc8c68a4950c9760d298ce555
URL: 
https://github.com/kamailio/kamailio/commit/b787627819fc93dcc8c68a4950c9760d298ce555

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2020-08-20T11:06:56+02:00

async: fix async_ms_route and export it to kemi

---

Modified: src/modules/async/async_mod.c

---

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

---

diff --git a/src/modules/async/async_mod.c b/src/modules/async/async_mod.c
index aae3c65500..3415d60224 100644
--- a/src/modules/async/async_mod.c
+++ b/src/modules/async/async_mod.c
@@ -404,7 +404,7 @@ static int w_async_ms_route(sip_msg_t *msg, char *rt, char 
*sec)
LM_ERR("no async interval value\n");
return -1;
}
-   return ki_async_route(msg, , s);
+   return ki_async_ms_route(msg, , s);
 }
 
 /**
@@ -505,6 +505,11 @@ static sr_kemi_t sr_kemi_async_exports[] = {
{ SR_KEMIP_STR, SR_KEMIP_INT, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
+   { str_init("async"), str_init("ms_route"),
+   SR_KEMIP_INT, ki_async_ms_route,
+   { SR_KEMIP_STR, SR_KEMIP_INT, SR_KEMIP_NONE,
+   SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+   },
{ str_init("async"), str_init("task_route"),
SR_KEMIP_INT, ki_async_task_route,
{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,


___
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] async: fix async_ms_route and export it to kemi (#2450)

2020-08-20 Thread Federico Cabiddu
Thanks Daniel, I'm going to merge and backport this one and I'll do a separate 
PR for the other exports.

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


[sr-dev] [kamailio/kamailio] async: fix async_ms_route and export it to kemi (#2450)

2020-08-20 Thread Federico Cabiddu
!-- Kamailio Pull Request Template --

!--
IMPORTANT:
  - for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
  - pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
  - backports to stable branches must be done with git cherry-pick -x 
...
  - code is contributed under BSD for core and main components (tm, sl, auth, 
tls)
  - code is contributed GPLv2 or a compatible license for the other components
  - GPL code is contributed with OpenSSL licensing exception
--

 Pre-Submission Checklist
!-- Go over all points below, and after creating the PR, tick all the 
checkboxes that apply --
!-- All points should be verified, otherwise, read the CONTRIBUTING 
guidelines from above--
!-- If youre unsure about any of these, dont hesitate to ask on 
sr-dev mailing list --
- [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
- [X] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)

 Checklist:
!-- Go over all points below, and after creating the PR, tick the 
checkboxes that apply --
- [X] PR should be backported to stable branches
- [X] Tested changes locally
- [ ] Related to issue # (replace  with an open issue number)

 Description
!-- Describe your changes in detail --
async_ms_route currently does not work, because w_async_ms_route calls 
ki_async_route instead of ki_async_ms_route.
This PR also exports ki_async_ms_route to kemi.
Ive noticed that other async functions (async_sleep and async_ms_sleep) 
are not exposed via kemi. Should be add them?
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * async: fix async_ms_route and export it to kemi

-- File Changes --

M src/modules/async/async_mod.c (7)

-- Patch Links --

https://github.com/kamailio/kamailio/pull/2450.patch
https://github.com/kamailio/kamailio/pull/2450.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/2450
___
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] Default config and options for Kamailio 5.4.0 (#2381)

2020-07-03 Thread Federico Cabiddu
Given that Prometheus is becoming quite common as a timeseries backend, what do 
you think about conditionally (#!ifdef) loading xhttp_prom module?

-- 
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/2381#issuecomment-653380053___
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] dispatcher: keep current destinations' load when adding/removing (#2353)

2020-06-11 Thread Federico Cabiddu
Merged #2353 into master.

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


[sr-dev] git:master:8d9e6578: dispatcher: keep current destinations' load when adding/removing

2020-06-11 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: 8d9e65789fe2f6da2648449639620899b1d1b2c3
URL: 
https://github.com/kamailio/kamailio/commit/8d9e65789fe2f6da2648449639620899b1d1b2c3

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2020-06-10T07:17:13+02:00

dispatcher: keep current destinations' load when adding/removing

---

Modified: src/modules/dispatcher/dispatch.c

---

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

---

diff --git a/src/modules/dispatcher/dispatch.c 
b/src/modules/dispatcher/dispatch.c
index f481cb4d61..66b35742e5 100644
--- a/src/modules/dispatcher/dispatch.c
+++ b/src/modules/dispatcher/dispatch.c
@@ -353,7 +353,7 @@ int ds_set_attrs(ds_dest_t *dest, str *vattrs)
 /**
  *
  */
-ds_dest_t *pack_dest(str iuri, int flags, int priority, str *attrs)
+ds_dest_t *pack_dest(str iuri, int flags, int priority, str *attrs, int dload)
 {
ds_dest_t *dp = NULL;
/* For DNS-Lookups */
@@ -419,6 +419,7 @@ ds_dest_t *pack_dest(str iuri, int flags, int priority, str 
*attrs)
 
dp->flags = flags;
dp->priority = priority;
+   dp->dload = dload;
 
if(ds_set_attrs(dp, attrs) < 0) {
LM_ERR("cannot set attributes!\n");
@@ -498,14 +499,14 @@ ds_dest_t *pack_dest(str iuri, int flags, int priority, 
str *attrs)
  *
  */
 int add_dest2list(int id, str uri, int flags, int priority, str *attrs,
-   int list_idx, int *setn)
+   int list_idx, int *setn, int dload)
 {
ds_dest_t *dp = NULL;
ds_set_t *sp = NULL;
ds_dest_t *dp0 = NULL;
ds_dest_t *dp1 = NULL;
 
-   dp = pack_dest(uri, flags, priority, attrs);
+   dp = pack_dest(uri, flags, priority, attrs, dload);
if(!dp)
goto err;
 
@@ -854,7 +855,7 @@ int ds_load_list(char *lfile)
attrs.len = p - attrs.s;
 
 add_destination:
-   if(add_dest2list(id, uri, flags, priority, , *next_idx, 
)
+   if(add_dest2list(id, uri, flags, priority, , *next_idx, 
, 0)
!= 0) {
LM_WARN("unable to add destination %.*s to set %d -- 
skipping\n",
uri.len, uri.s, id);
@@ -1104,7 +1105,7 @@ int ds_load_db(void)
}
}
LM_DBG("attributes string: [%.*s]\n", attrs.len, 
(attrs.s)?attrs.s:"");
-   if(add_dest2list(id, uri, flags, priority, , *next_idx, 
)
+   if(add_dest2list(id, uri, flags, priority, , *next_idx, 
, 0)
!= 0) {
dest_errs++;
LM_WARN("unable to add destination %.*s to set %d -- 
skipping\n",
@@ -2420,7 +2421,7 @@ void ds_add_dest_cb(ds_set_t *node, int i, void *arg)
 
if(add_dest2list(node->id, node->dlist[i].uri, node->dlist[i].flags,
node->dlist[i].priority, >dlist[i].attrs.body, 
*next_idx,
-   ) != 0) {
+   , node->dlist[i].dload) != 0) {
LM_WARN("failed to add destination in group %d - %.*s\n",
node->id, node->dlist[i].uri.len, 
node->dlist[i].uri.s);
}
@@ -2443,7 +2444,7 @@ int ds_add_dst(int group, str *address, int flags, str 
*attrs)
 
// add new destination
if(add_dest2list(group, *address, flags, priority, attrs,
-   *next_idx, ) != 0) {
+   *next_idx, , 0) != 0) {
LM_WARN("unable to add destination %.*s to set %d", 
address->len, address->s, group);
if(ds_load_mode==1) {
goto error;
@@ -2478,7 +2479,7 @@ void ds_filter_dest_cb(ds_set_t *node, int i, void *arg)
 
if(add_dest2list(node->id, node->dlist[i].uri, node->dlist[i].flags,
node->dlist[i].priority, >dlist[i].attrs.body, 
*next_idx,
-   filter_arg->setn) != 0) {
+   filter_arg->setn, node->dlist[i].dload) != 0) {
LM_WARN("failed to add destination in group %d - %.*s\n",
node->id, node->dlist[i].uri.len, 
node->dlist[i].uri.s);
}
@@ -2494,7 +2495,7 @@ int ds_remove_dst(int group, str *address)
 
setn = 0;
 
-   dp = pack_dest(*address, 0, 0, NULL);
+   dp = pack_dest(*address, 0, 0, NULL, 0);
filter_arg.setid = group;
filter_arg.dest = dp;
filter_arg.setn = 


___
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: keep current destinations' load when adding/removing (#2353)

2020-06-09 Thread Federico Cabiddu
!-- Kamailio Pull Request Template --

!--
IMPORTANT:
  - for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
  - pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
  - backports to stable branches must be done with git cherry-pick -x 
...
  - code is contributed under BSD for core and main components (tm, sl, auth, 
tls)
  - code is contributed GPLv2 or a compatible license for the other components
  - GPL code is contributed with OpenSSL licensing exception
--

 Pre-Submission Checklist
!-- Go over all points below, and after creating the PR, tick all the 
checkboxes that apply --
!-- All points should be verified, otherwise, read the CONTRIBUTING 
guidelines from above--
!-- If youre unsure about any of these, dont hesitate to ask on 
sr-dev mailing list --
- [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
- [X] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)

 Checklist:
!-- Go over all points below, and after creating the PR, tick the 
checkboxes that apply --
- [X] PR should be backported to stable branches
- [X] Tested changes locally
- [ ] Related to issue # (replace  with an open issue number)

 Description
!-- Describe your changes in detail --
When adding/removing a destination from a set, the load is currently non 
preserved, which leads to unbalanced load.
This PR addresses the issue without affecting the behavior when 
loading/reloading the whole list.
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * dispatcher: keep current destinations load when adding/removing

-- File Changes --

M src/modules/dispatcher/dispatch.c (19)

-- Patch Links --

https://github.com/kamailio/kamailio/pull/2353.patch
https://github.com/kamailio/kamailio/pull/2353.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/2353
___
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] dispatcher: don't reset load table when adding/removing a destination… (#2342)

2020-06-05 Thread Federico Cabiddu
Merged #2342 into master.

-- 
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/2342#event-3410895434___
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] dispatcher: don't reset load table when adding/removing a destination… (#2342)

2020-06-05 Thread Federico Cabiddu
Thank you Daniel, going to merge.
I also think it should be backported, adapted because there is no rpc 
add/remove command, to stable branches.

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


[sr-dev] git:master:4099a6ca: dispatcher: don't reset load table when adding/removing a destination or reloading the list

2020-06-05 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: 4099a6caf856c9af4d7d89aec73db143efbcd40b
URL: 
https://github.com/kamailio/kamailio/commit/4099a6caf856c9af4d7d89aec73db143efbcd40b

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2020-06-01T07:30:14+02:00

dispatcher: don't reset load table when adding/removing a destination or 
reloading the list

---

Modified: src/modules/dispatcher/dispatch.c

---

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

---

diff --git a/src/modules/dispatcher/dispatch.c 
b/src/modules/dispatcher/dispatch.c
index d859dc3907..f481cb4d61 100644
--- a/src/modules/dispatcher/dispatch.c
+++ b/src/modules/dispatcher/dispatch.c
@@ -878,7 +878,7 @@ int ds_load_list(char *lfile)
/* Update list - should it be sync'ed? */
_ds_list_nr = setn;
*crt_idx = *next_idx;
-   ds_ht_clear_slots(_dsht_load);
+   
ds_log_sets();
return 0;
 
@@ -1126,7 +1126,6 @@ int ds_load_db(void)
/* update data - should it be sync'ed? */
_ds_list_nr = setn;
*crt_idx = *next_idx;
-   ds_ht_clear_slots(_dsht_load);
 
ds_log_sets();
 
@@ -1617,22 +1616,24 @@ int ds_load_replace(struct sip_msg *msg, str *duid)
break;
}
}
+   /* old destination has not been found: has been removed meanwhile? */
if(olddst == -1) {
-   ds_unlock_cell(_dsht_load, >callid->body);
-   LM_ERR("old destination address not found for [%d, %.*s]\n", 
set,
+   LM_WARN("old destination address not found for [%d, %.*s]\n", 
set,
it->duid.len, it->duid.s);
-   return -1;
-   }
+   } 
if(newdst == -1) {
+   /* new destination has not been found: has been removed 
meanwhile? */
ds_unlock_cell(_dsht_load, >callid->body);
LM_ERR("new destination address not found for [%d, %.*s]\n", 
set,
duid->len, duid->s);
-   return -1;
+   return -2;
}
 
ds_unlock_cell(_dsht_load, >callid->body);
ds_del_cell(_dsht_load, >callid->body);
-   DS_LOAD_DEC(idx, olddst);
+   
+   if(olddst != -1)
+   DS_LOAD_DEC(idx, olddst);
 
if(ds_load_add(msg, idx, set, newdst) < 0) {
LM_ERR("unable to replace destination load [%.*s / %.*s]\n", 
duid->len,
@@ -2336,6 +2337,7 @@ int ds_manage_routes(sip_msg_t *msg, ds_select_state_t 
*rstate)
 int ds_update_dst(struct sip_msg *msg, int upos, int mode)
 {
 
+   int ret;
socket_info_t *sock = NULL;
sr_xavp_t *rxavp = NULL;
sr_xavp_t *lxavp = NULL;
@@ -2348,6 +2350,7 @@ int ds_update_dst(struct sip_msg *msg, int upos, int mode)
}
}
 
+next_dst:
rxavp = xavp_get(_xavp_dst, NULL);
if(rxavp == NULL || rxavp->val.type != SR_XTYPE_XAVP) {
LM_DBG("no xavp with previous destination record\n");
@@ -2395,12 +2398,18 @@ int ds_update_dst(struct sip_msg *msg, int upos, int 
mode)
return 1;
}
if(upos == DS_USE_NEXT) {
-   if(ds_load_replace(msg, >val.v.s) < 0) {
-   LM_ERR("cannot update load distribution\n");
-   return -1;
+   ret = ds_load_replace(msg, >val.v.s);
+   switch(ret) {
+   case 0:
+   break;
+   case -2:
+   LM_ERR("cannot update load with %.*s, skipping 
dst.\n", lxavp->val.v.s.len, lxavp->val.v.s.s);
+   goto next_dst;
+   default:
+   LM_ERR("cannot update load distribution\n");
+   return -1;
}
}
-
return 1;
 }
 
@@ -2448,7 +2457,7 @@ int ds_add_dst(int group, str *address, int flags, str 
*attrs)
 
_ds_list_nr = setn;
*crt_idx = *next_idx;
-   ds_ht_clear_slots(_dsht_load);
+   
ds_log_sets();
return 0;
 
@@ -2503,7 +2512,7 @@ int ds_remove_dst(int group, str *address)
 
_ds_list_nr = setn;
*crt_idx = *next_idx;
-   ds_ht_clear_slots(_dsht_load);
+   
ds_log_sets();
return 0;
 


___
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: don't reset load table when adding/removing a destination… (#2342)

2020-06-01 Thread Federico Cabiddu
… or reloading the list

!-- Kamailio Pull Request Template --

!--
IMPORTANT:
  - for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
  - pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
  - backports to stable branches must be done with git cherry-pick -x 
...
  - code is contributed under BSD for core and main components (tm, sl, auth, 
tls)
  - code is contributed GPLv2 or a compatible license for the other components
  - GPL code is contributed with OpenSSL licensing exception
--

 Pre-Submission Checklist
!-- Go over all points below, and after creating the PR, tick all the 
checkboxes that apply --
!-- All points should be verified, otherwise, read the CONTRIBUTING 
guidelines from above--
!-- If youre unsure about any of these, dont hesitate to ask on 
sr-dev mailing list --
- [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
- [x] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)

 Checklist:
!-- Go over all points below, and after creating the PR, tick the 
checkboxes that apply --
- [ ] PR should be backported to stable branches
- [x] Tested changes locally
- [ ] Related to issue # (replace  with an open issue number)

 Description

When a destination is added/removed or the whole list is reloaded, the calls 
that are being routed to another destination will fail.
This because ds_load_replace is returning an error not finding in the table the 
entry for the call being rerouted.
Another side effect of this is that when adding/removing destinations the 
actual load of the endpoints will be wrong since the current calls will never 
be deleted.
Ive removed the calls to ds_clean_slots and modified ds_load_replace to 
not exit when the old destination is not found (the endpoint could have been 
removed after the failover list had been created) and to return a new error 
code (-2) when the new destination is not found (for the same reason).
Finally Ive modified ds_update_dst to skip the current selected 
destination and select the next if ds_load_replace returns -2.

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

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

-- Commit Summary --

  * dispatcher: dont reset load table when adding/removing a destination 
or reloading the list

-- File Changes --

M src/modules/dispatcher/dispatch.c (37)

-- Patch Links --

https://github.com/kamailio/kamailio/pull/2342.patch
https://github.com/kamailio/kamailio/pull/2342.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/2342
___
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] dispatcher: rework attrs parameter in rpc 'add' command (#2339)

2020-05-28 Thread Federico Cabiddu
@grumvalski pushed 1 commit.

583b63e23f48b9bde84c6a86940ae09ff54bc252  dispatcher: rework attrs parameter in 
rpc 'add' command


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/kamailio/kamailio/pull/2339/files/e86af7e10e386845dcc2dc53623309d6b372f136..583b63e23f48b9bde84c6a86940ae09ff54bc252
___
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] dispatcher: rework attrs parameter in rpc 'add' command (#2339)

2020-05-28 Thread Federico Cabiddu
@grumvalski commented on this pull request.



>   rpc->fault(ctx, 500, "Invalid Parameters");
return;
+   } else if (nparams < 4) {

right, fixed and force pushed.

-- 
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/2339#discussion_r431980107___
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: rework attrs parameter in rpc 'add' command (#2339)

2020-05-28 Thread Federico Cabiddu
!-- Kamailio Pull Request Template --

!--
IMPORTANT:
  - for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
  - pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
  - backports to stable branches must be done with git cherry-pick -x 
...
  - code is contributed under BSD for core and main components (tm, sl, auth, 
tls)
  - code is contributed GPLv2 or a compatible license for the other components
  - GPL code is contributed with OpenSSL licensing exception
--

 Pre-Submission Checklist
!-- Go over all points below, and after creating the PR, tick all the 
checkboxes that apply --
!-- All points should be verified, otherwise, read the CONTRIBUTING 
guidelines from above--
!-- If youre unsure about any of these, dont hesitate to ask on 
sr-dev mailing list --
- [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:
!-- Go over all points below, and after creating the PR, tick the 
checkboxes that apply --
- [ ] PR should be backported to stable branches
- [x] Tested changes locally
- [ ] Related to issue # (replace  with an open issue number)

 Description
Fixed attrs parameters handling i rpc add command.

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

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

-- Commit Summary --

  * dispatcher: rework attrs parameter in rpc add command

-- File Changes --

M src/modules/dispatcher/dispatch.c (4)
M src/modules/dispatcher/dispatcher.c (10)

-- Patch Links --

https://github.com/kamailio/kamailio/pull/2339.patch
https://github.com/kamailio/kamailio/pull/2339.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/2339
___
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] dispatcher: add attrs param to rpc 'add' call (#2336)

2020-05-28 Thread Federico Cabiddu
@grumvalski commented on this pull request.



>  
flags = 0;
 
-   if(rpc->scan(ctx, "dS*d", , , ) < 2) {
+   if(rpc->scan(ctx, "dS*d", , , , ) < 3) {

Right, I'm going to fix.

-- 
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#discussion_r431609608___
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] dispatcher: add attrs param to rpc 'add' call (#2336)

2020-05-27 Thread Federico Cabiddu
Merged #2336 into master.

-- 
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#event-3381099203___
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] dispatcher: add attrs param to rpc 'add' call (#2336)

2020-05-27 Thread Federico Cabiddu
Thanks Henning.

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


[sr-dev] git:master:2e842e9c: dispatcher: add attrs param to rpc 'add' call

2020-05-27 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: 2e842e9c11b136270b56b2b48a0364a94749c4ed
URL: 
https://github.com/kamailio/kamailio/commit/2e842e9c11b136270b56b2b48a0364a94749c4ed

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2020-05-26T10:24:58+02:00

dispatcher: add attrs param to rpc 'add' call

---

Modified: src/modules/dispatcher/dispatch.c
Modified: src/modules/dispatcher/dispatch.h
Modified: src/modules/dispatcher/dispatcher.c
Modified: src/modules/dispatcher/doc/dispatcher_admin.xml

---

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

---

diff --git a/src/modules/dispatcher/dispatch.c 
b/src/modules/dispatcher/dispatch.c
index b5d56d405a..8cff6cdb56 100644
--- a/src/modules/dispatcher/dispatch.c
+++ b/src/modules/dispatcher/dispatch.c
@@ -2419,15 +2419,16 @@ void ds_add_dest_cb(ds_set_t *node, int i, void *arg)
 }
 
 /* add dispatcher entry to in-memory dispatcher list */
-int ds_add_dst(int group, str *address, int flags)
+int ds_add_dst(int group, str *address, int flags, str *attrs)
 {
int setn, priority;
-   str attrs;
 
setn = _ds_list_nr;
priority = 0;
-   attrs.s = 0;
-   attrs.len = 0;
+
+   if (attrs->len == 0) {
+   attrs->s = 0;
+   }
 
*next_idx = (*crt_idx + 1) % 2;
ds_avl_destroy(_lists[*next_idx]);
@@ -2436,7 +2437,7 @@ int ds_add_dst(int group, str *address, int flags)
ds_iter_set(_ds_list, _add_dest_cb, NULL);
 
// add new destination
-   if(add_dest2list(group, *address, flags, priority, ,
+   if(add_dest2list(group, *address, flags, priority, attrs,
*next_idx, ) != 0) {
LM_WARN("unable to add destination %.*s to set %d", 
address->len, address->s, group);
if(ds_load_mode==1) {
diff --git a/src/modules/dispatcher/dispatch.h 
b/src/modules/dispatcher/dispatch.h
index ee4ea0b760..2bd63dc64b 100644
--- a/src/modules/dispatcher/dispatch.h
+++ b/src/modules/dispatcher/dispatch.h
@@ -140,7 +140,7 @@ int ds_select_dst_limit(sip_msg_t *msg, int set, int alg, 
uint32_t limit,
int mode);
 int ds_select_dst(struct sip_msg *msg, int set, int alg, int mode);
 int ds_update_dst(struct sip_msg *msg, int upos, int mode);
-int ds_add_dst(int group, str *address, int flags);
+int ds_add_dst(int group, str *address, int flags, str *attrs);
 int ds_remove_dst(int group, str *address);
 int ds_update_state(sip_msg_t *msg, int group, str *address, int state,
ds_rctx_t *rctx);
diff --git a/src/modules/dispatcher/dispatcher.c 
b/src/modules/dispatcher/dispatcher.c
index 2a566ab730..b2693a2947 100644
--- a/src/modules/dispatcher/dispatcher.c
+++ b/src/modules/dispatcher/dispatcher.c
@@ -1800,15 +1800,16 @@ static void dispatcher_rpc_add(rpc_t *rpc, void *ctx)
 {
int group, flags;
str dest;
+  str attrs;
 
flags = 0;
 
-   if(rpc->scan(ctx, "dS*d", , , ) < 2) {
+   if(rpc->scan(ctx, "dS*d", , , , ) < 3) {
rpc->fault(ctx, 500, "Invalid Parameters");
return;
}
 
-   if(ds_add_dst(group, , flags) != 0) {
+   if(ds_add_dst(group, , flags, ) != 0) {
rpc->fault(ctx, 500, "Adding dispatcher dst failed");
return;
}
diff --git a/src/modules/dispatcher/doc/dispatcher_admin.xml 
b/src/modules/dispatcher/doc/dispatcher_admin.xml
index b872adc156..984b53258d 100644
--- a/src/modules/dispatcher/doc/dispatcher_admin.xml
+++ b/src/modules/dispatcher/doc/dispatcher_admin.xml
@@ -1938,15 +1938,19 @@ DEST: {
_flags_ (optional): as described in the 
list file format,
default 0
 
+   _attrs_ (optional): as described in the 
list file format,
+   default ""
+


Example:

 
 ...
-# prototype:  dispatcher.add _group_ _address_ _flags_
+# prototype:  dispatcher.add _group_ _address_ _flags_ _attrs_
  dispatcher.add 2 sip:127.0.0.1:5080
  dispatcher.add 3 sip:127.0.0.1:5075 8
+ dispatcher.add 3 sip:127.0.0.1:5075 0 
duid=abc;socket=udp:127.0.0.1:5060
 ...
 
 


___
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
!-- Kamailio Pull Request Template --

!--
IMPORTANT:
  - for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
  - pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
  - backports to stable branches must be done with git cherry-pick -x 
...
  - code is contributed under BSD for core and main components (tm, sl, auth, 
tls)
  - code is contributed GPLv2 or a compatible license for the other components
  - GPL code is contributed with OpenSSL licensing exception
--

 Pre-Submission Checklist
!-- Go over all points below, and after creating the PR, tick all the 
checkboxes that apply --
!-- All points should be verified, otherwise, read the CONTRIBUTING 
guidelines from above--
!-- If youre unsure about any of these, dont hesitate to ask on 
sr-dev mailing list --
- [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:
!-- Go over all points below, and after creating the PR, tick the 
checkboxes that apply --
- [ ] PR should be backported to stable branches
- [x] Tested changes locally
- [ ] Related to issue # (replace  with an open issue number)

 Description
!-- Describe your changes in detail --
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


Re: [sr-dev] [kamailio/kamailio] usrloc: change "-" for "_" in stats name to be prometheus compliant (#2304)

2020-05-02 Thread Federico Cabiddu
Merged #2304 into master.

-- 
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/2304#event-3296066480___
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] usrloc: change "-" for "_" in stats name to be prometheus compliant (#2304)

2020-05-02 Thread Federico Cabiddu
Thanks Daniel, documentation added to the wiki.

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


[sr-dev] git:master:3203a657: core: new core parameter stats_name_separator

2020-05-02 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: 3203a6572b874d191c3be61519853005bd5ab056
URL: 
https://github.com/kamailio/kamailio/commit/3203a6572b874d191c3be61519853005bd5ab056

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2020-05-01T13:02:39+02:00

core: new core parameter stats_name_separator

---

Modified: src/core/cfg.lex
Modified: src/core/cfg.y
Modified: src/core/cfg_core.c
Modified: src/core/cfg_core.h
Modified: src/core/config.h
Modified: src/modules/ims_usrloc_pcscf/udomain.c
Modified: src/modules/p_usrloc/udomain.c
Modified: src/modules/usrloc/udomain.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/3203a6572b874d191c3be61519853005bd5ab056.diff
Patch: 
https://github.com/kamailio/kamailio/commit/3203a6572b874d191c3be61519853005bd5ab056.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:9948696f: core: remove stats_name_separator from cfg_group_core

2020-05-02 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: 9948696fd84605919e6ce6a7106099f1cdd0de98
URL: 
https://github.com/kamailio/kamailio/commit/9948696fd84605919e6ce6a7106099f1cdd0de98

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2020-05-02T10:14:23+02:00

core: remove stats_name_separator from cfg_group_core

---

Modified: src/core/cfg.y
Modified: src/core/cfg_core.c
Modified: src/core/cfg_core.h
Modified: src/core/config.h
Modified: src/core/counters.c
Modified: src/core/counters.h
Modified: src/core/globals.h
Modified: src/modules/ims_usrloc_pcscf/udomain.c
Modified: src/modules/p_usrloc/udomain.c
Modified: src/modules/usrloc/udomain.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/9948696fd84605919e6ce6a7106099f1cdd0de98.diff
Patch: 
https://github.com/kamailio/kamailio/commit/9948696fd84605919e6ce6a7106099f1cdd0de98.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:0595795c: ims_usrloc_pcscf, p_usrloc, usrloc: use KSR_STATS_NAMESEP for stats names

2020-05-02 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: 0595795c659f6af586e63837efe56b45808cd735
URL: 
https://github.com/kamailio/kamailio/commit/0595795c659f6af586e63837efe56b45808cd735

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2020-04-28T16:24:24+02:00

ims_usrloc_pcscf, p_usrloc, usrloc: use KSR_STATS_NAMESEP for stats names

---

Modified: src/modules/ims_usrloc_pcscf/udomain.c
Modified: src/modules/p_usrloc/udomain.c
Modified: src/modules/usrloc/udomain.c

---

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

---

diff --git a/src/modules/ims_usrloc_pcscf/udomain.c 
b/src/modules/ims_usrloc_pcscf/udomain.c
index 7f63932e6b..bd5fabdb60 100644
--- a/src/modules/ims_usrloc_pcscf/udomain.c
+++ b/src/modules/ims_usrloc_pcscf/udomain.c
@@ -82,7 +82,7 @@ static char *build_stat_name( str* domain, char *var_name)
}
memcpy( s, domain->s, domain->len);
p = s + domain->len;
-   *(p++) = '_';
+   *(p++) = KSR_STATS_NAMESEP;
memcpy( p , var_name, strlen(var_name));
p += strlen(var_name);
*(p++) = 0;
diff --git a/src/modules/p_usrloc/udomain.c b/src/modules/p_usrloc/udomain.c
index 88612e957b..91db944a0c 100644
--- a/src/modules/p_usrloc/udomain.c
+++ b/src/modules/p_usrloc/udomain.c
@@ -55,7 +55,7 @@ static char *build_stat_name( str* domain, char *var_name)
}
memcpy( s, domain->s, domain->len);
p = s + domain->len;
-   *(p++) = '_';
+   *(p++) = KSR_STATS_NAMESEP;
memcpy( p , var_name, strlen(var_name));
p += strlen(var_name);
*(p++) = 0;
diff --git a/src/modules/usrloc/udomain.c b/src/modules/usrloc/udomain.c
index 321b72b64a..9f5e78cfd6 100644
--- a/src/modules/usrloc/udomain.c
+++ b/src/modules/usrloc/udomain.c
@@ -61,7 +61,7 @@ static char *build_stat_name( str* domain, char *var_name)
}
memcpy( s, domain->s, domain->len);
p = s + domain->len;
-   *(p++) = '_';
+   *(p++) = KSR_STATS_NAMESEP;
memcpy( p , var_name, strlen(var_name));
p += strlen(var_name);
*(p++) = 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:ddd27713: usrloc: change "-" for "_" in stats name to be prometheus compliant

2020-05-02 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: ddd277139165f39406832ddd557c2b56b75a7100
URL: 
https://github.com/kamailio/kamailio/commit/ddd277139165f39406832ddd557c2b56b75a7100

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2020-04-28T10:24:04+02:00

usrloc: change "-" for "_" in stats name to be prometheus compliant

---

Modified: src/modules/usrloc/udomain.c

---

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

---

diff --git a/src/modules/usrloc/udomain.c b/src/modules/usrloc/udomain.c
index 59ddff92d4..321b72b64a 100644
--- a/src/modules/usrloc/udomain.c
+++ b/src/modules/usrloc/udomain.c
@@ -61,7 +61,7 @@ static char *build_stat_name( str* domain, char *var_name)
}
memcpy( s, domain->s, domain->len);
p = s + domain->len;
-   *(p++) = '-';
+   *(p++) = '_';
memcpy( p , var_name, strlen(var_name));
p += strlen(var_name);
*(p++) = 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:4357b5e6: core: define KSR_STATS_NAMESEP for stats name separator

2020-05-02 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: 4357b5e6be2a71a401e9d53c43e787b9bfcc8ed0
URL: 
https://github.com/kamailio/kamailio/commit/4357b5e6be2a71a401e9d53c43e787b9bfcc8ed0

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2020-04-28T16:22:40+02:00

core: define KSR_STATS_NAMESEP for stats name separator

---

Modified: src/core/config.h

---

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

---

diff --git a/src/core/config.h b/src/core/config.h
index 63ff8dc26c..6af3dfecfd 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -211,4 +211,6 @@
 
 #define DEFAULT_MAX_WHILE_LOOPS 100/*!< Maximum allowed iterations 
for a while (to catch runaways) */
 
+#define KSR_STATS_NAMESEP '_' 
+
 #endif


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


[sr-dev] git:master:2fe0378c: p_usrloc, ims_usrloc_pcscf: change "-" for "_" in stats name to be prometheus compliant

2020-05-02 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: 2fe0378c3d0596e30d8ec9ea4cb7d828321d2030
URL: 
https://github.com/kamailio/kamailio/commit/2fe0378c3d0596e30d8ec9ea4cb7d828321d2030

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2020-04-28T14:48:59+02:00

p_usrloc, ims_usrloc_pcscf: change "-" for "_" in stats name to be prometheus 
compliant

---

Modified: src/modules/ims_usrloc_pcscf/udomain.c
Modified: src/modules/p_usrloc/udomain.c

---

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

---

diff --git a/src/modules/ims_usrloc_pcscf/udomain.c 
b/src/modules/ims_usrloc_pcscf/udomain.c
index 1be609ad42..7f63932e6b 100644
--- a/src/modules/ims_usrloc_pcscf/udomain.c
+++ b/src/modules/ims_usrloc_pcscf/udomain.c
@@ -82,7 +82,7 @@ static char *build_stat_name( str* domain, char *var_name)
}
memcpy( s, domain->s, domain->len);
p = s + domain->len;
-   *(p++) = '-';
+   *(p++) = '_';
memcpy( p , var_name, strlen(var_name));
p += strlen(var_name);
*(p++) = 0;
diff --git a/src/modules/p_usrloc/udomain.c b/src/modules/p_usrloc/udomain.c
index c25f1c6253..88612e957b 100644
--- a/src/modules/p_usrloc/udomain.c
+++ b/src/modules/p_usrloc/udomain.c
@@ -55,7 +55,7 @@ static char *build_stat_name( str* domain, char *var_name)
}
memcpy( s, domain->s, domain->len);
p = s + domain->len;
-   *(p++) = '-';
+   *(p++) = '_';
memcpy( p , var_name, strlen(var_name));
p += strlen(var_name);
*(p++) = 0;


___
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] usrloc: change "-" for "_" in stats name to be prometheus compliant (#2304)

2020-05-02 Thread Federico Cabiddu
Right, I realized after doing it. I've pushed the new suggest implementation.

-- 
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/2304#issuecomment-622852013___
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] usrloc: change "-" for "_" in stats name to be prometheus compliant (#2304)

2020-05-02 Thread Federico Cabiddu
@grumvalski pushed 1 commit.

9948696fd84605919e6ce6a7106099f1cdd0de98  core: remove stats_name_separator 
from cfg_group_core


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/kamailio/kamailio/pull/2304/files/3203a6572b874d191c3be61519853005bd5ab056..9948696fd84605919e6ce6a7106099f1cdd0de98
___
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] usrloc: change "-" for "_" in stats name to be prometheus compliant (#2304)

2020-05-01 Thread Federico Cabiddu
@grumvalski pushed 1 commit.

3203a6572b874d191c3be61519853005bd5ab056  core: new core parameter 
stats_name_separator


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/kamailio/kamailio/pull/2304/files/0595795c659f6af586e63837efe56b45808cd735..3203a6572b874d191c3be61519853005bd5ab056
___
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] usrloc: change "-" for "_" in stats name to be prometheus compliant (#2304)

2020-04-30 Thread Federico Cabiddu
I can find some time in the next days to implement the global param. I'd also 
go for prometheus format by default.

-- 
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/2304#issuecomment-621800458___
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] usrloc: change "-" for "_" in stats name to be prometheus compliant (#2304)

2020-04-28 Thread Federico Cabiddu
@grumvalski pushed 2 commits.

4357b5e6be2a71a401e9d53c43e787b9bfcc8ed0  core: define KSR_STATS_NAMESEP for 
stats name separator
0595795c659f6af586e63837efe56b45808cd735  ims_usrloc_pcscf, p_usrloc, usrloc: 
use KSR_STATS_NAMESEP for stats names


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/kamailio/kamailio/pull/2304/files/2fe0378c3d0596e30d8ec9ea4cb7d828321d2030..0595795c659f6af586e63837efe56b45808cd735
___
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] usrloc: change "-" for "_" in stats name to be prometheus compliant (#2304)

2020-04-28 Thread Federico Cabiddu
@grumvalski pushed 1 commit.

2fe0378c3d0596e30d8ec9ea4cb7d828321d2030  p_usrloc, ims_usrloc_pcscf: change 
"-" for "_" in stats name to be prometheus compliant


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/kamailio/kamailio/pull/2304/files/ddd277139165f39406832ddd557c2b56b75a7100..2fe0378c3d0596e30d8ec9ea4cb7d828321d2030
___
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] usrloc: change "-" for "_" in stats name to be prometheus compliant (#2304)

2020-04-28 Thread Federico Cabiddu
I've spot the same usage in p_usrloc and ims_usrloc_pcscf modules (they both 
derived from usrloc).
I didn't notice any other module building "derivate" stats (as those), so I'm 
not sure that implementing a global param is worth in this case.

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


[sr-dev] [kamailio/kamailio] usrloc: change "-" for "_" in stats name to be prometheus compliant (#2304)

2020-04-28 Thread Federico Cabiddu
!-- Kamailio Pull Request Template --

!--
IMPORTANT:
  - for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
  - pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
  - backports to stable branches must be done with git cherry-pick -x 
...
  - code is contributed under BSD for core and main components (tm, sl, auth, 
tls)
  - code is contributed GPLv2 or a compatible license for the other components
  - GPL code is contributed with OpenSSL licensing exception
--

 Pre-Submission Checklist
!-- Go over all points below, and after creating the PR, tick all the 
checkboxes that apply --
!-- All points should be verified, otherwise, read the CONTRIBUTING 
guidelines from above--
!-- If youre unsure about any of these, dont hesitate to ask on 
sr-dev mailing list --
- [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
- [X] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)

 Checklist:
!-- Go over all points below, and after creating the PR, tick the 
checkboxes that apply --
- [X] PR should be backported to stable branches
- [X] Tested changes locally
- [ ] Related to issue # (replace  with an open issue number)

 Description
!-- Describe your changes in detail --
usrloc generated statistics (contacts, expires, users) contain - in 
their names (usrloc-contacs and so on), which is not valid according to 
prometheus naming convention.  
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * usrloc: change - for _ in stats name to be 
prometheus compliant

-- File Changes --

M src/modules/usrloc/udomain.c (2)

-- Patch Links --

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


[sr-dev] git:5.3:3333d76e: siptrace: siptrace: fix memory leak in fake replies tracing

2020-04-22 Thread Federico Cabiddu
Module: kamailio
Branch: 5.3
Commit: d76e57c637b6d6dd7617ba4a51892a836d04
URL: 
https://github.com/kamailio/kamailio/commit/d76e57c637b6d6dd7617ba4a51892a836d04

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2020-04-22T14:17:14+02:00

siptrace: siptrace: fix memory leak in fake replies tracing

---

Modified: src/modules/siptrace/siptrace.c

---

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

---

diff --git a/src/modules/siptrace/siptrace.c b/src/modules/siptrace/siptrace.c
index ccd0b72508..e49946e525 100644
--- a/src/modules/siptrace/siptrace.c
+++ b/src/modules/siptrace/siptrace.c
@@ -1496,6 +1496,7 @@ static void trace_onreply_out(struct cell *t, int type, 
struct tmcb_params *ps)
siptrace_data_t sto;
siptrace_info_t* info;
int faked = 0;
+   int parsed_f = 0;
struct sip_msg *msg;
struct sip_msg *req;
struct ip_addr to_ip;
@@ -1534,6 +1535,11 @@ static void trace_onreply_out(struct cell *t, int type, 
struct tmcb_params *ps)
if(msg == NULL || msg == FAKED_REPLY) {
msg = t->uas.request;
faked = 1;
+   /* check if from header has been already parsed.
+* If not we have to parse it in pkg memory and free it at the 
end.
+*/
+   if (msg->from && msg->from->parsed == NULL)
+   parsed_f = 1;
}
 
if(sip_trace_prepare(msg) < 0)
@@ -1617,10 +1623,16 @@ static void trace_onreply_out(struct cell *t, int type, 
struct tmcb_params *ps)
 
if (info->uriState == STRACE_RAW_URI) {
LM_BUG("uriState must be either UNUSED or PARSED here! must be 
a bug! Message won't be traced!\n");
-   return;
+   goto end;
}
 
sip_trace_store(, info->uriState == STRACE_PARSED_URI ? 
>u.dest_info : NULL, NULL);
+
+end:
+   if (faked && parsed_f) {
+   free_from(msg->from->parsed);
+   msg->from->parsed = NULL;
+   }
 }
 
 static void trace_tm_neg_ack_in(struct cell *t, int type, struct tmcb_params 
*ps)


___
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] siptrace: siptrace: fix memory leak in fake replies tracing (#2295)

2020-04-22 Thread Federico Cabiddu
Merged #2295 into master.

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


[sr-dev] git:master:0f461ee2: siptrace: free parsed from in case of errors

2020-04-22 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: 0f461ee26fa72d1d2f4f6777f3e0d233619dc3fb
URL: 
https://github.com/kamailio/kamailio/commit/0f461ee26fa72d1d2f4f6777f3e0d233619dc3fb

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2020-04-22T12:17:18+02:00

siptrace: free parsed from in case of errors

---

Modified: src/modules/siptrace/siptrace.c

---

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

---

diff --git a/src/modules/siptrace/siptrace.c b/src/modules/siptrace/siptrace.c
index 26e9323ec7..5b4c064bec 100644
--- a/src/modules/siptrace/siptrace.c
+++ b/src/modules/siptrace/siptrace.c
@@ -1383,7 +1383,7 @@ static void trace_onreq_out(struct cell *t, int type, 
struct tmcb_params *ps)
}
 
if(sip_trace_msg_attrs(msg, ) < 0) {
-   return;
+   return; 
}
 
if(ps->send_buf.len > 0) {
@@ -1616,7 +1616,7 @@ static void trace_onreply_out(struct cell *t, int type, 
struct tmcb_params *ps)
}
 
if(sip_trace_msg_attrs(msg, ) < 0) {
-   return;
+   goto end;
}
 
if(faked == 0) {
@@ -1662,7 +1662,7 @@ static void trace_onreply_out(struct cell *t, int type, 
struct tmcb_params *ps)
sto.status.s = int2strbuf(ps->code, statusbuf, INT2STR_MAX_LEN, 
);
if(sto.status.s == 0) {
LM_ERR("failure to get the status string\n");
-   return;
+   goto end;
}
 
memset(_ip, 0, sizeof(struct ip_addr));
@@ -1700,7 +1700,7 @@ static void trace_onreply_out(struct cell *t, int type, 
struct tmcb_params *ps)
 end:
if (faked && parsed_f) {
free_from(msg->from->parsed);
-msg->from->parsed = NULL;
+   msg->from->parsed = NULL;
}
 }
 


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


[sr-dev] git:master:ee7496f1: siptrace: siptrace: fix memory leak in fake replies tracing

2020-04-22 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: ee7496f18b626a6c5dff10753db5b546759f6f7b
URL: 
https://github.com/kamailio/kamailio/commit/ee7496f18b626a6c5dff10753db5b546759f6f7b

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2020-04-22T10:54:29+02:00

siptrace: siptrace: fix memory leak in fake replies tracing

---

Modified: src/modules/siptrace/siptrace.c

---

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

---

diff --git a/src/modules/siptrace/siptrace.c b/src/modules/siptrace/siptrace.c
index 3bd1f5a98c..26e9323ec7 100644
--- a/src/modules/siptrace/siptrace.c
+++ b/src/modules/siptrace/siptrace.c
@@ -1569,6 +1569,7 @@ static void trace_onreply_out(struct cell *t, int type, 
struct tmcb_params *ps)
siptrace_data_t sto;
siptrace_info_t* info;
int faked = 0;
+   int parsed_f = 0;
struct sip_msg *msg;
struct sip_msg *req;
struct ip_addr to_ip;
@@ -1607,6 +1608,11 @@ static void trace_onreply_out(struct cell *t, int type, 
struct tmcb_params *ps)
if(msg == NULL || msg == FAKED_REPLY) {
msg = t->uas.request;
faked = 1;
+   /* check if from header has been already parsed.
+* If not we have to parse it in pkg memory and free it at the 
end.
+*/
+   if (msg->from && msg->from->parsed == NULL)
+   parsed_f = 1;
}
 
if(sip_trace_msg_attrs(msg, ) < 0) {
@@ -1686,10 +1692,16 @@ static void trace_onreply_out(struct cell *t, int type, 
struct tmcb_params *ps)
 
if (info->uriState == STRACE_RAW_URI) {
LM_BUG("uriState must be either UNUSED or PARSED here! must be 
a bug! Message won't be traced!\n");
-   return;
+   goto end;
}
 
sip_trace_store(, info->uriState == STRACE_PARSED_URI ? 
>u.dest_info : NULL, NULL);
+
+end:
+   if (faked && parsed_f) {
+   free_from(msg->from->parsed);
+msg->from->parsed = NULL;
+   }
 }
 
 static void trace_tm_neg_ack_in(struct cell *t, int type, struct tmcb_params 
*ps)


___
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] siptrace: siptrace: fix memory leak in fake replies tracing (#2295)

2020-04-22 Thread Federico Cabiddu
@grumvalski commented on this pull request.



> @@ -1383,7 +1383,7 @@ static void trace_onreq_out(struct cell *t, int type, 
> struct tmcb_params *ps)
}
 
if(sip_trace_msg_attrs(msg, ) < 0) {
-   return;
+   goto end; 
}

sorry, definitely not my day today...

-- 
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/2295#discussion_r412857021___
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] siptrace: siptrace: fix memory leak in fake replies tracing (#2295)

2020-04-22 Thread Federico Cabiddu
@grumvalski pushed 1 commit.

0f461ee26fa72d1d2f4f6777f3e0d233619dc3fb  siptrace: free parsed from in case of 
errors


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/kamailio/kamailio/pull/2295/files/f2e675876980c5c066a837fbd25c20594cfc64ea..0f461ee26fa72d1d2f4f6777f3e0d233619dc3fb
___
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] siptrace: siptrace: fix memory leak in fake replies tracing (#2295)

2020-04-22 Thread Federico Cabiddu
@grumvalski pushed 1 commit.

f2e675876980c5c066a837fbd25c20594cfc64ea  siptrace: free parsed from in case of 
errors


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/kamailio/kamailio/pull/2295/files/ee7496f18b626a6c5dff10753db5b546759f6f7b..f2e675876980c5c066a837fbd25c20594cfc64ea
___
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] siptrace: siptrace: fix memory leak in fake replies tracing (#2295)

2020-04-22 Thread Federico Cabiddu
Thank you Daniel and, again, you are right, I was working on 5.3 branch and 
didn't realize the new sip_trace_msg_attrs function. I'm pushing a fix. This 
also means that the patch cannot be backported to 5.3 as it is. 

-- 
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/2295#issuecomment-617665185___
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] siptrace: siptrace: fix memory leak in fake replies tracing (#2295)

2020-04-22 Thread Federico Cabiddu
@grumvalski pushed 1 commit.

ee7496f18b626a6c5dff10753db5b546759f6f7b  siptrace: siptrace: fix memory leak 
in fake replies tracing


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/kamailio/kamailio/pull/2295/files/c366b54689374dbcea0e94bf7810eee29aa17e45..ee7496f18b626a6c5dff10753db5b546759f6f7b
___
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] siptrace: siptrace: fix memory leak in fake replies tracing (#2295)

2020-04-22 Thread Federico Cabiddu
@grumvalski commented on this pull request.



> @@ -1607,6 +1608,11 @@ static void trace_onreply_out(struct cell *t, int 
> type, struct tmcb_params *ps)
if(msg == NULL || msg == FAKED_REPLY) {
msg = t->uas.request;
faked = 1;
+   /* check if from header has been already parsed.
+* If not we have to parse it in pkg memory and free iit at the 
end.
+*/
+   if (msg->from && msg->from->parsed != NULL)

you're right, I wrongly copied from local. I'm going to fix and force push.

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


[sr-dev] [kamailio/kamailio] siptrace: siptrace: fix memory leak in fake replies tracing (#2295)

2020-04-22 Thread Federico Cabiddu
!-- Kamailio Pull Request Template --

!--
IMPORTANT:
  - for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
  - pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
  - backports to stable branches must be done with git cherry-pick -x 
...
  - code is contributed under BSD for core and main components (tm, sl, auth, 
tls)
  - code is contributed GPLv2 or a compatible license for the other components
  - GPL code is contributed with OpenSSL licensing exception
--

 Pre-Submission Checklist
!-- Go over all points below, and after creating the PR, tick all the 
checkboxes that apply --
!-- All points should be verified, otherwise, read the CONTRIBUTING 
guidelines from above--
!-- If youre unsure about any of these, dont hesitate to ask on 
sr-dev mailing list --
- [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
- [X] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)

 Checklist:
!-- Go over all points below, and after creating the PR, tick the 
checkboxes that apply --
- [X] PR should be backported to stable branches
- [ ] Tested changes locally
- [ ] Related to issue # (replace  with an open issue number)

 Description
!-- Describe your changes in detail --
When tracing a faked reply (like 200 for CANCEL), the sip msg used to retrieve 
the tracing parameters is the transactions uas one (uas.request) which 
might have the from header parsed or not, depending on the routing script 
actions (by default, if Im not wrong, it is not parsed). If the header is 
not parsed, calling get_from in trace_onreply_out function will lead to a 
memory leak, beacause the header is parsed in pkg memory not freed when the 
transaction is deleted.
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * siptrace: siptrace: fix memory leak in fake replies tracing

-- File Changes --

M src/modules/siptrace/siptrace.c (12)

-- Patch Links --

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


[sr-dev] git:5.2:b6f40ec3: http_async_client: do not set global avp lists from t on async callback

2020-04-20 Thread Federico Cabiddu
Module: kamailio
Branch: 5.2
Commit: b6f40ec3016961d9e2f97b40bc6a05c752780b4f
URL: 
https://github.com/kamailio/kamailio/commit/b6f40ec3016961d9e2f97b40bc6a05c752780b4f

Author: Daniel-Constantin Mierla 
Committer: Federico Cabiddu 
Date: 2020-04-20T09:51:59+02:00

http_async_client: do not set global avp lists from t on async callback

- they are done by fake_env() used inside t_continue()
- they were set without reset, living in the process context, resulting
in invalid access when async callback was executed with faked_msg
- related to #2286

(cherry picked from commit 1bc3bbd010705ee247345c1ed9b36210bb8d9ed1)

---

Modified: src/modules/http_async_client/async_http.c

---

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

---

diff --git a/src/modules/http_async_client/async_http.c 
b/src/modules/http_async_client/async_http.c
index c459d564a8..2aa6681a7d 100644
--- a/src/modules/http_async_client/async_http.c
+++ b/src/modules/http_async_client/async_http.c
@@ -212,7 +212,7 @@ void async_http_cb(struct http_m_reply *reply, void *param)
}
 
strncpy(q_id, aq->id, strlen(aq->id));
-   
+
q_id[strlen(aq->id)] = '\0';
 
cfg_update();
@@ -227,16 +227,10 @@ void async_http_cb(struct http_m_reply *reply, void 
*param)
free_async_query(aq);
return;
}
-   // we bring the list of AVPs of the transaction to the current 
context
-   set_avp_list(AVP_TRACK_FROM | AVP_CLASS_URI, >uri_avps_from);
-   set_avp_list(AVP_TRACK_TO | AVP_CLASS_URI, >uri_avps_to);
-   set_avp_list(AVP_TRACK_FROM | AVP_CLASS_USER, 
>user_avps_from);
-   set_avp_list(AVP_TRACK_TO | AVP_CLASS_USER, >user_avps_to);
-   set_avp_list(AVP_TRACK_FROM | AVP_CLASS_DOMAIN, 
>domain_avps_from);
-   set_avp_list(AVP_TRACK_TO | AVP_CLASS_DOMAIN, 
>domain_avps_to);
-
-   if (t)
+
+   if (t) {
tmb.unref_cell(t);
+   }
 
LM_DBG("resuming transaction (%d:%d)\n", tindex, tlabel);
 


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


[sr-dev] git:5.3:ff48cc53: http_async_client: do not set global avp lists from t on async callback

2020-04-20 Thread Federico Cabiddu
Module: kamailio
Branch: 5.3
Commit: ff48cc5311d55176118ad57cf2d4417a2d229766
URL: 
https://github.com/kamailio/kamailio/commit/ff48cc5311d55176118ad57cf2d4417a2d229766

Author: Daniel-Constantin Mierla 
Committer: Federico Cabiddu 
Date: 2020-04-20T09:51:42+02:00

http_async_client: do not set global avp lists from t on async callback

- they are done by fake_env() used inside t_continue()
- they were set without reset, living in the process context, resulting
in invalid access when async callback was executed with faked_msg
- related to #2286

(cherry picked from commit 1bc3bbd010705ee247345c1ed9b36210bb8d9ed1)

---

Modified: src/modules/http_async_client/async_http.c

---

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

---

diff --git a/src/modules/http_async_client/async_http.c 
b/src/modules/http_async_client/async_http.c
index e468a955dc..5edf67ee5d 100644
--- a/src/modules/http_async_client/async_http.c
+++ b/src/modules/http_async_client/async_http.c
@@ -212,7 +212,7 @@ void async_http_cb(struct http_m_reply *reply, void *param)
}
 
strncpy(q_id, aq->id, strlen(aq->id));
-   
+
q_id[strlen(aq->id)] = '\0';
 
cfg_update();
@@ -227,16 +227,10 @@ void async_http_cb(struct http_m_reply *reply, void 
*param)
free_async_query(aq);
return;
}
-   // we bring the list of AVPs of the transaction to the current 
context
-   set_avp_list(AVP_TRACK_FROM | AVP_CLASS_URI, >uri_avps_from);
-   set_avp_list(AVP_TRACK_TO | AVP_CLASS_URI, >uri_avps_to);
-   set_avp_list(AVP_TRACK_FROM | AVP_CLASS_USER, 
>user_avps_from);
-   set_avp_list(AVP_TRACK_TO | AVP_CLASS_USER, >user_avps_to);
-   set_avp_list(AVP_TRACK_FROM | AVP_CLASS_DOMAIN, 
>domain_avps_from);
-   set_avp_list(AVP_TRACK_TO | AVP_CLASS_DOMAIN, 
>domain_avps_to);
-
-   if (t)
+
+   if (t) {
tmb.unref_cell(t);
+   }
 
LM_DBG("resuming transaction (%d:%d)\n", tindex, tlabel);
 


___
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] async_http_client crash (#2286)

2020-04-18 Thread Federico Cabiddu
Sorry the mail was sent before ending by accident.

Thanks for looking into it and fixing it Daniel. For sure it should be
backported.

Cheers,

Federico

On Sat, Apr 18, 2020 at 9:23 AM Federico Cabiddu 
wrote:

> Hi Daniel,
> you are absolutely right and that part of code is for sure wrong. Those
> lines have been there since the beginning and for sure due to my lack of
> understanding of transactions's internals and avps (don't remember why
> sincerely).
> For the records, I've been using mixed suspended/not suspended from the
> beginning but I've always used separate return routes for suspended and not
> suspended queries. That could explain why I never had it.
> Thanks for looking into it
>
> On Sat, Apr 18, 2020 at 3:13 AM Alex Balashov 
> wrote:
>
>> @miconda <https://github.com/miconda> To answer a few other questions:
>>
>>1.
>>
>>I always set $http_req(suspend) = 1 on async HTTP client transactions;
>>2.
>>
>>There are no event_routes anywhere;
>>3.
>>
>>The flow is complex, though. After this async HTTP query, there is
>>another *synchronous* HTTP query using the normal http_client module
>>+ mqueue + rtimer -- it was implemented this way because of some
>>problems with transaction-persistent variables (ironically) when 
>> suspending
>>the same TM transaction twice, and a desire for more granular control over
>>the request pipelines given the high and somewhat unpredictable latency of
>>what's being queried.
>>
>> Nevertheless, all this takes place long after the crash point.
>>
>> —
>> You are receiving this because you are subscribed to this thread.
>> Reply to this email directly, view it on GitHub
>> <https://github.com/kamailio/kamailio/issues/2286#issuecomment-615530081>,
>> or unsubscribe
>> <https://github.com/notifications/unsubscribe-auth/ABO7UZJSBJ6RUK2BJR3UONLRND5DNANCNFSM4MIVPAIQ>
>> .
>> ___
>> Kamailio (SER) - Development Mailing List
>> sr-dev@lists.kamailio.org
>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
>>
>
___
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] async_http_client crash (#2286)

2020-04-18 Thread Federico Cabiddu
Hi Daniel,
you are absolutely right and that part of code is for sure wrong. Those
lines have been there since the beginning and for sure due to my lack of
understanding of transactions's internals and avps (don't remember why
sincerely).
For the records, I've been using mixed suspended/not suspended from the
beginning but I've always used separate return routes for suspended and not
suspended queries. That could explain why I never had it.
Thanks for looking into it

On Sat, Apr 18, 2020 at 3:13 AM Alex Balashov 
wrote:

> @miconda  To answer a few other questions:
>
>1.
>
>I always set $http_req(suspend) = 1 on async HTTP client transactions;
>2.
>
>There are no event_routes anywhere;
>3.
>
>The flow is complex, though. After this async HTTP query, there is
>another *synchronous* HTTP query using the normal http_client module +
>mqueue + rtimer -- it was implemented this way because of some
>problems with transaction-persistent variables (ironically) when suspending
>the same TM transaction twice, and a desire for more granular control over
>the request pipelines given the high and somewhat unpredictable latency of
>what's being queried.
>
> Nevertheless, all this takes place long after the crash point.
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> ,
> or unsubscribe
> 
> .
> ___
> Kamailio (SER) - Development Mailing List
> sr-dev@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
>
___
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] async_http_client crash (#2286)

2020-04-15 Thread Federico Cabiddu
Hi Alex,
yes, avp should be persistent. I've never seen a crash like this in 5.2.x (the 
release I'm using in prod) and I'm using avp in resume routes, even 
suspending/resuming twice a single transaction (I have a scenario where two 
http queries are run).
Have anything changed in your system recently, e.g. libcurl version?
I'll try to have a look in the next days to what might have changed in the 
transactions framework that could explain.

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


Re: [sr-dev] git:master:430e00a2: modules: readme files regenerated - dialog ... [skip ci]

2020-04-09 Thread Federico Cabiddu
Nice! Thank you Daniel!

On Thu, 9 Apr 2020, 09:46 Kamailio Dev,  wrote:

> Module: kamailio
> Branch: master
> Commit: 430e00a208c9ae4c2cdc39d628fc0a1d23f30f81
> URL:
> https://github.com/kamailio/kamailio/commit/430e00a208c9ae4c2cdc39d628fc0a1d23f30f81
>
> Author: Kamailio Dev 
> Committer: Kamailio Dev 
> Date: 2020-04-09T09:46:16+02:00
>
> modules: readme files regenerated - dialog ... [skip ci]
>
> ---
>
> Modified: src/modules/dialog/README
>
> ---
>
> Diff:
> https://github.com/kamailio/kamailio/commit/430e00a208c9ae4c2cdc39d628fc0a1d23f30f81.diff
> Patch:
> https://github.com/kamailio/kamailio/commit/430e00a208c9ae4c2cdc39d628fc0a1d23f30f81.patch
>
> ---
>
> diff --git a/src/modules/dialog/README b/src/modules/dialog/README
> index cfae6ac338..cb6413f981 100644
> --- a/src/modules/dialog/README
> +++ b/src/modules/dialog/README
> @@ -2237,17 +2237,33 @@ kamcmd dlg.is_alive callid123 fromtag123 totag123
>
>  9.16. dlg.briefing
>
> -   Lists fewer attributes for dialog records in memory.
> +   Lists fewer attributes for dialog records in memory. The dialog hash
> +   entry and id are added always, the rest of them are a matter of 'attrs'
> +   parameter.
>
> Name: dlg.briefing
>
> Parameters:
> - * none - no parameter
> + * attrs - (optional) a list of characters (flags) representing the
> +   fields to be added to the response. If is missing, its default
> +   value is 'ftcFT' (note the characters are case sensitive).
> +   The characters can be:
> +  + f - From URI
> +  + t - To URI
> +  + c - Call-ID
> +  + F - From tag
> +  + T - To tag
> +  + I - Init time
> +  + S - Start time
> +  + E - End time
> +  + s - State
>
> RPC Command Example:
>  ...
>  kamctl rpc dlg.briefing
>  ...
> +kamctl rpc dlg.briefing "ft"
> +...
>
>  10. Exported Variables
>
>
>
> ___
> Kamailio (SER) - Development Mailing List
> sr-dev@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
>
___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


  1   2   3   >