Re: [sr-dev] [kamailio/kamailio] dialog: add dialog init, start end end timestamps to the output of dl… (#2279)

2020-04-08 Thread Federico Cabiddu
Merged #2279 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/2279#event-3216591710___
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] dialog: add dialog init, start end end timestamps to the output of dl… (#2279)

2020-04-08 Thread Federico Cabiddu
Nice idea, if I have time the next days I can start looking at 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/pull/2279#issuecomment-611304259___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:0eb265e6: dialog: add dialog init, start and end timestamps to the output of dlg.briefing

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

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2020-04-08T16:05:37+02:00

dialog: add dialog init, start and end timestamps to the output of dlg.briefing

---

Modified: src/modules/dialog/dialog.c

---

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

---

diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c
index 5dd941e7d0..962fceeb52 100644
--- a/src/modules/dialog/dialog.c
+++ b/src/modules/dialog/dialog.c
@@ -3075,7 +3075,7 @@ static void rpc_dlg_briefing(rpc_t *rpc, void *c)
rpc->fault(c, 500, "Failed to create the 
structure");
return;
}
-   if(rpc->struct_add(h, "ddSd",
+   if(rpc->struct_add(h, "ddS",
"h_entry", dlg->h_entry,
"h_id", dlg->h_id,
"from_uri", >from_uri,
@@ -3083,6 +3083,9 @@ static void rpc_dlg_briefing(rpc_t *rpc, void *c)
"call-id", >callid,
"from_tag", >tag[DLG_CALLER_LEG],
"to_tag", >tag[DLG_CALLER_LEG],
+   "init_ts", dlg->init_ts,
+   "start_ts", dlg->start_ts,
+   "end_ts", dlg->end_ts,
"state", dlg->state) < 0) {
rpc->fault(c, 500, "Failed to add fields");
return;


___
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] Grumvalski/ds outbound proxy (#2275)

2020-04-08 Thread Federico Cabiddu
Merged #2275 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/2275#event-3216588701___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:8fa5e4f5: dispatcher: docs for obproxy attr

2020-04-08 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: 8fa5e4f572a1ffe7efeb88cf8b80c1337f74741f
URL: 
https://github.com/kamailio/kamailio/commit/8fa5e4f572a1ffe7efeb88cf8b80c1337f74741f

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2020-04-07T15:18:34+02:00

dispatcher: docs for obproxy attr

---

Modified: src/modules/dispatcher/doc/dispatcher.xml
Modified: src/modules/dispatcher/doc/dispatcher_admin.xml

---

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

---

diff --git a/src/modules/dispatcher/doc/dispatcher.xml 
b/src/modules/dispatcher/doc/dispatcher.xml
index 8502aec0a3..b64151dd44 100644
--- a/src/modules/dispatcher/doc/dispatcher.xml
+++ b/src/modules/dispatcher/doc/dispatcher.xml
@@ -59,6 +59,11 @@
 Chavanton
 jchavan...@gmail.com
 
+
+Federico
+Cabiddu
+federico.cabi...@gmail.com
+


2004
@@ -84,6 +89,10 @@
 2017, 2018
 Julien chavanton, Flowroute
 
+   
+2020
+Federico Cabiddu, Libon
+   

 
 
diff --git a/src/modules/dispatcher/doc/dispatcher_admin.xml 
b/src/modules/dispatcher/doc/dispatcher_admin.xml
index ae8102b355..30cd6a5ec1 100644
--- a/src/modules/dispatcher/doc/dispatcher_admin.xml
+++ b/src/modules/dispatcher/doc/dispatcher_admin.xml
@@ -1316,6 +1316,7 @@ DEST: {
RWEIGHT: 50
SOCKET: 
SOCKNAME: 
+   OBPROXY: 
}
LATENCY: {
AVG: 20.104000
@@ -2055,6 +2056,10 @@ DEST: {
'ping_from' - used to set the From URI 
in OPTIONS keepalives.
It overwrites the general ds_ping_from 
parameter.

+   
+   'obproxy' - SIP URI of outbound proxy 
to be used when sending pings.
+   It overwrites the general 
ds_outbound_proxy parameter.
+   





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


[sr-dev] git:master:74ef108f: dispatcher: add new gateway attr "obproxy"

2020-04-08 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: 74ef108fe0371bd261acc42291d7adbba357f769
URL: 
https://github.com/kamailio/kamailio/commit/74ef108fe0371bd261acc42291d7adbba357f769

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2020-04-07T15:07:44+02:00

dispatcher: add new gateway attr "obproxy"

---

Modified: src/modules/dispatcher/dispatch.c
Modified: src/modules/dispatcher/dispatch.h
Modified: src/modules/dispatcher/dispatcher.c

---

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

---

diff --git a/src/modules/dispatcher/dispatch.c 
b/src/modules/dispatcher/dispatch.c
index b62d4c86de..6ded012085 100644
--- a/src/modules/dispatcher/dispatch.c
+++ b/src/modules/dispatcher/dispatch.c
@@ -324,6 +324,9 @@ int ds_set_attrs(ds_dest_t *dest, str *vattrs)
} else if(pit->name.len == 9
&& strncasecmp(pit->name.s, "ping_from", 9) == 
0) {
dest->attrs.ping_from = pit->body;
+   } else if(pit->name.len == 7 
+ && strncasecmp(pit->name.s, "obproxy", 7) == 
0) {
+   dest->attrs.obproxy = pit->body;
}
}
if(params_list)
@@ -3295,6 +3298,7 @@ void ds_ping_set(ds_set_t *node)
uac_req_t uac_r;
int i, j;
str ping_from;
+   str obproxy;
 
if(!node)
return;
@@ -3342,10 +3346,20 @@ void ds_ping_set(ds_set_t *node)
LM_DBG("Default ping_from: %.*s\n", 
ping_from.len, ping_from.s);
}
 
+   if(node->dlist[j].attrs.obproxy.s != NULL
+   && node->dlist[j].attrs.obproxy.len > 
0) {
+   obproxy = node->dlist[j].attrs.obproxy;
+   LM_DBG("outbound proxy: %.*s\n", obproxy.len, 
obproxy.s);
+   }
+   else {
+   obproxy = ds_outbound_proxy;
+   LM_DBG("Default outbound proxy: %.*s\n", 
ds_outbound_proxy.len, ds_outbound_proxy.s);
+   }
+
gettimeofday(>dlist[j].latency_stats.start, NULL);
 
if(tmb.t_request(_r, >dlist[j].uri, 
>dlist[j].uri,
-  _from, _outbound_proxy)
+  _from, )
< 0) {
LM_ERR("unable to ping [%.*s]\n", 
node->dlist[j].uri.len,
node->dlist[j].uri.s);
diff --git a/src/modules/dispatcher/dispatch.h 
b/src/modules/dispatcher/dispatch.h
index e067d30478..6c167a9551 100644
--- a/src/modules/dispatcher/dispatch.h
+++ b/src/modules/dispatcher/dispatch.h
@@ -188,6 +188,7 @@ typedef struct _ds_attrs {
int rweight;
int congestion_control;
str ping_from;
+   str obproxy;
 } ds_attrs_t;
 
 typedef struct _ds_latency_stats {
diff --git a/src/modules/dispatcher/dispatcher.c 
b/src/modules/dispatcher/dispatcher.c
index 06e96da61a..6ac01bbd2a 100644
--- a/src/modules/dispatcher/dispatcher.c
+++ b/src/modules/dispatcher/dispatcher.c
@@ -1573,7 +1573,7 @@ int ds_rpc_print_set(ds_set_t *node, rpc_t *rpc, void 
*ctx, void *rpc_handle)
rpc->fault(ctx, 500, "Internal error creating 
dest struct");
return -1;
}
-   if(rpc->struct_add(wh, "SSdddSS",
+   if(rpc->struct_add(wh, "SSdddSSS",
"BODY", 
&(node->dlist[j].attrs.body),
"DUID", 
(node->dlist[j].attrs.duid.s)
? 
&(node->dlist[j].attrs.duid) : ,
@@ -1583,7 +1583,9 @@ int ds_rpc_print_set(ds_set_t *node, rpc_t *rpc, void 
*ctx, void *rpc_handle)
"SOCKET", 
(node->dlist[j].attrs.socket.s)
? 
&(node->dlist[j].attrs.socket) : ,
"SOCKNAME", 
(node->dlist[j].attrs.sockname.s)
-   ? 
&(node->dlist[j].attrs.sockname) : )
+   ? 
&(node->dlist[j].attrs.sockname) : ,
+   "OBP

Re: [sr-dev] [kamailio/kamailio] siptrace: safety check for transaction when checking ACK (#2278)

2020-04-08 Thread Federico Cabiddu
Merged #2278 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/2278#event-3216585996___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:0c142be9: siptrace: safety check for transaction when checking ACK

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

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2020-04-08T14:40:17+02:00

siptrace: safety check for transaction when checking ACK

---

Modified: src/modules/siptrace/siptrace.c

---

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

---

diff --git a/src/modules/siptrace/siptrace.c b/src/modules/siptrace/siptrace.c
index c3876c9108..a7bcde62b8 100644
--- a/src/modules/siptrace/siptrace.c
+++ b/src/modules/siptrace/siptrace.c
@@ -874,16 +874,18 @@ static int sip_trace_helper(sip_msg_t *msg, dest_info_t 
*dst, str *duri,
orig_t = tmb.t_gett();
if(tmb.t_lookup_request(msg,0,)) {
t_invite = tmb.t_gett();
-   if (t_invite->uas.request->msg_flags & 
FL_SIPTRACE) {
-   LM_DBG("Transaction is already been 
traced, skipping.\n");
-   ret = 1;
+   if (t_invite!=T_NULL_CELL) {
+   if (t_invite->uas.request->msg_flags & 
FL_SIPTRACE) {
+   LM_DBG("Transaction is already 
been traced, skipping.\n");
+   ret = 1;
+   }
+   tmb.t_release_transaction( t_invite );
+   tmb.t_unref(msg);
}
-   tmb.t_release_transaction( t_invite );
-   tmb.t_unref(msg);
-   tmb.t_sett(orig_t, T_BR_UNDEFINED);
-   if (ret)
-   return 1;
}
+   tmb.t_sett(orig_t, T_BR_UNDEFINED);
+   if (ret)
+   return 1;
}
 
if (trace_type == SIPTRACE_DIALOG && dlgb.get_dlg == NULL) {


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


[sr-dev] [kamailio/kamailio] dialog: add dialog init, start end end timestamps to the output of dl… (#2279)

2020-04-08 Thread Federico Cabiddu
…g.briefing

!-- 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
IN some scenarios I found useful to have the timestamps (init, start, end) of 
the dialog as output of the dlg.briefing command.
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * dialog: add dialog init, start end end timestamps to the output of 
dlg.briefing

-- File Changes --

M src/modules/dialog/dialog.c (5)

-- Patch Links --

https://github.com/kamailio/kamailio/pull/2279.patch
https://github.com/kamailio/kamailio/pull/2279.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/2279
___
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: safety check for transaction when checking ACK (#2278)

2020-04-08 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
Testing with moderate load I had a crash in siptrace, in the newly added check 
for ACK for negative replies. Analyzing the core, the crash was caused by the 
invite transaction being 0x0 when t_gett is called after t_lookup_request. I 
was not able to reproduce it (how can t_lookup_request return 1 and then the 
transaction being 0x0?), but Ive added a check to avoid crashing.
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * siptrace: safety check for transaction when checking ACK

-- File Changes --

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

-- Patch Links --

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


[sr-dev] [kamailio/kamailio] Grumvalski/ds outbound proxy (#2275)

2020-04-07 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
This PR add a new attr, obproxy, to the gateways attrs, 
allowing to specify the outbound proxy used for sending pings per gateway.

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

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

-- Commit Summary --

  * dispatcher: add new gateway attr obproxy
  * dispatcher: docs for obproxy attr

-- File Changes --

M src/modules/dispatcher/dispatch.c (16)
M src/modules/dispatcher/dispatch.h (1)
M src/modules/dispatcher/dispatcher.c (6)
M src/modules/dispatcher/doc/dispatcher.xml (9)
M src/modules/dispatcher/doc/dispatcher_admin.xml (5)

-- Patch Links --

https://github.com/kamailio/kamailio/pull/2275.patch
https://github.com/kamailio/kamailio/pull/2275.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/2275
___
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 flag fixes (#2273)

2020-04-06 Thread Federico Cabiddu
Merged #2273 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/2273#event-3205599272___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:2ad78641: siptrace: skip sip_trace for ACK for negative replies if the original transaction is already being traced

2020-04-06 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: 2ad786413199b487a65258c8bd33703b5ccbf04d
URL: 
https://github.com/kamailio/kamailio/commit/2ad786413199b487a65258c8bd33703b5ccbf04d

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2020-04-05T17:20:48+02:00

siptrace: skip sip_trace for ACK for negative replies if the original 
transaction is already being traced

---

Modified: src/modules/siptrace/siptrace.c

---

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

---

diff --git a/src/modules/siptrace/siptrace.c b/src/modules/siptrace/siptrace.c
index 46116dea07..f95df0e069 100644
--- a/src/modules/siptrace/siptrace.c
+++ b/src/modules/siptrace/siptrace.c
@@ -833,8 +833,10 @@ static int sip_trace_helper(sip_msg_t *msg, dest_info_t 
*dst, str *duri,
str *corid, char *dir, enum siptrace_type_t trace_type)
 {
siptrace_info_t* info = NULL;
-  struct cell *t_invite;
+   struct cell *t_invite, *orig_t;
char *p = NULL;
+   int canceled;
+   int ret = 0;
 
if (trace_type == SIPTRACE_TRANSACTION || trace_type == 
SIPTRACE_DIALOG) {
int alloc_size = sizeof(siptrace_info_t);
@@ -853,17 +855,38 @@ static int sip_trace_helper(sip_msg_t *msg, dest_info_t 
*dst, str *duri,
 /* if sip_trace is called over an incoming CANCEL, skip
  * capturing it if the cancelled transaction is already being traced
  */
- if (msg->REQ_METHOD==METHOD_CANCEL) {
+   if (msg->REQ_METHOD==METHOD_CANCEL) {
t_invite=tmb.t_lookup_original(msg);
if (t_invite!=T_NULL_CELL) {
if (t_invite->uas.request->msg_flags & 
FL_SIPTRACE) {
-   LM_DBG("Transaction is already 
been traced, skipping.\n");
-   tmb.t_unref(msg);
-   return 1;
+   LM_DBG("Transaction is already been 
traced, skipping.\n");
+   tmb.t_unref(msg);
+   return 1;
}
tmb.t_unref(msg);
}
}
+ 
+   /* if sip_trace is called over an incoming ACK, skip
+* capturing it if it's an ACK for a negative reply for
+* an already traced transaction
+*/
+   if (msg->REQ_METHOD==METHOD_ACK) {
+   orig_t = tmb.t_gett();
+   if(tmb.t_lookup_request(msg,0,)) {
+   t_invite = tmb.t_gett();
+   if (t_invite->uas.request->msg_flags & 
FL_SIPTRACE) {
+   LM_DBG("Transaction is already been 
traced, skipping.\n");
+   ret = 1;
+   }
+   tmb.t_release_transaction( t_invite );
+   tmb.t_unref(msg);
+   tmb.t_sett(orig_t, T_BR_UNDEFINED);
+   if (ret)
+   return 1;
+   }
+   }
+
if (trace_type == SIPTRACE_DIALOG && dlgb.get_dlg == NULL) {
LM_WARN("DIALOG module not loaded! Tracing only current 
message!\n");
goto trace_current;


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


[sr-dev] git:master:080c6e07: siptrace: don't trace CANCEL if the cancelled transaction is already being traced

2020-04-06 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: 080c6e07708f1964498a43e70c9b6240b5bdebcd
URL: 
https://github.com/kamailio/kamailio/commit/080c6e07708f1964498a43e70c9b6240b5bdebcd

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2020-04-03T13:03:56+02:00

siptrace: don't trace CANCEL if the cancelled transaction is already being 
traced

---

Modified: src/modules/siptrace/siptrace.c

---

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

---

diff --git a/src/modules/siptrace/siptrace.c b/src/modules/siptrace/siptrace.c
index 3c1ec436d7..46116dea07 100644
--- a/src/modules/siptrace/siptrace.c
+++ b/src/modules/siptrace/siptrace.c
@@ -833,6 +833,7 @@ static int sip_trace_helper(sip_msg_t *msg, dest_info_t 
*dst, str *duri,
str *corid, char *dir, enum siptrace_type_t trace_type)
 {
siptrace_info_t* info = NULL;
+  struct cell *t_invite;
char *p = NULL;
 
if (trace_type == SIPTRACE_TRANSACTION || trace_type == 
SIPTRACE_DIALOG) {
@@ -849,6 +850,20 @@ static int sip_trace_helper(sip_msg_t *msg, dest_info_t 
*dst, str *duri,
goto trace_current;
}
 
+/* if sip_trace is called over an incoming CANCEL, skip
+ * capturing it if the cancelled transaction is already being traced
+ */
+ if (msg->REQ_METHOD==METHOD_CANCEL) {
+   t_invite=tmb.t_lookup_original(msg);
+   if (t_invite!=T_NULL_CELL) {
+   if (t_invite->uas.request->msg_flags & 
FL_SIPTRACE) {
+   LM_DBG("Transaction is already 
been traced, skipping.\n");
+   tmb.t_unref(msg);
+   return 1;
+   }
+   tmb.t_unref(msg);
+   }
+   }
if (trace_type == SIPTRACE_DIALOG && dlgb.get_dlg == NULL) {
LM_WARN("DIALOG module not loaded! Tracing only current 
message!\n");
goto trace_current;


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


[sr-dev] git:master:e28f4644: siptrace: trace incoming CANCEL into a dedicated callback

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

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2020-04-03T11:59:50+02:00

siptrace: trace incoming CANCEL into a dedicated callback

---

Modified: src/modules/siptrace/siptrace.c

---

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

---

diff --git a/src/modules/siptrace/siptrace.c b/src/modules/siptrace/siptrace.c
index b000d1ac8d..3c1ec436d7 100644
--- a/src/modules/siptrace/siptrace.c
+++ b/src/modules/siptrace/siptrace.c
@@ -64,8 +64,7 @@ MODULE_VERSION
 #define SIPTRACE_ANYADDR_LEN (sizeof(SIPTRACE_ANYADDR) - 1)
 
 #define trace_is_off(_msg)\
-_msg)->msg_flags & FL_SIPTRACE) == 0) \
-   || ((trace_flag != 0) && (_msg->flags & trace_flag) == 0))
+(((_msg)->msg_flags & FL_SIPTRACE) == 0) 
 
 #define is_null_pv(_str) \
(!str_strcmp(&_str, pv_get_null_str()))
@@ -98,6 +97,7 @@ static int w_hlog2(struct sip_msg *, char *correlationid, 
char *message);
 static int sip_trace_store_db(siptrace_data_t *sto);
 
 static void trace_onreq_out(struct cell *t, int type, struct tmcb_params *ps);
+static void trace_cancel_in(struct cell *t, int type, struct tmcb_params *ps);
 static void trace_onreply_in(struct cell *t, int type, struct tmcb_params *ps);
 static void trace_onreply_out(struct cell *t, int type, struct tmcb_params 
*ps);
 static void trace_tm_neg_ack_in(struct cell *t, int type, struct tmcb_params 
*ps);
@@ -1254,6 +1254,31 @@ static int w_sip_trace_mode(sip_msg_t *msg, char *pmode, 
char *p2)
return ki_sip_trace_mode(msg, );
 }
 
+static void trace_cancel_in(struct cell *t, int type, struct tmcb_params *ps)
+{
+   siptrace_info_t* info;
+   sip_msg_t *msg;
+
+   if(t == NULL || ps == NULL) {
+   LM_ERR("unexpected parameter values\n");
+   return;
+   }
+
+   if(ps->flags & TMCB_RETR_F) {
+   LM_DBG("retransmission - ignoring\n");
+   return;
+   }
+
+   info = (siptrace_info_t *)(*ps->param);
+   msg = ps->req;
+   if(tmb.register_tmcb(msg, 0, TMCB_RESPONSE_READY, trace_onreply_out, 
info, 0) <= 0) {
+   LM_ERR("can't register trace_onreply_out\n");
+   return;
+   }
+   msg->msg_flags |= FL_SIPTRACE;
+   sip_trace_helper(msg, NULL, NULL, NULL, NULL, 1);
+}
+
 static void trace_onreq_out(struct cell *t, int type, struct tmcb_params *ps)
 {
siptrace_data_t sto;
@@ -1296,19 +1321,9 @@ static void trace_onreq_out(struct cell *t, int type, 
struct tmcb_params *ps)
 * and can register a callback for the reply */
memset(, 0, sizeof(siptrace_data_t));
 
-   if (unlikely(type == TMCB_E2ECANCEL_IN)) {
-   msg->msg_flags |= FL_SIPTRACE;
-
-   if(tmb.register_tmcb(msg, 0, TMCB_RESPONSE_READY, 
trace_onreply_out, info, 0)
-   <= 0) {
-   LM_ERR("can't register trace_onreply_out\n");
-   return;
-   }
-   } else {
-   if(traced_user_avp.n != 0)
-   sto.avp = search_first_avp(traced_user_avp_type, 
traced_user_avp,
-   _value, );
-   }
+   if(traced_user_avp.n != 0)
+   sto.avp = search_first_avp(traced_user_avp_type, 
traced_user_avp,
+   _value, );
 
if((sto.avp == NULL) && trace_is_off(msg)) {
LM_DBG("trace off...\n");
@@ -1318,16 +1333,11 @@ static void trace_onreq_out(struct cell *t, int type, 
struct tmcb_params *ps)
if(sip_trace_prepare(msg) < 0)
return;
 
-   if (unlikely(type == TMCB_E2ECANCEL_IN)) {
-   sto.body.s = msg->buf;
-   sto.body.len = msg->len;
+   if(ps->send_buf.len > 0) {
+   sto.body = ps->send_buf;
} else {
-   if(ps->send_buf.len > 0) {
-   sto.body = ps->send_buf;
-   } else {
-   sto.body.s = "No request buffer";
-   sto.body.len = sizeof("No request buffer") - 1;
-   }
+   sto.body.s = "No request buffer";
+   sto.body.len = sizeof("No request buffer") - 1;
}
 
sto.callid = msg->callid->body;
@@ -1866,7 +1876,7 @@ static void trace_transaction(sip_msg_t* msg, 
siptrace_info_t* info, int dlg_tra
return;
}
 
-   if(tmb.register_tmcb(msg, 0, TMCB_E2ECANCE

[sr-dev] git:master:b64b3f03: siptrace: don't check if trace is off in ack for negative replies callback

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

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2020-04-03T10:00:53+02:00

siptrace: don't check if trace is off in ack for negative replies callback

---

Modified: src/modules/siptrace/siptrace.c

---

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

---

diff --git a/src/modules/siptrace/siptrace.c b/src/modules/siptrace/siptrace.c
index c27a9eadba..b000d1ac8d 100644
--- a/src/modules/siptrace/siptrace.c
+++ b/src/modules/siptrace/siptrace.c
@@ -1658,10 +1658,6 @@ static void trace_tm_neg_ack_in(struct cell *t, int 
type, struct tmcb_params *ps
return;
}
 
-   if(trace_is_off(ps->req)) {
-   LM_DBG("trace off...\n");
-   return;
-   }
 
sip_trace(ps->req, (info->uriState == STRACE_PARSED_URI) ? 
>u.dest_info : NULL,
NULL, NULL);


___
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 flag fixes (#2273)

2020-04-06 Thread Federico Cabiddu
Agree that such functions could be very useful in cases like this one.
Should I backport to 5.3?

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


[sr-dev] [kamailio/kamailio] Grumvalski/siptrace flag fixes (#2273)

2020-04-05 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, 
...)
- [ ] 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



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

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

-- Commit Summary --

  * siptrace: dont check if trace is off in ack for negative replies 
callback
  * siptrace: trace incoming CANCEL into a dedicated callback
  * siptrace: dont trace CANCEL if the cancelled transaction is already 
being traced
  * siptrace: skip sip_trace for ACK for negative replies if the original 
transaction is already being traced

-- File Changes --

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

-- Patch Links --

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


Re: [sr-dev] siptrace inconsistency

2020-04-05 Thread Federico Cabiddu
Hi Daniel,
thanks for having a look.
There is already a callback for negative ACK, my problem was that I was
using t_check_trans (tm api) to check if the ACK was a negative ACK, and
t_check_trans was calling this callback internally.
So, if after the sip_trace() call in the script we had a t_check_trans(),
the callback itself was called again, thus giving a duplicated message.
I've solved using instead t_lookup_request.
I've pushed another commit on the branch and I'm going to open the PR.

Cheers,

Federico



On Sun, Apr 5, 2020 at 9:18 AM Daniel-Constantin Mierla 
wrote:

> Hello,
>
> I think it is fine to merge those three commits to master as they solve
> some of the reported issue. There is also some work planned to be done for
> a global enable/disable tracing to database, so it makes sense to have all
> the code in master for combined testing.
>
> Regarding the negative ACK, maybe getting the invite transaction and
> seeing if it is a failed transaction is an option. Or simply adding in tm
> module a callback for negative ACK.
>
> Cheers,
> Daniel
> On 03.04.20 13:48, Federico Cabiddu wrote:
>
> Hi all,
> following the feedback I just pushed a branch (
> https://github.com/kamailio/kamailio/tree/grumvalski/siptrace_flag_fixes),
> which tries to address the issues discussed.
> I've tried to split the commits so that each issue is handled separately.
> With the first commit (
> https://github.com/kamailio/kamailio/commit/b64b3f03a9c6b69587ca360465f091f873f7274b)
> I fixed the incoming ACK for negative replies tracing: as discussed it
> makes no sense to check in the callback if tracing is enabled or not.
> The second commit (
> https://github.com/kamailio/kamailio/commit/e28f464457eea47cc606c73cbfe4b30fcc8b542a)
> refactors the e2e CANCEL handling. With the previous implementation the
> incoming CANCEL captured would have the ANYADDR set as destination address.
> This commit also allows to have exactly the same behavior between
> transaction tracing (sip_trace_mode("t")) and legacy tracing (setflag +
> sip_trace()) when tracing a specific INVITE.
> With the third (
> https://github.com/kamailio/kamailio/commit/080c6e07708f1964498a43e70c9b6240b5bdebcd)
> I've tried as much as possible to restore the legacy behavior when tracing
> all the requests without having duplicated captures for CANCEL and ACK for
> negative replies. I could achieve this for the CANCEL checking if the
> INVITE it refers to is already being traced (meaning that the CANCEL will
> be captured by the callback) but I couldn't for the ACK. I couldn't find a
> way to check if the ACK is for a negative reply (and thus it belongs to a
> transaction), without having the tm callbacks for ACK run, since both
> t_check and t_check_trans tm calls run the E2ECANCEL_IN callbacks.
> I've tried different scenarios in both capturing modes (transaction and
> flag+trace):
> 1) Successful call (INVITE-200-ACK)
> 2) Error replied
> 3) Canceled call
> 4) locally generated CANCEL (timeout)
> All looks good (except for the ACK issue) in both modes.
> I would like to have the developers' feedback before opening a PR, there
> could be other scenarios/use cases I'm not considering here.
> Thank you all.
>
> Cheers,
>
> Federico
>
>
>
> On Wed, Apr 1, 2020 at 2:45 PM Federico Cabiddu <
> federico.cabi...@gmail.com> wrote:
>
>> Hi,
>>
>>> OK, indeed, the previous behavior should be preserved in this case. Is
>>> sip_trace() without params now doing transaction mode capturing?
>>>
>> Yes and no. Transaction mode is activated but actual behavior is not
>> exactly the same (see case 3) vs case 1)).
>>
>> Cheers,
>>
>> Federico
>>
> --
> Daniel-Constantin Mierla -- www.asipto.comwww.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


Re: [sr-dev] siptrace inconsistency

2020-04-03 Thread Federico Cabiddu
Hi all,
following the feedback I just pushed a branch (
https://github.com/kamailio/kamailio/tree/grumvalski/siptrace_flag_fixes),
which tries to address the issues discussed.
I've tried to split the commits so that each issue is handled separately.
With the first commit (
https://github.com/kamailio/kamailio/commit/b64b3f03a9c6b69587ca360465f091f873f7274b)
I fixed the incoming ACK for negative replies tracing: as discussed it
makes no sense to check in the callback if tracing is enabled or not.
The second commit (
https://github.com/kamailio/kamailio/commit/e28f464457eea47cc606c73cbfe4b30fcc8b542a)
refactors the e2e CANCEL handling. With the previous implementation the
incoming CANCEL captured would have the ANYADDR set as destination address.
This commit also allows to have exactly the same behavior between
transaction tracing (sip_trace_mode("t")) and legacy tracing (setflag +
sip_trace()) when tracing a specific INVITE.
With the third (
https://github.com/kamailio/kamailio/commit/080c6e07708f1964498a43e70c9b6240b5bdebcd)
I've tried as much as possible to restore the legacy behavior when tracing
all the requests without having duplicated captures for CANCEL and ACK for
negative replies. I could achieve this for the CANCEL checking if the
INVITE it refers to is already being traced (meaning that the CANCEL will
be captured by the callback) but I couldn't for the ACK. I couldn't find a
way to check if the ACK is for a negative reply (and thus it belongs to a
transaction), without having the tm callbacks for ACK run, since both
t_check and t_check_trans tm calls run the E2ECANCEL_IN callbacks.
I've tried different scenarios in both capturing modes (transaction and
flag+trace):
1) Successful call (INVITE-200-ACK)
2) Error replied
3) Canceled call
4) locally generated CANCEL (timeout)
All looks good (except for the ACK issue) in both modes.
I would like to have the developers' feedback before opening a PR, there
could be other scenarios/use cases I'm not considering here.
Thank you all.

Cheers,

Federico



On Wed, Apr 1, 2020 at 2:45 PM Federico Cabiddu 
wrote:

> Hi,
>
>> OK, indeed, the previous behavior should be preserved in this case. Is
>> sip_trace() without params now doing transaction mode capturing?
>>
> Yes and no. Transaction mode is activated but actual behavior is not
> exactly the same (see case 3) vs case 1)).
>
> Cheers,
>
> Federico
>
___
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 ignore 404 as part of transaction during REGISTER (#2271)

2020-04-02 Thread Federico Cabiddu
As Daniel already replied you, SIP replies are handled in reply routes
based on Via.
You are posting a request route snippet which doesn't handle at all replies.
Please do what has been asked to you, write on the users mailing list and
there people will tell you if it is a bug or not.


On Thu, Apr 2, 2020 at 1:57 PM jpVm5jYYRE1VIKL 
wrote:

> Issue i reported is about that kamailio don`t relay 404 from upstream on
> 1st REGISTER.
>
> route[FORWARD]
> {
> t_on_failure("FAILROUTE");
> if(!t_relay())
> {
> sl_reply_error();
> }
>
> drop;
> }
>
>
> Have exactly same behavior reported. I still sure that this is a bug.
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> ,
> or unsubscribe
> 
> .
>


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


Re: [sr-dev] siptrace inconsistency

2020-04-01 Thread Federico Cabiddu
Hi,

> OK, indeed, the previous behavior should be preserved in this case. Is
> sip_trace() without params now doing transaction mode capturing?
>
Yes and no. Transaction mode is activated but actual behavior is not
exactly the same (see case 3) vs case 1)).

Cheers,

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


Re: [sr-dev] siptrace inconsistency

2020-04-01 Thread Federico Cabiddu
Hi Daniel,
thanks for the feedback. About your questions: received ACK and CANCEL were
not captured in old versions of the module, so no changes from this point
of view.
But tracing and flagging every request would work without duplicated
messages. Something like this

request_route {

if (!is_method("OPTIONS")) {
setflag(CAPTURE_FLAG);
sip_trace();
}
}

I would expect the legacy behavior preserved, but I need to check better
the code to understand how to do. If not possible we should add it to the
documentation.
I will make some tests removing the trace_is_off check for the negative ACK
and make a PR.
Finally I think that we also should align case 3) (siptrace + flag) with
case 1) (transaction tracing) so that the behavior is the same (as I think
was the intention originally).
What do you and other devs think?

Cheers,

Federico



On Tue, Mar 31, 2020 at 4:25 PM Daniel-Constantin Mierla 
wrote:

> Hi Federico,
>
> were the received ack and cancel captured automatically in the old version
> when sip trace was set for invite? There were many changes in the past
> years, but I remember that the flag was mainly for outgoing requests and
> matching replies of the transaction for which the flag was set. For
> incoming requests sip_trace() function had to be used.
>
> Based on your remark, I think that trace_tm_neg_ack_in() should not check
> if the trace-is-off(). It should be set when trace-is-on and that's it for
> the transaction.
>
> Feel free to clarify (or propose) the wanted behaviour and then we can
> work together to have it as expected. I used sip trace lately for tracing
> all traffic (trace_mode=1), no longer doing any filtering for
> transactions/dialogs.
>
> Cheers,
> Daniel
> On 31.03.20 09:09, Federico Cabiddu wrote:
>
> Hi all,
> I've been recently testing 5.3.x/master siptrace module, in particular the
> new trace mode "t" vs the legacy flag + sip_trace() mode and I've found
> some issues with the handling of CANCEL. Specifically, I've tested the
> following scenarios:
> 1) sip_trace_mode("t") on the initial INVITE only: received ACK for
> negative replies not captured
> 2) sip_trace_mode("t") on the initial INVITE and on neg ACK: received ACK
> captured twice
> 3) setflag and sip_trace() on the initial INVITE only: received CANCEL and
> ACK not captured (outgoing yes)
> 4) setflag and sip_trace() on the initial INVITE and ACK: received CANCEL
> not captured, received ACK captured twice
> 5) setflag and sip_trace() for each message (legacy): received CANCEL and
> 200 captured twice, received ACK captured twice
>
> Digging into the module's code the "culprit" looks to be trace_is_off
> function (
> https://github.com/kamailio/kamailio/blob/2768f8ce1cf6da242674e7e40c8e76eb6c630f6b/src/modules/siptrace/siptrace.c#L66)
> and the places where it is called.
> E.g.: for the case 1), when a negative reply is
> received, trace_tm_neg_ack_in is called, which calls inside trace_is_off (
> https://github.com/kamailio/kamailio/blob/2768f8ce1cf6da242674e7e40c8e76eb6c630f6b/src/modules/siptrace/siptrace.c#L1661),
> which cannot be true unless the ACK has been marked for capture in the
> script, in which case it will be capture twice (case 2). The same applies
> to the CANCEL for case 3), in trace_onreq_out (callback
> for TMCB_E2ECANCEL_IN) trace_is_off because the incoming message is not
> flagged. Case 3) should theoretically behave like case 1) according to
> commit
> https://github.com/kamailio/kamailio/commit/40e09d8625184f19ff5666a2848cbb8c6212db26
> .
>
> I'm not really sure if (and how) modify the trace_is_off function or not
> calling it in specific cases. E.g.: why calling it in trace_tm_neg_ack_in?
> This callback is set when we explicity want to trace a transaction, so why
> checking inside if tracing is on? Maybe I'm missing something, but I think
> that probably the different behaviors of the modes should be better
> specified/decided.
>
> Best regards,
>
> Federico
>
> ___
> Kamailio (SER) - Development Mailing 
> Listsr-dev@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
>
> --
> Daniel-Constantin Mierla -- www.asipto.comwww.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


[sr-dev] siptrace inconsistency

2020-03-31 Thread Federico Cabiddu
Hi all,
I've been recently testing 5.3.x/master siptrace module, in particular the
new trace mode "t" vs the legacy flag + sip_trace() mode and I've found
some issues with the handling of CANCEL. Specifically, I've tested the
following scenarios:
1) sip_trace_mode("t") on the initial INVITE only: received ACK for
negative replies not captured
2) sip_trace_mode("t") on the initial INVITE and on neg ACK: received ACK
captured twice
3) setflag and sip_trace() on the initial INVITE only: received CANCEL and
ACK not captured (outgoing yes)
4) setflag and sip_trace() on the initial INVITE and ACK: received CANCEL
not captured, received ACK captured twice
5) setflag and sip_trace() for each message (legacy): received CANCEL and
200 captured twice, received ACK captured twice

Digging into the module's code the "culprit" looks to be trace_is_off
function (
https://github.com/kamailio/kamailio/blob/2768f8ce1cf6da242674e7e40c8e76eb6c630f6b/src/modules/siptrace/siptrace.c#L66)
and the places where it is called.
E.g.: for the case 1), when a negative reply is
received, trace_tm_neg_ack_in is called, which calls inside trace_is_off (
https://github.com/kamailio/kamailio/blob/2768f8ce1cf6da242674e7e40c8e76eb6c630f6b/src/modules/siptrace/siptrace.c#L1661),
which cannot be true unless the ACK has been marked for capture in the
script, in which case it will be capture twice (case 2). The same applies
to the CANCEL for case 3), in trace_onreq_out (callback
for TMCB_E2ECANCEL_IN) trace_is_off because the incoming message is not
flagged. Case 3) should theoretically behave like case 1) according to
commit
https://github.com/kamailio/kamailio/commit/40e09d8625184f19ff5666a2848cbb8c6212db26
.

I'm not really sure if (and how) modify the trace_is_off function or not
calling it in specific cases. E.g.: why calling it in trace_tm_neg_ack_in?
This callback is set when we explicity want to trace a transaction, so why
checking inside if tracing is on? Maybe I'm missing something, but I think
that probably the different behaviors of the modes should be better
specified/decided.

Best regards,

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


[sr-dev] git:master:2ad60234: tm: initialize the context before running event route

2019-11-25 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: 2ad6023432ae37b1709638ead2c77e1e4130678a
URL: 
https://github.com/kamailio/kamailio/commit/2ad6023432ae37b1709638ead2c77e1e4130678a

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2019-11-25T09:14:40+01:00

tm: initialize the context before running event route

---

Modified: src/modules/tm/uac.c

---

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

---

diff --git a/src/modules/tm/uac.c b/src/modules/tm/uac.c
index 9af3da951a..1112d7758c 100644
--- a/src/modules/tm/uac.c
+++ b/src/modules/tm/uac.c
@@ -273,6 +273,9 @@ static inline int t_run_local_req(
tm_global_ctx_id.msgid=lreq.id;
tm_global_ctx_id.pid=lreq.pid;
set_t(new_cell, T_BR_UNDEFINED);
+  
+   init_run_actions_ctx(_ctx);
+   
if(goto_on_local_req>=0) {
run_top_route(event_rt.rlist[goto_on_local_req], , 
_ctx);
} else {


___
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] tm: add support for dropping messages in local-request event route (#2147)

2019-11-25 Thread Federico Cabiddu
Merged #2147 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/2147#event-2829172430___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:00f4147a: tm: add support for dropping messages in local-request event route

2019-11-25 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: 00f4147a410990d3ebeeef8825329bbdff728d1a
URL: 
https://github.com/kamailio/kamailio/commit/00f4147a410990d3ebeeef8825329bbdff728d1a

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2019-11-25T08:51:30+01:00

tm: add support for dropping messages in local-request event route

---

Modified: src/core/error.h
Modified: src/modules/tm/uac.c

---

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

---

diff --git a/src/core/error.h b/src/core/error.h
index 829073e555..8ac763bf2d 100644
--- a/src/core/error.h
+++ b/src/core/error.h
@@ -48,6 +48,7 @@
 #define E_Q_EMPTY   -16 /* Empty q */
 #define E_Q_TOO_BIG -17 /* q too big (> 1) */
 #define E_Q_DEC_MISSING -18 /* Decimal part missing */
+#define E_DROP  -19 /* Dropped in script */
 
 
 
diff --git a/src/modules/tm/uac.c b/src/modules/tm/uac.c
index 1478853d3d..9af3da951a 100644
--- a/src/modules/tm/uac.c
+++ b/src/modules/tm/uac.c
@@ -239,6 +239,8 @@ static inline int t_run_local_req(
msg_ctx_id_t backup_ctxid;
int refresh_shortcuts = 0;
sr_kemi_eng_t *keng = NULL;
+   run_act_ctx_t ra_ctx;
+   run_act_ctx_t *bctx;
str evname = str_init("tm:local-request");
 
LM_DBG("executing event_route[tm:local-request]\n");
@@ -272,17 +274,20 @@ static inline int t_run_local_req(
tm_global_ctx_id.pid=lreq.pid;
set_t(new_cell, T_BR_UNDEFINED);
if(goto_on_local_req>=0) {
-   run_top_route(event_rt.rlist[goto_on_local_req], , 0);
+   run_top_route(event_rt.rlist[goto_on_local_req], , 
_ctx);
} else {
keng = sr_kemi_eng_get();
if(keng==NULL) {
LM_WARN("event callback (%s) set, but no cfg engine\n",
tm_event_callback.s);
} else {
+   bctx = sr_kemi_act_ctx_get();
+   sr_kemi_act_ctx_set(_ctx);
if(sr_kemi_route(keng, , EVENT_ROUTE,
_event_callback, )<0) 
{
LM_ERR("error running event route kemi 
callback\n");
}
+   sr_kemi_act_ctx_set(bctx);
}
}
/* restore original environment */
@@ -296,6 +301,12 @@ static inline int t_run_local_req(
tm_xdata_swap(new_cell, _xd, 1);
setsflagsval(sflag_bk);
 
+   if (unlikely(ra_ctx.run_flags_R_F)) {
+   LM_DBG("tm:local-request dropped msg. to %.*s\n", 
+   lreq.dst_uri.len, lreq.dst_uri.s);
+   refresh_shortcuts = E_DROP;
+   goto clean;
+   }
/* rebuild the new message content */
if(lreq.force_send_socket != uac_r->dialog->send_sock) {
LM_DBG("Send socket updated to: %.*s",
@@ -350,6 +361,7 @@ static inline int t_run_local_req(
}
}
 
+clean:
/* clean local msg structure */
if (unlikely(lreq.new_uri.s))
{
@@ -514,6 +526,10 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
 #ifdef WITH_EVENT_LOCAL_REQUEST
if (unlikely(goto_on_local_req>=0 || tm_event_callback.len>0)) {
refresh_shortcuts = t_run_local_req(, _len, uac_r, 
new_cell, request);
+   if (unlikely(refresh_shortcuts==E_DROP)) {
+   ret=E_DROP;
+   goto error1;
+   }   
}
 #endif
 
@@ -605,6 +621,7 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
 int prepare_req_within(uac_req_t *uac_r,
struct retr_buf **dst_req)
 {
+   int ret = -1;
if (!uac_r || !uac_r->method || !uac_r->dialog) {
LM_ERR("Invalid parameter value\n");
goto err;
@@ -619,13 +636,17 @@ int prepare_req_within(uac_req_t *uac_r,
if ((uac_r->method->len == 6) && (!memcmp("CANCEL", uac_r->method->s, 
6))) goto send;
uac_r->dialog->loc_seq.value++; /* Increment CSeq */
  send:
-   return t_uac_prepare(uac_r, dst_req, 0);
+   ret = t_uac_prepare(uac_r, dst_req, 0);
+   
+   if (unlikely(ret < 0 && ret == E_DROP)) {
+   ret = 0;
+   }
 
  err:
/* if (cbp) shm_free(cbp); */
/* !! never free cbp here because if t_uac_prepare fails, cbp is not 
freed
 * and thus caller has no chance to discover if it is freed or not !! */
-   return -1;
+   return ret;
 }
 
 static inline int send_prepared_request_impl(struct retr_buf *request, int 
retransmit, int branch)
@@ -711,7 +732,14 @@ int t_uac_with_ids(uac_req_t *uac_r,

Re: [sr-dev] [kamailio/kamailio] tm: add support for dropping messages in local-request event route (#2147)

2019-11-25 Thread Federico Cabiddu
I did put it in the core to avoid conflicts with other returned codes and for 
beeing used in the future (in case). I'll leave it in the core.

-- 
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/2147#issuecomment-558148176___
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] tm: add support for dropping messages in local-request event route (#2147)

2019-11-25 Thread Federico Cabiddu
I haven't spotted any other usage for the moment. I could rename it like 
E_LOCAL_DROP. 

-- 
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/2147#issuecomment-558067764___
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] tm: add support for dropping messages in local-request event route (#2147)

2019-11-25 Thread Federico Cabiddu
right, added now.

-- 
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/2147#issuecomment-558041500___
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] tm: add support for dropping messages in local-request event route (#2147)

2019-11-25 Thread Federico Cabiddu
@grumvalski pushed 1 commit.

2ad6023432ae37b1709638ead2c77e1e4130678a  tm: initialize the context before 
running event route


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/kamailio/kamailio/pull/2147/files/b58bfec2413a09568343fa1e2b2e199cfaa2e1fa..2ad6023432ae37b1709638ead2c77e1e4130678a
___
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] tm: add support for dropping messages in local-request event route (#2147)

2019-11-25 Thread Federico Cabiddu
@grumvalski pushed 1 commit.

b58bfec2413a09568343fa1e2b2e199cfaa2e1fa  tm: initialize the context before 
running event route


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/kamailio/kamailio/pull/2147/files/00f4147a410990d3ebeeef8825329bbdff728d1a..b58bfec2413a09568343fa1e2b2e199cfaa2e1fa
___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] [kamailio/kamailio] tm: add support for dropping messages in local-request event route (#2147)

2019-11-25 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 --
Currently it is not possible to drop a local generated message in 
tm:local-request event route because there is no context associated when 
running the event route. With this PR I tried to solve this introducing a new 
returned error (E_DROP) and a context into t_run_local_req.
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * tm: add support for dropping messages in local-request event route

-- File Changes --

M src/core/error.h (1)
M src/modules/tm/uac.c (36)

-- Patch Links --

https://github.com/kamailio/kamailio/pull/2147.patch
https://github.com/kamailio/kamailio/pull/2147.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/2147
___
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: add support for parsing http/2 replies parsing (#2132)

2019-11-21 Thread Federico Cabiddu
The patches applied cleanly on both branches, I needed a couple of days to 
test. I've cherry-picked the commit.

-- 
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/2132#issuecomment-557022751___
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:c3392b75: core: add support for parsing http/2 replies parsing

2019-11-21 Thread Federico Cabiddu
Module: kamailio
Branch: 5.3
Commit: c3392b750ebe70db7aee8928fd40b704af23a5d9
URL: 
https://github.com/kamailio/kamailio/commit/c3392b750ebe70db7aee8928fd40b704af23a5d9

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2019-11-21T11:27:35+01:00

core: add support for parsing http/2 replies parsing

(cherry picked from commit 17be36102e3a1c286c69a5da193dd8405000ab62)

---

Modified: src/core/parser/msg_parser.h
Modified: src/core/parser/parse_fline.c
Modified: src/core/parser/parse_fline.h

---

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

---

diff --git a/src/core/parser/msg_parser.h b/src/core/parser/msg_parser.h
index 827c541086..d5399c4fe5 100644
--- a/src/core/parser/msg_parser.h
+++ b/src/core/parser/msg_parser.h
@@ -147,9 +147,12 @@ if (  (*tmp==(firstchar) || *tmp==((firstchar) | 32)) &&   
   \
SIP_VERSION, SIP_VERSION_LEN))
 
 #define IS_HTTP_REPLY(rpl)\
-   ((rpl)->first_line.u.reply.version.len >= HTTP_VERSION_LEN && \
+   (((rpl)->first_line.u.reply.version.len >= HTTP_VERSION_LEN && \
!strncasecmp((rpl)->first_line.u.reply.version.s, \
-   HTTP_VERSION, HTTP_VERSION_LEN))
+   HTTP_VERSION, HTTP_VERSION_LEN)) || \
+   ((rpl)->first_line.u.reply.version.len >= HTTP2_VERSION_LEN && \
+   !strncasecmp((rpl)->first_line.u.reply.version.s, \
+   HTTP2_VERSION, HTTP2_VERSION_LEN)))
 
 #define IS_SIP_REPLY(rpl)\
((rpl)->first_line.u.reply.version.len >= SIP_VERSION_LEN && \
diff --git a/src/core/parser/parse_fline.c b/src/core/parser/parse_fline.c
index 6d46f2192a..c535b49a4c 100644
--- a/src/core/parser/parse_fline.c
+++ b/src/core/parser/parse_fline.c
@@ -96,21 +96,28 @@ char* parse_first_line(char* buffer, unsigned int len, 
struct msg_start* fl)
fl->flags|=FLINE_FLAG_PROTO_SIP;
fl->u.reply.version.len=SIP_VERSION_LEN;
tmp=buffer+SIP_VERSION_LEN;
-   } else if (http_reply_parse != 0 &&
-   (*tmp=='H' || *tmp=='h') &&
+   } else if (http_reply_parse != 0 && (*tmp=='H' || *tmp=='h')) {
/* 'HTTP/1.' */
-   strncasecmp( tmp+1, HTTP_VERSION+1, 
HTTP_VERSION_LEN-1)==0 &&
-   /* [0|1] */
-   ((*(tmp+HTTP_VERSION_LEN)=='0') || 
(*(tmp+HTTP_VERSION_LEN)=='1')) &&
-   (*(tmp+HTTP_VERSION_LEN+1)==' ')  ){ 
-   /* ugly hack to be able to route http replies
-* Note: - the http reply must have a via
-*   - the message is marked as SIP_REPLY (ugly)
-*/
-   fl->type=SIP_REPLY;
-   fl->flags|=FLINE_FLAG_PROTO_HTTP;
-   fl->u.reply.version.len=HTTP_VERSION_LEN+1 
/*include last digit*/;
-   tmp=buffer+HTTP_VERSION_LEN+1 /* last digit */;
+   if (strncasecmp( tmp+1, HTTP_VERSION+1, 
HTTP_VERSION_LEN-1)==0 &&
+ /* [0|1] */
+ ((*(tmp+HTTP_VERSION_LEN)=='0') || 
(*(tmp+HTTP_VERSION_LEN)=='1')) &&
+ (*(tmp+HTTP_VERSION_LEN+1)==' ')  ){ 
+   /* ugly hack to be able to route http replies
+   * Note: - the http reply must have a via
+   *   - the message is marked as SIP_REPLY (ugly)
+   */
+ fl->type=SIP_REPLY;
+ fl->flags|=FLINE_FLAG_PROTO_HTTP;
+ fl->u.reply.version.len=HTTP_VERSION_LEN+1 
/*include last digit*/;
+  tmp=buffer+HTTP_VERSION_LEN+1 /* last digit */;
+   /* 'HTTP/2' */
+   } else if (strncasecmp( tmp+1, HTTP2_VERSION+1, 
HTTP2_VERSION_LEN-1)==0 &&
+   (*(tmp+HTTP2_VERSION_LEN)==' 
')) {
+   fl->type=SIP_REPLY;
+   fl->flags|=FLINE_FLAG_PROTO_HTTP;
+   
fl->u.reply.version.len=HTTP2_VERSION_LEN;
+   tmp=buffer+HTTP2_VERSION_LEN;
+   }
} else IFISMETHOD( INVITE, 'I' )
else IFISMETHOD( CANCEL, 'C')
else IFISMETHOD( ACK, 'A' )
diff --git a/src/core/parser/parse_fline.h b/src/core/parser/

[sr-dev] git:5.2:18444d61: core: add support for parsing http/2 replies parsing

2019-11-21 Thread Federico Cabiddu
Module: kamailio
Branch: 5.2
Commit: 18444d619b87c3734f3078f09c50a4fef1f8a259
URL: 
https://github.com/kamailio/kamailio/commit/18444d619b87c3734f3078f09c50a4fef1f8a259

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2019-11-21T11:26:53+01:00

core: add support for parsing http/2 replies parsing

(cherry picked from commit 17be36102e3a1c286c69a5da193dd8405000ab62)

---

Modified: src/core/parser/msg_parser.h
Modified: src/core/parser/parse_fline.c
Modified: src/core/parser/parse_fline.h

---

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

---

diff --git a/src/core/parser/msg_parser.h b/src/core/parser/msg_parser.h
index 969fbc6f9b..7199c5905d 100644
--- a/src/core/parser/msg_parser.h
+++ b/src/core/parser/msg_parser.h
@@ -146,9 +146,12 @@ if (  (*tmp==(firstchar) || *tmp==((firstchar) | 32)) &&   
   \
SIP_VERSION, SIP_VERSION_LEN))
 
 #define IS_HTTP_REPLY(rpl)\
-   ((rpl)->first_line.u.reply.version.len >= HTTP_VERSION_LEN && \
+   (((rpl)->first_line.u.reply.version.len >= HTTP_VERSION_LEN && \
!strncasecmp((rpl)->first_line.u.reply.version.s, \
-   HTTP_VERSION, HTTP_VERSION_LEN))
+   HTTP_VERSION, HTTP_VERSION_LEN)) || \
+   ((rpl)->first_line.u.reply.version.len >= HTTP2_VERSION_LEN && \
+   !strncasecmp((rpl)->first_line.u.reply.version.s, \
+   HTTP2_VERSION, HTTP2_VERSION_LEN)))
 
 #define IS_SIP_REPLY(rpl)\
((rpl)->first_line.u.reply.version.len >= SIP_VERSION_LEN && \
diff --git a/src/core/parser/parse_fline.c b/src/core/parser/parse_fline.c
index e6b93aca58..bdd4824818 100644
--- a/src/core/parser/parse_fline.c
+++ b/src/core/parser/parse_fline.c
@@ -96,21 +96,28 @@ char* parse_first_line(char* buffer, unsigned int len, 
struct msg_start* fl)
fl->flags|=FLINE_FLAG_PROTO_SIP;
fl->u.reply.version.len=SIP_VERSION_LEN;
tmp=buffer+SIP_VERSION_LEN;
-   } else if (http_reply_parse != 0 &&
-   (*tmp=='H' || *tmp=='h') &&
+   } else if (http_reply_parse != 0 && (*tmp=='H' || *tmp=='h')) {
/* 'HTTP/1.' */
-   strncasecmp( tmp+1, HTTP_VERSION+1, 
HTTP_VERSION_LEN-1)==0 &&
-   /* [0|1] */
-   ((*(tmp+HTTP_VERSION_LEN)=='0') || 
(*(tmp+HTTP_VERSION_LEN)=='1')) &&
-   (*(tmp+HTTP_VERSION_LEN+1)==' ')  ){ 
-   /* ugly hack to be able to route http replies
-* Note: - the http reply must have a via
-*   - the message is marked as SIP_REPLY (ugly)
-*/
-   fl->type=SIP_REPLY;
-   fl->flags|=FLINE_FLAG_PROTO_HTTP;
-   fl->u.reply.version.len=HTTP_VERSION_LEN+1 
/*include last digit*/;
-   tmp=buffer+HTTP_VERSION_LEN+1 /* last digit */;
+   if (strncasecmp( tmp+1, HTTP_VERSION+1, 
HTTP_VERSION_LEN-1)==0 &&
+ /* [0|1] */
+ ((*(tmp+HTTP_VERSION_LEN)=='0') || 
(*(tmp+HTTP_VERSION_LEN)=='1')) &&
+ (*(tmp+HTTP_VERSION_LEN+1)==' ')  ){ 
+   /* ugly hack to be able to route http replies
+   * Note: - the http reply must have a via
+   *   - the message is marked as SIP_REPLY (ugly)
+   */
+ fl->type=SIP_REPLY;
+ fl->flags|=FLINE_FLAG_PROTO_HTTP;
+ fl->u.reply.version.len=HTTP_VERSION_LEN+1 
/*include last digit*/;
+  tmp=buffer+HTTP_VERSION_LEN+1 /* last digit */;
+   /* 'HTTP/2' */
+   } else if (strncasecmp( tmp+1, HTTP2_VERSION+1, 
HTTP2_VERSION_LEN-1)==0 &&
+   (*(tmp+HTTP2_VERSION_LEN)==' 
')) {
+   fl->type=SIP_REPLY;
+   fl->flags|=FLINE_FLAG_PROTO_HTTP;
+   
fl->u.reply.version.len=HTTP2_VERSION_LEN;
+   tmp=buffer+HTTP2_VERSION_LEN;
+   }
} else IFISMETHOD( INVITE, 'I' )
else IFISMETHOD( CANCEL, 'C')
else IFISMETHOD( ACK, 'A' )
diff --git a/src/core/parser/parse_fline.h b/src/core/parser/

Re: [sr-dev] [kamailio/kamailio] core: add support for parsing http/2 replies parsing (#2132)

2019-11-18 Thread Federico Cabiddu
Merged #2132 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/2132#event-2807447284___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:17be3610: core: add support for parsing http/2 replies parsing

2019-11-18 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: 17be36102e3a1c286c69a5da193dd8405000ab62
URL: 
https://github.com/kamailio/kamailio/commit/17be36102e3a1c286c69a5da193dd8405000ab62

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2019-11-16T16:33:04+01:00

core: add support for parsing http/2 replies parsing

---

Modified: src/core/parser/msg_parser.h
Modified: src/core/parser/parse_fline.c
Modified: src/core/parser/parse_fline.h

---

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

---

diff --git a/src/core/parser/msg_parser.h b/src/core/parser/msg_parser.h
index 160a7eb21d..0b0f5044ed 100644
--- a/src/core/parser/msg_parser.h
+++ b/src/core/parser/msg_parser.h
@@ -146,9 +146,12 @@ if (  (*tmp==(firstchar) || *tmp==((firstchar) | 32)) &&   
   \
SIP_VERSION, SIP_VERSION_LEN))
 
 #define IS_HTTP_REPLY(rpl)\
-   ((rpl)->first_line.u.reply.version.len >= HTTP_VERSION_LEN && \
+   (((rpl)->first_line.u.reply.version.len >= HTTP_VERSION_LEN && \
!strncasecmp((rpl)->first_line.u.reply.version.s, \
-   HTTP_VERSION, HTTP_VERSION_LEN))
+   HTTP_VERSION, HTTP_VERSION_LEN)) || \
+   ((rpl)->first_line.u.reply.version.len >= HTTP2_VERSION_LEN && \
+   !strncasecmp((rpl)->first_line.u.reply.version.s, \
+   HTTP2_VERSION, HTTP2_VERSION_LEN)))
 
 #define IS_SIP_REPLY(rpl)\
((rpl)->first_line.u.reply.version.len >= SIP_VERSION_LEN && \
diff --git a/src/core/parser/parse_fline.c b/src/core/parser/parse_fline.c
index 6d46f2192a..c535b49a4c 100644
--- a/src/core/parser/parse_fline.c
+++ b/src/core/parser/parse_fline.c
@@ -96,21 +96,28 @@ char* parse_first_line(char* buffer, unsigned int len, 
struct msg_start* fl)
fl->flags|=FLINE_FLAG_PROTO_SIP;
fl->u.reply.version.len=SIP_VERSION_LEN;
tmp=buffer+SIP_VERSION_LEN;
-   } else if (http_reply_parse != 0 &&
-   (*tmp=='H' || *tmp=='h') &&
+   } else if (http_reply_parse != 0 && (*tmp=='H' || *tmp=='h')) {
/* 'HTTP/1.' */
-   strncasecmp( tmp+1, HTTP_VERSION+1, 
HTTP_VERSION_LEN-1)==0 &&
-   /* [0|1] */
-   ((*(tmp+HTTP_VERSION_LEN)=='0') || 
(*(tmp+HTTP_VERSION_LEN)=='1')) &&
-   (*(tmp+HTTP_VERSION_LEN+1)==' ')  ){ 
-   /* ugly hack to be able to route http replies
-* Note: - the http reply must have a via
-*   - the message is marked as SIP_REPLY (ugly)
-*/
-   fl->type=SIP_REPLY;
-   fl->flags|=FLINE_FLAG_PROTO_HTTP;
-   fl->u.reply.version.len=HTTP_VERSION_LEN+1 
/*include last digit*/;
-   tmp=buffer+HTTP_VERSION_LEN+1 /* last digit */;
+   if (strncasecmp( tmp+1, HTTP_VERSION+1, 
HTTP_VERSION_LEN-1)==0 &&
+ /* [0|1] */
+ ((*(tmp+HTTP_VERSION_LEN)=='0') || 
(*(tmp+HTTP_VERSION_LEN)=='1')) &&
+ (*(tmp+HTTP_VERSION_LEN+1)==' ')  ){ 
+   /* ugly hack to be able to route http replies
+   * Note: - the http reply must have a via
+   *   - the message is marked as SIP_REPLY (ugly)
+   */
+ fl->type=SIP_REPLY;
+ fl->flags|=FLINE_FLAG_PROTO_HTTP;
+ fl->u.reply.version.len=HTTP_VERSION_LEN+1 
/*include last digit*/;
+  tmp=buffer+HTTP_VERSION_LEN+1 /* last digit */;
+   /* 'HTTP/2' */
+   } else if (strncasecmp( tmp+1, HTTP2_VERSION+1, 
HTTP2_VERSION_LEN-1)==0 &&
+   (*(tmp+HTTP2_VERSION_LEN)==' 
')) {
+   fl->type=SIP_REPLY;
+   fl->flags|=FLINE_FLAG_PROTO_HTTP;
+   
fl->u.reply.version.len=HTTP2_VERSION_LEN;
+   tmp=buffer+HTTP2_VERSION_LEN;
+   }
} else IFISMETHOD( INVITE, 'I' )
else IFISMETHOD( CANCEL, 'C')
else IFISMETHOD( ACK, 'A' )
diff --git a/src/core/parser/parse_fline.h b/src/core/parser/parse_fline.h
index 2add9b0efb..63f74ececf 100644
--- a/src/core/p

Re: [sr-dev] [kamailio/kamailio] core: add support for parsing http/2 replies parsing (#2132)

2019-11-18 Thread Federico Cabiddu
I agree that the usage of http/2 will become more and more common. If you 
agree, I'll also backport it to 5.2.x since this is still a supported version.

-- 
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/2132#issuecomment-554997070___
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: add support for parsing http/2 replies parsing (#2132)

2019-11-16 Thread Federico Cabiddu
@grumvalski pushed 1 commit.

17be36102e3a1c286c69a5da193dd8405000ab62  core: add support for parsing http/2 
replies parsing


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/kamailio/kamailio/pull/2132/files/b375c5d4cb87e8f826c764cf63237b9d11d50a6a..17be36102e3a1c286c69a5da193dd8405000ab62
___
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: add support for parsing http/2 replies parsing (#2132)

2019-11-15 Thread Federico Cabiddu
grumvalski commented on this pull request.



> @@ -47,7 +47,10 @@
 #define SIP_VERSION_LEN 7
 
 #define HTTP_VERSION "HTTP/1."
-#define HTTP_VERSION_LEN (sizeof(HTTP_VERSION)-1)
+#define HTTP_VERSION_LEN (sizeof(HTTP2_VERSION)-1)

Yes, it was not done intentionally. I'll fix and force push if you agree. 

-- 
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/2132#discussion_r346999757___
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: add support for parsing http/2 replies parsing (#2132)

2019-11-15 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)
- [ ] 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 --
http_async_client module needs to parse http replies. Currently HTTP/2 is not 
supported by the core parser. 
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * core: add support for parsing http/2 replies parsing

-- File Changes --

M src/core/parser/msg_parser.h (7)
M src/core/parser/parse_fline.c (34)
M src/core/parser/parse_fline.h (5)

-- Patch Links --

https://github.com/kamailio/kamailio/pull/2132.patch
https://github.com/kamailio/kamailio/pull/2132.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/2132
___
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] q_malloc crash on Kamailio 5.2.3 with http_async_query function (#2091)

2019-10-08 Thread Federico Cabiddu
Thank you for looking at it Daniel!
Sincerely I don't understand how this issue is only appearing now, since the 
code hasn't changed since the very beginning.

-- 
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/2091#issuecomment-539410176___
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] q_malloc crash on Kamailio 5.2.3 with http_async_query function (#2091)

2019-10-06 Thread Federico Cabiddu
Hi,
I tested your scenario (calling http_async_query from diaog:end event route) 
but I haven't been able to reproduce the crash so far, neither with 5.2.3 nor 
with master.
Is the crash systematic for you?
Is there any other operation you are doing in your script before calling the 
http_async?
Could you please increase kamailio's debug level?
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/2091#issuecomment-538718272___
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:e8c6a8fb: dialog: run DLGCB_LOADED callbacks when loading dialog from db

2019-09-17 Thread Federico Cabiddu
Module: kamailio
Branch: 5.2
Commit: e8c6a8fbd1b16ddd1b8c9180aaf27dcd5cc9e05c
URL: 
https://github.com/kamailio/kamailio/commit/e8c6a8fbd1b16ddd1b8c9180aaf27dcd5cc9e05c

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2019-09-17T14:35:53+02:00

dialog: run DLGCB_LOADED callbacks when loading dialog from db

---

Modified: src/modules/dialog/dialog.c
Modified: src/modules/dialog/dlg_cb.c
Modified: src/modules/dialog/dlg_cb.h
Modified: src/modules/dialog/dlg_db_handler.c

---

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

---

diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c
index 6665398742..9c656e2b58 100644
--- a/src/modules/dialog/dialog.c
+++ b/src/modules/dialog/dialog.c
@@ -707,7 +707,6 @@ static int mod_init(void)
}
}
 
-   destroy_dlg_callbacks( DLGCB_LOADED );
 
/* timer process to send keep alive requests */
if(dlg_ka_timer>0 && dlg_ka_interval>0)
diff --git a/src/modules/dialog/dlg_cb.c b/src/modules/dialog/dlg_cb.c
index 12946994ba..f3c70bc173 100644
--- a/src/modules/dialog/dlg_cb.c
+++ b/src/modules/dialog/dlg_cb.c
@@ -232,6 +232,23 @@ void run_create_callbacks(struct dlg_cell *dlg, struct 
sip_msg *msg)
return;
 }
 
+void run_dlg_load_callbacks(struct dlg_cell *dlg)
+{
+   struct dlg_callback *cb;
+
+   if (load_cbs && load_cbs!=POINTER_CLOSED_MARKER) {
+   for ( cb=load_cbs->first; cb; cb=cb->next ) {
+   params.req = NULL;
+   params.rpl = NULL;
+   params.direction = DLG_DIR_NONE;
+   params.param = >param;
+   
+   cb->callback( dlg, DLGCB_LOADED,  );
+   }
+  }
+   return;
+}
+
 
 void run_dlg_callbacks( int type ,
struct dlg_cell *dlg,
diff --git a/src/modules/dialog/dlg_cb.h b/src/modules/dialog/dlg_cb.h
index 82afa05a82..bb0037c7f7 100644
--- a/src/modules/dialog/dlg_cb.h
+++ b/src/modules/dialog/dlg_cb.h
@@ -109,6 +109,7 @@ void run_dlg_callbacks( int type ,
 
 void run_load_callbacks( void );
 
+void run_dlg_load_callbacks(struct dlg_cell *dlg);
 
 /*!
  * \brief Function that returns valid SIP message from given dialog callback 
parameter struct
diff --git a/src/modules/dialog/dlg_db_handler.c 
b/src/modules/dialog/dlg_db_handler.c
index b15cc86485..41bf52bd74 100644
--- a/src/modules/dialog/dlg_db_handler.c
+++ b/src/modules/dialog/dlg_db_handler.c
@@ -40,6 +40,7 @@
 #include "../../core/counters.h"
 #include "dlg_hash.h"
 #include "dlg_var.h"
+#include "dlg_cb.h"
 #include "dlg_profile.h"
 #include "dlg_db_handler.h"
 
@@ -488,6 +489,7 @@ int load_dialog_info_from_db(int dlg_hash_size, int 
fetch_num_rows,
get_ticks());
 
dlg->dflags = 0;
+  
if(mode!=0) {
if(loaded_extrah_entry;
@@ -497,6 +499,8 @@ int load_dialog_info_from_db(int dlg_hash_size, int 
fetch_num_rows,
dlg->dflags |= DLG_FLAG_DB_LOAD_EXTRA;
loaded_extra_more = 1;
}
+ /* if loading at runtime run the callbacks for the 
loaded dialog */
+ run_dlg_load_callbacks(dlg);
}
next_dialog:
;


___
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] dialog: run DLGCB_LOADED callbacks when loading dialog from db (#2066)

2019-09-17 Thread Federico Cabiddu
Merged #2066 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/2066#event-2639721028___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:10037f65: dialog: run DLGCB_LOADED callbacks when loading dialog from db

2019-09-17 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: 10037f658cd1657275f383314b6960715c17ea39
URL: 
https://github.com/kamailio/kamailio/commit/10037f658cd1657275f383314b6960715c17ea39

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2019-09-17T07:52:29+02:00

dialog: run DLGCB_LOADED callbacks when loading dialog from db

---

Modified: src/modules/dialog/dialog.c
Modified: src/modules/dialog/dlg_cb.c
Modified: src/modules/dialog/dlg_cb.h
Modified: src/modules/dialog/dlg_db_handler.c

---

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

---

diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c
index 8f5a186e40..b849cfbb6c 100644
--- a/src/modules/dialog/dialog.c
+++ b/src/modules/dialog/dialog.c
@@ -714,7 +714,6 @@ static int mod_init(void)
}
}
 
-   destroy_dlg_callbacks( DLGCB_LOADED );
 
/* timer process to send keep alive requests */
if(dlg_ka_timer>0 && dlg_ka_interval>0)
diff --git a/src/modules/dialog/dlg_cb.c b/src/modules/dialog/dlg_cb.c
index 12946994ba..f3c70bc173 100644
--- a/src/modules/dialog/dlg_cb.c
+++ b/src/modules/dialog/dlg_cb.c
@@ -232,6 +232,23 @@ void run_create_callbacks(struct dlg_cell *dlg, struct 
sip_msg *msg)
return;
 }
 
+void run_dlg_load_callbacks(struct dlg_cell *dlg)
+{
+   struct dlg_callback *cb;
+
+   if (load_cbs && load_cbs!=POINTER_CLOSED_MARKER) {
+   for ( cb=load_cbs->first; cb; cb=cb->next ) {
+   params.req = NULL;
+   params.rpl = NULL;
+   params.direction = DLG_DIR_NONE;
+   params.param = >param;
+   
+   cb->callback( dlg, DLGCB_LOADED,  );
+   }
+  }
+   return;
+}
+
 
 void run_dlg_callbacks( int type ,
struct dlg_cell *dlg,
diff --git a/src/modules/dialog/dlg_cb.h b/src/modules/dialog/dlg_cb.h
index 82afa05a82..bb0037c7f7 100644
--- a/src/modules/dialog/dlg_cb.h
+++ b/src/modules/dialog/dlg_cb.h
@@ -109,6 +109,7 @@ void run_dlg_callbacks( int type ,
 
 void run_load_callbacks( void );
 
+void run_dlg_load_callbacks(struct dlg_cell *dlg);
 
 /*!
  * \brief Function that returns valid SIP message from given dialog callback 
parameter struct
diff --git a/src/modules/dialog/dlg_db_handler.c 
b/src/modules/dialog/dlg_db_handler.c
index 56c7ef39a2..1325469675 100644
--- a/src/modules/dialog/dlg_db_handler.c
+++ b/src/modules/dialog/dlg_db_handler.c
@@ -40,6 +40,7 @@
 #include "../../core/counters.h"
 #include "dlg_hash.h"
 #include "dlg_var.h"
+#include "dlg_cb.h"
 #include "dlg_profile.h"
 #include "dlg_db_handler.h"
 
@@ -493,6 +494,7 @@ int load_dialog_info_from_db(int dlg_hash_size, int 
fetch_num_rows,
get_ticks());
 
dlg->dflags = 0;
+  
if(mode!=0) {
if(loaded_extrah_entry;
@@ -502,6 +504,8 @@ int load_dialog_info_from_db(int dlg_hash_size, int 
fetch_num_rows,
dlg->dflags |= DLG_FLAG_DB_LOAD_EXTRA;
loaded_extra_more = 1;
}
+ /* if loading at runtime run the callbacks for the 
loaded dialog */
+ run_dlg_load_callbacks(dlg);
}
next_dialog:
;


___
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] dialog: run DLGCB_LOADED callbacks when loading dialog from db (#2066)

2019-09-17 Thread Federico Cabiddu
Thanks. I'm going to merge and backport to 5.2 (where the new functions have 
been introduced).

-- 
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/2066#issuecomment-532200676___
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] dialog: run DLGCB_LOADED callbacks when loading dialog from db (#2066)

2019-09-16 Thread Federico Cabiddu
@grumvalski pushed 1 commit.

10037f658cd1657275f383314b6960715c17ea39  dialog: run DLGCB_LOADED callbacks 
when loading dialog from db


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/kamailio/kamailio/pull/2066/files/1d6a06c5cdef9665ec473817235856c22a79949f..10037f658cd1657275f383314b6960715c17ea39
___
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] dialog: run DLGCB_LOADED callbacks when loading dialog from db (#2066)

2019-09-14 Thread Federico Cabiddu
Thans for looking Henning, I fixed the indentation (automatic editor settings) 
and push a new commit. I can rebase/squash before merging.
Yes, the fix should also work for dlg_db_load_extra (mode 2 for the function).

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2066#issuecomment-53143___
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] dialog: run DLGCB_LOADED callbacks when loading dialog from db (#2066)

2019-09-14 Thread Federico Cabiddu
@grumvalski pushed 1 commit.

1d6a06c5cdef9665ec473817235856c22a79949f  dialog: fix indentation


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/kamailio/kamailio/pull/2066/files/b30b53d07200beaf5566c270a22d6f7f48cb54c3..1d6a06c5cdef9665ec473817235856c22a79949f
___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] [kamailio/kamailio] dialog: run DLGCB_LOADED callbacks when loading dialog from db (#2066)

2019-09-14 Thread Federico Cabiddu
When a specific dialog is loaded from db via dlg_db_load_callid, the load 
callbacks are not executed so, for example, a CDR is not generated.
No sure if this should considered a new feature or a bug (and so eventually be 
backported).
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * dialog: run DLGCB_LOADED callbacks when loading dialog from db

-- File Changes --

M src/modules/dialog/dialog.c (1)
M src/modules/dialog/dlg_cb.c (17)
M src/modules/dialog/dlg_cb.h (1)
M src/modules/dialog/dlg_db_handler.c (4)

-- Patch Links --

https://github.com/kamailio/kamailio/pull/2066.patch
https://github.com/kamailio/kamailio/pull/2066.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/2066
___
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_redis: add examples about usage with dialog module (#2059)

2019-09-08 Thread Federico Cabiddu
Merged #2059 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/2059#event-2616626216___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:86990ab5: db_redis: add examples about usage with dialog module

2019-09-08 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: 86990ab53c4b5e5ede49b95e17b02f96ae00a01c
URL: 
https://github.com/kamailio/kamailio/commit/86990ab53c4b5e5ede49b95e17b02f96ae00a01c

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2019-09-08T09:56:43+02:00

db_redis: add examples about usage with dialog module

---

Modified: src/modules/db_redis/doc/db_redis_admin.xml

---

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

---

diff --git a/src/modules/db_redis/doc/db_redis_admin.xml 
b/src/modules/db_redis/doc/db_redis_admin.xml
index 0c8ba2ed04..6439c79b6f 100644
--- a/src/modules/db_redis/doc/db_redis_admin.xml
+++ b/src/modules/db_redis/doc/db_redis_admin.xml
@@ -226,12 +226,15 @@ loadmodule "db_redis.so"
 #!define DBURL_ACC"redis://127.0.0.1:6379/6"
 #!define DBURL_AUTH   "redis://127.0.0.1:6379/7"
 #!define DBURL_PERM   "redis://127.0.0.1:6379/8"
+#!define DBURL_DLG"redis://127.0.0.1:6379/9"
 ...
 modparam("db_redis", "schema_path", "/usr/share/kamailio/db_redis/kamailio")
 modparam("db_redis", "keys", "version=entry:table_name")
 modparam("db_redis", "keys", 
"location=entry:ruidusrdom:username,domaintimer:partition,keepalive")
 modparam("db_redis", "keys", "acc=entry:callid,time_hirescid:callid")
 modparam("db_redis", "keys", "subscriber=entry:username,domain")
+modparam("db_redis", "keys", "dialog=entry:hash_entry,hash_idcid:callid")
+modparam("db_redis", "keys", 
"dialog_vars=entry:hash_entry,hash_id,dialog_keydialog:hash_entry,hash_id")
 ...
 modparam("usrloc", "db_url", DBURL_USRLOC)
 ...
@@ -240,6 +243,8 @@ modparam("acc_db", "db_url", DBURL_ACC)
 modparam("auth_db", "db_url", DBURL_AUTH)
 ...
 modparam("permissions", "db_url", DBURL_PERM)
+...
+modparam("dialog", "db_url", DBURL_DLG)
 ...




___
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:761758b1: dialog: check xdata length when loading profile from db

2019-09-08 Thread Federico Cabiddu
Module: kamailio
Branch: 5.2
Commit: 761758b1d8a7ebdb72caf8d5442a38988cf2e951
URL: 
https://github.com/kamailio/kamailio/commit/761758b1d8a7ebdb72caf8d5442a38988cf2e951

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2019-09-08T10:20:56+02:00

dialog: check xdata length when loading profile from db

(cherry picked from commit d05dfc20632fde1d65017ff5d7f41713a9c79825)

---

Modified: src/modules/dialog/dlg_db_handler.c

---

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

---

diff --git a/src/modules/dialog/dlg_db_handler.c 
b/src/modules/dialog/dlg_db_handler.c
index 1b9d704cf6..b15cc86485 100644
--- a/src/modules/dialog/dlg_db_handler.c
+++ b/src/modules/dialog/dlg_db_handler.c
@@ -452,7 +452,7 @@ int load_dialog_info_from_db(int dlg_hash_size, int 
fetch_num_rows,
dlg_set_toroute(dlg, _name);
 
GET_STR_VALUE(xdata, values, 21, 0, 0);
-   if(xdata.s!=NULL && dlg->state!=DLG_STATE_DELETED)
+   if(xdata.len > 0 && xdata.s!=NULL && 
dlg->state!=DLG_STATE_DELETED)
{
srjson_InitDoc(, NULL);
jdoc.buf = xdata;


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


[sr-dev] git:5.1:75dc482c: dialog: check xdata length when loading profile from db

2019-09-08 Thread Federico Cabiddu
Module: kamailio
Branch: 5.1
Commit: 75dc482cf327e3a707281f903c7e75d3b28cf52c
URL: 
https://github.com/kamailio/kamailio/commit/75dc482cf327e3a707281f903c7e75d3b28cf52c

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2019-09-08T10:20:36+02:00

dialog: check xdata length when loading profile from db

(cherry picked from commit d05dfc20632fde1d65017ff5d7f41713a9c79825)

---

Modified: src/modules/dialog/dlg_db_handler.c

---

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

---

diff --git a/src/modules/dialog/dlg_db_handler.c 
b/src/modules/dialog/dlg_db_handler.c
index 8e8b5b088b..92d469852e 100644
--- a/src/modules/dialog/dlg_db_handler.c
+++ b/src/modules/dialog/dlg_db_handler.c
@@ -414,7 +414,7 @@ static int load_dialog_info_from_db(int dlg_hash_size, int 
fetch_num_rows)
dlg_set_toroute(dlg, _name);
 
GET_STR_VALUE(xdata, values, 21, 0, 0);
-   if(xdata.s!=NULL && dlg->state!=DLG_STATE_DELETED)
+   if(xdata.len > 0 && xdata.s!=NULL && 
dlg->state!=DLG_STATE_DELETED)
{
srjson_InitDoc(, NULL);
jdoc.buf = xdata;


___
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] dialog: check xdata length when loading profile from db (#2058)

2019-09-08 Thread Federico Cabiddu
Merged #2058 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/2058#event-2616624497___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:d05dfc20: dialog: check xdata length when loading profile from db

2019-09-08 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: d05dfc20632fde1d65017ff5d7f41713a9c79825
URL: 
https://github.com/kamailio/kamailio/commit/d05dfc20632fde1d65017ff5d7f41713a9c79825

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2019-09-08T09:01:10+02:00

dialog: check xdata length when loading profile from db

---

Modified: src/modules/dialog/dlg_db_handler.c

---

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

---

diff --git a/src/modules/dialog/dlg_db_handler.c 
b/src/modules/dialog/dlg_db_handler.c
index 2c89685ffc..56c7ef39a2 100644
--- a/src/modules/dialog/dlg_db_handler.c
+++ b/src/modules/dialog/dlg_db_handler.c
@@ -457,7 +457,7 @@ int load_dialog_info_from_db(int dlg_hash_size, int 
fetch_num_rows,
dlg_set_toroute(dlg, _name);
 
GET_STR_VALUE(xdata, values, 21, 0, 0);
-   if(xdata.s!=NULL && dlg->state!=DLG_STATE_DELETED)
+   if(xdata.len > 0 && xdata.s!=NULL && 
dlg->state!=DLG_STATE_DELETED)
{
srjson_InitDoc(, NULL);
jdoc.buf = xdata;


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


[sr-dev] [kamailio/kamailio] db_redis: add examples about usage with dialog module (#2059)

2019-09-08 Thread Federico Cabiddu
Small contribution to db_redis module documentation.
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * db_redis: add examples about usage with dialog module

-- File Changes --

M src/modules/db_redis/doc/db_redis_admin.xml (5)

-- Patch Links --

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


[sr-dev] [kamailio/kamailio] dialog: check xdata length when loading profile from db (#2058)

2019-09-08 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 using a backend not supporting NULL, like Redis, which store 
it as an empty string, xdata.s can be not null (it contains \0). This 
leads to an error trying to read it as a json document.
Not really a bug, but it leads to the error
invalid json doc [[]]
being printed each time a dialog is loaded from db (Redis).
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * dialog: check xdata length when loading profile from db

-- File Changes --

M src/modules/dialog/dlg_db_handler.c (2)

-- Patch Links --

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


Re: [sr-dev] [SR-Users] RFC: about sl and tm local-response event routes

2019-08-27 Thread Federico Cabiddu
Hi Daniel,
yes, sorry I meant local-response!

Cheers,

Federico


On Tue, Aug 27, 2019 at 4:19 PM Daniel-Constantin Mierla 
wrote:

> Hi Federico,
>
> local-request stays the same (that's rather used based on mailing list
> discussions).
>
> I proposed to change the local-response to local-response-sent (I don't
> remember any discussion about people using it, I checked the commit log and
> was added by Peter Dunkley several years ago, I never used it so far).
>
> Cheers,
> Daniel
> On 27.08.19 16:04, Federico Cabiddu wrote:
>
> Hi Daniel,
> personally I have just one case of local-request, so it wouldn't hurt too
> much this change that brings consistency.
>
> Cheers,
>
> Federico
>
> On Tue, Aug 27, 2019 at 1:37 PM Daniel-Constantin Mierla <
> mico...@gmail.com> wrote:
>
>> Hello,
>>
>> just discovered what I consider to be an inconsistency in naming and
>> behaviour for event_route blocks for local-request and local-response
>> and starting a discussion here to see how to move on.
>>
>> The event_route[tm:local-request] is executed before sending there local
>> generated request out (allowing also to change its content, drop,
>> etc...). This event route is quite popular event route used when the
>> local generated requests need to be checked or updates.
>>
>> The event_route[tm:local-response] is executed after the response is
>> sent out, obviously no possibility to change anymore the content. I
>> haven't checked the code for event_route[sl:local-response], but based
>> on commit message should be the same.
>>
>> I haven't used the local-response so far at all, today after a
>> discussion on sr-users I wanted to enable kemi callback for
>> tm:local-response and I noticed that behaviour in the code, even I
>> expected to be like local-request (before sending out).
>>
>> I am not sure how much used are the event routes for tm:local-response
>> and sl:local-response, I haven't seen any questions about them so far on
>> mailing lists, that's why I am asking here if would make sense to rename
>> them like tm:local-response-sent and sl:local-response-sent to properly
>> reflect when they are executed. I am  expecting that they are very few
>> used so far,  so no big head ache with upgrades and bringing some
>> consistency around (this change to be part of next major release).
>>
>> It can stay like now with proper documentation, however in the future if
>> one want and event route for local responses before being sent out,
>> there will be more confusion, imo ...
>>
>> Cheers,
>> Daniel
>>
>> --
>> Daniel-Constantin Mierla -- www.asipto.com
>> www.twitter.com/miconda -- www.linkedin.com/in/miconda
>>
>>
>> ___
>> Kamailio (SER) - Users Mailing List
>> sr-us...@lists.kamailio.org
>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>
> --
> Daniel-Constantin Mierla -- www.asipto.comwww.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


Re: [sr-dev] [SR-Users] RFC: about sl and tm local-response event routes

2019-08-27 Thread Federico Cabiddu
Hi Daniel,
personally I have just one case of local-request, so it wouldn't hurt too
much this change that brings consistency.

Cheers,

Federico

On Tue, Aug 27, 2019 at 1:37 PM Daniel-Constantin Mierla 
wrote:

> Hello,
>
> just discovered what I consider to be an inconsistency in naming and
> behaviour for event_route blocks for local-request and local-response
> and starting a discussion here to see how to move on.
>
> The event_route[tm:local-request] is executed before sending there local
> generated request out (allowing also to change its content, drop,
> etc...). This event route is quite popular event route used when the
> local generated requests need to be checked or updates.
>
> The event_route[tm:local-response] is executed after the response is
> sent out, obviously no possibility to change anymore the content. I
> haven't checked the code for event_route[sl:local-response], but based
> on commit message should be the same.
>
> I haven't used the local-response so far at all, today after a
> discussion on sr-users I wanted to enable kemi callback for
> tm:local-response and I noticed that behaviour in the code, even I
> expected to be like local-request (before sending out).
>
> I am not sure how much used are the event routes for tm:local-response
> and sl:local-response, I haven't seen any questions about them so far on
> mailing lists, that's why I am asking here if would make sense to rename
> them like tm:local-response-sent and sl:local-response-sent to properly
> reflect when they are executed. I am  expecting that they are very few
> used so far,  so no big head ache with upgrades and bringing some
> consistency around (this change to be part of next major release).
>
> It can stay like now with proper documentation, however in the future if
> one want and event route for local responses before being sent out,
> there will be more confusion, imo ...
>
> Cheers,
> Daniel
>
> --
> Daniel-Constantin Mierla -- www.asipto.com
> www.twitter.com/miconda -- www.linkedin.com/in/miconda
>
>
> ___
> Kamailio (SER) - Users Mailing List
> sr-us...@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:5.1:a792b1cf: siptrace: check if trace_to_database is set before checking the db connection

2019-08-27 Thread Federico Cabiddu
Module: kamailio
Branch: 5.1
Commit: a792b1cfd927e1c29385a229d82b96c91b86b9ab
URL: 
https://github.com/kamailio/kamailio/commit/a792b1cfd927e1c29385a229d82b96c91b86b9ab

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2019-08-27T09:28:12+02:00

siptrace: check if trace_to_database is set before checking the db connection

(cherry picked from commit afd0c929dc72a975e2ca3c88f307fd8c140a4fda)

---

Modified: src/modules/siptrace/siptrace.c

---

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

---

diff --git a/src/modules/siptrace/siptrace.c b/src/modules/siptrace/siptrace.c
index 1e26bc2131..59c14d7b7e 100644
--- a/src/modules/siptrace/siptrace.c
+++ b/src/modules/siptrace/siptrace.c
@@ -503,14 +503,14 @@ static int sip_trace_store(siptrace_data_t *sto, 
dest_info_t *dst,
 
 static int sip_trace_store_db(siptrace_data_t *sto)
 {
+   if(trace_to_database_flag == NULL || *trace_to_database_flag == 0)
+   goto done;
+
if(db_con == NULL) {
LM_DBG("database connection not initialized\n");
return -1;
}
 
-   if(trace_to_database_flag == NULL || *trace_to_database_flag == 0)
-   goto done;
-
db_key_t db_keys[NR_KEYS];
db_val_t db_vals[NR_KEYS];
 


___
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:94b60464: siptrace: check if trace_to_database is set before checking the db connection

2019-08-27 Thread Federico Cabiddu
Module: kamailio
Branch: 5.2
Commit: 94b60464c9ccac49ebae238aa42ae16fb2c5f9ec
URL: 
https://github.com/kamailio/kamailio/commit/94b60464c9ccac49ebae238aa42ae16fb2c5f9ec

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2019-08-27T09:27:54+02:00

siptrace: check if trace_to_database is set before checking the db connection

(cherry picked from commit afd0c929dc72a975e2ca3c88f307fd8c140a4fda)

---

Modified: src/modules/siptrace/siptrace.c

---

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

---

diff --git a/src/modules/siptrace/siptrace.c b/src/modules/siptrace/siptrace.c
index 08ddc07ef5..a5299d4cad 100644
--- a/src/modules/siptrace/siptrace.c
+++ b/src/modules/siptrace/siptrace.c
@@ -497,14 +497,14 @@ static int sip_trace_store(siptrace_data_t *sto, 
dest_info_t *dst,
 
 static int sip_trace_store_db(siptrace_data_t *sto)
 {
+   if(trace_to_database_flag == NULL || *trace_to_database_flag == 0)
+   goto done;
+
if(db_con == NULL) {
LM_DBG("database connection not initialized\n");
return -1;
}
 
-   if(trace_to_database_flag == NULL || *trace_to_database_flag == 0)
-   goto done;
-
db_key_t db_keys[NR_KEYS];
db_val_t db_vals[NR_KEYS];
 


___
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: check if trace_to_database is set before checking the db co… (#2047)

2019-08-27 Thread Federico Cabiddu
Merged #2047 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/2047#event-2586033125___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:afd0c929: siptrace: check if trace_to_database is set before checking the db connection

2019-08-27 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: afd0c929dc72a975e2ca3c88f307fd8c140a4fda
URL: 
https://github.com/kamailio/kamailio/commit/afd0c929dc72a975e2ca3c88f307fd8c140a4fda

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2019-08-26T20:21:13+02:00

siptrace: check if trace_to_database is set before checking the db connection

---

Modified: src/modules/siptrace/siptrace.c

---

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

---

diff --git a/src/modules/siptrace/siptrace.c b/src/modules/siptrace/siptrace.c
index 8fa832a043..211ddac363 100644
--- a/src/modules/siptrace/siptrace.c
+++ b/src/modules/siptrace/siptrace.c
@@ -542,14 +542,14 @@ static int sip_trace_store(siptrace_data_t *sto, 
dest_info_t *dst,
 
 static int sip_trace_store_db(siptrace_data_t *sto)
 {
+   if(trace_to_database_flag == NULL || *trace_to_database_flag == 0)
+   goto done;
+
if(db_con == NULL) {
LM_DBG("database connection not initialized\n");
return -1;
}
 
-   if(trace_to_database_flag == NULL || *trace_to_database_flag == 0)
-   goto done;
-
db_key_t db_keys[NR_KEYS];
db_val_t db_vals[NR_KEYS];
 


___
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: check if trace_to_database is set before checking the db co… (#2047)

2019-08-27 Thread Federico Cabiddu
…nnection

!-- 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
Return the proper error code to not stop message processing in reply_route.

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

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

-- Commit Summary --

  * siptrace: check if trace_to_database is set before checking the db 
connection

-- File Changes --

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

-- Patch Links --

https://github.com/kamailio/kamailio/pull/2047.patch
https://github.com/kamailio/kamailio/pull/2047.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/2047
___
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] TCP ACK is going to different IP then original invite sent (#1998)

2019-07-02 Thread Federico Cabiddu
that's already the case if you use IP addresses in 200 OK => ACK. 
The parameter you are speaking can not be implemented in core modules like tm, 
because that would mean implementing a tracking between transactions which is 
totally out of scope for those modules. Again, mechanisms external external to 
transactions need to be used.

-- 
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/1998#issuecomment-507596287___
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] TCP ACK is going to different IP then original invite sent (#1998)

2019-07-02 Thread Federico Cabiddu
I'm afraid that this is perfectly legitimate proxy behavior as per RFC.
If your 200 OK contact contains a FQDN as domain part, the ACK will have it
in the R-URI and Kamailio will forcefully have to resolve it before
relaying and there is no guarantee that the result will be the same.
Also don't forget that ACK is a transaction on its own, if you want to
track down things between INVITE transaction and ACL transaction you have
to use an "external" mechanism, like can using dialog module or htable
module.


On Tue, Jul 2, 2019 at 10:55 AM Surendra Tiwari 
wrote:

> Description
>
> We are converting udp call to tcp call in kamailio. kamailio sending out
> an invite to a destination. Before sending, kamailio resolving that
> destination domain to IP. After receiving invite request, Destination send
> 180 and 200 OK . 200 Ok contact contains the domain name of destination.
> After this kamailio forward those request to next route. kamailio recieved
> the ack from upstream. After reciving the ack from upstream it resolves
> again the domain name to different IP, as domain name have 2 IP's behind.
> Troubleshooting Reproduction Debugging Data
>
> (paste your debugging data here)
>
> Log Messages
>
> (paste your log messages here)
>
> SIP Traffic
>
> (paste your sip traffic here)
>
> Possible Solutions Additional Information
>
>- *Kamailio Version* - output of kamailio -v
>
> (paste your output here)
>
>
>- *Operating System*:
>
> (paste your output here)
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> ,
> or mute the thread
> 
> .
>


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


Re: [sr-dev] Additional headers on a dispatcher options ping

2019-05-31 Thread Federico Cabiddu
Hi Alex,
yes it works (just verified this morning ;-).
I use this trick in several situation, in the event-route the message is
still editable.
It's in the onsend_route that you cannot modify it, IIRC.

Cheers,

Federico

On Fri, May 31, 2019 at 8:27 AM Alex Balashov 
wrote:

> Federico,
>
> Does that actually work? I thought this route provides a hook to catch
> the request, but does not necessarily apply any lump changes to the
> outgoing message?
>
> On Fri, May 31, 2019 at 07:27:34AM +0200, Federico Cabiddu wrote:
>
> > Hi,
> > to add headers to locally generated requests, as it's the case for
> > dispatcher's OPTIONS, you could use tm's module "local-request" event
> route
> > to catch the outgoing OPTIONS and append a header before it's relayed.
> > Something like this:
> >
> > event_route[tm:local-request] { # Handle locally generated requests
> > if (is_method("OPTIONS")) {
> > xlog("L_INFO", "dispatcher generated OPTIONS to $du\n");
> > append_hf("X-CustomHeader: myValue\r\n");
> > }
> > }
> >
> > Cheers,
> >
> > Federico
> >
> > On Thu, May 30, 2019 at 9:28 PM Henning Westerholt 
> wrote:
> >
> > > Hello Tim,
> > >
> > > at the moment there is no such functionality available in the module.
> But
> > > have a look eg. to the implementation of this function
> > >
> > >
> > >
> https://kamailio.org/docs/modules/5.2.x/modules/dispatcher.html#dispatcher.p.ds_ping_from
> > >
> > > in C function "void ds_ping_set(ds_set_t *node)" which allows to set
> the
> > > From header for the dispatcher pings. Maybe this gives you a starting
> > > point. If you came up with an extension, we are always open to pull
> > > requests. :-)
> > >
> > > Cheers,
> > >
> > > Henning
> > > Am 22.05.19 um 00:06 schrieb Tim Chubb:
> > >
> > > Hi
> > >
> > >
> > >
> > > Is there any mechanism to add a contact and rr headers to the option
> > > messages generated by dispatcher?
> > >
> > >
> > >
> > > I have a need for both headers to be present otherwise the message gets
> > > rejected at the proxy im trying to connect to,  the content of the
> headers
> > > in my use case is the from address, so would seem trivial (in so far I
> know
> > > enough c to just about follow what’s going on in the code, but wouldn’t
> > > know where to start to add the functionality) to add using the existing
> > > from attribute and a pair of additional modparams to enable this
> > > functionality, if its not already possible
> > >
> > > Currently I have a workaround by generating the pings in asterisk and
> > > routing as usual, but would really prefer to not reinvent the wheel
> and use
> > > dispatcher as I do with other trunks and services mainly for
> consistency
> > > and keeping what is essentially a routing issue out of the application
> > > stack, as apart from the missing headers dispatchers functionality is
> > > exactly what I need.
> > >
> > >
> > >
> > > Any suggestions?
> > >
> > >
> > >
> > > Tim.
> > >
> > >
> > >
> > >
> > >
> > >
> > > ___
> > > Kamailio (SER) - Development Mailing Listsr-dev
> @lists.kamailio.orghttps://
> lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
> > >
> > > --
> > > Henning Westerholt - https://skalatan.de/blog/
> > > Kamailio services - https://skalatan.de/services
> > >
> > > ___
> > > 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
>
>
> --
> Alex Balashov | Principal | Evariste Systems LLC
>
> Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
> Web: http://www.evaristesys.com/, http://www.csrpswitch.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


Re: [sr-dev] Additional headers on a dispatcher options ping

2019-05-30 Thread Federico Cabiddu
Hi,
to add headers to locally generated requests, as it's the case for
dispatcher's OPTIONS, you could use tm's module "local-request" event route
to catch the outgoing OPTIONS and append a header before it's relayed.
Something like this:

event_route[tm:local-request] { # Handle locally generated requests
if (is_method("OPTIONS")) {
xlog("L_INFO", "dispatcher generated OPTIONS to $du\n");
append_hf("X-CustomHeader: myValue\r\n");
}
}

Cheers,

Federico

On Thu, May 30, 2019 at 9:28 PM Henning Westerholt  wrote:

> Hello Tim,
>
> at the moment there is no such functionality available in the module. But
> have a look eg. to the implementation of this function
>
>
> https://kamailio.org/docs/modules/5.2.x/modules/dispatcher.html#dispatcher.p.ds_ping_from
>
> in C function "void ds_ping_set(ds_set_t *node)" which allows to set the
> From header for the dispatcher pings. Maybe this gives you a starting
> point. If you came up with an extension, we are always open to pull
> requests. :-)
>
> Cheers,
>
> Henning
> Am 22.05.19 um 00:06 schrieb Tim Chubb:
>
> Hi
>
>
>
> Is there any mechanism to add a contact and rr headers to the option
> messages generated by dispatcher?
>
>
>
> I have a need for both headers to be present otherwise the message gets
> rejected at the proxy im trying to connect to,  the content of the headers
> in my use case is the from address, so would seem trivial (in so far I know
> enough c to just about follow what’s going on in the code, but wouldn’t
> know where to start to add the functionality) to add using the existing
> from attribute and a pair of additional modparams to enable this
> functionality, if its not already possible
>
> Currently I have a workaround by generating the pings in asterisk and
> routing as usual, but would really prefer to not reinvent the wheel and use
> dispatcher as I do with other trunks and services mainly for consistency
> and keeping what is essentially a routing issue out of the application
> stack, as apart from the missing headers dispatchers functionality is
> exactly what I need.
>
>
>
> Any suggestions?
>
>
>
> Tim.
>
>
>
>
>
>
> ___
> Kamailio (SER) - Development Mailing 
> Listsr-dev@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
>
> --
> Henning Westerholt - https://skalatan.de/blog/
> Kamailio services - https://skalatan.de/services
>
> ___
> 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] Siptrace (#1912)

2019-04-02 Thread Federico Cabiddu
grumvalski commented on this pull request.

Thanks! 
Looks fine, just a small comment on the doc.

> @@ -656,6 +654,11 @@ hlog("$hdr(P-MyID)", "Another one with a custom 
> correlation ID");
Stateless forwarded messages (forward()) are not logged if you set the
flag, use sip_trace() inside onsend_route block.

+   
+   If dialog level tracing is used internally generated BYE transaction(in
+   case of internal timeouts) won't be traced. At the moment kamailio 
offers
+   no posibility to trace those messages.

Actually it should be possible to capture these BYEs, as we do for ACK, in 
onsend_route or in tm's module local_route.

-- 
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/1912#pullrequestreview-221492084___
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] Small notes on $http_req(timeout) usage. (#1913)

2019-03-29 Thread Federico Cabiddu
You're right, I missed it sorry.

Federico

On Fri, Mar 29, 2019 at 9:36 AM Daniel-Constantin Mierla <
notificati...@github.com> wrote:

> @samael33 , @grumvalski
>  -- the commit messages on this pull are
> really inappropriate for development history.
>
> Next time check the contribution guidelines:
>
>-
>https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> ,
> or mute the thread
> 
> .
>


-- 
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/1913#issuecomment-477921080___
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] Small notes on $http_req(timeout) usage. (#1913)

2019-03-29 Thread Federico Cabiddu
Merged #1913 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/1913#event-2238374358___
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] Small notes on $http_req(timeout) usage. (#1913)

2019-03-28 Thread Federico Cabiddu
grumvalski commented on this pull request.

Thank you!
Just a small comment on the PR.

> @@ -435,7 +435,7 @@ xlog("L_INFO", "received reply for query $http_req_id\n");
hdr: sets/modifies/removes 
a HTTP header. N.B.: setting this variable multiple times will add several 
headers to the query.
body: 
sets/modifies/removes the request body
method: sets the HTTP 
method: either "GET", "POST", "PUT" or "DELETE" (these are the supported 
methods). (Note: if the method is not set, curl will use GET, or POST if a body 
is specified)
-   timeout: sets the HTTP 
timeout
+   timeout: sets the HTTP 
timeout. (Note, this timeout should be normally less, than 
tm.fr_timer timeout, cause transaction timeout has a higher 
priority over HTTP timeout)

s/cause/because/
and 
s/less,/less/

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


[sr-dev] git:master:4a2f5334: http_async_client: add ifdef/endif block for tcp_keepalive

2019-02-09 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: 4a2f5334e898b0c1aaffdd73cae205c9fee43f37
URL: 
https://github.com/kamailio/kamailio/commit/4a2f5334e898b0c1aaffdd73cae205c9fee43f37

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2019-02-09T16:16:50+01:00

http_async_client: add ifdef/endif block for tcp_keepalive

---

Modified: src/modules/http_async_client/doc/http_async_client_admin.xml
Modified: src/modules/http_async_client/http_multi.c

---

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

---

diff --git a/src/modules/http_async_client/doc/http_async_client_admin.xml 
b/src/modules/http_async_client/doc/http_async_client_admin.xml
index 73fdf32841..5a050bf424 100644
--- a/src/modules/http_async_client/doc/http_async_client_admin.xml
+++ b/src/modules/http_async_client/doc/http_async_client_admin.xml
@@ -299,6 +299,11 @@ modparam("http_async_client", "tls_ca_path", 
"/etc/kamailio/ssl/ca/")
 
If defined to a non-zero value, TCP keepalive will be 
enabled on cURL connections.

+
+
+Requires libcurl >= 7.25.0
+
+   


Default value is 0 (disabled).
diff --git a/src/modules/http_async_client/http_multi.c 
b/src/modules/http_async_client/http_multi.c
index 43936a78de..948171b519 100644
--- a/src/modules/http_async_client/http_multi.c
+++ b/src/modules/http_async_client/http_multi.c
@@ -529,6 +529,7 @@ int new_request(str *query, http_m_params_t *query_params, 
http_multi_cbe_t cb,
 
 /* enable tcp keepalives for the handler */
if (cell->params.tcp_keepalive) {
+#ifdef CURLOPT_TCP_KEEPALIVE
LM_DBG("Enabling TCP keepalives\n");
curl_easy_setopt(cell->easy, CURLOPT_TCP_KEEPALIVE, 1L);

@@ -541,6 +542,9 @@ int new_request(str *query, http_m_params_t *query_params, 
http_multi_cbe_t cb,
curl_easy_setopt(cell->easy, CURLOPT_TCP_KEEPINTVL, 
cell->params.tcp_ka_interval);
LM_DBG("CURLOPT_TCP_KEEPINTERVAL set to %d\n", 
cell->params.tcp_ka_interval);
}
+#else
+   LM_DBG("tcp_keepalive configured, but installed cURL version 
doesn't include CURLOPT_TCP_KEEPINTERVAL.\n");
+#endif
}

 LM_DBG("Adding easy %p to multi %p (%.*s)\n", cell->easy, g->multi, 
query->len, query->s);


___
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] dmq: wait for a 2nd failed ping before deleting a node (#1840)

2019-02-07 Thread Federico Cabiddu
Merged #1840 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/1840#event-2124046795___
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] dmq: wait for a 2nd failed ping before deleting a node (#1840)

2019-02-07 Thread Federico Cabiddu
Mergin, 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/pull/1840#issuecomment-461418016___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:8ffcb5f7: dmq: wait for a 2nd failed ping before deleting a node

2019-02-07 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: 8ffcb5f7fee8223b4857135d3d64ac4414bf87a2
URL: 
https://github.com/kamailio/kamailio/commit/8ffcb5f7fee8223b4857135d3d64ac4414bf87a2

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2019-02-07T11:39:27+01:00

dmq: wait for a 2nd failed ping before deleting a node

---

Modified: src/modules/dmq/notification_peer.c

---

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

---

diff --git a/src/modules/dmq/notification_peer.c 
b/src/modules/dmq/notification_peer.c
index f6a3e8e478..769b0e327b 100644
--- a/src/modules/dmq/notification_peer.c
+++ b/src/modules/dmq/notification_peer.c
@@ -412,7 +412,9 @@ int extract_node_list(dmq_node_list_t *update_list, struct 
sip_msg *msg)
update_list->nodes = cur;
update_list->count++;
total_nodes++;
-   } else if(!ret->local && find->uri.params.s && ret->status != 
find->status) {
+   } else if(!ret->local && find->uri.params.s && 
+   ret->status != find->status && 
ret->status != DMQ_NODE_DISABLED) {
+   /* don't update the node if it is in ending state */
LM_DBG("updating status on %.*s from %d to %d\n", 
STR_FMT(_uri),
ret->status, find->status);
ret->status = find->status;
@@ -588,6 +590,8 @@ int notification_resp_callback_f(
 
LM_DBG("notification_callback_f triggered [%p %d %p]\n", msg, code, 
param);
if(code == 200) {
+   /* be sure that the node that answered is in active state */
+   update_dmq_node_status(node_list, node, DMQ_NODE_ACTIVE);
nodes_recv = extract_node_list(node_list, msg);
LM_DBG("received %d new or changed nodes\n", nodes_recv);
if(dmq_init_callback_done && !*dmq_init_callback_done) {
@@ -595,16 +599,21 @@ int notification_resp_callback_f(
run_init_callbacks();
}
} else if(code == 408) {
-   /* deleting node - the server did not respond */
-   LM_ERR("deleting server %.*s because of failed request\n",
-   STR_FMT(>orig_uri));
if(STR_EQ(node->orig_uri, dmq_notification_address)) {
LM_ERR("not deleting notification_peer\n");
-   update_dmq_node_status(node_list, node, 
DMQ_NODE_PENDING);
+   update_dmq_node_status(node_list, node, 
DMQ_NODE_PENDING);  
return 0;
}
-   ret = del_dmq_node(node_list, node);
-   LM_DBG("del_dmq_node returned %d\n", ret);
+   if (node->status == DMQ_NODE_DISABLED) {
+   /* deleting node - the server did not respond */
+   LM_ERR("deleting server %.*s because of failed 
request\n",
+   STR_FMT(>orig_uri));
+   ret = del_dmq_node(node_list, node);
+   LM_DBG("del_dmq_node returned %d\n", ret);
+   } else {
+   /* put the node in disabled state and wait for the next 
ping before deleting it */
+   update_dmq_node_status(node_list, node, 
DMQ_NODE_DISABLED);
+   }
}
return 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] dmq: wait for a 2nd failed ping before deleting a node (#1840)

2019-02-07 Thread Federico Cabiddu
I discovered the problem exactly because I wanted to fail quickly, having a 
global fr_timer of 5 s. 
IMHO the patch as it is doesn't affect the capability to fail quickly since a 
node is taken off the nodelist for message broadcasting immediately, except for 
the ping. I would say that it affects the recovery speed, since a two pings 
cycle is needed before a node is added back in case of a temporary failure.
A modparam can be added to enable this, along with the caveat in the doc that a 
race condition can happen due to the combination of fr_timer and dmq ping 
interval.

-- 
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/1840#issuecomment-461400838___
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] dmq: wait for a 2nd failed ping before deleting a node (#1840)

2019-02-07 Thread Federico Cabiddu
Definitely :)
Should I merge and backport this one?

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


[sr-dev] [kamailio/kamailio] dmq: wait for a 2nd failed ping before deleting a node (#1840)

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

 Type Of Change
- [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:
- [X] PR should be backported to stable branches
- [X] Tested changes locally
- [ ] Related to issue # (replace  with an open issue number)

 Description
I've recently being experiencing a loop in nodes removal/addition leading to 
"ghost nodes".
Suppose to have three servers A,B,C.
Server C goes down not cleanly, so DMQ doesn't notify the other nodes. Server A 
is the first to send its ping, with a nodelist including node C. After 
fr_timer, the transaction for the message to node C times out and the node is 
removed from node A nodelist.
Then node B sends its ping with a nodelist including node C (still alive for 
A), node A sees node C as a new node and adds it back to its nodelist. Now node 
B reaching fr_timer timeout removes node C, until next node's A ping, and so 
on. This does not occur if the delta between node A and node B pings is less 
than fr_timer.
What I propose here is that, upon a failed ping, the failing node is put in 
disabled state and we wait a 2nd failed ping before removing it from the 
nodelist. This should prevent dead nodes to come back.
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * dmq: wait for a 2nd failed ping before deleting a node

-- File Changes --

M src/modules/dmq/notification_peer.c (23)

-- Patch Links --

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


[sr-dev] git:5.1:f1c3c374: jsonrpcs: fix double free crash

2019-02-07 Thread Federico Cabiddu
Module: kamailio
Branch: 5.1
Commit: f1c3c3748a709c6c7cd1a6ff43a3d23ef97c1771
URL: 
https://github.com/kamailio/kamailio/commit/f1c3c3748a709c6c7cd1a6ff43a3d23ef97c1771

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2019-02-07T09:39:32+01:00

jsonrpcs: fix double free crash

(cherry picked from commit 9dc5cbaa4f078adee0a061885965494a9364e5d0)

---

Modified: src/modules/jsonrpcs/jsonrpcs_mod.c

---

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

---

diff --git a/src/modules/jsonrpcs/jsonrpcs_mod.c 
b/src/modules/jsonrpcs/jsonrpcs_mod.c
index ca614d55b6..178d0c3598 100644
--- a/src/modules/jsonrpcs/jsonrpcs_mod.c
+++ b/src/modules/jsonrpcs/jsonrpcs_mod.c
@@ -1299,7 +1299,6 @@ static int jsonrpc_dispatch(sip_msg_t* msg, char* s1, 
char* s2)
if (!ctx->reply_sent && !(ctx->flags_DELAYED_REPLY_F)) {
ret = jsonrpc_send(ctx);
}
-   srjson_DeleteDoc(ctx->jreq);
jsonrpc_clean_context(ctx);
if (ret < 0) return -1;
return 1;


___
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] jsonrpcs: fix double free crash (#1839)

2019-02-07 Thread Federico Cabiddu
Merged #1839 into master.

-- 
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1839#event-2123391668___
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:f247933a: jsonrpcs: fix double free crash

2019-02-07 Thread Federico Cabiddu
Module: kamailio
Branch: 5.2
Commit: f247933aac6ada6147ce83943cca87b24805e96f
URL: 
https://github.com/kamailio/kamailio/commit/f247933aac6ada6147ce83943cca87b24805e96f

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2019-02-07T09:39:04+01:00

jsonrpcs: fix double free crash

(cherry picked from commit 9dc5cbaa4f078adee0a061885965494a9364e5d0)

---

Modified: src/modules/jsonrpcs/jsonrpcs_mod.c

---

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

---

diff --git a/src/modules/jsonrpcs/jsonrpcs_mod.c 
b/src/modules/jsonrpcs/jsonrpcs_mod.c
index 8049779e55..a6c5616561 100644
--- a/src/modules/jsonrpcs/jsonrpcs_mod.c
+++ b/src/modules/jsonrpcs/jsonrpcs_mod.c
@@ -1297,7 +1297,6 @@ static int jsonrpc_dispatch(sip_msg_t* msg, char* s1, 
char* s2)
if (!ctx->reply_sent && !(ctx->flags_DELAYED_REPLY_F)) {
ret = jsonrpc_send(ctx);
}
-   srjson_DeleteDoc(ctx->jreq);
jsonrpc_clean_context(ctx);
if (ret < 0) return -1;
return 1;


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


[sr-dev] git:master:9dc5cbaa: jsonrpcs: fix double free crash

2019-02-07 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: 9dc5cbaa4f078adee0a061885965494a9364e5d0
URL: 
https://github.com/kamailio/kamailio/commit/9dc5cbaa4f078adee0a061885965494a9364e5d0

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2019-02-07T09:23:01+01:00

jsonrpcs: fix double free crash

---

Modified: src/modules/jsonrpcs/jsonrpcs_mod.c

---

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

---

diff --git a/src/modules/jsonrpcs/jsonrpcs_mod.c 
b/src/modules/jsonrpcs/jsonrpcs_mod.c
index 8049779e55..a6c5616561 100644
--- a/src/modules/jsonrpcs/jsonrpcs_mod.c
+++ b/src/modules/jsonrpcs/jsonrpcs_mod.c
@@ -1297,7 +1297,6 @@ static int jsonrpc_dispatch(sip_msg_t* msg, char* s1, 
char* s2)
if (!ctx->reply_sent && !(ctx->flags_DELAYED_REPLY_F)) {
ret = jsonrpc_send(ctx);
}
-   srjson_DeleteDoc(ctx->jreq);
jsonrpc_clean_context(ctx);
if (ret < 0) return -1;
return 1;


___
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] jsonrpcs: fix double free crash (#1839)

2019-02-07 Thread Federico Cabiddu
Yes, was added in 8e5742ff1657bdb2adce357fc6f1a2e04fd913c6.

On Thu, Feb 7, 2019 at 9:31 AM Daniel-Constantin Mierla <
notificati...@github.com> wrote:

> Was this added in a recent commit, right?
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> ,
> or mute the thread
> 
> .
> ___
> 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] jsonrpcs: fix double free crash (#1839)

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

 Type Of Change
- [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:
- [X] PR should be backported to stable branches
- [X] Tested changes locally
- [ ] Related to issue # (replace  with an open issue number)

 Description
srjson_DeleteDoc(ctx->jreq) is already called in jsonrpc_clean_context(ctx). 
Calling it twice causes a crash due to a double free attempt.
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * jsonrpcs: fix double free crash

-- File Changes --

M src/modules/jsonrpcs/jsonrpcs_mod.c (1)

-- Patch Links --

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


[sr-dev] git:master:5afe4863: http_async_client: add documentation for new TCP keepalive parameters

2019-02-06 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: 5afe486375ae1ec8d7e479e579d5cc898fa1bac5
URL: 
https://github.com/kamailio/kamailio/commit/5afe486375ae1ec8d7e479e579d5cc898fa1bac5

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2019-02-06T17:17:17+01:00

http_async_client: add documentation for new TCP keepalive parameters

---

Modified: src/modules/http_async_client/doc/http_async_client_admin.xml

---

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

---

diff --git a/src/modules/http_async_client/doc/http_async_client_admin.xml 
b/src/modules/http_async_client/doc/http_async_client_admin.xml
index 605964e268..73fdf32841 100644
--- a/src/modules/http_async_client/doc/http_async_client_admin.xml
+++ b/src/modules/http_async_client/doc/http_async_client_admin.xml
@@ -291,6 +291,63 @@ modparam("http_async_client", "tls_client_key", 
"/etc/kamailio/ssl/clientcert.ke
 ...
 modparam("http_async_client", "tls_ca_path", "/etc/kamailio/ssl/ca/")
 ...
+
+   
+   
+   
+   tcp_keepalive (integer)
+
+   If defined to a non-zero value, TCP keepalive will be 
enabled on cURL connections.
+   
+   
+   
+   Default value is 0 (disabled).
+   
+   
+   
+   Set tcp_keepalive parameter
+   
+...
+modparam("http_async_client", "tcp_keepalive", 1)
+...
+
+   
+   
+   
+   tcp_ka_idle (integer)
+
+   TCP keep-alive idle time wait value (in seconds).
+   
+   
+   
+   Default value is 0 (use cURL default value, 60s).
+   
+   
+   
+   Set tcp_ka_idle parameter
+   
+...
+modparam("http_async_client", "tcp_ka_idle", 30)
+...
+
+   
+   
+   
+   tcp_ka_interval (integer)
+
+   TCP keep-alive interval (in seconds).
+   
+   
+   
+   Default value is 0 (use cURL default value, 60s).
+   
+   
+   
+   Set tcp_ka_interval parameter
+   
+...
+modparam("http_async_client", "tcp_ka_interval", 120)
+...
 


@@ -397,6 +454,9 @@ xlog("L_INFO", "received reply for query $http_req_id\n");
username: sets the 
username to use for authenticated requests
password: sets the 
password to use for authenticated requests
suspend: if set to 0 it 
doesn't suspend the current transaction before performing the 
query
+   tcp_keepalive: enable TCP 
keepalive
+   tcp_ka_idle: set TCP 
keepalive idle time wait
+   tcp_ka_interval: set TCP 
keepalive interval


$http_req(key) variable usage


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


[sr-dev] git:master:a8e5f411: http_async_client: add parameters to enable/set tcp keepalive

2019-02-06 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: a8e5f411c4ab46b3c418533440e523d69a88aeb7
URL: 
https://github.com/kamailio/kamailio/commit/a8e5f411c4ab46b3c418533440e523d69a88aeb7

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2019-02-06T17:16:18+01:00

http_async_client: add parameters to enable/set tcp keepalive

---

Modified: src/modules/http_async_client/async_http.c
Modified: src/modules/http_async_client/async_http.h
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/a8e5f411c4ab46b3c418533440e523d69a88aeb7.diff
Patch: 
https://github.com/kamailio/kamailio/commit/a8e5f411c4ab46b3c418533440e523d69a88aeb7.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:18ef9da4: tsilo: fixed ts_append example in the doc

2019-01-28 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: 18ef9da4c029fefd5089aed484cd8f32ddb0fb17
URL: 
https://github.com/kamailio/kamailio/commit/18ef9da4c029fefd5089aed484cd8f32ddb0fb17

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2019-01-28T20:56:55+01:00

tsilo: fixed ts_append example in the doc

---

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

---

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

---

diff --git a/src/modules/tsilo/doc/tsilo_admin.xml 
b/src/modules/tsilo/doc/tsilo_admin.xml
index f1ab297da5..c294e7c282 100644
--- a/src/modules/tsilo/doc/tsilo_admin.xml
+++ b/src/modules/tsilo/doc/tsilo_admin.xml
@@ -178,7 +178,7 @@ if (is_method("INVITE")) {

 ...
 if (is_method("REGISTER")) {
-   ts_append("location", "$tU");
+   ts_append("location", "$tu");
 }
 ...
 


___
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:bb9661c5: tsilo: fixed ts_append example in the doc

2019-01-28 Thread Federico Cabiddu
Module: kamailio
Branch: 5.2
Commit: bb9661c595201ab6ce69e34e6084630be7faa307
URL: 
https://github.com/kamailio/kamailio/commit/bb9661c595201ab6ce69e34e6084630be7faa307

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2019-01-28T20:58:35+01:00

tsilo: fixed ts_append example in the doc

(cherry picked from commit 18ef9da4c029fefd5089aed484cd8f32ddb0fb17)

---

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

---

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

---

diff --git a/src/modules/tsilo/doc/tsilo_admin.xml 
b/src/modules/tsilo/doc/tsilo_admin.xml
index f1ab297da5..c294e7c282 100644
--- a/src/modules/tsilo/doc/tsilo_admin.xml
+++ b/src/modules/tsilo/doc/tsilo_admin.xml
@@ -178,7 +178,7 @@ if (is_method("INVITE")) {

 ...
 if (is_method("REGISTER")) {
-   ts_append("location", "$tU");
+   ts_append("location", "$tu");
 }
 ...
 


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


[sr-dev] git:5.1:f727b05a: tsilo: fixed ts_append example in the doc

2019-01-28 Thread Federico Cabiddu
Module: kamailio
Branch: 5.1
Commit: f727b05ad76c1b22ddba8b3aed311084c260c588
URL: 
https://github.com/kamailio/kamailio/commit/f727b05ad76c1b22ddba8b3aed311084c260c588

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2019-01-28T20:58:58+01:00

tsilo: fixed ts_append example in the doc

(cherry picked from commit 18ef9da4c029fefd5089aed484cd8f32ddb0fb17)

---

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

---

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

---

diff --git a/src/modules/tsilo/doc/tsilo_admin.xml 
b/src/modules/tsilo/doc/tsilo_admin.xml
index e6cfe9b155..7c79994d38 100644
--- a/src/modules/tsilo/doc/tsilo_admin.xml
+++ b/src/modules/tsilo/doc/tsilo_admin.xml
@@ -178,7 +178,7 @@ if (is_method("INVITE")) {

 ...
 if (is_method("REGISTER")) {
-   ts_append("location", "$tU");
+   ts_append("location", "$tu");
 }
 ...
 


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


[sr-dev] git:5.1:8a21170c: siptrace: don't calculate message source socket if already set

2019-01-17 Thread Federico Cabiddu
Module: kamailio
Branch: 5.1
Commit: 8a21170c3a5283b84e0ff3cbc6db8c72413dec05
URL: 
https://github.com/kamailio/kamailio/commit/8a21170c3a5283b84e0ff3cbc6db8c72413dec05

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2019-01-17T09:43:47+01:00

siptrace: don't calculate message source socket if already set

(cherry picked from commit 929a24f08aeef6b72999ac9b188ffeded40759a9)

---

Modified: src/modules/siptrace/siptrace.c

---

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

---

diff --git a/src/modules/siptrace/siptrace.c b/src/modules/siptrace/siptrace.c
index 035ace455b..1e26bc2131 100644
--- a/src/modules/siptrace/siptrace.c
+++ b/src/modules/siptrace/siptrace.c
@@ -1520,7 +1520,10 @@ int siptrace_net_data_send(sr_event_param_t *evp)
return -1;
 
new_dst = *nd->dst;
-   new_dst.send_sock = get_send_socket(0, >dst->to, nd->dst->proto);
+
+   if(new_dst.send_sock == 0) {
+   new_dst.send_sock = get_send_socket(0, >dst->to, 
nd->dst->proto);
+   }
 
memset(, 0, sizeof(siptrace_data_t));
 


___
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:b7193895: siptrace: don't calculate message source socket if already set

2019-01-17 Thread Federico Cabiddu
Module: kamailio
Branch: 5.2
Commit: b71938952e1fc7543fa5bf7ba2abed6e39167150
URL: 
https://github.com/kamailio/kamailio/commit/b71938952e1fc7543fa5bf7ba2abed6e39167150

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2019-01-17T09:43:29+01:00

siptrace: don't calculate message source socket if already set

(cherry picked from commit 929a24f08aeef6b72999ac9b188ffeded40759a9)

---

Modified: src/modules/siptrace/siptrace.c

---

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

---

diff --git a/src/modules/siptrace/siptrace.c b/src/modules/siptrace/siptrace.c
index 7de96b4b5d..521ff113ab 100644
--- a/src/modules/siptrace/siptrace.c
+++ b/src/modules/siptrace/siptrace.c
@@ -1492,7 +1492,10 @@ int siptrace_net_data_send(sr_event_param_t *evp)
return -1;
 
new_dst = *nd->dst;
-   new_dst.send_sock = get_send_socket(0, >dst->to, nd->dst->proto);
+
+   if(new_dst.send_sock == 0) {
+   new_dst.send_sock = get_send_socket(0, >dst->to, 
nd->dst->proto);
+   }
 
memset(, 0, sizeof(siptrace_data_t));
 


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


[sr-dev] git:master:929a24f0: siptrace: don't calculate message source socket if already set

2019-01-17 Thread Federico Cabiddu
Module: kamailio
Branch: master
Commit: 929a24f08aeef6b72999ac9b188ffeded40759a9
URL: 
https://github.com/kamailio/kamailio/commit/929a24f08aeef6b72999ac9b188ffeded40759a9

Author: Federico Cabiddu 
Committer: Federico Cabiddu 
Date: 2019-01-16T18:09:42+01:00

siptrace: don't calculate message source socket if already set

---

Modified: src/modules/siptrace/siptrace.c

---

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

---

diff --git a/src/modules/siptrace/siptrace.c b/src/modules/siptrace/siptrace.c
index 8957c22fab..05a6310f40 100644
--- a/src/modules/siptrace/siptrace.c
+++ b/src/modules/siptrace/siptrace.c
@@ -1493,7 +1493,10 @@ int siptrace_net_data_send(sr_event_param_t *evp)
return -1;
 
new_dst = *nd->dst;
-   new_dst.send_sock = get_send_socket(0, >dst->to, nd->dst->proto);
+
+   if(new_dst.send_sock == 0) {
+   new_dst.send_sock = get_send_socket(0, >dst->to, 
nd->dst->proto);
+   }
 
memset(, 0, sizeof(siptrace_data_t));
 


___
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: don't calculate message source socket if already set (#1810)

2019-01-17 Thread Federico Cabiddu
Merged #1810 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/1810#event-2079555129___
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: don't calculate message source socket if already set (#1810)

2019-01-16 Thread Federico Cabiddu
When trace_mode = 1, the source socket of an outgoing message can be retrieved 
from the payload passed in the callback of SREV_NET_DATA_SEND. Otherwise, if 
the socket has been manually forced (setting $fs, calling force_send_socket..), 
the information will be overwritten and the actual source socket of the 
outgoing message lost.
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * siptrace: siptrace: don't calculate message source socket if already set

-- File Changes --

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

-- Patch Links --

https://github.com/kamailio/kamailio/pull/1810.patch
https://github.com/kamailio/kamailio/pull/1810.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/1810
___
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] tsilo: add check for empty aor (#1802)

2019-01-10 Thread Federico Cabiddu
Merged #1802 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/1802#event-2065239829___
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] TSILO crashes kamailio on ts_store() (#1775)

2019-01-10 Thread Federico Cabiddu
Closed #1775 via #1802.

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


<    1   2   3   >