[sr-dev] git:master:ebd1c6c7: tm: cb_flags made unsigned for uac_req

2024-05-01 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: ebd1c6c75a1b832ce85d576aad134b99d47b5738
URL: 
https://github.com/kamailio/kamailio/commit/ebd1c6c75a1b832ce85d576aad134b99d47b5738

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-05-01T06:07:26+02:00

tm: cb_flags made unsigned for uac_req

---

Modified: src/modules/tm/uac.h

---

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

---

diff --git a/src/modules/tm/uac.h b/src/modules/tm/uac.h
index 59fa7f4e9ea..6fad3380cd8 100644
--- a/src/modules/tm/uac.h
+++ b/src/modules/tm/uac.h
@@ -47,7 +47,7 @@ typedef struct uac_req
str *ssock;
str *ssockname;
dlg_t *dialog;
-   int cb_flags;
+   unsigned int cb_flags;
transaction_cb *cb;
void *cbp;
str *callid;

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


[sr-dev] git:master:68624c2d: pv_headers: print also the new TMCB_LOCAL_REQUEST_DROP in debug function

2024-05-01 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 68624c2da093ab789d4e8d35df65ef1bce024bca
URL: 
https://github.com/kamailio/kamailio/commit/68624c2da093ab789d4e8d35df65ef1bce024bca

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-05-01T06:08:28+02:00

pv_headers: print also the new TMCB_LOCAL_REQUEST_DROP in debug function

---

Modified: src/modules/pv_headers/pv_headers.c

---

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

---

diff --git a/src/modules/pv_headers/pv_headers.c 
b/src/modules/pv_headers/pv_headers.c
index c6196a1f5f6..c6ffe70753a 100644
--- a/src/modules/pv_headers/pv_headers.c
+++ b/src/modules/pv_headers/pv_headers.c
@@ -479,6 +479,8 @@ static inline char *tm_type_to_string(int type)
return "TMCB_ON_BRANCH_FAILURE";
case TMCB_ON_BRANCH_FAILURE_RO:
return "TMCB_ON_BRANCH_FAILURE_RO";
+   case TMCB_LOCAL_REQUEST_DROP:
+   return "TMCB_LOCAL_REQUEST_DROP";
case TMCB_MAX:
return "TMCB_MAX";
}

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


[sr-dev] git:master:ee06666c: tm: free new buffer on drop for local requests

2024-05-01 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: ee0c43d96029315dae7618e10d381265a85a
URL: 
https://github.com/kamailio/kamailio/commit/ee0c43d96029315dae7618e10d381265a85a

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-05-01T05:28:18+02:00

tm: free new buffer on drop for local requests

- GH #3403

---

Modified: src/modules/tm/uac.c

---

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

---

diff --git a/src/modules/tm/uac.c b/src/modules/tm/uac.c
index 206f69ef59d..5559533e5fb 100644
--- a/src/modules/tm/uac.c
+++ b/src/modules/tm/uac.c
@@ -559,6 +559,7 @@ static inline int t_uac_prepare(
refresh_shortcuts =
t_run_local_req(, _len, uac_r, 
new_cell, request);
if(unlikely(refresh_shortcuts == E_DROP)) {
+   shm_free(buf);
ret = E_DROP;
goto error1;
}

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


[sr-dev] git:master:00aac8d4: uac: check if local requests are dropped and free the param

2024-05-01 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 00aac8d48370fac356eecff535835d918c631cc5
URL: 
https://github.com/kamailio/kamailio/commit/00aac8d48370fac356eecff535835d918c631cc5

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-05-01T07:00:58+02:00

uac: check if local requests are dropped and free the param

---

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

---

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

---

diff --git a/src/modules/uac/uac_reg.c b/src/modules/uac/uac_reg.c
index 4885f4d4023..bbe592ba04c 100644
--- a/src/modules/uac/uac_reg.c
+++ b/src/modules/uac/uac_reg.c
@@ -974,6 +974,10 @@ void uac_reg_tm_callback(struct cell *t, int type, struct 
tmcb_params *ps)
ri->l_uuid.len, ri->l_uuid.s);
goto error;
}
+   if(uac_r.cb_flags & TMCB_LOCAL_REQUEST_DROP) {
+   shm_free(uuid);
+   *ps->param = NULL;
+   }
 
ri->flags |= UAC_REG_AUTHSENT;
lock_release(ri->lock);
@@ -1130,6 +1134,9 @@ int uac_reg_send(reg_uac_t *reg, time_t tn)
reg->flags &= ~UAC_REG_ONGOING;
return -1;
}
+   if(uac_r.cb_flags & TMCB_LOCAL_REQUEST_DROP) {
+   shm_free(uuid);
+   }
return 0;
 }
 
diff --git a/src/modules/uac/uac_send.c b/src/modules/uac/uac_send.c
index c29e9b4b90e..f91a0c75b4f 100644
--- a/src/modules/uac/uac_send.c
+++ b/src/modules/uac/uac_send.c
@@ -794,6 +794,11 @@ void uac_send_tm_callback(struct cell *t, int type, struct 
tmcb_params *ps)
LM_ERR("failed to send request with authentication\n");
goto error;
}
+   if(uac_r.cb_flags & TMCB_LOCAL_REQUEST_DROP) {
+   shm_free(tp);
+   *ps->param = NULL;
+   tp = NULL;
+   }
 
if(tp->evroute != 0) {
return;
@@ -871,6 +876,10 @@ int uac_req_send(void)
shm_free(tp);
return -1;
}
+   if(uac_r.cb_flags & TMCB_LOCAL_REQUEST_DROP) {
+   if(tp != NULL)
+   shm_free(tp);
+   }
return 1;
 }
 

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


[sr-dev] git:master:f5da773c: tm: cb flag to mark local uac on request drop

2024-05-01 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: f5da773c5fa29edbf9d0e65a83a62f495928ddec
URL: 
https://github.com/kamailio/kamailio/commit/f5da773c5fa29edbf9d0e65a83a62f495928ddec

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-05-01T05:57:46+02:00

tm: cb flag to mark local uac on request drop

---

Modified: src/modules/tm/t_hooks.h
Modified: src/modules/tm/uac.c

---

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

---

diff --git a/src/modules/tm/t_hooks.h b/src/modules/tm/t_hooks.h
index aa566cb35d1..cdb657bad64 100644
--- a/src/modules/tm/t_hooks.h
+++ b/src/modules/tm/t_hooks.h
@@ -59,7 +59,8 @@ struct cell;
 #define TMCB_RESPONSE_SENT_N 23
 #define TMCB_ON_BRANCH_FAILURE_RO_N 24
 #define TMCB_ON_BRANCH_FAILURE_N 25
-#define TMCB_MAX_N 25
+#define TMCB_LOCAL_REQUEST_DROP_N 26
+#define TMCB_MAX_N 26
 
 
 #define TMCB_REQUEST_IN (1 << TMCB_REQUEST_IN_N)
@@ -88,6 +89,7 @@ struct cell;
 #define TMCB_RESPONSE_SENT (1 << TMCB_RESPONSE_SENT_N)
 #define TMCB_ON_BRANCH_FAILURE (1 << TMCB_ON_BRANCH_FAILURE_N)
 #define TMCB_ON_BRANCH_FAILURE_RO (1 << TMCB_ON_BRANCH_FAILURE_RO_N)
+#define TMCB_LOCAL_REQUEST_DROP (1 << TMCB_LOCAL_REQUEST_DROP_N)
 #define TMCB_MAX ((1 << (TMCB_MAX_N + 1)) - 1)
 
 
diff --git a/src/modules/tm/uac.c b/src/modules/tm/uac.c
index 5559533e5fb..5384d826dd8 100644
--- a/src/modules/tm/uac.c
+++ b/src/modules/tm/uac.c
@@ -680,6 +680,7 @@ int prepare_req_within(uac_req_t *uac_r, struct retr_buf 
**dst_req)
ret = t_uac_prepare(uac_r, dst_req, 0);
 
if(unlikely(ret < 0 && ret == E_DROP)) {
+   uac_r->cb_flags |= TMCB_LOCAL_REQUEST_DROP;
ret = 0;
}
 
@@ -775,6 +776,7 @@ int t_uac_with_ids(
 
if(ret < 0) {
if(unlikely(ret == E_DROP)) {
+   uac_r->cb_flags |= TMCB_LOCAL_REQUEST_DROP;
ret = 0;
}
return ret;

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


[sr-dev] git:master:d12fc310: presence: check if the local notify was dropped in event route

2024-05-01 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: d12fc31056cb37aac347ec05f9ada7bafa5f52de
URL: 
https://github.com/kamailio/kamailio/commit/d12fc31056cb37aac347ec05f9ada7bafa5f52de

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-05-01T06:20:43+02:00

presence: check if the local notify was dropped in event route

- free tm cb parameter on drop
- related to GH #3403

---

Modified: src/modules/presence/notify.c

---

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

---

diff --git a/src/modules/presence/notify.c b/src/modules/presence/notify.c
index 4c9dece1a39..9a8af778c04 100644
--- a/src/modules/presence/notify.c
+++ b/src/modules/presence/notify.c
@@ -1736,6 +1736,10 @@ int send_notify_request(
shm_free(cb_param);
goto error;
}
+   if(uac_r.cb_flags & TMCB_LOCAL_REQUEST_DROP) {
+   shm_free(cb_param);
+   goto done;
+   }
 
LM_GEN2(pres_local_log_facility, pres_local_log_level,
"NOTIFY %.*s via %.*s on behalf of %.*s for event %.*s 
: %.*s\n",
@@ -1744,6 +1748,7 @@ int send_notify_request(
subs->event->name.len, subs->event->name.s, 
subs->callid.len,
subs->callid.s);
 
+done:
ps_free_tm_dlg(td);
 
if(str_hdr.s)

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


[sr-dev] Re: Enquiry about N5 interface implementation

2024-05-01 Thread Daniel-Constantin Mierla via sr-dev
Hello,

you have to replace the Rx interface with N5, which is not a dedicated
module, but you have to implement it in the config file. You can use
http_client for example to interact with PCF from Kamailio, and
eventually nghttp2 if you expect some callbacks/notifications to be
returned to Kamailio. Alternatively, you can use embedded python3 or Lua
for such purposes.

To deal with json, the jansson module is a good option in Kamailio, or,
again, embedded interpreters could be the alternative.

The demo was done on TU Berlin AV testbed running development version of
Kamailio, their configs are specific to their infrastructure and
additional components, probably just not going to be simply published.
But everything on Kamailio was done with the stock/public git master branch.

As for a starting point, Kamailio has sample configs for VoLTE, on its
git repo (misc/examples/) or you can find some tutorials by various
people on the web. Follow the Rx related functions in those configs and
replace with N5.

Cheers,
Daniel

On 30.04.24 07:00, Viabhav Bansal via sr-dev wrote:
> Hey there!
>
> I hope the Kamailio team is physically as well as mentally healthy and
> thriving towards progressive development.
> I am a part of a team which deals in development of converged 4G and
> 5G networks. 
> We have been diving deep into Open5GS 5G core and use Kamailio as our
> SIP server.
> However, we are trying to successfully implement VoNR UE registration
> as well as calling, and facing challenges in that area.
> I recently saw the VoNR as well as SMSoNR demonstration which the
> Kamailio team performed and was massively impressed by it! I would
> like to know when will the N5 SBI update will be rolling out to the
> public so that we can conduct our testing as well.
>
> Hoping for a timely response and update,
> Thanks and regards,
> Vaibhav.
>
> ___
> Kamailio (SER) - Development Mailing List
> To unsubscribe send an email to sr-dev-le...@lists.kamailio.org

-- 
Daniel-Constantin Mierla (@ asipto.com)
twitter.com/miconda -- linkedin.com/in/miconda
Kamailio Consultancy, Training and Development Services -- asipto.com
___
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org


[sr-dev] git:master:60d2ab64: ims_ipsec_pcscf: cascade on options to get the uri for fill_contact()

2024-04-30 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 60d2ab6464657abf38136a771c297c6f5536e27a
URL: 
https://github.com/kamailio/kamailio/commit/60d2ab6464657abf38136a771c297c6f5536e27a

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-30T10:19:35+02:00

ims_ipsec_pcscf: cascade on options to get the uri for fill_contact()

---

Modified: src/modules/ims_ipsec_pcscf/cmd.c

---

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

---

diff --git a/src/modules/ims_ipsec_pcscf/cmd.c 
b/src/modules/ims_ipsec_pcscf/cmd.c
index b5c009dfcf8..05079834252 100644
--- a/src/modules/ims_ipsec_pcscf/cmd.c
+++ b/src/modules/ims_ipsec_pcscf/cmd.c
@@ -187,7 +187,7 @@ static int fill_contact(
if(m->first_line.type == SIP_REQUEST) {
char *alias_start;
struct sip_uri uri;
-   str suri;
+   str suri = STR_NULL;
 
memset(, 0, sizeof(struct sip_uri));
 
@@ -196,17 +196,20 @@ static int fill_contact(
suri.len = ruri->len;
LM_DBG("using param r-uri for contact filling: %.*s\n", 
suri.len,
suri.s);
-   } else if((sflags & IPSEC_DSTADDR_SEARCH) && m->dst_uri.s != 
NULL
- && m->dst_uri.len > 0) {
+   }
+   if((sflags & IPSEC_DSTADDR_SEARCH) && suri.s == NULL
+   && m->dst_uri.s != NULL && m->dst_uri.len > 0) {
suri = m->dst_uri;
LM_DBG("using dst uri for contact filling: %.*s\n", 
suri.len,
suri.s);
-   } else if((sflags & IPSEC_RURIADDR_SEARCH) && m->new_uri.s != 
NULL
- && m->new_uri.len > 0) {
+   }
+   if((sflags & IPSEC_RURIADDR_SEARCH) && suri.s == NULL
+   && m->new_uri.s != NULL && m->new_uri.len > 0) {
suri = m->new_uri;
LM_DBG("using new r-uri for contact filling: %.*s\n", 
suri.len,
suri.s);
-   } else {
+   }
+   if(suri.s == NULL) {
suri = m->first_line.u.request.uri;
LM_DBG("using original uri for contact filling: 
%.*s\n", suri.len,
suri.s);

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


[sr-dev] Re: [kamailio/kamailio] usrloc: delete location_attrs in db_only mode on delete_urecord (PR #3827)

2024-04-29 Thread Daniel-Constantin Mierla via sr-dev
Thanks, looks ok imo.

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

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


[sr-dev] Re: [kamailio/kamailio] ims_registrar_scscf: fix uninitialized access of memory, minor refactors (PR #3787)

2024-04-29 Thread Daniel-Constantin Mierla via sr-dev
Looks ok for merging, imo.

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

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


[sr-dev] git:master:48dab490: ims_ipsec_pcscf: handle tls for replies

2024-04-29 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 48dab490965fa7f2f7200d95edd7dbb1407b2536
URL: 
https://github.com/kamailio/kamailio/commit/48dab490965fa7f2f7200d95edd7dbb1407b2536

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-29T10:08:29+02:00

ims_ipsec_pcscf: handle tls for replies

---

Modified: src/modules/ims_ipsec_pcscf/cmd.c

---

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

---

diff --git a/src/modules/ims_ipsec_pcscf/cmd.c 
b/src/modules/ims_ipsec_pcscf/cmd.c
index b1e36ae2e24..b5c009dfcf8 100644
--- a/src/modules/ims_ipsec_pcscf/cmd.c
+++ b/src/modules/ims_ipsec_pcscf/cmd.c
@@ -1053,13 +1053,15 @@ int ipsec_forward(struct sip_msg *m, udomain_t *d, int 
_cflags)
}
 
if(m->first_line.type == SIP_REPLY) {
+   /* reply handling */
if(_cflags & IPSEC_FORWARD_USEVIA) {
+   /* req - corresponding request from transaction */
dst_proto = vb ? vb->proto : req->rcv.proto;
 
// As per ETSI TS 133 203 V11.2.0, 7.1 Security 
association parameters
// https://tools.ietf.org/html/rfc3261#section-18
// From Reply and TCP send via the same ports Request 
was recevied.
-   if(dst_proto == PROTO_TCP) {
+   if(dst_proto == PROTO_TCP || dst_proto == PROTO_TLS) {
src_port = req->rcv.dst_port;
dst_port = req->rcv.src_port;
} else {
@@ -1073,25 +1075,34 @@ int ipsec_forward(struct sip_msg *m, udomain_t *d, int 
_cflags)
}
}
} else {
-   // for Reply get the dest proto from the received 
request
+   // dest proto from the corresponding request from 
transaction
dst_proto = req->rcv.proto;
-   // for Reply and TCP sends from P-CSCF server port, for 
Reply and UDP sends from P-CSCF client port
-   src_port = dst_proto == PROTO_TCP ? s->port_ps : 
s->port_pc;
+   if(dst_proto == PROTO_TCP || dst_proto == PROTO_TLS) {
+   // for TCP/TLS send from P-CSCF server port
+   src_port = s->port_ps;
 
-   // for Reply and TCP sends to UE client port, for Reply 
and UDP sends to UE server port
-   dst_port = dst_proto == PROTO_TCP ? s->port_uc : 
s->port_us;
+   // for TCP/TLS send to UE client port
+   dst_port = s->port_uc;
+   } else {
+   // for UDP send from P-CSCF client port
+   src_port = s->port_pc;
 
-   // Check send socket
+   // for UDP send to UE server port
+   dst_port = s->port_us;
+   }
+   // find send socket
client_sock =
grep_sock_info(via_host.af == AF_INET ? 
_listen_addr

  : _listen_addr6,
src_port, dst_proto);
if(!client_sock) {
+   /* fallback: P-CSCF client port to UE server 
port */
src_port = s->port_pc;
dst_port = s->port_us;
}
}
} else {
+   /* request handling */
if(_cflags & IPSEC_FORWARD_USEVIA) {
dst_proto = ims_ipsec_get_forward_proto(m);
} else {

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


[sr-dev] git:master:575b17d2: ims_ipsec_pcscf: docs updated for ipsec_forward() flags

2024-04-29 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 575b17d23cd5fa060f775bc56b42c735048bc849
URL: 
https://github.com/kamailio/kamailio/commit/575b17d23cd5fa060f775bc56b42c735048bc849

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-29T06:46:56+02:00

ims_ipsec_pcscf: docs updated for ipsec_forward() flags

---

Modified: src/modules/ims_ipsec_pcscf/doc/ims_ipsec_pcscf_admin.xml

---

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

---

diff --git a/src/modules/ims_ipsec_pcscf/doc/ims_ipsec_pcscf_admin.xml 
b/src/modules/ims_ipsec_pcscf/doc/ims_ipsec_pcscf_admin.xml
index ff65668e6e1..ee58f16fb63 100644
--- a/src/modules/ims_ipsec_pcscf/doc/ims_ipsec_pcscf_admin.xml
+++ b/src/modules/ims_ipsec_pcscf/doc/ims_ipsec_pcscf_admin.xml
@@ -284,7 +284,7 @@ ipsec_create("location", "1");
  

  
- 0x01 (1) - set force socket for 
request messages. Useful for ipsec and TCP.
+ 0x01 (1) - set force 
socket for request messages. Useful for ipsec and TCP/TLS.
  


@@ -316,17 +316,19 @@ ipsec_create("location", "1");


  
- 0x40 (64) - use user 
equipment client port as target for TCP requests.
+ 0x40 (64) - use user 
equipment client port as target for TCP/TLS requests
+ (try to reuse the UE client connection).
  


  
- 0x80 (128) - set 
transport parameter in the new dst uri for TCP requests.
+ 0x80 (128) - set 
transport parameter in the new dst uri for TCP/TLS requests.
  


  
- 0x100 (256) - use Via 
attributes (port and protocol) for routing UDP reply.
+ 0x100 (256) - use Via 
attributes (port and protocol) for routing UDP reply,
+ and protocol from next hop address for 
request (otherwise it taken from saved contact).
  



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


[sr-dev] git:master:ab261540: ims_ipsec_pcscf: decouple IPSEC_FORWARD_USEVIA and IPSEC_TCPPORT_UEC for requests

2024-04-29 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: ab261540d656ed456bac8876f77f940457a9baf6
URL: 
https://github.com/kamailio/kamailio/commit/ab261540d656ed456bac8876f77f940457a9baf6

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-29T06:32:07+02:00

ims_ipsec_pcscf: decouple IPSEC_FORWARD_USEVIA and IPSEC_TCPPORT_UEC for 
requests

- both flags should be avaible for use at the same time in
  ipsec_forward()
- for request IPSEC_FORWARD_USEVIA gets the protocol from the next hop
  address

---

Modified: src/modules/ims_ipsec_pcscf/cmd.c

---

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

---

diff --git a/src/modules/ims_ipsec_pcscf/cmd.c 
b/src/modules/ims_ipsec_pcscf/cmd.c
index b5a598b44ba..fff9def48a2 100644
--- a/src/modules/ims_ipsec_pcscf/cmd.c
+++ b/src/modules/ims_ipsec_pcscf/cmd.c
@@ -942,6 +942,37 @@ int ipsec_create(struct sip_msg *m, udomain_t *d, int 
_cflags)
return ret;
 }
 
+/**
+ *
+ */
+int ims_ipsec_get_forward_proto(sip_msg_t *msg)
+{
+   struct sip_uri parsed_uri;
+   str uri;
+
+   if(msg == NULL) {
+   LM_ERR("no message structure - fallback to UDP\n");
+   return PROTO_UDP;
+   }
+
+   if(msg->dst_uri.s != NULL && msg->dst_uri.len > 0) {
+   uri = msg->dst_uri;
+   } else {
+   if(msg->new_uri.s != NULL && msg->new_uri.len > 0) {
+   uri = msg->new_uri;
+   } else {
+   uri = msg->first_line.u.request.uri;
+   }
+   }
+   if(parse_uri(uri.s, uri.len, _uri) != 0) {
+   LM_ERR("failed to parse next hop uri [%.*s]\n", uri.len, uri.s);
+   return PROTO_UDP;
+   }
+   if(parsed_uri.proto == PROTO_NONE || parsed_uri.proto == PROTO_OTHER) {
+   return PROTO_UDP;
+   }
+   return parsed_uri.proto;
+}
 
 int ipsec_forward(struct sip_msg *m, udomain_t *d, int _cflags)
 {
@@ -1061,43 +1092,24 @@ int ipsec_forward(struct sip_msg *m, udomain_t *d, int 
_cflags)
}
} else {
if(_cflags & IPSEC_FORWARD_USEVIA) {
-   if(req->first_line.u.request.method_value == 
METHOD_REGISTER) {
-   // for Request get the dest proto from the 
saved contact
-   dst_proto = pcontact->received_proto;
-   } else {
-   if(m->dst_uri.s != NULL
-   && strstr(m->dst_uri.s, 
";transport=tcp") != NULL) {
-   dst_proto = PROTO_TCP;
-   } else if(m->dst_uri.s != NULL
- && strstr(m->dst_uri.s, 
";transport=tls") != NULL) {
-   dst_proto = PROTO_TLS;
-   } else {
-   dst_proto = m->rcv.proto;
-   }
-   }
-
-   // for Request sends from P-CSCF client port
-   src_port = s->port_pc;
-   // for Request sends to UE server port
-   dst_port = s->port_us;
+   dst_proto = ims_ipsec_get_forward_proto(m);
} else {
-   // for Request get the dest proto from the saved contact
dst_proto = pcontact->received_proto;
+   }
+   if((_cflags & IPSEC_TCPPORT_UEC)
+   && ((dst_proto == PROTO_TCP) || (dst_proto == 
PROTO_TLS))) {
+   // TCP/TLS send from P-CSCF server port, UDP sends from 
P-CSCF client port
+   src_port = s->port_ps;
 
-   if(_cflags & IPSEC_TCPPORT_UEC) {
-   // for Request and TCP sends from P-CSCF server 
port, for Request and UDP sends from P-CSCF client port
-   src_port = dst_proto == PROTO_TCP ? s->port_ps 
: s->port_pc;
-
-   // for Request and TCP sends to UE client port, 
for Request and UDP sends to UE server port
-   dst_port = dst_proto == PROTO_TCP ? s->port_uc 
: s->port_us;
+   // for TCP/TLS sends to UE client port, for UDP sends 
to UE server port
+   dst_port = s->port_uc;
 
-   } else {
-   // for Request sends from P-CSCF client port
-   src_port = s->port_pc;
+   } else {
+

[sr-dev] git:master:f7f93828: ims_ipsec_pcscf: updated comments for ipsec_forward() flags

2024-04-29 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: f7f93828993b5975dfe5f26ad63ba6c489aa69f7
URL: 
https://github.com/kamailio/kamailio/commit/f7f93828993b5975dfe5f26ad63ba6c489aa69f7

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-29T06:49:47+02:00

ims_ipsec_pcscf: updated comments for ipsec_forward() flags

---

Modified: src/modules/ims_ipsec_pcscf/cmd.c

---

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

---

diff --git a/src/modules/ims_ipsec_pcscf/cmd.c 
b/src/modules/ims_ipsec_pcscf/cmd.c
index fff9def48a2..b1e36ae2e24 100644
--- a/src/modules/ims_ipsec_pcscf/cmd.c
+++ b/src/modules/ims_ipsec_pcscf/cmd.c
@@ -88,11 +88,12 @@ extern struct tm_binds tmb;
 #define IPSEC_NOALIAS_SEARCH (1 << 4)
 /* if set - do not reset dst uri for IPsec forward */
 #define IPSEC_NODSTURI_RESET (1 << 5)
-/* if set - use user equipment client port as target for requests over TCP */
+/* if set - use user equipment client port as target for requests over TCP/TLS 
*/
 #define IPSEC_TCPPORT_UEC (1 << 6)
-/* if set - build new dst uri with transport parameter for TCP */
+/* if set - build new dst uri with transport parameter for TCP/TLS */
 #define IPSEC_SETDSTURI_FULL (1 << 7)
-/* if set - use Via attributes for routing reply */
+/* if set - use Via attributes for routing reply
+ * and protocol from next hop address for request */
 #define IPSEC_FORWARD_USEVIA (1 << 8)
 /* if set - try TCP if corresponding UDP socket is not found */
 #define IPSEC_FORWARD_TRYTCP (1 << 9)

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


[sr-dev] git: new commits in branch 5.7

2024-04-28 Thread Daniel-Constantin Mierla via sr-dev
- URL:  
https://github.com/kamailio/kamailio/commit/fb685a8bd5d5e34edde44614f313cbb5c27b3c25
Author: Daniel-Constantin Mierla 
Date:   2024-04-29T05:02:09+02:00

jansson: declare variables at the beginning of blocks

(cherry picked from commit a2bff77c3f7bfee8dae90c3ef20522d480f2e14d)

- URL:  
https://github.com/kamailio/kamailio/commit/2758754f2bb427bff06b2a6e82175870eced336d
Author: Xenofon Karamanos 
Date:   2024-04-29T05:05:31+02:00

core: properly handle drop() action for kemi engines

- GH #3718

(cherry picked from commit 82593a09f8ef6d53e7e88238c057bbcdd9ab287b)

- URL:  
https://github.com/kamailio/kamailio/commit/4b88c5bf30054739f476388523e8d2b2ce84b040
Author: Daniel-Constantin Mierla 
Date:   2024-04-29T05:08:18+02:00

core: rthreads - init return variable

(cherry picked from commit 181c602616e13323786335e8e28f182871aa5e9b)
(cherry picked from commit 0747c18d5c4db2e7e8408ad2c7efa120ec76523e)

- URL:  
https://github.com/kamailio/kamailio/commit/02b877493cd6ffc6cfdf7da114d255d1f4710917
Author: Daniel-Constantin Mierla 
Date:   2024-04-29T05:08:56+02:00

core: ppcfg - jump to end when defexp eval does not get a str val

(cherry picked from commit daac0bdb88f6f732bda7c683af45b90f87fdb7c9)
(cherry picked from commit 4c78a564c5ad8662014cf686428a37238a6d8476)

- URL:  
https://github.com/kamailio/kamailio/commit/cea618ede170bd02bb7ccd478a4f1a7a6c052cdf
Author: Daniel-Constantin Mierla 
Date:   2024-04-29T05:09:18+02:00

core: select - handle ws and wss inside select_ip_port()

(cherry picked from commit d8e0942c9e83c8cad7c182bf41c156ba35bf24d2)
(cherry picked from commit 089bf63178039b13cde0beccfacab1536af76179)

- URL:  
https://github.com/kamailio/kamailio/commit/92d3b52ca4595a7e4d8ab003951191c387d32eee
Author: Daniel-Constantin Mierla 
Date:   2024-04-29T05:09:31+02:00

core: parser rr - check for rr value before serializing

(cherry picked from commit 6ee26a3ae3293aaeb4507d5d0b16ad31173cc39a)
(cherry picked from commit 4626cb7f0e0b273153ce0004900a92553783a893)

- URL:  
https://github.com/kamailio/kamailio/commit/d12613c8e357a8dc882eefe2d84fedd1df97a415
Author: Daniel-Constantin Mierla 
Date:   2024-04-29T05:10:14+02:00

ctl: reset log prefix on reading ctl traffic

- it may be previously set in process by some event route

(cherry picked from commit 5b8b2717ee2f57da932132683b27eb33cea3fd59)
(cherry picked from commit d45c78eeeaea6a9fc9dcb927436f834392d9d7c9)

- URL:  
https://github.com/kamailio/kamailio/commit/f225edd2fdc87b0ebf72e15d8a11255ddd86b872
Author: Daniel-Constantin Mierla 
Date:   2024-04-29T05:12:20+02:00

acc: more log messages of failure arsing extra acc string

(cherry picked from commit 04a73ace6572dd5c95a8f50b39b2ce712f7ebe84)
(cherry picked from commit 91b0962679092f28abb5022d1505372356460f7d)

- URL:  
https://github.com/kamailio/kamailio/commit/c90b736a098e1d76224c1e97c2a71423efa5cf98
Author: Elena-Ramona Modroiu 
Date:   2024-04-29T05:13:20+02:00

core: resolve/create_srv_pref_list() - insert at correct position in list

(cherry picked from commit f35cf8904119dcf582ea2451648de5fef095466b)
(cherry picked from commit dbf9208f3a402844c9981fb7ed09493a1338dfdd)

- URL:  
https://github.com/kamailio/kamailio/commit/a82d1575d9ac7820e526741fc169033767a10ca5
Author: Elena-Ramona Modroiu 
Date:   2024-04-29T05:13:27+02:00

corex: fix conditions for dns_cache modparam srv attributes

(cherry picked from commit 8114b2016d032484edafe4edd04fb02d52cfd058)
(cherry picked from commit 3f44cabcfc0abc83ae1971ac74fbb0bd36829ce4)

- URL:  
https://github.com/kamailio/kamailio/commit/edbcfff018145372fd6fa5d1777912f0f84d8ea7
Author: Daniel-Constantin Mierla 
Date:   2024-04-29T05:13:56+02:00

smsops: reformat module exports structures

(cherry picked from commit 9848d43cb367d6901a0b8c727759feb8a8fad930)
(cherry picked from commit b21a7aaa467f2b76a52308557657c65274e34087)

- URL:  
https://github.com/kamailio/kamailio/commit/b3935051a8112b1a2152d8eb65da29b1941735df
Author: Daniel-Constantin Mierla 
Date:   2024-04-29T05:14:04+02:00

smsops: short reference section about variables

(cherry picked from commit 9a94930ae1168d5df79e3dc1414841cdf23a2eba)
(cherry picked from commit c0c8ee05ab25256b9154d2056ee04b07f3f2290a)

- URL:  
https://github.com/kamailio/kamailio/commit/f1969ecaacd47eb03ef6b54d71c70370d9e39150
Author: Daniel-Constantin Mierla 
Date:   2024-04-29T05:14:11+02:00

blst: reformat exported structures

(cherry picked from commit e39557c96d2f419184c826d779f1a3309acc4269)
(cherry picked from commit e394a05152b29d4009c9cb963bced72526c7651b)

- URL:  
https://github.com/kamailio/kamailio/commit/8bb69fd5f5911098a3e567887ad2a3a2820ae5e6
Author: Daniel-Constantin Mierla 
Date:   2024-04-29T05:14:51+02:00

sdpops: reformat the codecs map

(cherry picked from commit 359a442e14a156b0bcf60dc5b2580cbc57924e34)
(cherry picked from commit 855c76780c4399d6d9881ce3c525a7df56e111c4)

- URL:  
https://github.com/kamailio/kamailio/commit/96ff473191bb24be90e2dde82fccb5ce06698baf
Author: vijay kumar 
Date

[sr-dev] git:master:85589470: ims_registrar_scscf: init variable to fix analyzer warning

2024-04-28 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 8558947034f16b162c15eda39d18f5f5df4ef562
URL: 
https://github.com/kamailio/kamailio/commit/8558947034f16b162c15eda39d18f5f5df4ef562

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-28T23:29:22+02:00

ims_registrar_scscf: init variable to fix analyzer warning

---

Modified: src/modules/ims_registrar_scscf/lookup.c

---

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

---

diff --git a/src/modules/ims_registrar_scscf/lookup.c 
b/src/modules/ims_registrar_scscf/lookup.c
index 836ce9ca11b..99707dae0ce 100644
--- a/src/modules/ims_registrar_scscf/lookup.c
+++ b/src/modules/ims_registrar_scscf/lookup.c
@@ -334,7 +334,7 @@ int term_impu_has_contact(struct sip_msg *_m, udomain_t 
*_d, char *_s)
str aor, uri;
ucontact_t *ptr = 0;
int res;
-   int ret;
+   int ret = -1;
 
impu_contact_t *impucontact;
 

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


[sr-dev] Re: [kamailio/kamailio] utils/kamctl: make root host/port configurable (PR #3830)

2024-04-28 Thread Daniel-Constantin Mierla via sr-dev
Merged #3830 into master.

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

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


[sr-dev] Re: [kamailio/kamailio] modules/statsd: ensure statsd failures do not stop execution (PR #3819)

2024-04-28 Thread Daniel-Constantin Mierla via sr-dev
Merged #3819 into master.

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

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


[sr-dev] git:master:de23dc10: utils/kamctl: make root host/port configurable

2024-04-28 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: de23dc1035e4b885f45bc4150d282c26b294db64
URL: 
https://github.com/kamailio/kamailio/commit/de23dc1035e4b885f45bc4150d282c26b294db64

Author: Tyler Moore 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-28T23:14:16+02:00

utils/kamctl: make root host/port configurable

- add support for configuring the DB root host/port connection
  parameters separate from the ro/rw settings. This allows the
  user to authenticate over the specific socket configured
  (tcp/udp/unix) for each connection type (root/ro/rw).
- note that support is added for mysql and postgresql connections.
  no changes to the other DB engine connection parameters.

---

Modified: utils/kamctl/kamctlrc
Modified: utils/kamctl/kamdbctl.base
Modified: utils/kamctl/kamdbctl.mysql
Modified: utils/kamctl/kamdbctl.pgsql

---

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

---

diff --git a/utils/kamctl/kamctlrc b/utils/kamctl/kamctlrc
index ce0bd9d93bc..67af483d9c6 100644
--- a/utils/kamctl/kamctlrc
+++ b/utils/kamctl/kamctlrc
@@ -44,6 +44,14 @@
 ## database access host (from where is kamctl used)
 # DBACCESSHOST=192.168.0.1
 
+## database host for super user (useful for specifying a local socket or 
virtual hostname)
+# defaults to value of DBHOST when not set
+# DBROOTHOST="localhost"
+
+## database port for super user (on some DB specifying the port will force TCP 
connections)
+# default value will depend on client DB tool
+# DBROOTPORT=""
+
 ## database super user (for ORACLE this is 'scheme-creator' user)
 # DBROOTUSER="root"
 
diff --git a/utils/kamctl/kamdbctl.base b/utils/kamctl/kamdbctl.base
index 4a3beccaef4..5579c9e8373 100644
--- a/utils/kamctl/kamdbctl.base
+++ b/utils/kamctl/kamdbctl.base
@@ -20,6 +20,9 @@ DBROUSER=${DBROUSER:-kamailioro}
 # password for read-only user
 DBROPW=${DBROPW:-kamailioro}
 
+# address of database server for root connections
+DBROOTHOST=${DBROOTHOST:-$DBHOST}
+
 # user name column
 USERCOL=${USERCOL:-username}
 
diff --git a/utils/kamctl/kamdbctl.mysql b/utils/kamctl/kamdbctl.mysql
index 81a730bbe65..49915dc7954 100644
--- a/utils/kamctl/kamdbctl.mysql
+++ b/utils/kamctl/kamdbctl.mysql
@@ -27,23 +27,22 @@ fi
 # config vars
 #
 
-# full privileges MySQL user
-if [ -z "$DBROOTUSER" ]; then
-   DBROOTUSER="root"
-fi
-
 # Set DBROOTPW in kamctlrc or via next line to set the database
 # root password if you want to run this script without any user prompt.
 # This is unsafe, but useful e.g. for automatic testing.
 #DBROOTPW=""
 
-
-if [ -z "$DBPORT" ] ; then
-   CMD="mysql -h $DBHOST -u$DBROOTUSER "
-   DUMP_CMD="mysqldump -h $DBHOST -u$DBROOTUSER -c -t "
-else
-   CMD="mysql -h $DBHOST -P $DBPORT -u$DBROOTUSER "
-   DUMP_CMD="mysqldump -h $DBHOST -P $DBPORT -u$DBROOTUSER -c -t "
+# build the client base commands one param at a time
+# let the client choose defaults where not specified
+CMD="mysql -h $DBROOTHOST"
+DUMP_CMD="mysqldump -c -t -h $DBROOTHOST"
+if [ -n "$DBROOTPORT" ] ; then
+   CMD="$CMD -P $DBROOTPORT"
+   DUMP_CMD="$DUMP_CMD -P $DBROOTPORT"
+fi
+if [ -n "$DBROOTUSER" ]; then
+   CMD="$CMD -u $DBROOTUSER"
+   DUMP_CMD="mysqldump -u $DBROOTUSER"
 fi
 
 #
diff --git a/utils/kamctl/kamdbctl.pgsql b/utils/kamctl/kamdbctl.pgsql
index 1eb5d88d2b8..3b46c04294f 100644
--- a/utils/kamctl/kamdbctl.pgsql
+++ b/utils/kamctl/kamdbctl.pgsql
@@ -51,12 +51,12 @@ if [ -z "$DBROOTUSER" ]; then
fi
 fi
 
-if [ -z "$DBPORT" ] ; then
-   CMD="psql -q -h $DBHOST -U $DBROOTUSER "
-   DUMP_CMD="pg_dump -h $DBHOST -U $DBROOTUSER -c"
+if [ -z "$DBROOTPORT" ] ; then
+   CMD="psql -q -h $DBROOTHOST -U $DBROOTUSER "
+   DUMP_CMD="pg_dump -h $DBROOTHOST -U $DBROOTUSER -c"
 else
-   CMD="psql -q -h $DBHOST -p $DBPORT -U $DBROOTUSER "
-   DUMP_CMD="pg_dump -h $DBHOST -p $DBPORT -U $DBROOTUSER -c"
+   CMD="psql -q -h $DBROOTHOST -p $DBROOTPORT -U $DBROOTUSER "
+   DUMP_CMD="pg_dump -h $DBROOTHOST -p $DBROOTPORT -U $DBROOTUSER -c"
 fi
 
 #

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


[sr-dev] Re: [kamailio/kamailio] utils/kamctl: make root host/port configurable (PR #3830)

2024-04-28 Thread Daniel-Constantin Mierla via sr-dev
Thanks!

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

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


[sr-dev] Re: [kamailio/kamailio] modules/statsd: ensure statsd failures do not stop execution (PR #3819)

2024-04-28 Thread Daniel-Constantin Mierla via sr-dev
Thanks!

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

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


[sr-dev] git:master:f0caa96e: phonenum: clang format cpp file

2024-04-27 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: f0caa96e7622c40200d22d730ca904f27e5fe752
URL: 
https://github.com/kamailio/kamailio/commit/f0caa96e7622c40200d22d730ca904f27e5fe752

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-27T08:46:17+02:00

phonenum: clang format cpp file

---

Modified: src/modules/phonenum/cphonenumber.cpp

---

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

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


[sr-dev] Re: [kamailio/kamailio] phonenum: add national number (PR #3820)

2024-04-27 Thread Daniel-Constantin Mierla via sr-dev
Merged #3820 into master.

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

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


[sr-dev] git:master:efffd1db: phonenum: add national number

2024-04-27 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: efffd1db25f2da411f53fdab4954c60c16c021ae
URL: 
https://github.com/kamailio/kamailio/commit/efffd1db25f2da411f53fdab4954c60c16c021ae

Author: Daniel Donoghue 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-27T08:44:10+02:00

phonenum: add national number

- add natnum property, containing the nationally formatted number, to pv

---

Modified: src/modules/phonenum/cphonenumber.cpp
Modified: src/modules/phonenum/cphonenumber.h
Modified: src/modules/phonenum/doc/phonenum_admin.xml
Modified: src/modules/phonenum/phonenum_pv.c

---

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

---

diff --git a/src/modules/phonenum/cphonenumber.cpp 
b/src/modules/phonenum/cphonenumber.cpp
index 60f5039c88f..94cc9d2cddb 100644
--- a/src/modules/phonenum/cphonenumber.cpp
+++ b/src/modules/phonenum/cphonenumber.cpp
@@ -128,9 +128,11 @@ telnum_t* telnum_parse(char* number, char* region)
return res;
}
res->valid = 1;
-   string formattedNumber;
-   _phoneUtil.Format(parsedNumber, PhoneNumberUtil::E164, 
);
-   res->normalized = strdup(formattedNumber.c_str());
+   string formattedNumberE164, formattedNumberNational;
+   _phoneUtil.Format(parsedNumber, PhoneNumberUtil::E164, 
);
+   _phoneUtil.Format(parsedNumber, PhoneNumberUtil::NATIONAL, 
);
+   res->normalized = strdup(formattedNumberE164.c_str());
+   res->natnum = strdup(formattedNumberNational.c_str());
string descNumber = 
_phoneGeoCoder->GetDescriptionForNumber(parsedNumber, Locale("en"));
res->ndesc = strdup(descNumber.c_str());
res->ltype = 
strdup(telnum_linetype(_phoneUtil.GetNumberType(parsedNumber)));
@@ -156,6 +158,7 @@ telnum_t* telnum_new(char* number)
tn->ltype = NULL;
tn->ndesc = NULL;
tn->ccname = NULL;
+   tn->natnum = NULL;
tn->error = NULL;
return tn;
 }
@@ -183,5 +186,8 @@ void telnum_free(telnum_t* tn)
if (tn->ccname) {
free(tn->ccname);
}
+   if (tn->natnum) {
+   free(tn->natnum);
+   }
free(tn);
 }
diff --git a/src/modules/phonenum/cphonenumber.h 
b/src/modules/phonenum/cphonenumber.h
index 1a6a06df861..b9e1dc09d96 100644
--- a/src/modules/phonenum/cphonenumber.h
+++ b/src/modules/phonenum/cphonenumber.h
@@ -37,6 +37,7 @@ extern "C"
char *ltype;
char *ndesc;
char *ccname;
+   char *natnum;
char *error;
int cctel;
int valid;
diff --git a/src/modules/phonenum/doc/phonenum_admin.xml 
b/src/modules/phonenum/doc/phonenum_admin.xml
index f3a3e98ede0..740ec4780a3 100644
--- a/src/modules/phonenum/doc/phonenum_admin.xml
+++ b/src/modules/phonenum/doc/phonenum_admin.xml
@@ -205,7 +205,10 @@ if(phonenum_match_cn("1-484-555-", "US", "src")) {
valid result; 0 otherwise


-   normalized - 
normalized phone number
+   normalized - 
normalized (E164) phone number
+   
+   
+   natnum - 
nationally formatted phone number


cctel - country 
code for phone number
diff --git a/src/modules/phonenum/phonenum_pv.c 
b/src/modules/phonenum/phonenum_pv.c
index f6bcc025f66..5970c6b9845 100644
--- a/src/modules/phonenum/phonenum_pv.c
+++ b/src/modules/phonenum/phonenum_pv.c
@@ -190,6 +190,8 @@ int pv_parse_phonenum_name(pv_spec_p sp, str *in)
gpv->type = 0;
else if(strncmp(pvs.s, "ccname", 6) == 0)
gpv->type = 7;
+   else if(strncmp(pvs.s, "natnum", 6) == 0)
+   gpv->type = 8;
else
goto error;
break;
@@ -268,6 +270,10 @@ int pv_get_phonenum(struct sip_msg *msg, pv_param_t 
*param, pv_value_t *res)
if(gpv->item->r.record->ccname == NULL)
return pv_get_null(msg, param, res);
return pv_get_strzval(msg, param, res, 
gpv->item->r.record->ccname);
+   case 8: /* natnum */
+   if(gpv->item->r.record->natnum == NULL)
+   return pv_get_null(msg, param, res);
+   return pv_get_st

[sr-dev] git:master:8506a6fe: ims_usrloc_scscf: enclose examples in dotted lines for better visibility

2024-04-26 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 8506a6fe781e6e0b0b1418f4087db50480db6b57
URL: 
https://github.com/kamailio/kamailio/commit/8506a6fe781e6e0b0b1418f4087db50480db6b57

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-26T14:35:22+02:00

ims_usrloc_scscf: enclose examples in dotted lines for better visibility

---

Modified: src/modules/ims_usrloc_scscf/doc/ims_usrloc_scscf_admin.xml

---

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

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


[sr-dev] git:master:15d859e1: ims_usrloc_scscf: reformat exported structures

2024-04-26 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 15d859e1e96552fca2708cf56047021beae29711
URL: 
https://github.com/kamailio/kamailio/commit/15d859e1e96552fca2708cf56047021beae29711

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-26T14:24:16+02:00

ims_usrloc_scscf: reformat exported structures

---

Modified: src/modules/ims_usrloc_scscf/ims_usrloc_scscf_mod.c

---

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

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


[sr-dev] Re: [kamailio/kamailio] free_fixup functions in cmd_export_t are not called (Issue #3814)

2024-04-26 Thread Daniel-Constantin Mierla via sr-dev
What do you mean by both cases?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3814#issuecomment-2079404313
You are receiving this because you are subscribed to this thread.

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


[sr-dev] Re: [kamailio/kamailio] modules/statsd: ensure statsd failures do not stop execution (PR #3819)

2024-04-25 Thread Daniel-Constantin Mierla via sr-dev
@miconda commented on this pull request.



>  }
 
 static int ki_statsd_decr_with_labels(sip_msg_t *msg, str *key, str *labels)
 {
-   return statsd_count(key->s, "-1", labels->s);
+   return convert_result(statsd_count(key->s, "-1", labels->s));
+}
+
+static int convert_result(bool result)
+{
+   if(result == false) {
+   return -1;
+   }
+
+   return 0;

Shouldn't the above line be `return 1`? Or I misunderstood the purpose.

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

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


[sr-dev] Re: [kamailio/kamailio] ERROR: [core/ppcfg.c:275]: pp_ifdef_level_error(): different number of preprocessor directives: 1 more #!if[n]def as #!endif (Issue #3826)

2024-04-25 Thread Daniel-Constantin Mierla via sr-dev
This tracker is used for reporting bugs in the C code. For asking questions 
about using Kamailio and its configuration file, use 
sr-us...@lists.kamailio.org mailing list.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3826#issuecomment-2077181575
You are receiving this because you are subscribed to this thread.

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


[sr-dev] Re: [kamailio/kamailio] ERROR: [core/ppcfg.c:275]: pp_ifdef_level_error(): different number of preprocessor directives: 1 more #!if[n]def as #!endif (Issue #3826)

2024-04-25 Thread Daniel-Constantin Mierla via sr-dev
Closed #3826 as completed.

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

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


[sr-dev] git:master:c0d80f9e: htable: added in operator for rm functions

2024-04-25 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: c0d80f9eb42b025802c4680f19d788d01497301a
URL: 
https://github.com/kamailio/kamailio/commit/c0d80f9eb42b025802c4680f19d788d01497301a

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-25T13:53:31+02:00

htable: added in operator for rm functions

---

Modified: src/modules/htable/ht_api.c
Modified: src/modules/htable/ht_api.h
Modified: src/modules/htable/ht_dmq.h
Modified: src/modules/htable/htable.c

---

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

---

diff --git a/src/modules/htable/ht_api.c b/src/modules/htable/ht_api.c
index afda3dc6c54..ecc49b547d6 100644
--- a/src/modules/htable/ht_api.c
+++ b/src/modules/htable/ht_api.c
@@ -1389,8 +1389,12 @@ int ht_rm_cell_op(str *sre, ht_t *ht, int mode, int op)
   == 
0) {
match = 1;
}
+   } else if(op == HT_RM_OP_IN) {
+   if(sre->len <= it->name.len
+   && 
str_search(>name, sre) != NULL) {
+   match = 1;
+   }
}
-
} else {
if(op == HT_RM_OP_SW) {
if(it->flags & AVP_VAL_STR) {
@@ -1410,6 +1414,13 @@ int ht_rm_cell_op(str *sre, ht_t *ht, int mode, int op)
match = 1;
}
}
+   } else if(op == HT_RM_OP_IN) {
+   if(it->flags & AVP_VAL_STR) {
+   if(sre->len <= it->value.s.len
+   && 
str_search(>value.s, sre) != NULL) {
+   match = 1;
+   }
+   }
}
}
if(match == 1) {
diff --git a/src/modules/htable/ht_api.h b/src/modules/htable/ht_api.h
index 7c7642ef5df..f7bd8ed42c0 100644
--- a/src/modules/htable/ht_api.h
+++ b/src/modules/htable/ht_api.h
@@ -126,6 +126,8 @@ int ht_reset_content(ht_t *ht);
 #define HT_RM_OP_SW 3
 #define HT_RM_OP_EW 3
 #define HT_RM_OP_RE 4
+#define HT_RM_OP_IN 5
+
 int ht_rm_cell_op(str *sre, ht_t *ht, int mode, int op);
 int ht_match_cell_op_str(str *sre, ht_t *ht, int mode, int op);
 
diff --git a/src/modules/htable/ht_dmq.h b/src/modules/htable/ht_dmq.h
index 7577e445a76..5388d8e00df 100644
--- a/src/modules/htable/ht_dmq.h
+++ b/src/modules/htable/ht_dmq.h
@@ -40,7 +40,8 @@ typedef enum
HT_DMQ_DEL_CELL,
HT_DMQ_RM_CELL_RE,
HT_DMQ_RM_CELL_SW,
-   HT_DMQ_RM_CELL_EW
+   HT_DMQ_RM_CELL_EW,
+   HT_DMQ_RM_CELL_IN
 } ht_dmq_action_t;
 
 int ht_dmq_initialize();
diff --git a/src/modules/htable/htable.c b/src/modules/htable/htable.c
index 6f775bb33ce..414bd5556b1 100644
--- a/src/modules/htable/htable.c
+++ b/src/modules/htable/htable.c
@@ -527,6 +527,18 @@ static int ht_rm_items(sip_msg_t *msg, str *hname, str 
*op, str *val, int mkey)
return -1;
}
return 1;
+   } else if(strncmp(op->s, "ew", 2) == 0) {
+   isval.s = *val;
+   if((ht->dmqreplicate > 0)
+   && 
ht_dmq_replicate_action(HT_DMQ_RM_CELL_IN, >name,
+  NULL, 
AVP_VAL_STR, , mkey)
+  != 0) {
+   LM_ERR("dmq replication failed (op 
%d)\n", mkey);
+   }
+   if(ht_rm_cell_op(val, ht, mkey, HT_RM_OP_IN) < 
0) {
+   return -1;
+   }
+   return 1;
}
LM_WARN("unsupported match operator: %.*s\n", op->len, 
op->s);
break;

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


[sr-dev] git:master:39a2679f: htable: docs for in operator for remove functions

2024-04-25 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 39a2679fe165e34a225615ec32c58692fdcaf6a8
URL: 
https://github.com/kamailio/kamailio/commit/39a2679fe165e34a225615ec32c58692fdcaf6a8

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-25T14:00:40+02:00

htable: docs for in operator for remove functions

---

Modified: src/modules/htable/doc/htable_admin.xml

---

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

---

diff --git a/src/modules/htable/doc/htable_admin.xml 
b/src/modules/htable/doc/htable_admin.xml
index c5cc20e22ed..23a159c6982 100644
--- a/src/modules/htable/doc/htable_admin.xml
+++ b/src/modules/htable/doc/htable_admin.xml
@@ -916,6 +916,11 @@ sht_rm_value_re("ha=>.*");
with'.


+   
+   
+   in - match the val parameter as 
'includes'.
+   
+   


All parameters can be static strings or contain 
variables.
@@ -962,6 +967,11 @@ sht_rm_name("ha", "re", ".*");
with'.


+   
+   
+   in - match the val parameter as 
'includes'.
+   
+   


All parameters can be static strings or contain 
variables.

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


[sr-dev] git:master:fe8f052c: tcpops: removed unused variable introduced recently

2024-04-25 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: fe8f052c29528b656062927626f9784b32b7c8f6
URL: 
https://github.com/kamailio/kamailio/commit/fe8f052c29528b656062927626f9784b32b7c8f6

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-25T13:49:58+02:00

tcpops: removed unused variable introduced recently

---

Modified: src/modules/tcpops/tcpops.c

---

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

---

diff --git a/src/modules/tcpops/tcpops.c b/src/modules/tcpops/tcpops.c
index 9c648c1f2a3..97068c627bb 100644
--- a/src/modules/tcpops/tcpops.c
+++ b/src/modules/tcpops/tcpops.c
@@ -248,7 +248,6 @@ static void 
tcpops_tcp_closed_run_route(tcp_closed_event_info_t *tev)
sip_msg_t *fmsg;
sr_kemi_eng_t *keng = NULL;
str *evname;
-   int bkconid = -1;
 
LM_DBG("event reason id: %d\n", tev->reason);
if(tcpops_event_callback.len > 0) {

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


[sr-dev] git:5.8:e76d755d: tcpops: removed unused variable introduced recently

2024-04-25 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: 5.8
Commit: e76d755de6482e51c9ddac5bba3834cb58ad79b2
URL: 
https://github.com/kamailio/kamailio/commit/e76d755de6482e51c9ddac5bba3834cb58ad79b2

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-25T13:50:44+02:00

tcpops: removed unused variable introduced recently

(cherry picked from commit fe8f052c29528b656062927626f9784b32b7c8f6)

---

Modified: src/modules/tcpops/tcpops.c

---

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

---

diff --git a/src/modules/tcpops/tcpops.c b/src/modules/tcpops/tcpops.c
index 9c648c1f2a3..97068c627bb 100644
--- a/src/modules/tcpops/tcpops.c
+++ b/src/modules/tcpops/tcpops.c
@@ -248,7 +248,6 @@ static void 
tcpops_tcp_closed_run_route(tcp_closed_event_info_t *tev)
sip_msg_t *fmsg;
sr_kemi_eng_t *keng = NULL;
str *evname;
-   int bkconid = -1;
 
LM_DBG("event reason id: %d\n", tev->reason);
if(tcpops_event_callback.len > 0) {

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


[sr-dev] git: new commits in branch 5.8

2024-04-25 Thread Daniel-Constantin Mierla via sr-dev
- URL:  
https://github.com/kamailio/kamailio/commit/bb48da13adfe36716c3d958ed1d9c410424f4d19
Author: Jannik Volkland 
Date:   2024-04-25T13:31:15+02:00

db_redis: docs - refine docs regarding client certificates [skip ci]

The created ssl context does not use client certificates [1,2] which is against 
the default in current Redis configurations [3]. The used Redis server 
therefore needs to be configured to not use tls-auth-clients [3].

There is also a small typo in "ac_path" which was fixed to "ca_path".

[1]: 
https://github.com/kamailio/kamailio/blob/8047c958b42ea5af2e8f9ede0152f892ac0eea3a/src/modules/db_redis/redis_connection.c#L168
[2]: 
https://github.com/kamailio/kamailio/blob/8047c958b42ea5af2e8f9ede0152f892ac0eea3a/src/modules/db_redis/redis_connection.c#L212
[3]: 
https://redis.io/docs/management/security/encryption/#client-certificate-authentication

(cherry picked from commit 40a50243f0bae782b7acd97cf0a9b1138185068b)

- URL:  
https://github.com/kamailio/kamailio/commit/f337f13cdbc7e8805c0130dbae3befaf4b684c7c
Author: Jannik Volkland 
Date:   2024-04-25T13:31:21+02:00

ndb_redis: docs - refine docs regarding client certificates [skip ci]

The created ssl context does not use client certificates [1,2] which is against 
the default in current Redis configurations [3]. The used Redis server 
therefore needs to be configured to not use tls-auth-clients [3].

There is also a small typo in "ac_path" which was fixed to "ca_path".

[1]: 
https://github.com/kamailio/kamailio/blob/8047c958b42ea5af2e8f9ede0152f892ac0eea3a/src/modules/db_redis/redis_connection.c#L168
[2]: 
https://github.com/kamailio/kamailio/blob/8047c958b42ea5af2e8f9ede0152f892ac0eea3a/src/modules/db_redis/redis_connection.c#L212
[3]: 
https://redis.io/docs/management/security/encryption/#client-certificate-authentication

(cherry picked from commit 6faa180661e799187eff3a498f8b13e96719fa92)

- URL:  
https://github.com/kamailio/kamailio/commit/855c76780c4399d6d9881ce3c525a7df56e111c4
Author: Daniel-Constantin Mierla 
Date:   2024-04-25T13:31:50+02:00

sdpops: reformat the codecs map

(cherry picked from commit 359a442e14a156b0bcf60dc5b2580cbc57924e34)

- URL:  
https://github.com/kamailio/kamailio/commit/7295607e680ad1dd5290b15dab7fed77c65bfb88
Author: Daniel-Constantin Mierla 
Date:   2024-04-25T13:32:18+02:00

core: parser/sdp - rename parameter to suggest better its role

(cherry picked from commit b03ec73589c12e566b11ce2c653401daa915c805)

- URL:  
https://github.com/kamailio/kamailio/commit/8d312ded02559b325cdd691bde61c54148b077a5
Author: Daniel-Constantin Mierla 
Date:   2024-04-25T13:33:01+02:00

siputils: tel2sip2() - memset to 0 pkg allocs and recompute len of new uri

(cherry picked from commit d1118064d04bb77c818540e68edf1766db1d560a)

- URL:  
https://github.com/kamailio/kamailio/commit/800ed174b9402d1b253b2cb4ab04b5fb7030dc8d
Author: Daniel-Constantin Mierla 
Date:   2024-04-25T13:33:24+02:00

ims_ipsec_pcscf: log error message made info

(cherry picked from commit 92d3573b500374d100639484e5a84cb640dc6b1d)

- URL:  
https://github.com/kamailio/kamailio/commit/595d3f472179402dce7a51672c2dbfbcf3b54bd5
Author: Xenofon Karamanos <22965395+xkara...@users.noreply.github.com>
Date:   2024-04-25T13:34:17+02:00

corex: Fix unknown af in list_sockets

(cherry picked from commit 8bc64a9e6820243336387d9cd9acf81f24d89993)

- URL:  
https://github.com/kamailio/kamailio/commit/d2cf78f5c70977639f3b7f66b852350b764e4b13
Author: vijay kumar 
Date:   2024-04-25T13:35:18+02:00

rtpengine: fix pkg mem leak in send_rtpp_command()
- freed request.s after sending request to websocket

(cherry picked from commit b4753ae4216b0c960ac094f4be8232fb4d0147b0)

- URL:  
https://github.com/kamailio/kamailio/commit/2661594bf7f31558e6ac7524f33ebb358aefce21
Author: Xenofon Karamanos <22965395+xkara...@users.noreply.github.com>
Date:   2024-04-25T13:35:38+02:00

tcp_main: Add protocol argument for searching tcp/tls connections

(cherry picked from commit 4a40b16d4f9bef9bc75d3272c83878e6348aa0b8)

- URL:  
https://github.com/kamailio/kamailio/commit/0c070443b585c597d2d6249ac6ac32490d9c7f48
Author: Xenofon Karamanos <22965395+xkara...@users.noreply.github.com>
Date:   2024-04-25T13:35:45+02:00

tcp_main: Add proto argument to tcpconn_exists function

(cherry picked from commit 6779efd430178adff0ae438d178e38c003e4e05c)

- URL:  
https://github.com/kamailio/kamailio/commit/a19e6e0e49d9881ab990d23ad31a95773fe1a00b
Author: Xenofon Karamanos <22965395+xkara...@users.noreply.github.com>
Date:   2024-04-25T13:35:57+02:00

tcp_main: Update comment docs

(cherry picked from commit 0a28a93c6e060081267dc686e342d45ef03358e7)

- URL:  
https://github.com/kamailio/kamailio/commit/7d103cf3887401fca32d95f7ea7ee10f28e9e127
Author: Xenofon Karamanos <22965395+xkara...@users.noreply.github.com>
Date:   2024-04-25T13:36:25+02:00

core/forward: Match protocol when forwarding

(cherry picked from commit 

[sr-dev] git:master:0ebfddd2: regex: reformat exported structures

2024-04-24 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 0ebfddd20b43396d602b4c68a88f7c2bc58ed211
URL: 
https://github.com/kamailio/kamailio/commit/0ebfddd20b43396d602b4c68a88f7c2bc58ed211

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-24T21:34:28+02:00

regex: reformat exported structures

---

Modified: src/modules/regex/regex_mod.c

---

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

---

diff --git a/src/modules/regex/regex_mod.c b/src/modules/regex/regex_mod.c
index 4bb4d7cdcee..292af692136 100644
--- a/src/modules/regex/regex_mod.c
+++ b/src/modules/regex/regex_mod.c
@@ -113,48 +113,54 @@ static int w_pcre_match_group(struct sip_msg *_msg, char 
*_s1, char *_s2);
 /*
  * Exported functions
  */
+/* clang-format off */
 static cmd_export_t cmds[] = {
-   {"pcre_match", (cmd_function)w_pcre_match, 2, fixup_spve_spve, 
0,
-   REQUEST_ROUTE | FAILURE_ROUTE | ONREPLY_ROUTE | 
BRANCH_ROUTE
-   | LOCAL_ROUTE},
-   {"pcre_match_group", (cmd_function)w_pcre_match_group, 2,
-   fixup_spve_spve, 0,
-   REQUEST_ROUTE | FAILURE_ROUTE | ONREPLY_ROUTE | 
BRANCH_ROUTE
-   | LOCAL_ROUTE},
-   {"pcre_match_group", (cmd_function)w_pcre_match_group, 1,
-   fixup_spve_null, 0,
-   REQUEST_ROUTE | FAILURE_ROUTE | ONREPLY_ROUTE | 
BRANCH_ROUTE
-   | LOCAL_ROUTE},
-   {0, 0, 0, 0, 0, 0}};
+   {"pcre_match", (cmd_function)w_pcre_match, 2, fixup_spve_spve, 0,
+   REQUEST_ROUTE | FAILURE_ROUTE | ONREPLY_ROUTE | 
BRANCH_ROUTE
+   | LOCAL_ROUTE},
+   {"pcre_match_group", (cmd_function)w_pcre_match_group, 2,
+   fixup_spve_spve, 0,
+   REQUEST_ROUTE | FAILURE_ROUTE | ONREPLY_ROUTE | 
BRANCH_ROUTE
+   | LOCAL_ROUTE},
+   {"pcre_match_group", (cmd_function)w_pcre_match_group, 1,
+   fixup_spve_null, 0,
+   REQUEST_ROUTE | FAILURE_ROUTE | ONREPLY_ROUTE | 
BRANCH_ROUTE
+   | LOCAL_ROUTE},
+   {0, 0, 0, 0, 0, 0}
+};
 
 
 /*
  * Exported parameters
  */
-static param_export_t params[] = {{"file", PARAM_STRING, },
-   {"max_groups", INT_PARAM, _groups},
-   {"group_max_size", INT_PARAM, _max_size},
-   {"pcre_caseless", INT_PARAM, _caseless},
-   {"pcre_multiline", INT_PARAM, _multiline},
-   {"pcre_dotall", INT_PARAM, _dotall},
-   {"pcre_extended", INT_PARAM, _extended}, {0, 0, 0}};
+static param_export_t params[] = {
+   {"file", PARAM_STRING, },
+   {"max_groups", INT_PARAM, _groups},
+   {"group_max_size", INT_PARAM, _max_size},
+   {"pcre_caseless", INT_PARAM, _caseless},
+   {"pcre_multiline", INT_PARAM, _multiline},
+   {"pcre_dotall", INT_PARAM, _dotall},
+   {"pcre_extended", INT_PARAM, _extended},
+   {0, 0, 0}
+};
 
 
 /*
  * Module interface
  */
 struct module_exports exports = {
-   "regex", /*!< module name */
-   DEFAULT_DLFLAGS, /*!< dlopen flags */
-   cmds,/*!< exported functions */
-   params,  /*!< exported parameters */
-   0,   /*!< exported RPC functions */
-   0,   /*!< exported pseudo-variables 
*/
-   0,   /*!< response handling 
function */
-   mod_init,/*!< module initialization function */
-   0,   /*!< per-child init function */
-   destroy  /*!< destroy function */
+   "regex", /*!< module name */
+   DEFAULT_DLFLAGS, /*!< dlopen flags */
+   cmds,/*!< exported functions */
+   params,  /*!< exported parameters */
+   0,   /*!< exported RPC functions */
+   0,   /*!< exported pseudo-variables */
+   0,   /*!< response handling function */
+   mod_init,/*!< module initialization function */
+   0,   /*!< 

[sr-dev] Re: [kamailio/kamailio] phonenum: add national number (PR #3820)

2024-04-24 Thread Daniel-Constantin Mierla via sr-dev
Thanks! I will merge once the CI/CD actions complete ok.

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

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


[sr-dev] Re: [kamailio/kamailio] Kamailio 5.8 core dumps with regex module (Issue #3812)

2024-04-23 Thread Daniel-Constantin Mierla via sr-dev
Looked a bot over it and the `pcres` global was not allocated, by an assign to 
`*pcres` was done.

On the other hand, I am not sure if it is enough, I guess the compiled regex 
has to be stored in shared memory and I cannot say it is done. Maybe 
@linuxmaniac can have more insights on it.

With pcre3 library, there was a function from the lib that returned a 
contiguous block for the compiled regex that was then copied to shm.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3812#issuecomment-2071938830
You are receiving this because you are subscribed to this thread.

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


[sr-dev] git:master:84517c14: regex: init globals for safer shutdown on failure

2024-04-23 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 84517c14ca38a8371c67b858077a42019c2217a8
URL: 
https://github.com/kamailio/kamailio/commit/84517c14ca38a8371c67b858077a42019c2217a8

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-23T11:49:23+02:00

regex: init globals for safer shutdown on failure

---

Modified: src/modules/regex/regex_mod.c

---

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

---

diff --git a/src/modules/regex/regex_mod.c b/src/modules/regex/regex_mod.c
index e7aaada852d..8e8c1645f0e 100644
--- a/src/modules/regex/regex_mod.c
+++ b/src/modules/regex/regex_mod.c
@@ -68,7 +68,7 @@ gen_lock_t *reload_lock;
 /*
  * Module exported parameter variables
  */
-static char *file;
+static char *file = NULL;
 static int max_groups = MAX_GROUPS;
 static int group_max_size = GROUP_MAX_SIZE;
 static int pcre_caseless = 0;
@@ -83,9 +83,9 @@ static int pcre_extended = 0;
 static pcre2_general_context *pcres_gctx = NULL;
 static pcre2_match_context *pcres_mctx = NULL;
 static pcre2_compile_context *pcres_ctx = NULL;
-static pcre2_code **pcres;
-static pcre2_code ***pcres_addr;
-static int *num_pcres;
+static pcre2_code **pcres = NULL;
+static pcre2_code ***pcres_addr = NULL;
+static int *num_pcres = NULL;
 static int pcre_options = 0x;
 
 

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


[sr-dev] git:master:2cc62133: regex: allocate pcres array

2024-04-23 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 2cc62133db4f6875f55e73e044f37dafbb2274c2
URL: 
https://github.com/kamailio/kamailio/commit/2cc62133db4f6875f55e73e044f37dafbb2274c2

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-23T12:08:30+02:00

regex: allocate pcres array

- GH #3812

---

Modified: src/modules/regex/regex_mod.c

---

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

---

diff --git a/src/modules/regex/regex_mod.c b/src/modules/regex/regex_mod.c
index 8e8c1645f0e..4bb4d7cdcee 100644
--- a/src/modules/regex/regex_mod.c
+++ b/src/modules/regex/regex_mod.c
@@ -462,6 +462,15 @@ static int load_pcres(int action)
}
shm_free(pcres);
}
+
+   if(pcres == NULL) {
+   if((pcres = shm_malloc(sizeof(pcre2_code *) * num_pcres_tmp)) 
== 0) {
+   LM_ERR("no more memory for pcres\n");
+   goto err;
+   }
+   memset(pcres, 0, sizeof(pcre2_code *) * num_pcres_tmp);
+   }
+
*num_pcres = num_pcres_tmp;
*pcres = *pcres_tmp;
*pcres_addr = pcres;

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


[sr-dev] Re: [kamailio/kamailio] free_fixup functions in cmd_export_t are not called (Issue #3814)

2024-04-23 Thread Daniel-Constantin Mierla via sr-dev
I am not sure if they are executed at shut down, it was one of the purposes for 
fixup-free function, cleaning up at shut down, but this one was not pursued and 
it is rather tricky because it can be done mainly only for the main process, 
which is not doing anything at runtime. Also, it can slow the restarts ...

Anyhow, one place where they should be used is when using the `modf(...)` from 
KEMI, which should be avoided. Another one, which would be the most important, 
iirc, is when having expressions in the parameters of config functions, like:

```
func1($var(x) + $var(y));
```

instead of:

```
func1("$var(x)$var(y)");
```

Anyhow, you should test to validate the above, I was not the one developing the 
config interpreter when they were added.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3814#issuecomment-2071859533
You are receiving this because you are subscribed to this thread.

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


[sr-dev] Re: [kamailio/kamailio] Misleading source IP of 1.0.0.127 in event routes (Issue #3817)

2024-04-23 Thread Daniel-Constantin Mierla via sr-dev
Closed #3817 as completed.

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

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


[sr-dev] Re: [kamailio/kamailio] Misleading source IP of 1.0.0.127 in event routes (Issue #3817)

2024-04-23 Thread Daniel-Constantin Mierla via sr-dev
This should be fixed by parsing the loopback ip instead of direct filling of ip 
addr fields. It will be backported. Reopen if still an issue.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3817#issuecomment-2071833806
You are receiving this because you are subscribed to this thread.

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


[sr-dev] git:master:66b3c04a: core: fmsg - parse loopback ip when initializing faked msg structure

2024-04-23 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 66b3c04a9653425b1602c82dd2456a7eb7cf59d1
URL: 
https://github.com/kamailio/kamailio/commit/66b3c04a9653425b1602c82dd2456a7eb7cf59d1

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-23T11:19:30+02:00

core: fmsg - parse loopback ip when initializing faked msg structure

- GH #3817

---

Modified: src/core/fmsg.c

---

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

---

diff --git a/src/core/fmsg.c b/src/core/fmsg.c
index 7a4f9ba87e5..b30ca9f69cf 100644
--- a/src/core/fmsg.c
+++ b/src/core/fmsg.c
@@ -25,6 +25,7 @@
 #include "dprint.h"
 #include "globals.h"
 #include "dset.h"
+#include "resolve.h"
 
 #include "fmsg.h"
 
@@ -57,6 +58,8 @@ static void faked_msg_buf_init(void)
 
 static int faked_msg_init_new(sip_msg_t *fmsg)
 {
+   str loip = str_init("127.0.0.1");
+
faked_msg_buf_init();
 
/* init faked sip msg */
@@ -75,13 +78,9 @@ static int faked_msg_init_new(sip_msg_t *fmsg)
 
fmsg->rcv.proto = PROTO_UDP;
fmsg->rcv.src_port = 5060;
-   fmsg->rcv.src_ip.u.addr32[0] = 0x7f01;
-   fmsg->rcv.src_ip.af = AF_INET;
-   fmsg->rcv.src_ip.len = 4;
+   str2ipbuf(, >rcv.src_ip);
fmsg->rcv.dst_port = 5060;
-   fmsg->rcv.dst_ip.u.addr32[0] = 0x7f01;
-   fmsg->rcv.dst_ip.af = AF_INET;
-   fmsg->rcv.dst_ip.len = 4;
+   str2ipbuf(, >rcv.dst_ip);
 
return 0;
 }

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


[sr-dev] Re: [kamailio/kamailio] tcpops module event_route[tcp:closed] route block $conid is null (Issue #3767)

2024-04-23 Thread Daniel-Constantin Mierla via sr-dev
@liangbaolin: I pushed a few commits to address this one, last being 
f5c05a68ae72881ab0691bb8488112356fc67c79 Can you try with git master branch and 
see if ok? If yes, patches will be backported.



-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3767#issuecomment-2071757318
You are receiving this because you are subscribed to this thread.

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


[sr-dev] git:master:27e3b7f3: tcpops: reworked some debug messages

2024-04-23 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 27e3b7f3f82957c6dc80f2ff89c40bdd87cecb81
URL: 
https://github.com/kamailio/kamailio/commit/27e3b7f3f82957c6dc80f2ff89c40bdd87cecb81

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-23T10:21:20+02:00

tcpops: reworked some debug messages

---

Modified: src/modules/tcpops/tcpops.c

---

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

---

diff --git a/src/modules/tcpops/tcpops.c b/src/modules/tcpops/tcpops.c
index 2b767a9470e..97068c627bb 100644
--- a/src/modules/tcpops/tcpops.c
+++ b/src/modules/tcpops/tcpops.c
@@ -249,6 +249,7 @@ static void 
tcpops_tcp_closed_run_route(tcp_closed_event_info_t *tev)
sr_kemi_eng_t *keng = NULL;
str *evname;
 
+   LM_DBG("event reason id: %d\n", tev->reason);
if(tcpops_event_callback.len > 0) {
rt = -1;
keng = sr_kemi_eng_get();
@@ -258,9 +259,10 @@ static void 
tcpops_tcp_closed_run_route(tcp_closed_event_info_t *tev)
}
} else {
rt = tcp_closed_routes[tev->reason];
-   LM_DBG("event reason id: %d rt: %d\n", tev->reason, rt);
-   if(rt == -1)
+   if(rt == -1) {
+   LM_DBG("event reason id: %d - event route not set\n", 
tev->reason);
return;
+   }
}
 
if(faked_msg_init() < 0) {

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


[sr-dev] git:master:f5c05a68: pv: use global tcp connection callback for event route on $conid

2024-04-23 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: f5c05a68ae72881ab0691bb8488112356fc67c79
URL: 
https://github.com/kamailio/kamailio/commit/f5c05a68ae72881ab0691bb8488112356fc67c79

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-23T10:42:02+02:00

pv: use global tcp connection callback for event route on $conid

---

Modified: src/modules/pv/pv_core.c
Modified: src/modules/tcpops/tcpops.c

---

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

---

diff --git a/src/modules/pv/pv_core.c b/src/modules/pv/pv_core.c
index 40557ba4628..b10b7513a6f 100644
--- a/src/modules/pv/pv_core.c
+++ b/src/modules/pv/pv_core.c
@@ -2927,6 +2927,13 @@ int pv_get_tcpconn_id(struct sip_msg *msg, pv_param_t 
*param, pv_value_t *res)
if(msg == NULL)
return -1;
 
+   /* use first the connection set for event_route[tcp:...] */
+   con = ksr_tcpcon_evcb_get();
+   if(con != NULL) {
+   return pv_get_sintval(msg, param, res, con->id);
+   }
+
+   /* find connection from sip message structure */
if((con = tcpconn_get(msg->rcv.proto_reserved1, 0, 0, 0, 0)) == NULL)
return pv_get_null(msg, param, res);
 
diff --git a/src/modules/tcpops/tcpops.c b/src/modules/tcpops/tcpops.c
index 97068c627bb..9c648c1f2a3 100644
--- a/src/modules/tcpops/tcpops.c
+++ b/src/modules/tcpops/tcpops.c
@@ -248,6 +248,7 @@ static void 
tcpops_tcp_closed_run_route(tcp_closed_event_info_t *tev)
sip_msg_t *fmsg;
sr_kemi_eng_t *keng = NULL;
str *evname;
+   int bkconid = -1;
 
LM_DBG("event reason id: %d\n", tev->reason);
if(tcpops_event_callback.len > 0) {

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


[sr-dev] git:master:d114d117: core: tcp - set a global shortcut to tcp connection for event route

2024-04-23 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: d114d11724dc4157e7e5809504531d26da6bcc57
URL: 
https://github.com/kamailio/kamailio/commit/d114d11724dc4157e7e5809504531d26da6bcc57

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-23T10:36:35+02:00

core: tcp - set a global shortcut to tcp connection for event route

---

Modified: src/core/tcp_conn.h
Modified: src/core/tcp_main.c

---

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

---

diff --git a/src/core/tcp_conn.h b/src/core/tcp_conn.h
index 5b579b2ffb9..57dff5a291b 100644
--- a/src/core/tcp_conn.h
+++ b/src/core/tcp_conn.h
@@ -434,4 +434,6 @@ typedef struct ws_event_info
int id;
 } ws_event_info_t;
 
+tcp_connection_t *ksr_tcpcon_evcb_get(void);
+
 #endif
diff --git a/src/core/tcp_main.c b/src/core/tcp_main.c
index 957a9b97c0f..2456459cfa2 100644
--- a/src/core/tcp_main.c
+++ b/src/core/tcp_main.c
@@ -3670,6 +3670,12 @@ int _tcpconn_write_nb(
return n;
 }
 
+static tcp_connection_t *_ksr_tcpcon_evcb = NULL;
+
+tcp_connection_t *ksr_tcpcon_evcb_get(void)
+{
+   return _ksr_tcpcon_evcb;
+}
 
 static int tcp_emit_closed_event(struct tcp_connection *con)
 {
@@ -3692,7 +3698,9 @@ static int tcp_emit_closed_event(struct tcp_connection 
*con)
tev.id = con->id;
tev.con = con;
evp.data = (void *)();
+   _ksr_tcpcon_evcb = con;
ret = sr_event_exec(SREV_TCP_CLOSED, );
+   _ksr_tcpcon_evcb = NULL;
} else {
LM_DBG("no callback registering for handling TCP closed 
event\n");
}

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


[sr-dev] git:master:11e7d71e: core: tcp - keep connection id on event route cb structure

2024-04-23 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 11e7d71e5c2ee9428298658ed3b9a0f625d40f00
URL: 
https://github.com/kamailio/kamailio/commit/11e7d71e5c2ee9428298658ed3b9a0f625d40f00

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-23T10:19:29+02:00

core: tcp - keep connection id on event route cb structure

---

Modified: src/core/tcp_conn.h
Modified: src/core/tcp_main.c

---

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

---

diff --git a/src/core/tcp_conn.h b/src/core/tcp_conn.h
index 13301563945..5b579b2ffb9 100644
--- a/src/core/tcp_conn.h
+++ b/src/core/tcp_conn.h
@@ -422,6 +422,7 @@ typedef struct tcp_event_info
 typedef struct tcp_closed_event_info
 {
enum tcp_closed_reason reason;
+   int id;
struct tcp_connection *con;
 } tcp_closed_event_info_t;
 
diff --git a/src/core/tcp_main.c b/src/core/tcp_main.c
index b71e7ad37f2..957a9b97c0f 100644
--- a/src/core/tcp_main.c
+++ b/src/core/tcp_main.c
@@ -3689,6 +3689,7 @@ static int tcp_emit_closed_event(struct tcp_connection 
*con)
if(likely(sr_event_enabled(SREV_TCP_CLOSED))) {
memset(, 0, sizeof(tcp_closed_event_info_t));
tev.reason = reason;
+   tev.id = con->id;
tev.con = con;
evp.data = (void *)();
ret = sr_event_exec(SREV_TCP_CLOSED, );

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


[sr-dev] Re: [kamailio/kamailio] Kamailio 5.6 (and 5.7) core dumps with uac_req_send() from uac module (Issue #3725)

2024-04-23 Thread Daniel-Constantin Mierla via sr-dev
Reopened #3725.

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

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


[sr-dev] git:master:b96de87a: ipops: define hostname size for ptr structure

2024-04-22 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: b96de87ae94db2285d7a5f022c38a746d69ae5ef
URL: 
https://github.com/kamailio/kamailio/commit/b96de87ae94db2285d7a5f022c38a746d69ae5ef

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-22T21:43:40+02:00

ipops: define hostname size for ptr structure

- replace the strncpy with strlen with straight strcpy

---

Modified: src/modules/ipops/ipops_pv.c
Modified: src/modules/ipops/ipops_pv.h

---

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

---

diff --git a/src/modules/ipops/ipops_pv.c b/src/modules/ipops/ipops_pv.c
index 034ec696594..acbe08a4283 100644
--- a/src/modules/ipops/ipops_pv.c
+++ b/src/modules/ipops/ipops_pv.c
@@ -429,7 +429,7 @@ int ptr_update_pv(str *ip_address, str *name)
sr_dns_item_t *dr = NULL;
struct sockaddr_in sa;
struct sockaddr_in6 sa6;
-   char hostname[256];
+   char hostname[SR_DNS_HOSTNAME_SIZE];
int result;
int ip_type;
if(ip_address->len > INET6_ADDRSTRLEN) {
@@ -499,8 +499,7 @@ int ptr_update_pv(str *ip_address, str *name)
}
 
/* Store the hostname in the sr_dns_item_t structure. */
-   strncpy(dr->hostname, hostname, strlen(hostname));
-   dr->hostname[strlen(hostname)] = '\0';
+   strcpy(dr->hostname, hostname);
dr->count = 1;
 
LM_DBG("reverse dns PV updated for: %s (%d)\n", dr->r[0].addr, 
dr->count);
diff --git a/src/modules/ipops/ipops_pv.h b/src/modules/ipops/ipops_pv.h
index 5e9a19be1da..cede3b4217c 100644
--- a/src/modules/ipops/ipops_pv.h
+++ b/src/modules/ipops/ipops_pv.h
@@ -27,7 +27,7 @@
 #define PV_DNS_ADDR 64
 #define PV_DNS_RECS 32
 #define SR_DNS_PVIDX 1
-
+#define SR_DNS_HOSTNAME_SIZE 256
 typedef struct _sr_dns_record
 {
int type;
@@ -38,7 +38,7 @@ typedef struct _sr_dns_item
 {
str name;
unsigned int hashid;
-   char hostname[256];
+   char hostname[SR_DNS_HOSTNAME_SIZE];
int count;
int ipv4;
int ipv6;

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


[sr-dev] git:master:6e6b4f06: xhttp_prom: use %lu for printing pkg fields

2024-04-22 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 6e6b4f06546a0d9ad942847ee745b17a5aeb7f6a
URL: 
https://github.com/kamailio/kamailio/commit/6e6b4f06546a0d9ad942847ee745b17a5aeb7f6a

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-22T21:54:26+02:00

xhttp_prom: use %lu for printing pkg fields

---

Modified: src/modules/xhttp_prom/prom.c

---

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

---

diff --git a/src/modules/xhttp_prom/prom.c b/src/modules/xhttp_prom/prom.c
index efe111b752a..71accf21845 100644
--- a/src/modules/xhttp_prom/prom.c
+++ b/src/modules/xhttp_prom/prom.c
@@ -253,7 +253,7 @@ static int prom_metric_pkgmem_print(prom_ctx_t *ctx)
for(; i < pkg_proc_stats_no; i++) {
if(prom_body_printf(ctx,
   "%.*spkgmem_used{pid=\"%u\", rank=\"%d\", 
desc=\"%s\"} "
-  "%d %" PRIu64 "\n",
+  "%lu %" PRIu64 "\n",
   xhttp_prom_beginning.len, 
xhttp_prom_beginning.s,
   pkg_proc_stats[i].pid, 
pkg_proc_stats[i].rank, pt[i].desc,
   pkg_proc_stats[i].used, ts)
@@ -263,7 +263,7 @@ static int prom_metric_pkgmem_print(prom_ctx_t *ctx)
}
if(prom_body_printf(ctx,
   "%.*spkgmem_available{pid=\"%u\", 
rank=\"%d\", "
-  "desc=\"%s\"} %d %" PRIu64 "\n",
+  "desc=\"%s\"} %lu %" PRIu64 "\n",
   xhttp_prom_beginning.len, 
xhttp_prom_beginning.s,
   pkg_proc_stats[i].pid, 
pkg_proc_stats[i].rank, pt[i].desc,
   pkg_proc_stats[i].available, ts)
@@ -273,7 +273,7 @@ static int prom_metric_pkgmem_print(prom_ctx_t *ctx)
}
if(prom_body_printf(ctx,
   "%.*spkgmem_real_used{pid=\"%u\", 
rank=\"%d\", "
-  "desc=\"%s\"} %d %" PRIu64 "\n",
+  "desc=\"%s\"} %lu %" PRIu64 "\n",
   xhttp_prom_beginning.len, 
xhttp_prom_beginning.s,
   pkg_proc_stats[i].pid, 
pkg_proc_stats[i].rank, pt[i].desc,
   pkg_proc_stats[i].real_used, ts)
@@ -283,7 +283,7 @@ static int prom_metric_pkgmem_print(prom_ctx_t *ctx)
}
if(prom_body_printf(ctx,
   "%.*spkgmem_total_frags{pid=\"%u\", 
rank=\"%d\", "
-  "desc=\"%s\"} %d %" PRIu64 "\n",
+  "desc=\"%s\"} %lu %" PRIu64 "\n",
   xhttp_prom_beginning.len, 
xhttp_prom_beginning.s,
   pkg_proc_stats[i].pid, 
pkg_proc_stats[i].rank, pt[i].desc,
   pkg_proc_stats[i].total_frags, ts)
@@ -293,7 +293,7 @@ static int prom_metric_pkgmem_print(prom_ctx_t *ctx)
}
if(prom_body_printf(ctx,
   "%.*spkgmem_total_size{pid=\"%u\", 
rank=\"%d\" "
-  "desc=\"%s\"} %d %" PRIu64 "\n",
+  "desc=\"%s\"} %lu %" PRIu64 "\n",
   xhttp_prom_beginning.len, 
xhttp_prom_beginning.s,
   pkg_proc_stats[i].pid, 
pkg_proc_stats[i].rank, pt[i].desc,
   pkg_proc_stats[i].total_size, ts)

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


[sr-dev] Re: [kamailio/kamailio] Misleading source IP of 1.0.0.127 in event routes (Issue #3817)

2024-04-22 Thread Daniel-Constantin Mierla via sr-dev
It looks like reversed order, what is the operating system and the compiler 
used?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3817#issuecomment-2070730147
You are receiving this because you are subscribed to this thread.

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


[sr-dev] git:master:1adc0724: acc: docs - small fix to cdr_extra param example

2024-04-15 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 1adc07240c153b40f6bf5cb700145f8789070bcc
URL: 
https://github.com/kamailio/kamailio/commit/1adc07240c153b40f6bf5cb700145f8789070bcc

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-15T21:29:54+02:00

acc: docs - small fix to cdr_extra param example

---

Modified: src/modules/acc/doc/acc_admin.xml

---

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

---

diff --git a/src/modules/acc/doc/acc_admin.xml 
b/src/modules/acc/doc/acc_admin.xml
index 69be72fe2e6..37a1365627e 100644
--- a/src/modules/acc/doc/acc_admin.xml
+++ b/src/modules/acc/doc/acc_admin.xml
@@ -1156,7 +1156,7 @@ modparam("acc", "cdr_facility", "LOG_DAEMON")
cdr_extra example

 ...
-modparam("acc", "cdr_extra", "c1=$dlg_var(caller);c2=$dlg_var(callee)"
+modparam("acc", "cdr_extra", "c1=$dlg_var(caller);c2=$dlg_var(callee)")
 ...
 


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


[sr-dev] Maintenance work overnight on kamailio.org server

2024-04-15 Thread Daniel-Constantin Mierla via sr-dev
Hello,

there is some planned work on the data center infrastructure hosting
kamailio.org server that is going to affect briefly the web server (web
site, wiki) and the mailing lists.

The downtime is expected to be 10-15 minutes around 1:00am Western
Europe time (CEST / GMT+2), but if it takes longer or repeats, be
patient for a while.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla (@ asipto.com)
twitter.com/miconda -- linkedin.com/in/miconda
Kamailio Consultancy, Training and Development Services -- asipto.com
Kamailio World Conference, April 18-19, 2024, Berlin -- kamailioworld.com

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


[sr-dev] git:master:39ca2874: Makefile.defs: version set to 5.9.0-dev1

2024-04-14 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 39ca28748162e940bd91bf4e0cb0b1223b5f9138
URL: 
https://github.com/kamailio/kamailio/commit/39ca28748162e940bd91bf4e0cb0b1223b5f9138

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-15T07:19:31+02:00

Makefile.defs: version set to 5.9.0-dev1

---

Modified: src/Makefile.defs

---

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

---

diff --git a/src/Makefile.defs b/src/Makefile.defs
index 4165ca084fb..9feece65535 100644
--- a/src/Makefile.defs
+++ b/src/Makefile.defs
@@ -107,7 +107,7 @@ INSTALL_FLAVOUR=$(FLAVOUR)
 VERSION = 5
 PATCHLEVEL = 9
 SUBLEVEL =  0
-EXTRAVERSION = -dev0
+EXTRAVERSION = -dev1
 
 # memory manager switcher
 # 0 - f_malloc (fast malloc)

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


[sr-dev] git:master:29a890ff: htable: add ew (end-with) operator for delete items functions

2024-04-14 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 29a890ffdcd394d26d53bd0951c7ca58262c7696
URL: 
https://github.com/kamailio/kamailio/commit/29a890ffdcd394d26d53bd0951c7ca58262c7696

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-14T15:29:57+02:00

htable: add ew (end-with) operator for delete items functions

---

Modified: src/modules/htable/ht_api.c
Modified: src/modules/htable/ht_api.h
Modified: src/modules/htable/ht_dmq.h
Modified: src/modules/htable/htable.c

---

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

---

diff --git a/src/modules/htable/ht_api.c b/src/modules/htable/ht_api.c
index 2391cb5c5d0..afda3dc6c54 100644
--- a/src/modules/htable/ht_api.c
+++ b/src/modules/htable/ht_api.c
@@ -1033,7 +1033,7 @@ int ht_table_spec(char *spec)
 
coldelim = tok.s[0];
LM_DBG("htable [%.*s] - coldelim [%c]\n", name.len, 
name.s,
-  coldelim);
+   coldelim);
} else if(pit->name.len == 7
  && strncmp(pit->name.s, "colnull", 7) == 0) {
if(tok.len > 1)
@@ -1045,8 +1045,7 @@ int ht_table_spec(char *spec)
colnull = tok.s[0];
}
 
-   LM_DBG("htable [%.*s] - colnull [%c]\n", name.len, 
name.s,
-   colnull);
+   LM_DBG("htable [%.*s] - colnull [%c]\n", name.len, 
name.s, colnull);
} else {
goto error;
}
@@ -1383,7 +1382,15 @@ int ht_rm_cell_op(str *sre, ht_t *ht, int mode, int op)
&& strncmp(it->name.s, 
sre->s, sre->len) == 0) {
match = 1;
}
+   } else if(op == HT_RM_OP_EW) {
+   if(sre->len <= it->name.len
+   && strncmp(it->name.s + 
it->name.len - sre->len,
+  
sre->s, sre->len)
+  == 
0) {
+   match = 1;
+   }
}
+
} else {
if(op == HT_RM_OP_SW) {
if(it->flags & AVP_VAL_STR) {
@@ -1393,6 +1400,16 @@ int ht_rm_cell_op(str *sre, ht_t *ht, int mode, int op)
match = 1;
}
}
+   } else if(op == HT_RM_OP_EW) {
+   if(it->flags & AVP_VAL_STR) {
+   if(sre->len <= it->value.s.len
+   && 
strncmp(it->value.s.s + it->value.s.len
+   
   - sre->len,
+   
   sre->s, sre->len)
+   
   == 0) {
+   match = 1;
+   }
+   }
}
}
if(match == 1) {
diff --git a/src/modules/htable/ht_api.h b/src/modules/htable/ht_api.h
index e24a93b1f17..7c7642ef5df 100644
--- a/src/modules/htable/ht_api.h
+++ b/src/modules/htable/ht_api.h
@@ -124,6 +124,7 @@ int ht_reset_content(ht_t *ht);
 #define HT_RM_OP_EQ 1
 #define HT_RM_OP_NE 2
 #define HT_RM_OP_SW 3
+#define HT_RM_OP_EW 3
 #define HT_RM_OP_RE 4
 int ht_rm_cell_op(str *sre, ht_t *ht, int mode, int op);
 int ht_match_cell_op_str(str *sre, ht_t *ht, int mode, int op);
diff --git a/src/modules/htable/ht_dmq.h b/src/modules/htable/ht_dmq.h
index bc5f18830be..7577e445a76 100644
--- a/src/modules/htable/ht_dmq.h
+++ b/src/modules/htable/ht_dmq.h
@@ -39,7 +39,8 @@ typedef enum
HT_DMQ_SET_CELL_EXPIRE,
HT_DMQ_DEL_CELL,
HT_DMQ_RM_CELL_RE,
-   HT_DMQ_RM_CELL_SW
+   HT_DMQ_RM_CELL_SW,
+   HT_DMQ_RM_CELL_EW
 } ht_dmq_action_t;
 
 int ht_dmq_initialize();
diff --git a/src/modules/htable/htable.c b/src/modules/htable/htable

[sr-dev] git:master:bb093505: htable: docs for sw operator for functions removing items

2024-04-14 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: bb093505c5c5f625339f85961518f9db3fd6725d
URL: 
https://github.com/kamailio/kamailio/commit/bb093505c5c5f625339f85961518f9db3fd6725d

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-14T15:41:31+02:00

htable: docs for sw operator for functions removing items

---

Modified: src/modules/htable/doc/htable_admin.xml

---

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

---

diff --git a/src/modules/htable/doc/htable_admin.xml 
b/src/modules/htable/doc/htable_admin.xml
index 69ad5e64581..c5cc20e22ed 100644
--- a/src/modules/htable/doc/htable_admin.xml
+++ b/src/modules/htable/doc/htable_admin.xml
@@ -910,6 +910,12 @@ sht_rm_value_re("ha=>.*");
with'.


+   
+   
+   ew - match the val parameter as 
'ends
+   with'.
+   
+   


All parameters can be static strings or contain 
variables.
@@ -950,6 +956,12 @@ sht_rm_name("ha", "re", ".*");
with'.


+   
+   
+   ew - match the val parameter as 
'ends
+   with'.
+   
+   


All parameters can be static strings or contain 
variables.

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


[sr-dev] git:master:671b874a: nghttp2: clear response headers on event route

2024-04-13 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 671b874a31fb10c6c9e9a246358928f202fc669d
URL: 
https://github.com/kamailio/kamailio/commit/671b874a31fb10c6c9e9a246358928f202fc669d

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-13T21:24:54+02:00

nghttp2: clear response headers on event route

---

Modified: src/modules/nghttp2/nghttp2_mod.c

---

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

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


[sr-dev] git:master:a368140d: nghttp2: fix typo in filed type

2024-04-13 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: a368140d8d32a68ccc21845aad95e43c98a802d7
URL: 
https://github.com/kamailio/kamailio/commit/a368140d8d32a68ccc21845aad95e43c98a802d7

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-13T08:58:20+02:00

nghttp2: fix typo in filed type

---

Modified: src/modules/nghttp2/nghttp2_server.h

---

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

---

diff --git a/src/modules/nghttp2/nghttp2_server.h 
b/src/modules/nghttp2/nghttp2_server.h
index 8b343fd11ce..ac69a147313 100644
--- a/src/modules/nghttp2/nghttp2_server.h
+++ b/src/modules/nghttp2/nghttp2_server.h
@@ -79,7 +79,7 @@ typedef struct http2_stream_data
char *request_path;
char *request_pathfull;
char *request_method;
-   ttp2_msghdr_t *hdrlist;
+   http2_msghdr_t *hdrlist;
int32_t stream_id;
int fd;
 } http2_stream_data;

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


[sr-dev] git:master:a8481f58: nghttp2: debug message instead of error on peer disconnect

2024-04-12 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: a8481f588d5461285e512a0b68803ffc0f41d7b3
URL: 
https://github.com/kamailio/kamailio/commit/a8481f588d5461285e512a0b68803ffc0f41d7b3

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-12T21:59:44+02:00

nghttp2: debug message instead of error on peer disconnect

---

Modified: src/modules/nghttp2/nghttp2_server.c

---

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

---

diff --git a/src/modules/nghttp2/nghttp2_server.c 
b/src/modules/nghttp2/nghttp2_server.c
index d5153bef0c6..d8c23220a13 100644
--- a/src/modules/nghttp2/nghttp2_server.c
+++ b/src/modules/nghttp2/nghttp2_server.c
@@ -221,7 +221,7 @@ static void delete_http2_session_data(http2_session_data 
*session_data)
 {
http2_stream_data *stream_data;
SSL *ssl = bufferevent_openssl_get_ssl(session_data->bev);
-   LM_ERR("%s disconnected\n", session_data->client_addr);
+   LM_DBG("remote peer %s disconnected\n", session_data->client_addr);
if(ssl) {
SSL_shutdown(ssl);
}

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


[sr-dev] git:master:11c5ed67: nghttp2: debug with data content

2024-04-12 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 11c5ed679193c4cc94957c0a5948e07bfbfcfee9
URL: 
https://github.com/kamailio/kamailio/commit/11c5ed679193c4cc94957c0a5948e07bfbfcfee9

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-12T21:59:44+02:00

nghttp2: debug with data content

---

Modified: src/modules/nghttp2/nghttp2_server.c

---

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

---

diff --git a/src/modules/nghttp2/nghttp2_server.c 
b/src/modules/nghttp2/nghttp2_server.c
index 8c17f847f87..d5153bef0c6 100644
--- a/src/modules/nghttp2/nghttp2_server.c
+++ b/src/modules/nghttp2/nghttp2_server.c
@@ -560,6 +560,27 @@ static int on_frame_recv_callback(
return 0;
 }
 
+/*
+ * The implementation of nghttp2_on_data_chunk_recv_callback type.
+ * - function to get the received body.
+ */
+static int on_data_chunk_recv_callback(nghttp2_session *session, uint8_t flags,
+   int32_t stream_id, const uint8_t *data, size_t len, void 
*user_data)
+{
+   struct Request *req;
+   (void)flags;
+   (void)user_data;
+
+   req = nghttp2_session_get_stream_user_data(session, stream_id);
+   if(req) {
+   LM_DBG(" (DATA chunk) [%lu 
bytes]\n",
+   (unsigned long int)len);
+   LM_DBG("[[%.*s]]", (int)len, (char *)data);
+   LM_DBG("\n");
+   }
+   return 0;
+}
+
 static int on_stream_close_callback(nghttp2_session *session, int32_t 
stream_id,
uint32_t error_code, void *user_data)
 {
@@ -587,6 +608,9 @@ static void initialize_nghttp2_session(http2_session_data 
*session_data)
nghttp2_session_callbacks_set_on_frame_recv_callback(
callbacks, on_frame_recv_callback);
 
+   nghttp2_session_callbacks_set_on_data_chunk_recv_callback(
+   callbacks, on_data_chunk_recv_callback);
+
nghttp2_session_callbacks_set_on_stream_close_callback(
callbacks, on_stream_close_callback);
 

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


[sr-dev] git:master:702e9cdb: nghttp2: structure to hold headers in stream data

2024-04-12 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 702e9cdbe8c6ca5856c25f9737d77e3223bbf9ce
URL: 
https://github.com/kamailio/kamailio/commit/702e9cdbe8c6ca5856c25f9737d77e3223bbf9ce

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-12T21:59:44+02:00

nghttp2: structure to hold headers in stream data

---

Modified: src/modules/nghttp2/nghttp2_server.h

---

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

---

diff --git a/src/modules/nghttp2/nghttp2_server.h 
b/src/modules/nghttp2/nghttp2_server.h
index cad3772d9ef..8b343fd11ce 100644
--- a/src/modules/nghttp2/nghttp2_server.h
+++ b/src/modules/nghttp2/nghttp2_server.h
@@ -66,12 +66,20 @@
 struct app_context;
 typedef struct app_context app_context;
 
+typedef struct http2_msghdr
+{
+   str name;
+   str value;
+   struct http2_msghdr *next;
+} http2_msghdr_t;
+
 typedef struct http2_stream_data
 {
struct http2_stream_data *prev, *next;
char *request_path;
char *request_pathfull;
char *request_method;
+   ttp2_msghdr_t *hdrlist;
int32_t stream_id;
int fd;
 } http2_stream_data;

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


[sr-dev] git:master:2b8d5877: nghttp2: added $nghttp2(pathfull) - full http path with all params

2024-04-12 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 2b8d587713d96fbee31534b9b16f2c2b432e2e68
URL: 
https://github.com/kamailio/kamailio/commit/2b8d587713d96fbee31534b9b16f2c2b432e2e68

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-12T21:59:44+02:00

nghttp2: added $nghttp2(pathfull) - full http path with all params

---

Modified: src/modules/nghttp2/nghttp2_mod.c
Modified: src/modules/nghttp2/nghttp2_server.c
Modified: src/modules/nghttp2/nghttp2_server.h

---

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

---

diff --git a/src/modules/nghttp2/nghttp2_mod.c 
b/src/modules/nghttp2/nghttp2_mod.c
index 95918b1e6c8..c3e05e50b05 100644
--- a/src/modules/nghttp2/nghttp2_mod.c
+++ b/src/modules/nghttp2/nghttp2_mod.c
@@ -218,6 +218,14 @@ int pv_parse_nghttp2_name(pv_spec_p sp, str *in)
goto error;
}
break;
+   case 8:
+   if(strncasecmp(in->s, "pathfull", 8) == 0) {
+   sp->pvp.pvn.u.isname.name.n = 6;
+   } else {
+   goto error;
+   }
+   break;
+
default:
if(in->len > 2 && in->s[1] == ':'
&& (in->s[0] == 'h' || in->s[0] == 
'H')) {
@@ -275,6 +283,9 @@ int pv_get_nghttp2(sip_msg_t *msg, pv_param_t *param, 
pv_value_t *res)
return pv_get_strval(msg, param, res, 
&_ksr_nghttp2_ctx.srcip);
}
return pv_get_null(msg, param, res);
+   case 6: /* pathfull */
+   return pv_get_strval(msg, param, res, 
&_ksr_nghttp2_ctx.pathfull);
+
default:
return pv_get_null(msg, param, res);
}
diff --git a/src/modules/nghttp2/nghttp2_server.c 
b/src/modules/nghttp2/nghttp2_server.c
index dec339d7a15..8c17f847f87 100644
--- a/src/modules/nghttp2/nghttp2_server.c
+++ b/src/modules/nghttp2/nghttp2_server.c
@@ -179,7 +179,12 @@ static void delete_http2_stream_data(http2_stream_data 
*stream_data)
close(stream_data->fd);
}
free(stream_data->request_path);
-   free(stream_data->request_method);
+   if(stream_data->request_pathfull) {
+   free(stream_data->request_pathfull);
+   }
+   if(stream_data->request_method) {
+   free(stream_data->request_method);
+   }
free(stream_data);
 }
 
@@ -460,6 +465,7 @@ static int on_header_callback(nghttp2_session *session,
for(j = 0; j < valuelen && value[j] != '?'; ++j)
;
stream_data->request_path = 
percent_decode(value, j);
+   stream_data->request_pathfull = 
percent_decode(value, valuelen);
} else if(namelen == sizeof(METHOD) - 1
  && memcmp(METHOD, name, namelen) == 
0) {
if(stream_data->request_method) {
diff --git a/src/modules/nghttp2/nghttp2_server.h 
b/src/modules/nghttp2/nghttp2_server.h
index 34e6155abfc..cad3772d9ef 100644
--- a/src/modules/nghttp2/nghttp2_server.h
+++ b/src/modules/nghttp2/nghttp2_server.h
@@ -70,6 +70,7 @@ typedef struct http2_stream_data
 {
struct http2_stream_data *prev, *next;
char *request_path;
+   char *request_pathfull;
char *request_method;
int32_t stream_id;
int fd;
@@ -100,6 +101,7 @@ typedef struct ksr_nghttp2_ctx
int rplhdrs_n;
str method;
str path;
+   str pathfull;
str httpversion;
str data;
char srcipbuf[IP_ADDR_MAX_STR_SIZE];

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


[sr-dev] Re: [kamailio/kamailio] tcp/docs: Added tcp_accept_iplimit config sample (PR #3792)

2024-04-11 Thread Daniel-Constantin Mierla via sr-dev
Fine for me to add it to the default config file `etc/kamailio.cfg`, but the 
commit message should be updated to reflect that, not the prefix `tcp/docs:` is 
not suggesting at all it is about `etc/kamailio.cfg`.

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

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


[sr-dev] Re: [kamailio/kamailio] pike: fix documentation for reqs_density_per_unit (PR #3806)

2024-04-11 Thread Daniel-Constantin Mierla via sr-dev
Then I guess this can be closed without merging, right?

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

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


[sr-dev] Re: [kamailio/kamailio] cfgutils lock (PR #3808)

2024-04-11 Thread Daniel-Constantin Mierla via sr-dev
I have nothing explicitly against this enhancement, but I guess that if one 
wanted to have two strings to compose the lock key,  then could use 
`lock("$var(str1)$var(str2)")` as alternative to new variant 
`lock("$var(str1)", "$var(str2)")`. The hashing behind is probably not the same 
result, but from the perspective of taking in consideration two strings for 
hashing, should be a similar behaviour.

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

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


[sr-dev] Re: [kamailio/kamailio] core/tcp_main: Match protocol when lookup tcp/tls connections (PR #3810)

2024-04-11 Thread Daniel-Constantin Mierla via sr-dev
It can be merged from my point of view, although I am not the main developer of 
tcp/tls code in Kamailio, I guess it was considered that remote ip/port is 
enough, considering that tls is over a tcp connection, so it cannot overlap, 
but when listening on different sockets, it could be a conflict.

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

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


[sr-dev] git:master:7fb51562: nghttp2: $nghttp2(url) replaced with $nghttp2(path)

2024-04-10 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 7fb51562233c8b94a4bb38e4bcb8c7529937ed9e
URL: 
https://github.com/kamailio/kamailio/commit/7fb51562233c8b94a4bb38e4bcb8c7529937ed9e

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-10T07:31:18+02:00

nghttp2: $nghttp2(url) replaced with $nghttp2(path)

- match corresponding http2 header name

---

Modified: src/modules/nghttp2/nghttp2_mod.c
Modified: src/modules/nghttp2/nghttp2_server.c
Modified: src/modules/nghttp2/nghttp2_server.h

---

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

---

diff --git a/src/modules/nghttp2/nghttp2_mod.c 
b/src/modules/nghttp2/nghttp2_mod.c
index de7a13485bf..95918b1e6c8 100644
--- a/src/modules/nghttp2/nghttp2_mod.c
+++ b/src/modules/nghttp2/nghttp2_mod.c
@@ -186,15 +186,10 @@ int pv_parse_nghttp2_name(pv_spec_p sp, str *in)
if(sp == NULL || in == NULL || in->len <= 0)
return -1;
switch(in->len) {
-   case 3:
-   if(strncasecmp(in->s, "url", 3) == 0) {
-   sp->pvp.pvn.u.isname.name.n = 0;
-   } else {
-   goto error;
-   }
-   break;
case 4:
-   if(strncasecmp(in->s, "data", 4) == 0) {
+   if(strncasecmp(in->s, "path", 4) == 0) {
+   sp->pvp.pvn.u.isname.name.n = 0;
+   } else if(strncasecmp(in->s, "data", 4) == 0) {
sp->pvp.pvn.u.isname.name.n = 1;
} else if(strncasecmp(in->s, "size", 4) == 0) {
sp->pvp.pvn.u.isname.name.n = 2;
@@ -264,8 +259,8 @@ int pv_get_nghttp2(sip_msg_t *msg, pv_param_t *param, 
pv_value_t *res)
}
 
switch(param->pvn.u.isname.name.n) {
-   case 0: /* url */
-   return pv_get_strval(msg, param, res, 
&_ksr_nghttp2_ctx.url);
+   case 0: /* path */
+   return pv_get_strval(msg, param, res, 
&_ksr_nghttp2_ctx.path);
case 1: /* data */
return pv_get_strval(msg, param, res, 
&_ksr_nghttp2_ctx.data);
case 2: /* size */
diff --git a/src/modules/nghttp2/nghttp2_server.c 
b/src/modules/nghttp2/nghttp2_server.c
index 46b4e003462..38ae3673d46 100644
--- a/src/modules/nghttp2/nghttp2_server.c
+++ b/src/modules/nghttp2/nghttp2_server.c
@@ -494,8 +494,8 @@ static int on_request_recv(nghttp2_session *session,
_ksr_nghttp2_ctx.session_data = session_data;
_ksr_nghttp2_ctx.stream_data = stream_data;
 
-   _ksr_nghttp2_ctx.url.s = stream_data->request_path;
-   _ksr_nghttp2_ctx.url.len = strlen(_ksr_nghttp2_ctx.url.s);
+   _ksr_nghttp2_ctx.path.s = stream_data->request_path;
+   _ksr_nghttp2_ctx.path.len = strlen(_ksr_nghttp2_ctx.path.s);
 
_ksr_nghttp2_ctx.srcip.s = session_data->client_addr;
_ksr_nghttp2_ctx.srcip.len = strlen(_ksr_nghttp2_ctx.srcip.s);
diff --git a/src/modules/nghttp2/nghttp2_server.h 
b/src/modules/nghttp2/nghttp2_server.h
index dc1f5f148c6..bb5e446631c 100644
--- a/src/modules/nghttp2/nghttp2_server.h
+++ b/src/modules/nghttp2/nghttp2_server.h
@@ -98,7 +98,7 @@ typedef struct ksr_nghttp2_ctx
nghttp2_nv rplhdrs_v[KSR_NGHTTP2_RPLHDRS_SIZE];
int rplhdrs_n;
str method;
-   str url;
+   str path;
str httpversion;
str data;
char srcipbuf[IP_ADDR_MAX_STR_SIZE];

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


[sr-dev] git:master:9a43631e: nghttp2: store method in stream data

2024-04-10 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 9a43631e1707490c0781f9d2d10055663ebcde44
URL: 
https://github.com/kamailio/kamailio/commit/9a43631e1707490c0781f9d2d10055663ebcde44

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-10T08:07:30+02:00

nghttp2: store method in stream data

---

Modified: src/modules/nghttp2/nghttp2_server.c
Modified: src/modules/nghttp2/nghttp2_server.h

---

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

---

diff --git a/src/modules/nghttp2/nghttp2_server.c 
b/src/modules/nghttp2/nghttp2_server.c
index 38ae3673d46..dec339d7a15 100644
--- a/src/modules/nghttp2/nghttp2_server.c
+++ b/src/modules/nghttp2/nghttp2_server.c
@@ -179,6 +179,7 @@ static void delete_http2_stream_data(http2_stream_data 
*stream_data)
close(stream_data->fd);
}
free(stream_data->request_path);
+   free(stream_data->request_method);
free(stream_data);
 }
 
@@ -436,6 +437,7 @@ static int on_header_callback(nghttp2_session *session,
 {
http2_stream_data *stream_data;
const char PATH[] = ":path";
+   const char METHOD[] = ":method";
(void)flags;
(void)user_data;
 
@@ -446,15 +448,25 @@ static int on_header_callback(nghttp2_session *session,
}
stream_data = nghttp2_session_get_stream_user_data(
session, frame->hd.stream_id);
-   if(!stream_data || stream_data->request_path) {
+   if(!stream_data) {
break;
}
if(namelen == sizeof(PATH) - 1
&& memcmp(PATH, name, namelen) == 0) {
size_t j;
+   if(stream_data->request_path) {
+   break;
+   }
for(j = 0; j < valuelen && value[j] != '?'; ++j)
;
stream_data->request_path = 
percent_decode(value, j);
+   } else if(namelen == sizeof(METHOD) - 1
+ && memcmp(METHOD, name, namelen) == 
0) {
+   if(stream_data->request_method) {
+   break;
+   }
+   stream_data->request_method =
+   strndup((const char *)value, 
valuelen);
}
break;
}
@@ -497,8 +509,15 @@ static int on_request_recv(nghttp2_session *session,
_ksr_nghttp2_ctx.path.s = stream_data->request_path;
_ksr_nghttp2_ctx.path.len = strlen(_ksr_nghttp2_ctx.path.s);
 
-   _ksr_nghttp2_ctx.srcip.s = session_data->client_addr;
-   _ksr_nghttp2_ctx.srcip.len = strlen(_ksr_nghttp2_ctx.srcip.s);
+   if(stream_data->request_method) {
+   _ksr_nghttp2_ctx.method.s = stream_data->request_method;
+   _ksr_nghttp2_ctx.method.len = strlen(_ksr_nghttp2_ctx.method.s);
+   }
+
+   if(session_data->client_addr) {
+   _ksr_nghttp2_ctx.srcip.s = session_data->client_addr;
+   _ksr_nghttp2_ctx.srcip.len = strlen(_ksr_nghttp2_ctx.srcip.s);
+   }
 
ksr_event_route();
 
diff --git a/src/modules/nghttp2/nghttp2_server.h 
b/src/modules/nghttp2/nghttp2_server.h
index bb5e446631c..34e6155abfc 100644
--- a/src/modules/nghttp2/nghttp2_server.h
+++ b/src/modules/nghttp2/nghttp2_server.h
@@ -70,6 +70,7 @@ typedef struct http2_stream_data
 {
struct http2_stream_data *prev, *next;
char *request_path;
+   char *request_method;
int32_t stream_id;
int fd;
 } http2_stream_data;

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


[sr-dev] git:master:2da9ed93: Makefile.groups: added group for nghttp2 module

2024-04-09 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 2da9ed9395ef04f889f4594753fc5f4cf7a75b29
URL: 
https://github.com/kamailio/kamailio/commit/2da9ed9395ef04f889f4594753fc5f4cf7a75b29

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-09T19:28:25+02:00

Makefile.groups: added group for nghttp2 module

---

Modified: src/Makefile.groups

---

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

---

diff --git a/src/Makefile.groups b/src/Makefile.groups
index fec21d47bdd..ee514014be2 100644
--- a/src/Makefile.groups
+++ b/src/Makefile.groups
@@ -235,6 +235,9 @@ mod_list_ruxc=ruxc
 # - modules depending on microhttpd library
 mod_list_microhttpd=microhttpd
 
+# - modules depending on nghttp2 library
+mod_list_nghttp2=nghttp2
+
 # - modules depending on libgcrypt library
 mod_list_gcrypt=gcrypt
 
@@ -288,6 +291,7 @@ mod_list_all=$(sort $(mod_list_basic) $(mod_list_extra) \
   $(mod_list_tlsa) \
   $(mod_list_tls_wolfssl) \
   $(mod_list_microhttpd) \
+  $(mod_list_nghttp2) \
   $(mod_list_gcrypt) \
   $(mod_list_rtp_media_server)
 
@@ -542,6 +546,9 @@ module_group_kruxc=$(mod_list_ruxc)
 # K microhttpd module
 module_group_kmicrohttpd=$(mod_list_microhttpd)
 
+# K nghttp2 module
+module_group_knghttp2=$(mod_list_nghttp2)
+
 # K gcrypt module
 module_group_kgcrypt=$(mod_list_gcrypt)
 

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


[sr-dev] git:master:3439eb44: nghttp2: docs for nghttp2_reply_header(...) function

2024-04-09 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 3439eb44087b044cb9caaaf8af8df155d6a42bba
URL: 
https://github.com/kamailio/kamailio/commit/3439eb44087b044cb9caaaf8af8df155d6a42bba

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-09T19:15:32+02:00

nghttp2: docs for nghttp2_reply_header(...) function

---

Modified: src/modules/nghttp2/doc/nghttp2_admin.xml

---

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

---

diff --git a/src/modules/nghttp2/doc/nghttp2_admin.xml 
b/src/modules/nghttp2/doc/nghttp2_admin.xml
index 4589bc145fe..54cde446de6 100644
--- a/src/modules/nghttp2/doc/nghttp2_admin.xml
+++ b/src/modules/nghttp2/doc/nghttp2_admin.xml
@@ -129,17 +129,39 @@ end
Functions


-   nghttp2_reply(code, reason, ctype, 
body)
+   nghttp2_reply(code, body)


-   Send back a reply with content-type and body.
+   Send back a reply with body. The body can be empty string. Both 
parameters
+   can contain variables.


nghttp2_reply usage

 ...
 event_route[nghttp2:request] {
-nghttp2_reply("200", "OK", "text/html",
+nghttp2_reply("200",
+"htmlbodyOK/body/html");
+}
+...
+
+   
+   
+   
+   
+   nghttp2_reply_header(name, 
value)
+   
+   
+   Set a header to be added to reply. There can be up to 15 
headers.
+   
+   
+   nghttp2_reply usage
+   
+...
+event_route[nghttp2:request] {
+nghttp2_reply_header("Content-Type", "text/html");
+nghttp2_reply_header("My-Header", "xyz");
+nghttp2_reply("200",
 "htmlbodyOK/body/html");
 }
 ...

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


[sr-dev] git:master:ec847027: nghttp2: separate function for setting response headers

2024-04-09 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: ec847027effacb0f7003a3b12ff33017e10dc0c1
URL: 
https://github.com/kamailio/kamailio/commit/ec847027effacb0f7003a3b12ff33017e10dc0c1

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-09T19:10:57+02:00

nghttp2: separate function for setting response headers

---

Modified: src/modules/nghttp2/nghttp2_mod.c
Modified: src/modules/nghttp2/nghttp2_server.c
Modified: src/modules/nghttp2/nghttp2_server.h

---

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

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


[sr-dev] git:master:f3a5fb51: nghttp2: convert to debug messages

2024-04-09 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: f3a5fb519d1e6a6670e44175332dc7889f8fb99e
URL: 
https://github.com/kamailio/kamailio/commit/f3a5fb519d1e6a6670e44175332dc7889f8fb99e

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-09T17:21:40+02:00

nghttp2: convert to debug messages

---

Modified: src/modules/nghttp2/nghttp2_server.c

---

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

---

diff --git a/src/modules/nghttp2/nghttp2_server.c 
b/src/modules/nghttp2/nghttp2_server.c
index 075ff6e0b23..bdbec4a8c58 100644
--- a/src/modules/nghttp2/nghttp2_server.c
+++ b/src/modules/nghttp2/nghttp2_server.c
@@ -240,7 +240,7 @@ static void delete_http2_session_data(http2_session_data 
*session_data)
 {
http2_stream_data *stream_data;
SSL *ssl = bufferevent_openssl_get_ssl(session_data->bev);
-   fprintf(stderr, "%s disconnected\n", session_data->client_addr);
+   LM_ERR("%s disconnected\n", session_data->client_addr);
if(ssl) {
SSL_shutdown(ssl);
}
@@ -517,8 +517,7 @@ static int on_request_recv(nghttp2_session *session,
}
return 0;
}
-   fprintf(stderr, "%s GET %s\n", session_data->client_addr,
-   stream_data->request_path);
+   LM_DBG("%s GET %s\n", session_data->client_addr, 
stream_data->request_path);
if(!check_path(stream_data->request_path)) {
if(error_reply(session, stream_data) != 0) {
return NGHTTP2_ERR_CALLBACK_FAILURE;
@@ -676,7 +675,7 @@ static void eventcb(struct bufferevent *bev, short events, 
void *ptr)
SSL *ssl;
(void)bev;
 
-   fprintf(stderr, "%s connected\n", session_data->client_addr);
+   LM_DBG("%s connected\n", session_data->client_addr);
 
ssl = bufferevent_openssl_get_ssl(session_data->bev);
 
@@ -690,8 +689,7 @@ static void eventcb(struct bufferevent *bev, short events, 
void *ptr)
 #endif /* OPENSSL_VERSION_NUMBER >= 0x10002000L */
 
if(alpn == NULL || alpnlen != 2 || memcmp("h2", alpn, 2) != 0) {
-   fprintf(stderr, "%s h2 is not negotiated\n",
-   session_data->client_addr);
+   LM_DBG("%s h2 is not negotiated\n", 
session_data->client_addr);
delete_http2_session_data(session_data);
return;
}
@@ -707,11 +705,11 @@ static void eventcb(struct bufferevent *bev, short 
events, void *ptr)
return;
}
if(events & BEV_EVENT_EOF) {
-   fprintf(stderr, "%s EOF\n", session_data->client_addr);
+   LM_DBG("%s EOF\n", session_data->client_addr);
} else if(events & BEV_EVENT_ERROR) {
-   fprintf(stderr, "%s network error\n", 
session_data->client_addr);
+   LM_DBG("%s network error\n", session_data->client_addr);
} else if(events & BEV_EVENT_TIMEOUT) {
-   fprintf(stderr, "%s timeout\n", session_data->client_addr);
+   LM_DBG("%s timeout\n", session_data->client_addr);
}
delete_http2_session_data(session_data);
 }

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


[sr-dev] git:master:20fd1c44: nghttpd2: docs - update required libnghttp2 version

2024-04-09 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 20fd1c44916f45b7dec6253f6f105aa606839281
URL: 
https://github.com/kamailio/kamailio/commit/20fd1c44916f45b7dec6253f6f105aa606839281

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-09T17:18:05+02:00

nghttpd2: docs - update required libnghttp2 version

---

Modified: src/modules/nghttp2/doc/nghttp2_admin.xml

---

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

---

diff --git a/src/modules/nghttp2/doc/nghttp2_admin.xml 
b/src/modules/nghttp2/doc/nghttp2_admin.xml
index 80465a7a49c..4589bc145fe 100644
--- a/src/modules/nghttp2/doc/nghttp2_admin.xml
+++ b/src/modules/nghttp2/doc/nghttp2_admin.xml
@@ -43,7 +43,7 @@



-   libnghttp2 - libnghttpd 
library (v1.61.0+)
+   libnghttp2 - libnghttpd 
library (v1.43.0+)




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


[sr-dev] git:master:740b73e6: nghttp2: Makefile - link with additional libraries

2024-04-09 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 740b73e6dd174f2946e29cfc00c2a72063fd6645
URL: 
https://github.com/kamailio/kamailio/commit/740b73e6dd174f2946e29cfc00c2a72063fd6645

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-09T17:10:47+02:00

nghttp2: Makefile - link with additional libraries

---

Modified: src/modules/nghttp2/Makefile

---

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

---

diff --git a/src/modules/nghttp2/Makefile b/src/modules/nghttp2/Makefile
index d6b2dd84674..f71ba0c3556 100644
--- a/src/modules/nghttp2/Makefile
+++ b/src/modules/nghttp2/Makefile
@@ -38,7 +38,55 @@ else
LEVENTLIBS = $(shell $(LEVENT_BUILDER) --libs)
 endif
 
-DEFS+=$(LNGHTTP2DEFS) $(LEVENTDEFS)
-LIBS=$(LNGHTTP2LIBS) $(LEVENTLIBS)
+
+ifeq ($(CROSS_COMPILE),)
+LEVENTSSL_BUILDER = $(shell \
+   if pkg-config --exists libevent_openssl; then \
+   echo 'pkg-config libevent_openssl'; \
+   fi)
+endif
+
+ifeq ($(LEVENTSSL_BUILDER),)
+   LEVENTSSLDEFS=-I$(LOCALBASE)/include -I$(SYSBASE)/include
+   LEVENTSSLLIBS=-L$(LOCALBASE)/lib -levent_openssl
+else
+   LEVENTSSLDEFS = $(shell $(LEVENTSSL_BUILDER) --cflags)
+   LEVENTSSLLIBS = $(shell $(LEVENTSSL_BUILDER) --libs)
+endif
+
+
+ifeq ($(CROSS_COMPILE),)
+LSSL_BUILDER=$(shell \
+   if pkg-config --exists libssl; then \
+   echo 'pkg-config libssl'; \
+   fi)
+LCRYPTO_BUILDER=$(shell \
+   if pkg-config --exists libcrypto; then \
+   echo 'pkg-config libcrypto'; \
+   fi)
+endif
+
+ifneq ($(LSSL_BUILDER),)
+   LSSLDEFS = $(shell $(LSSL_BUILDER) --cflags)
+   LSSLLIBS = $(shell $(LSSL_BUILDER) --libs)
+
+ifneq ($(CRYPTO_BUILDER),)
+   LCRYPTODEFS = $(shell $(LCRYPTO_BUILDER) --cflags)
+   LCRYPTOLIBS = $(shell $(LCRYPTO_BUILDER) --libs)
+endif
+
+else
+   LSSLDEFS = -I$(LOCALBASE)/ssl/include
+   LSSLLIBS = -L$(LOCALBASE)/lib -L$(LOCALBASE)/ssl/lib \
+   -L$(LOCALBASE)/lib64 -L$(LOCALBASE)/ssl/lib64 \
+   -lssl -lcrypto
+   LCRYPTODEFS =
+   LCRYPTOLIBS =
+endif
+
+
+
+DEFS+=$(LNGHTTP2DEFS) $(LEVENTDEFS) $(LEVENTSSLDEFS) $(LSSLDEFS) $(LCRYPTODEFS)
+LIBS=$(LNGHTTP2LIBS) $(LEVENTLIBS) $(LEVENTSSLLIBS) $(LSSLLIBS) $(LCRYPTOLIBS)
 
 include ../../Makefile.modules

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


[sr-dev] git:master:6333db8f: nghttp2: compatibility with older libnghttp2 versions

2024-04-09 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 6333db8fb19bd8684476914b3fe4d3ebda36940a
URL: 
https://github.com/kamailio/kamailio/commit/6333db8fb19bd8684476914b3fe4d3ebda36940a

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-09T17:10:47+02:00

nghttp2: compatibility with older libnghttp2 versions

---

Modified: src/modules/nghttp2/nghttp2_server.c

---

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

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


[sr-dev] git:master:d55cd7e6: http_client: docs for http_client_response_headers_clear()

2024-04-08 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: d55cd7e613c787ce0dd91abad036d4ecd7556023
URL: 
https://github.com/kamailio/kamailio/commit/d55cd7e613c787ce0dd91abad036d4ecd7556023

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-08T17:03:19+02:00

http_client: docs for http_client_response_headers_clear()

---

Modified: src/modules/http_client/doc/http_client_admin.xml

---

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

---

diff --git a/src/modules/http_client/doc/http_client_admin.xml 
b/src/modules/http_client/doc/http_client_admin.xml
index 0a8f147eb0e..e81d912c11e 100644
--- a/src/modules/http_client/doc/http_client_admin.xml
+++ b/src/modules/http_client/doc/http_client_admin.xml
@@ -1047,6 +1047,26 @@ http_client_response_headers_set("1");
 http_client_request_v2pk("GET", 
"http://api.com/index.php?r_uri=$(ru{s.escape.param})f_uri=$(fu{s.escape.param})",
   "", "X-Token: abc", "$var(result)");
 xinfo("response header: $httprhdr(X-Header)\n");
+...
+   
+   
+   
+   
+   
+   http_client_response_headers_clear()
+   
+   
+   Clear stored response headers, if not 
explicitely done, it happens
+   when the next HTTP request is performed.
+   
+   
+   
http_client_response_headers_clear() usage
+   
+...
+http_client_request_v2pk("GET", 
"http://api.com/index.php?r_uri=$(ru{s.escape.param})f_uri=$(fu{s.escape.param})",
+  "", "X-Token: abc", "$var(result)");
+xinfo("response header: $httprhdr(X-Header)\n");
+http_client_response_headers_clear();
 ...



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


[sr-dev] git:master:cdf0633b: http_client: added http_client_response_headers_clear()

2024-04-08 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: cdf0633b6b51bbfb7eb785715358c88aeb4c6a40
URL: 
https://github.com/kamailio/kamailio/commit/cdf0633b6b51bbfb7eb785715358c88aeb4c6a40

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-08T14:14:58+02:00

http_client: added http_client_response_headers_clear()

- clear response headers
- if not explicitely done, it happens when next http request is
  performed

---

Modified: src/modules/http_client/http_client.c

---

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

---

diff --git a/src/modules/http_client/http_client.c 
b/src/modules/http_client/http_client.c
index c8af2f64901..27310829d0e 100644
--- a/src/modules/http_client/http_client.c
+++ b/src/modules/http_client/http_client.c
@@ -160,6 +160,8 @@ static int w_http_query_request_v2pk(struct sip_msg *_m, 
char *_met, char *_url,
char *_body, char *_hdrs, char *_result);
 static int w_http_client_response_headers_set(
sip_msg_t *_m, char *_pval, char *_p2);
+static int w_http_client_response_headers_clear(
+   sip_msg_t *_m, char *_p1, char *_p2);
 
 /* forward function */
 static int curl_con_param(modparam_t type, void *val);
@@ -205,6 +207,9 @@ static cmd_export_t cmds[] = {
{"http_client_response_headers_set",
(cmd_function)w_http_client_response_headers_set, 1, 
fixup_igp_null,
fixup_free_igp_null, ANY_ROUTE},
+   {"http_client_response_headers_clear",
+   (cmd_function)w_http_client_response_headers_clear, 1, 0,
+   0, ANY_ROUTE},
{"bind_http_client",  (cmd_function)bind_httpc_api,  0, 0, 0, 0},
{0,0,0,0,0,0}
 };
@@ -1184,6 +1189,16 @@ static int w_http_client_response_headers_set(
return ki_http_client_response_headers_set(_m, ival);
 }
 
+/*!
+ *
+ */
+static int w_http_client_response_headers_clear(
+   sip_msg_t *_m, char *_pval, char *_p2)
+{
+   http_client_response_headers_reset();
+   return 1;
+}
+
 /*!
  * Parse arguments to  pv $curlerror
  */

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


[sr-dev] git:master:5ba76f65: nghttp2: new module for supporting direct http2 connections

2024-04-08 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 5ba76f65f5c2ea522a2e6629bd845918258a80cf
URL: 
https://github.com/kamailio/kamailio/commit/5ba76f65f5c2ea522a2e6629bd845918258a80cf

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-08T21:25:11+02:00

nghttp2: new module for supporting direct http2 connections

- initial import version

---

Added: src/modules/nghttp2/Makefile
Added: src/modules/nghttp2/README
Added: src/modules/nghttp2/doc/Makefile
Added: src/modules/nghttp2/doc/nghttp2.xml
Added: src/modules/nghttp2/doc/nghttp2_admin.xml
Added: src/modules/nghttp2/nghttp2_mod.c
Added: src/modules/nghttp2/nghttp2_server.c
Added: src/modules/nghttp2/nghttp2_server.h

---

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

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


[sr-dev] Re: [kamailio/kamailio] pike: fix documentation for reqs_density_per_unit (PR #3806)

2024-04-08 Thread Daniel-Constantin Mierla via sr-dev
Probably the code has to be checked, it used to be some warming up based on ip 
address prefix (no longer sure, but something in the direction of: for x.y.z.w, 
first keep x, then x.y, then x.y.z and then block the traffic), but the it was 
the merge with SER modules and not sure what ended up to be. Also, maybe it 
block immediately if it is in the same subnetwork, source code should be 
authoritative here and should be checked before merging.

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

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


[sr-dev] git:master:b3562c6b: http_client: docs for http_client_response_headers_set()

2024-04-07 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: b3562c6b10accec829a15c25fd56e53c8c89a87e
URL: 
https://github.com/kamailio/kamailio/commit/b3562c6b10accec829a15c25fd56e53c8c89a87e

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-07T15:50:33+02:00

http_client: docs for http_client_response_headers_set()

---

Modified: src/modules/http_client/doc/http_client_admin.xml

---

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

---

diff --git a/src/modules/http_client/doc/http_client_admin.xml 
b/src/modules/http_client/doc/http_client_admin.xml
index 6424582074c..0a8f147eb0e 100644
--- a/src/modules/http_client/doc/http_client_admin.xml
+++ b/src/modules/http_client/doc/http_client_admin.xml
@@ -1026,6 +1026,27 @@ http_client_request_v2pk("GET", 
"http://api.com/index.php?r_uri=$(ru{s.escape.pa
 switch ($rc) {
 ...
 }
+...
+   
+   
+   
+   
+   
+   http_client_response_headers_set(mode)
+   
+   
+   Set if the HTTP response header should be 
stored (when mode is 1)
+   or not (when mode is 0). If mode is 0, then it 
also clears previously
+   stored response headers.
+   
+   
+   
http_client_response_headers_set() usage
+   
+...
+http_client_response_headers_set("1");
+http_client_request_v2pk("GET", 
"http://api.com/index.php?r_uri=$(ru{s.escape.param})f_uri=$(fu{s.escape.param})",
+  "", "X-Token: abc", "$var(result)");
+xinfo("response header: $httprhdr(X-Header)\n");
 ...



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


[sr-dev] git:master:fdb9c938: http_client: docs for $httprhdr(name)

2024-04-07 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: fdb9c938639b3fea29b8c1ba6e6e412a5da8a7f3
URL: 
https://github.com/kamailio/kamailio/commit/fdb9c938639b3fea29b8c1ba6e6e412a5da8a7f3

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-07T10:27:11+02:00

http_client: docs for $httprhdr(name)

---

Modified: src/modules/http_client/doc/http_client_admin.xml

---

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

---

diff --git a/src/modules/http_client/doc/http_client_admin.xml 
b/src/modules/http_client/doc/http_client_admin.xml
index f5eb42f7b91..6424582074c 100644
--- a/src/modules/http_client/doc/http_client_admin.xml
+++ b/src/modules/http_client/doc/http_client_admin.xml
@@ -716,7 +716,8 @@ modparam("http_client", "netinterface", "eth0")

response_headers (int)

-   Set to 1 in order to store HTTP response headers.
+   Set to 1 in order to store HTTP response headers. A 
header value
+   can be retrieved with $httprhdr(name).



@@ -1031,7 +1032,7 @@ switch ($rc) {



-   Pseudovariables
+   Pseudo-Variables


$curlerror(error)
@@ -1044,6 +1045,15 @@ switch ($rc) {
http://curl.haxx.se/libcurl/c/libcurl-errors.html


+   
+   
+   $httprhdr(name)
+   
+   
+   Return response header value. It requires 
response_headers parameter
+   to be set to 1.
+   
+   


RPC Commands

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


[sr-dev] git:master:00198b8d: http_client: added http_client_response_headers_set(mode)

2024-04-07 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 00198b8d863a94ea593b7473c88c35e6cad67014
URL: 
https://github.com/kamailio/kamailio/commit/00198b8d863a94ea593b7473c88c35e6cad67014

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-07T10:41:22+02:00

http_client: added http_client_response_headers_set(mode)

- control if http response header should be set or not

---

Modified: src/modules/http_client/http_client.c

---

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

---

diff --git a/src/modules/http_client/http_client.c 
b/src/modules/http_client/http_client.c
index 4bea581d50f..c8af2f64901 100644
--- a/src/modules/http_client/http_client.c
+++ b/src/modules/http_client/http_client.c
@@ -158,6 +158,8 @@ static int w_http_query_request(struct sip_msg *_m, char 
*_met, char *_url,
char *_body, char *_hdrs, char *_result);
 static int w_http_query_request_v2pk(struct sip_msg *_m, char *_met, char 
*_url,
char *_body, char *_hdrs, char *_result);
+static int w_http_client_response_headers_set(
+   sip_msg_t *_m, char *_pval, char *_p2);
 
 /* forward function */
 static int curl_con_param(modparam_t type, void *val);
@@ -200,6 +202,9 @@ static cmd_export_t cmds[] = {
{"http_get_redirect", (cmd_function)w_curl_get_redirect, 2, 
fixup_curl_get_redirect,
fixup_free_curl_get_redirect,
REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE},
+   {"http_client_response_headers_set",
+   (cmd_function)w_http_client_response_headers_set, 1, 
fixup_igp_null,
+   fixup_free_igp_null, ANY_ROUTE},
{"bind_http_client",  (cmd_function)bind_httpc_api,  0, 0, 0, 0},
{0,0,0,0,0,0}
 };
@@ -1149,6 +1154,36 @@ static int w_http_query_request(sip_msg_t *_m, char 
*_met, char *_url,
return ki_http_request_helper(_m, , , , , 0, dst);
 }
 
+/*!
+ *
+ */
+static int ki_http_client_response_headers_set(sip_msg_t *_m, int ival)
+{
+   if(ival == 0) {
+   http_client_response_headers_reset();
+   http_client_response_headers_param = 0;
+   } else {
+   http_client_response_headers_param = 1;
+   }
+
+   return 1;
+}
+
+/*!
+ *
+ */
+static int w_http_client_response_headers_set(
+   sip_msg_t *_m, char *_pval, char *_p2)
+{
+   int ival = 0;
+
+   if(fixup_get_ivalue(_m, (gparam_t *)_pval, ) < 0) {
+   LM_ERR("failed to get parameter value\n");
+   return -1;
+   }
+   return ki_http_client_response_headers_set(_m, ival);
+}
+
 /*!
  * Parse arguments to  pv $curlerror
  */

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


[sr-dev] git:master:90d78b7b: http_clinet: added variable $httprhdr(name) - get response header value

2024-04-07 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 90d78b7b2bfc1899c1b64c2db8a353d43df68218
URL: 
https://github.com/kamailio/kamailio/commit/90d78b7b2bfc1899c1b64c2db8a353d43df68218

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-07T10:15:41+02:00

http_clinet: added variable $httprhdr(name) - get response header value

---

Modified: src/modules/http_client/functions.c
Modified: src/modules/http_client/functions.h
Modified: src/modules/http_client/http_client.c

---

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

---

diff --git a/src/modules/http_client/functions.c 
b/src/modules/http_client/functions.c
index e910b514bbf..0004eb3ddc1 100644
--- a/src/modules/http_client/functions.c
+++ b/src/modules/http_client/functions.c
@@ -39,6 +39,7 @@
 #include "../../core/pvar.h"
 #include "../../core/route_struct.h"
 #include "../../core/ut.h"
+#include "../../core/trim.h"
 #include "../../core/mem/mem.h"
 #include "../../core/parser/msg_parser.h"
 
@@ -127,6 +128,46 @@ void http_client_response_headers_reset(void)
_http_client_response_headers = NULL;
 }
 
+/**
+ *
+ */
+int http_client_response_headers_get(str *hname, str *hbody)
+{
+   httpc_hdr_t *it;
+   char *p;
+
+   if(_http_client_response_headers == NULL) {
+   return -1;
+   }
+   if(hname == NULL || hname->len <= 0 || hbody == NULL) {
+   return -1;
+   }
+   for(it = _http_client_response_headers; it != NULL; it = it->next) {
+   if(it->name.len == 0 && it->hbuf.s[0] != ' ' && it->hbuf.s[0] 
!= '\t'
+   && it->hbuf.s[0] != '\r' && it->hbuf.s[0] != 
'\n') {
+   /* parsing */
+   p = strchr(it->hbuf.s, ':');
+   if(p == NULL) {
+   continue;
+   }
+   it->name.s = it->hbuf.s;
+   it->name.len = p - it->name.s;
+   trim(>name);
+   p++;
+   it->body.s = p;
+   it->body.len = it->hbuf.s + it->hbuf.len - it->body.s;
+   trim(>body);
+   }
+   if(it->name.len == hname->len
+   && strncasecmp(it->name.s, hname->s, 
hname->len) == 0) {
+   hbody->s = it->body.s;
+   hbody->len = it->body.len;
+   return 0;
+   }
+   }
+   return -1;
+}
+
 /*
  * curl write function that saves received data as zero terminated
  * to stream. Returns the amount of data taken care of.
diff --git a/src/modules/http_client/functions.h 
b/src/modules/http_client/functions.h
index d0c66c64e66..30c326bd0f8 100644
--- a/src/modules/http_client/functions.h
+++ b/src/modules/http_client/functions.h
@@ -78,4 +78,7 @@ int http_client_request_c(sip_msg_t *_m, char *_url, str 
*_dst, char *_body,
 
 char *http_get_content_type(const str *connection);
 
+int http_client_response_headers_get(str *hname, str *hbody);
+void http_client_response_headers_reset(void);
+
 #endif /* CURL_FUNCTIONS_H */
diff --git a/src/modules/http_client/http_client.c 
b/src/modules/http_client/http_client.c
index d640d772ad3..4bea581d50f 100644
--- a/src/modules/http_client/http_client.c
+++ b/src/modules/http_client/http_client.c
@@ -164,6 +164,8 @@ static int curl_con_param(modparam_t type, void *val);
 static int pv_parse_curlerror(pv_spec_p sp, str *in);
 static int pv_get_curlerror(
struct sip_msg *msg, pv_param_t *param, pv_value_t *res);
+static int pv_parse_httprhdr(pv_spec_p sp, str *in);
+static int pv_get_httprhdr(sip_msg_t *msg, pv_param_t *param, pv_value_t *res);
 
 /* clang-format off */
 /* Exported functions */
@@ -237,6 +239,8 @@ static param_export_t params[] = {
 static pv_export_t mod_pvs[] = {
{{"curlerror", (sizeof("curlerror")-1)}, /* Curl error codes */
PVT_OTHER, pv_get_curlerror, 0, pv_parse_curlerror, 0, 0, 0},
+   {{"httprhdr", (sizeof("httprhdr")-1)}, /* HTTP response header */
+   PVT_OTHER, pv_get_httprhdr, 0, pv_parse_httprhdr, 0, 0, 0},
 
{{0, 0}, 0, 0, 0, 0, 0, 0, 0}
 };
@@ -1193,6 +1197,35 @@ static int pv_get_curlerror(
return pv_get_strval(msg, param, res, );
 }
 
+/**
+ *
+ */
+static int pv_parse_httprhdr(pv_spec_p sp, str *in)
+{
+   if(sp == NULL || in == NULL || in->len <= 0)
+   return -1;
+
+   sp->pvp.pvn.type = PV_NAME_INTSTR;
+   sp->pvp.pvn.u.isname.type = AVP_VAL_STR;
+

[sr-dev] git:master:f7e0a189: http_client: docs for modparam response_headers

2024-04-07 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: f7e0a189362cc9f5ab8962868496c4b49b72a76c
URL: 
https://github.com/kamailio/kamailio/commit/f7e0a189362cc9f5ab8962868496c4b49b72a76c

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-07T09:33:04+02:00

http_client: docs for modparam response_headers

---

Modified: src/modules/http_client/doc/http_client_admin.xml

---

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

---

diff --git a/src/modules/http_client/doc/http_client_admin.xml 
b/src/modules/http_client/doc/http_client_admin.xml
index 2fb918d5997..f5eb42f7b91 100644
--- a/src/modules/http_client/doc/http_client_admin.xml
+++ b/src/modules/http_client/doc/http_client_admin.xml
@@ -709,6 +709,25 @@ http_follow_redirect = no

 ...
 modparam("http_client", "netinterface", "eth0")
+...
+   
+   
+   
+   
+   response_headers (int)
+   
+   Set to 1 in order to store HTTP response headers.
+   
+   
+   
+   Default value is 0.
+   
+   
+   
+   Set response_headers 
parameter
+   
+...
+modparam("http_client", "response_headers", 1)
 ...



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


[sr-dev] git:master:8f364976: http_client: option to store http response headers

2024-04-07 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 8f364976a81358de39cb5d675b3703f3f65a0d59
URL: 
https://github.com/kamailio/kamailio/commit/8f364976a81358de39cb5d675b3703f3f65a0d59

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-07T09:20:33+02:00

http_client: option to store http response headers

- new modparam response_headers has to be set to 1

---

Modified: src/modules/http_client/functions.c
Modified: src/modules/http_client/http_client.c
Modified: src/modules/http_client/http_client.h

---

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

---

diff --git a/src/modules/http_client/functions.c 
b/src/modules/http_client/functions.c
index df6b8233b51..e910b514bbf 100644
--- a/src/modules/http_client/functions.c
+++ b/src/modules/http_client/functions.c
@@ -75,6 +75,58 @@ typedef struct
 } curl_query_t;
 
 
+/**
+ *
+ */
+typedef struct httpc_hdr
+{
+   str hbuf;
+   str name;
+   str body;
+   struct httpc_hdr *next;
+} httpc_hdr_t;
+
+/**
+ *
+ */
+httpc_hdr_t *_http_client_response_headers = NULL;
+
+/**
+ *
+ */
+httpc_hdr_t *httpc_hdr_block_add(httpc_hdr_t **head, char *s, int len)
+{
+   httpc_hdr_t *nv;
+   nv = pkg_mallocxz(sizeof(httpc_hdr_t) + (len + 1) * sizeof(char));
+   if(!nv) {
+   PKG_MEM_ERROR;
+   return 0;
+   }
+   nv->hbuf.s = (char *)nv + sizeof(httpc_hdr_t);
+   memcpy(nv->hbuf.s, s, len);
+   nv->hbuf.len = len;
+   nv->next = *head;
+   *head = nv;
+
+   return nv;
+}
+
+/**
+ *
+ */
+void http_client_response_headers_reset(void)
+{
+   httpc_hdr_t *it0;
+   httpc_hdr_t *it1;
+   it0 = _http_client_response_headers;
+   while(it0 != NULL) {
+   it1 = it0->next;
+   pkg_free(it0);
+   it0 = it1;
+   }
+   _http_client_response_headers = NULL;
+}
+
 /*
  * curl write function that saves received data as zero terminated
  * to stream. Returns the amount of data taken care of.
@@ -112,6 +164,20 @@ size_t write_function(void *ptr, size_t size, size_t 
nmemb, void *stream_ptr)
 }
 
 
+size_t http_client_response_header_cb(
+   char *b, size_t size, size_t nitems, void *userdata)
+{
+   size_t numbytes;
+
+   numbytes = size * nitems;
+   LM_DBG("http response header [%.*s]\n", (int)numbytes, b);
+
+   httpc_hdr_block_add(&_http_client_response_headers, b, (int)numbytes);
+
+   return numbytes;
+   ;
+}
+
 /*! Send query to server, optionally post data.
  */
 static int curL_request_url(struct sip_msg *_m, const char *_met,
@@ -288,6 +354,12 @@ static int curL_request_url(struct sip_msg *_m, const char 
*_met,
res |= curl_easy_setopt(curl, CURLOPT_INTERFACE, 
params->netinterface);
}
 
+   if(http_client_response_headers_param != 0) {
+   http_client_response_headers_reset();
+   res |= curl_easy_setopt(
+   curl, CURLOPT_HEADERFUNCTION, 
http_client_response_header_cb);
+   }
+
res |= curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_function);
res |= curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)());
 
diff --git a/src/modules/http_client/http_client.c 
b/src/modules/http_client/http_client.c
index 91573425990..d640d772ad3 100644
--- a/src/modules/http_client/http_client.c
+++ b/src/modules/http_client/http_client.c
@@ -117,6 +117,8 @@ unsigned int default_query_result = 1;
 /*!< Default download size for result of query function. 0=disabled (no limit) 
*/
 unsigned int default_query_maxdatasize = 0;
 
+int http_client_response_headers_param = 0;
+
 str http_client_config_file = STR_NULL;
 
 static curl_version_info_data *curl_info;
@@ -224,6 +226,7 @@ static param_export_t params[] = {
{"query_result", PARAM_INT, _query_result },
{"query_maxdatasize", PARAM_INT, _query_maxdatasize },
{"netinterface", PARAM_STRING,  _netinterface },
+   {"response_headers", PARAM_INT, _client_response_headers_param },
{0, 0, 0}
 };
 
diff --git a/src/modules/http_client/http_client.h 
b/src/modules/http_client/http_client.h
index c56f411df1f..42ee1e914f8 100644
--- a/src/modules/http_client/http_client.h
+++ b/src/modules/http_client/http_client.h
@@ -75,6 +75,8 @@ extern counter_handle_t connfail;  /* Failed Connection 
attempts */
 
 extern char *default_netinterface;
 
+extern int http_client_response_headers_param; /* store http response headers 
*/
+
 /* Curl  stream object  */
 typedef struct
 {

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


[sr-dev] git:master:9b3b8ec9: corex: docs for dns_file parameter

2024-04-06 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 9b3b8ec968c6f7bda0d10a0d4fe593a92560ee7d
URL: 
https://github.com/kamailio/kamailio/commit/9b3b8ec968c6f7bda0d10a0d4fe593a92560ee7d

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-06T08:35:19+02:00

corex: docs for dns_file parameter

---

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

---

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

---

diff --git a/src/modules/corex/doc/corex_admin.xml 
b/src/modules/corex/doc/corex_admin.xml
index d5cfe1db477..3cdad0aa2a5 100644
--- a/src/modules/corex/doc/corex_admin.xml
+++ b/src/modules/corex/doc/corex_admin.xml
@@ -162,6 +162,41 @@ modparam("corex", "alias_subdomains", 
"udp:sip-router.org:5060")
 modparam("corex", "dns_cache", 
"type=A;name=kamailio.org;addr=193.22.119.66;ttl=360;flags=0")
 modparam("corex", "dns_cache", 
"type=;name=kamailio.org;addr=2a00:d60:0:400::2;ttl=360;flags=0")
 ...
+
+   
+   
+   
+   dns_file (string)
+   
+   Path to the file from where to load dns_cache records. It can 
be set
+   many times to add more than one file.
+   
+   
+   Inside the file, the dns_cache record has to be in a single line, 
with
+   the format of the dns_cache module parameter (see above). Empty 
lines
+   or lines with whitespaces only are ignored. Comment lines have to 
start
+   with '#'. Comments are not accepted after dns_cache records, only on
+   separate lines.
+   
+   
+   
+   Default value is NULL.
+   
+   
+   
+   Set dns_file parameter
+   
+...
+# content of /etc/kamailio/kamailio-cache.dns
+
+# IPv4 record
+type=A;name=kamailio.org;addr=193.22.119.66;ttl=360;flags=0
+# IPv6 record
+type=;name=kamailio.org;addr=2a00:d60:0:400::2;ttl=360;flags=0
+...
+...
+modparam("corex", "dns_file", "/etc/kamailio/kamailio-cache.dns")
+...
 


@@ -1291,4 +1326,3 @@ sub do_uncompress() {
 
 
 
-

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


[sr-dev] git:master:c8cf642c: corex: added dns_file modparam

2024-04-06 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: c8cf642c21169bcaee82347db858d8f3bcb6a42c
URL: 
https://github.com/kamailio/kamailio/commit/c8cf642c21169bcaee82347db858d8f3bcb6a42c

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-06T08:19:19+02:00

corex: added dns_file modparam

- can be set to the path of a file containing dns_cache records
- each line has to contain a dns_cache-param-formatted record
- empty lines are allowed
- comment line has to start with #, comments can be only on separate
  line, not supported after dns_cache record

---

Modified: src/modules/corex/corex_mod.c

---

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

---

diff --git a/src/modules/corex/corex_mod.c b/src/modules/corex/corex_mod.c
index 4152fbf5df4..6739e4cee16 100644
--- a/src/modules/corex/corex_mod.c
+++ b/src/modules/corex/corex_mod.c
@@ -32,6 +32,7 @@
 #include "../../core/fmsg.h"
 #include "../../core/kemi.h"
 #include "../../core/str_list.h"
+#include "../../core/trim.h"
 #include "../../core/events.h"
 #include "../../core/onsend.h"
 #include "../../core/forward.h"
@@ -82,12 +83,15 @@ static int corex_evrt_reply_out_no = -1;
 
 int corex_alias_subdomains_param(modparam_t type, void *val);
 int corex_dns_cache_param(modparam_t type, void *val);
+int corex_dns_file_param(modparam_t type, void *val);
+int corex_dns_file_load(void);
 
 static int mod_init(void);
 static int child_init(int);
 static void mod_destroy(void);
 
 static str_list_t *corex_dns_cache_list = NULL;
+static str_list_t *corex_dns_file_list = NULL;
 
 static int corex_dns_cache_param_add(str *pval);
 
@@ -176,6 +180,8 @@ static param_export_t params[] = {
(void *)corex_alias_subdomains_param},
{"dns_cache", PARAM_STR | USE_FUNC_PARAM,
(void *)corex_dns_cache_param},
+   {"dns_file", PARAM_STR | USE_FUNC_PARAM,
+   (void *)corex_dns_file_param},
{"nio_intercept", INT_PARAM, _intercept},
{"nio_min_msg_len", INT_PARAM, _min_msg_len},
{"nio_msg_avp", PARAM_STR, _msg_avp_param},
@@ -226,6 +232,9 @@ static int mod_init(void)
return -1;
}
}
+   if(corex_dns_file_load() < 0) {
+   return -1;
+   }
 
if((nio_intercept > 0) && (nio_intercept_init() < 0)) {
LM_ERR("failed to register network io intercept callback\n");
@@ -385,6 +394,67 @@ int corex_dns_cache_param(modparam_t type, void *val)
return 0;
 }
 
+int corex_dns_file_param(modparam_t type, void *val)
+{
+   str_list_t *sit;
+
+   if(val == NULL || ((str *)val)->s == NULL || ((str *)val)->len == 0) {
+   LM_ERR("invalid parameter\n");
+   return -1;
+   }
+
+   sit = (str_list_t *)pkg_mallocxz(sizeof(str_list_t));
+   if(sit == NULL) {
+   PKG_MEM_ERROR;
+   return -1;
+   }
+   sit->s = *((str *)val);
+   if(corex_dns_file_list != NULL) {
+   sit->next = corex_dns_file_list;
+   }
+   corex_dns_file_list = sit;
+
+   return 0;
+}
+
+int corex_dns_file_load(void)
+{
+   str_list_t *sit;
+   str sline;
+   char lbuf[512];
+   FILE *FP;
+
+   for(sit = corex_dns_file_list; sit != NULL; sit = sit->next) {
+   FP = fopen(sit->s.s, "r");
+   if(FP == NULL) {
+   LM_ERR("failed to open file '%.*s'\n", sit->s.len, 
sit->s.s);
+   return -1;
+   }
+   while(fgets(lbuf, 512, FP)) {
+   sline.s = lbuf;
+   sline.len = strlen(sline.s);
+   trim();
+   if(sline.len <= 0) {
+   /* empty line */
+   continue;
+   }
+   if(sline.s[0] == '#') {
+   /* comment */
+   continue;
+   }
+   if(corex_dns_cache_param_add() < 0) {
+   LM_ERR("failed to add record: '%.*s' (%.*s)\n", 
sline.len,
+   sline.s, sit->s.len, sit->s.s);
+   fclose(FP);
+   return -1;
+   }
+   }
+   fclose(FP);
+   }
+
+   return 0;
+}
+
 static int corex_dns_cache_param_add(str *pval)
 {
str sval;

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


[sr-dev] git:master:92d3573b: ims_ipsec_pcscf: log error message made info

2024-04-05 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 92d3573b500374d100639484e5a84cb640dc6b1d
URL: 
https://github.com/kamailio/kamailio/commit/92d3573b500374d100639484e5a84cb640dc6b1d

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-05T21:42:12+02:00

ims_ipsec_pcscf: log error message made info

---

Modified: src/modules/ims_ipsec_pcscf/cmd.c

---

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

---

diff --git a/src/modules/ims_ipsec_pcscf/cmd.c 
b/src/modules/ims_ipsec_pcscf/cmd.c
index 4f7301b56c1..b5a598b44ba 100644
--- a/src/modules/ims_ipsec_pcscf/cmd.c
+++ b/src/modules/ims_ipsec_pcscf/cmd.c
@@ -1126,7 +1126,8 @@ int ipsec_forward(struct sip_msg *m, udomain_t *d, int 
_cflags)
buf_len =
snprintf(buf, sizeof(buf) - 1, 
"sip:%.*s:%d;transport=tcp",
ci.via_host.len, 
ci.via_host.s, dst_port);
-   } else if((_cflags & IPSEC_SETDSTURI_FULL) && (dst_proto == 
PROTO_TLS)) {
+   } else if((_cflags & IPSEC_SETDSTURI_FULL)
+ && (dst_proto == PROTO_TLS)) {
buf_len =
snprintf(buf, sizeof(buf) - 1, 
"sip:%.*s:%d;transport=tls",
ci.via_host.len, 
ci.via_host.s, dst_port);
@@ -1143,7 +1144,7 @@ int ipsec_forward(struct sip_msg *m, udomain_t *d, int 
_cflags)
memcpy(m->dst_uri.s, buf, buf_len);
m->dst_uri.len = buf_len;
m->dst_uri.s[m->dst_uri.len] = '\0';
-   LM_ERR("new destination URI: %.*s\n", m->dst_uri.len, 
m->dst_uri.s);
+   LM_INFO("new destination URI: %.*s\n", m->dst_uri.len, 
m->dst_uri.s);
}
 
// Set send socket

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


[sr-dev] git:master:d1118064: siputils: tel2sip2() - memset to 0 pkg allocs and recompute len of new uri

2024-04-05 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: d1118064d04bb77c818540e68edf1766db1d560a
URL: 
https://github.com/kamailio/kamailio/commit/d1118064d04bb77c818540e68edf1766db1d560a

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-05T16:19:42+02:00

siputils: tel2sip2() - memset to 0 pkg allocs and recompute len of new uri

---

Modified: src/modules/siputils/checks.c

---

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

---

diff --git a/src/modules/siputils/checks.c b/src/modules/siputils/checks.c
index 2ba80b5be94..6cc977197fb 100644
--- a/src/modules/siputils/checks.c
+++ b/src/modules/siputils/checks.c
@@ -780,7 +780,7 @@ int tel2sip2(struct sip_msg *_msg, char *_uri, char 
*_hostpart, char *_res)
return 1;
 
/* reserve memory for clean tel uri */
-   tel_uri.s = pkg_malloc(uri.len + 1);
+   tel_uri.s = pkg_mallocxz(uri.len + 1);
if(tel_uri.s == 0) {
LM_ERR("no more pkg memory\n");
return -1;
@@ -839,7 +839,7 @@ int tel2sip2(struct sip_msg *_msg, char *_uri, char 
*_hostpart, char *_res)
 
/* reserve memory for resulting sip uri */
sip_uri.len = 4 + tel_uri.len - 4 + 1 + hostpart.len + 1 + 10;
-   sip_uri.s = pkg_malloc(sip_uri.len + 1);
+   sip_uri.s = pkg_mallocxz(sip_uri.len + 1);
if(sip_uri.s == 0) {
LM_ERR("no more pkg memory\n");
pkg_free(tel_uri.s);
@@ -873,6 +873,8 @@ int tel2sip2(struct sip_msg *_msg, char *_uri, char 
*_hostpart, char *_res)
/* tel_uri is not needed anymore */
pkg_free(tel_uri.s);
 
+   sip_uri.len = strlen(sip_uri.s);
+
/* set result pv value and write sip uri to result pv */
res_val.rs = sip_uri;
res_val.flags = PV_VAL_STR;

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


[sr-dev] git:master:ac22a5c1: textopsx: added msg_changed_route(rname)

2024-04-05 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: ac22a5c174d4652ae09b779a5384182211700f20
URL: 
https://github.com/kamailio/kamailio/commit/ac22a5c174d4652ae09b779a5384182211700f20

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-05T13:00:32+02:00

textopsx: added msg_changed_route(rname)

- execute a route block using the changed message, without efectivelly
  changing the current message structure (it stays without changes
  applied)

---

Modified: src/modules/textopsx/textopsx.c

---

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

---

diff --git a/src/modules/textopsx/textopsx.c b/src/modules/textopsx/textopsx.c
index 5710cfeb864..8982924296a 100644
--- a/src/modules/textopsx/textopsx.c
+++ b/src/modules/textopsx/textopsx.c
@@ -46,6 +46,7 @@
 MODULE_VERSION
 
 static int msg_apply_changes_f(sip_msg_t *msg, char *str1, char *str2);
+static int msg_changed_route_f(sip_msg_t *msg, char *str1, char *str2);
 static int msg_set_buffer_f(sip_msg_t *msg, char *p1data, char *p2);
 
 static int change_reply_status_f(sip_msg_t *, char *, char *);
@@ -122,6 +123,8 @@ static pv_export_t mod_pvs[] = {
 static cmd_export_t cmds[] = {
{"msg_apply_changes", (cmd_function)msg_apply_changes_f, 0, 0, 0,
REQUEST_ROUTE | ONREPLY_ROUTE},
+   {"msg_changed_route", (cmd_function)msg_changed_route_f, 1, 
fixup_spve_null,
+   fixup_free_spve_null, ANY_ROUTE},
{"msg_set_buffer", (cmd_function)msg_set_buffer_f, 1, fixup_spve_null,
fixup_free_spve_null, REQUEST_ROUTE | ONREPLY_ROUTE},
{"change_reply_status", change_reply_status_f, 2,
@@ -276,6 +279,92 @@ static int msg_apply_changes_f(sip_msg_t *msg, char *str1, 
char *str2)
return sip_msg_apply_changes(msg);
 }
 
+/**
+ *
+ */
+static int ki_msg_changed_route(sip_msg_t *msg, str *rname)
+{
+   str obuf = STR_NULL;
+   int ridx = -1;
+   sip_msg_t lmsg;
+   sr_kemi_eng_t *keng = NULL;
+   run_act_ctx_t ctx;
+   str evname = str_init("textopsx:msg-changed-route");
+
+   keng = sr_kemi_eng_get();
+   if(keng == NULL) {
+   ridx = route_lookup(_rt, rname->s);
+   if(ridx < 0) {
+   LM_ERR("route block [%.*s] not found\n", rname->len, 
rname->s);
+   return -1;
+   }
+   }
+
+   if(sip_msg_eval_changes(msg, ) < 0 || obuf.s == NULL) {
+   LM_ERR("failed to evaluate msg changes\n");
+   return -1;
+   }
+
+   memset(, 0, sizeof(sip_msg_t));
+   lmsg.buf = obuf.s;
+   lmsg.len = obuf.len;
+   lmsg.id = msg->id;
+   lmsg.pid = msg->pid;
+   lmsg.rcv = msg->rcv;
+   lmsg.set_global_address = msg->set_global_address;
+   lmsg.set_global_port = msg->set_global_port;
+   lmsg.flags = msg->flags;
+   lmsg.msg_flags = msg->msg_flags;
+   memcpy(lmsg.xflags, msg->xflags, KSR_XFLAGS_SIZE * sizeof(flag_t));
+   lmsg.hash_index = msg->hash_index;
+   lmsg.force_send_socket = msg->force_send_socket;
+
+   /* parse the local message */
+   LM_DBG("SIP message content updated - parsing\n");
+   if(parse_msg(lmsg.buf, lmsg.len, ) != 0) {
+   LM_ERR("parsing new sip message failed [[%.*s]]\n", lmsg.len, 
lmsg.buf);
+   return -1;
+   }
+   if(parse_headers(, HDR_FROM_F | HDR_TO_F | HDR_CALLID_F | 
HDR_CSEQ_F, 0)
+   < 0) {
+   LM_ERR("parsing main headers of new sip message failed 
[[%.*s]]\n",
+   lmsg.len, lmsg.buf);
+   return -1;
+   }
+   init_run_actions_ctx();
+
+   if(keng == NULL) {
+   run_top_route(main_rt.rlist[ridx], , );
+   } else {
+   if(sr_kemi_ctx_route(keng, , , get_route_type(),
+  rname, )
+   < 0) {
+   LM_ERR("error running route kemi callback\n");
+   }
+   }
+
+   free_sip_msg();
+
+   pkg_free(obuf.s);
+
+   return 1;
+}
+
+/**
+ *
+ */
+static int msg_changed_route_f(sip_msg_t *msg, char *prname, char *str2)
+{
+   str rname = STR_NULL;
+
+   if(fixup_get_svalue(msg, (gparam_t *)prname, ) < 0) {
+   LM_ERR("could not get route name param value\n");
+   return -1;
+   }
+
+   return ki_msg_changed_route(msg, );
+}
+
 /**
  *
  */

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


[sr-dev] git:master:3208dd82: textopsx: docs for msg_changed_route(...)

2024-04-05 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 3208dd822f94cff7b28d9682b083f3d144d7368e
URL: 
https://github.com/kamailio/kamailio/commit/3208dd822f94cff7b28d9682b083f3d144d7368e

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-05T13:00:32+02:00

textopsx: docs for msg_changed_route(...)

---

Modified: src/modules/textopsx/doc/functions.xml

---

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

---

diff --git a/src/modules/textopsx/doc/functions.xml 
b/src/modules/textopsx/doc/functions.xml
index b6b50916051..92666736c86 100644
--- a/src/modules/textopsx/doc/functions.xml
+++ b/src/modules/textopsx/doc/functions.xml
@@ -50,6 +50,33 @@ if(msg_apply_changes())


 
+   
+   
+   msg_changed_route(rname)
+   
+   
+   Execute a route block specified by rname, using a new 
SIP message
+   structure build using the current SIP message with 
applied changes.
+   The current SIP message does not get the changes 
applied.
+   
+   
+   This function can be used from ANY_ROUTE.
+   
+   
+   msg_changed_route() usage
+   
+...
+append_hf("My-Header: yes\r\n");
+msg_changed_route("UPDATEDMSG");
+...
+route[UPDATEDMSG] {
+   xinfo("My-Header-Value: $hdr(My-Header)\n");
+}
+...
+
+   
+   
+


msg_set_buffer(data)

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


[sr-dev] git:master:756f01ee: pv: use core helper to evaluate changes for pv updated message buffer

2024-04-05 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 756f01eecec754726c09a7067e11db9781e35ac1
URL: 
https://github.com/kamailio/kamailio/commit/756f01eecec754726c09a7067e11db9781e35ac1

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-05T13:00:32+02:00

pv: use core helper to evaluate changes for pv updated message buffer

---

Modified: src/modules/pv/pv_core.c

---

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

---

diff --git a/src/modules/pv/pv_core.c b/src/modules/pv/pv_core.c
index 1f998bfc1d3..40557ba4628 100644
--- a/src/modules/pv/pv_core.c
+++ b/src/modules/pv/pv_core.c
@@ -522,8 +522,6 @@ static str _ksr_pv_msg_buf_updated = STR_NULL;
 int pv_get_msg_buf_updated(
struct sip_msg *msg, pv_param_t *param, pv_value_t *res)
 {
-   dest_info_t send_info;
-
if(msg == NULL)
return -1;
 
@@ -533,17 +531,7 @@ int pv_get_msg_buf_updated(
_ksr_pv_msg_buf_updated.len = 0;
}
 
-   init_dest_info(_info);
-   send_info.proto = PROTO_UDP;
-   if(msg->first_line.type == SIP_REPLY) {
-   _ksr_pv_msg_buf_updated.s = generate_res_buf_from_sip_res(msg,
-   (unsigned int *)&_ksr_pv_msg_buf_updated.len,
-   BUILD_NO_VIA1_UPDATE);
-   } else if(msg->first_line.type == SIP_REQUEST) {
-   _ksr_pv_msg_buf_updated.s = build_req_buf_from_sip_req(msg,
-   (unsigned int *)&_ksr_pv_msg_buf_updated.len, 
_info,
-   BUILD_NO_PATH | BUILD_NO_LOCAL_VIA | 
BUILD_NO_VIA1_UPDATE);
-   } else {
+   if(sip_msg_eval_changes(msg, &_ksr_pv_msg_buf_updated) < 0) {
return pv_get_null(msg, param, res);
}
 

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


[sr-dev] git:master:cad94eb7: core: msg translator - helper function to evaluate changes

2024-04-05 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: cad94eb73c1223ddcf69aa0d073deb3118b46e3f
URL: 
https://github.com/kamailio/kamailio/commit/cad94eb73c1223ddcf69aa0d073deb3118b46e3f

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-05T13:00:32+02:00

core: msg translator - helper function to evaluate changes

---

Modified: src/core/msg_translator.c
Modified: src/core/msg_translator.h

---

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

---

diff --git a/src/core/msg_translator.c b/src/core/msg_translator.c
index acd5911867a..ab02fb7c47c 100644
--- a/src/core/msg_translator.c
+++ b/src/core/msg_translator.c
@@ -3485,6 +3485,33 @@ int sip_msg_update_buffer(sip_msg_t *msg, str *obuf)
return 1;
 }
 
+/**
+ * evaluate changes and set the output buffer
+ * - obuf->s has to be pkg freed
+ * - return: 1 on success, -1 on failure
+ */
+int sip_msg_eval_changes(sip_msg_t *msg, str *obuf)
+{
+   dest_info_t dst;
+
+   init_dest_info();
+   dst.proto = PROTO_UDP;
+   if(msg->first_line.type == SIP_REPLY) {
+   obuf->s = generate_res_buf_from_sip_res(
+   msg, (unsigned int *)>len, 
BUILD_NO_VIA1_UPDATE);
+   } else {
+   obuf->s = build_req_buf_from_sip_req(msg, (unsigned int 
*)>len,
+   ,
+   BUILD_NO_PATH | BUILD_NO_LOCAL_VIA | 
BUILD_NO_VIA1_UPDATE);
+   }
+   if(obuf->s == NULL) {
+   LM_ERR("couldn't update msg buffer content\n");
+   return -1;
+   }
+
+   return 1;
+}
+
 /**
  *
  */
diff --git a/src/core/msg_translator.h b/src/core/msg_translator.h
index eac64186d56..9d41b472767 100644
--- a/src/core/msg_translator.h
+++ b/src/core/msg_translator.h
@@ -173,6 +173,11 @@ void process_lumps(struct sip_msg *msg, struct lump 
*lumps, char *new_buf,
  */
 int sip_msg_update_buffer(sip_msg_t *msg, str *obuf);
 
+/**
+ * evaluate changes and set the output buffer
+ */
+int sip_msg_eval_changes(sip_msg_t *msg, str *obuf);
+
 /**
  * apply changes to sip msg buffer and reparse
  */

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


[sr-dev] Re: [kamailio/kamailio] DBURL can't read env params (Issue #3800)

2024-04-05 Thread Daniel-Constantin Mierla via sr-dev
Closed #3800 as completed.

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

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


[sr-dev] Re: [kamailio/kamailio] DBURL can't read env params (Issue #3800)

2024-04-05 Thread Daniel-Constantin Mierla via sr-dev
@whosgonna gave good answers, if there is anything left to be clarified, the 
discussion should be done via sr-us...@lists.kamailio.org, not being an issue 
in the C code to stay on tracker.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3800#issuecomment-2039310467
You are receiving this because you are subscribed to this thread.

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


[sr-dev] Re: [kamailio/kamailio] Topos breaks early dialog transactions on multi-homed kamailio instances using enable_double_rr and versions >= 5.6.5 (Issue #3757)

2024-04-05 Thread Daniel-Constantin Mierla via sr-dev
Thanks for testing and reporting back!

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3757#issuecomment-2039303595
You are receiving this because you are subscribed to this thread.

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


[sr-dev] Re: [kamailio/kamailio] Topos breaks early dialog transactions on multi-homed kamailio instances using enable_double_rr and versions >= 5.6.5 (Issue #3757)

2024-04-05 Thread Daniel-Constantin Mierla via sr-dev
Closed #3757 as completed.

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

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


[sr-dev] git:master:664190b3: rtpengine: added param write_sdp_pv_mode

2024-04-05 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 664190b31303b52728f957113d97bd77a7ab4f8d
URL: 
https://github.com/kamailio/kamailio/commit/664190b31303b52728f957113d97bd77a7ab4f8d

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-05T10:55:09+02:00

rtpengine: added param write_sdp_pv_mode

- if set to 1, write the returned sdp in pv and set the body
- default 0, write only in pv (existing behaviour so far)

---

Modified: src/modules/rtpengine/rtpengine.c

---

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

---

diff --git a/src/modules/rtpengine/rtpengine.c 
b/src/modules/rtpengine/rtpengine.c
index 8a2f9f82d89..c51b4742081 100644
--- a/src/modules/rtpengine/rtpengine.c
+++ b/src/modules/rtpengine/rtpengine.c
@@ -322,6 +322,7 @@ static int_str setid_avp;
 
 static str write_sdp_pvar_str = {NULL, 0};
 static pv_spec_t *write_sdp_pvar = NULL;
+static int write_sdp_pvar_mode = 0;
 
 static str read_sdp_pvar_str = {NULL, 0};
 static pv_spec_t *read_sdp_pvar = NULL;
@@ -504,6 +505,7 @@ static param_export_t params[] = {
{"force_send_interface", PARAM_STRING, _send_ip_str},
{"rtp_inst_pvar", PARAM_STR, _inst_pv_param},
{"write_sdp_pv", PARAM_STR, _sdp_pvar_str},
+   {"write_sdp_pv_mode", PARAM_INT, _sdp_pvar_mode},
{"read_sdp_pv", PARAM_STR, _sdp_pvar_str},
{"hash_table_tout", INT_PARAM, _table_tout},
{"hash_table_size", INT_PARAM, _table_size},
@@ -4708,9 +4710,11 @@ static int rtpengine_offer_answer(
goto error_free;
}
 
-   pkg_free(newbody.s);
-
-   } else {
+   if(write_sdp_pvar_mode == 0) {
+   pkg_free(newbody.s);
+   }
+   }
+   if(write_sdp_pvar == NULL || write_sdp_pvar_mode != 0) {
if(cl_field.len) {
anchor = del_lump(msg, cl_field.s - msg->buf, 
cl_field.len, 0);
cl_repl.s = pkg_malloc(10);

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


  1   2   3   4   5   6   7   8   9   10   >