[sr-dev] git:master:324611b2: rtpengine: use ki functions as exported api functions (#3956)

2024-09-02 Thread GitHub via sr-dev
Module: kamailio
Branch: master
Commit: 324611b2ecfe2fda25abc8114361d00a9e654772
URL: 
https://github.com/kamailio/kamailio/commit/324611b2ecfe2fda25abc8114361d00a9e654772

Author: Farzaneh Soltanzadeh 
Committer: GitHub 
Date: 2024-09-02T08:04:19-04:00

rtpengine: use ki functions as exported api functions (#3956)

- remove extra funcs
- change functions name

Co-authored-by: Farzaneh Soltanzadeh 

---

Modified: src/modules/rtpengine/api.h
Modified: src/modules/rtpengine/rtpengine.c

---

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

---

diff --git a/src/modules/rtpengine/api.h b/src/modules/rtpengine/api.h
index fa499916238..d5c68e6d871 100644
--- a/src/modules/rtpengine/api.h
+++ b/src/modules/rtpengine/api.h
@@ -26,18 +26,17 @@
 
 #include "../../core/parser/msg_parser.h"
 
-typedef int (*rtpengine_start_recording_f)(
-   struct sip_msg *msg, char *str1, char *str2);
-typedef int (*rtpengine_answer_f)(struct sip_msg *msg, char *str1, char *str2);
-typedef int (*rtpengine_offer_f)(struct sip_msg *msg, char *str1, char *str2);
-typedef int (*rtpengine_delete_f)(struct sip_msg *msg, char *str1, char *str2);
+typedef int (*rtpengine_start_recording_f)(struct sip_msg *msg);
+typedef int (*rtpengine_answer_f)(struct sip_msg *msg, str *str);
+typedef int (*rtpengine_offer_f)(struct sip_msg *msg, str *str);
+typedef int (*rtpengine_delete_f)(struct sip_msg *msg, str *str);
 
 typedef struct rtpengine_api
 {
-   rtpengine_start_recording_f start_recording;
-   rtpengine_answer_f answer;
-   rtpengine_offer_f offer;
-   rtpengine_delete_f delete;
+   rtpengine_start_recording_f rtpengine_start_recording;
+   rtpengine_answer_f rtpengine_answer;
+   rtpengine_offer_f rtpengine_offer;
+   rtpengine_delete_f rtpengine_delete;
 } rtpengine_api_t;
 
 typedef int (*bind_rtpengine_f)(rtpengine_api_t *api);
diff --git a/src/modules/rtpengine/rtpengine.c 
b/src/modules/rtpengine/rtpengine.c
index 84bf5951752..e31feb3ceeb 100644
--- a/src/modules/rtpengine/rtpengine.c
+++ b/src/modules/rtpengine/rtpengine.c
@@ -5794,10 +5794,10 @@ static int bind_rtpengine(rtpengine_api_t *api)
LM_ERR("Invalid parameter value\n");
return -1;
}
-   api->start_recording = start_recording_f;
-   api->answer = rtpengine_answer1_f;
-   api->offer = rtpengine_offer1_f;
-   api->delete = rtpengine_delete1_f;
+   api->rtpengine_start_recording = ki_start_recording;
+   api->rtpengine_answer = ki_rtpengine_answer;
+   api->rtpengine_offer = ki_rtpengine_offer;
+   api->rtpengine_delete = ki_rtpengine_delete;
 
return 0;
 }
\ No newline at end of file

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


[sr-dev] git:master:a3a63655: siprepo: fix int params and wrong copy data in siprepo_msg_async_pull (#3919)

2024-07-18 Thread GitHub via sr-dev
Module: kamailio
Branch: master
Commit: a3a63655dbcbf1bc8067f34c36f4a7295b2a1745
URL: 
https://github.com/kamailio/kamailio/commit/a3a63655dbcbf1bc8067f34c36f4a7295b2a1745

Author: emvondo <106535097+emvo...@users.noreply.github.com>
Committer: GitHub 
Date: 2024-07-18T10:10:33+02:00

siprepo: fix int params and wrong copy data in siprepo_msg_async_pull (#3919)

* siprepo: fix int params and wrong copy data in siprepo_msg_async_pull

-

Co-authored-by: emvondo 

---

Modified: src/modules/siprepo/siprepo_data.c
Modified: src/modules/siprepo/siprepo_mod.c

---

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

---

diff --git a/src/modules/siprepo/siprepo_data.c 
b/src/modules/siprepo/siprepo_data.c
index 397def720fb..2720c50c2c0 100644
--- a/src/modules/siprepo/siprepo_data.c
+++ b/src/modules/siprepo/siprepo_data.c
@@ -496,15 +496,15 @@ int siprepo_msg_async_pull(str *callid, str *msgid, str 
*gname, str *rname,
return -1;
}
stp->callid.s = (char*)stp + 
ROUND_POINTER(sizeof(siprepo_task_param_t));
-   memcpy(callid->s, stp->callid.s, callid->len);
+   memcpy(stp->callid.s, callid->s, callid->len);
stp->callid.len = callid->len;
 
stp->msgid.s = stp->callid.s + ROUND_POINTER(callid->len + 1);
-   memcpy(msgid->s, stp->msgid.s, msgid->len);
+   memcpy(stp->msgid.s, msgid->s, msgid->len);
stp->msgid.len = msgid->len;
 
stp->rname.s = stp->msgid.s + ROUND_POINTER(msgid->len + 1);
-   memcpy(rname->s, stp->rname.s, rname->len);
+   memcpy(stp->rname.s, rname->s, rname->len);
stp->rname.len = rname->len;
 
stp->rmode = rmode;
diff --git a/src/modules/siprepo/siprepo_mod.c 
b/src/modules/siprepo/siprepo_mod.c
index d8f8b02c5ad..e6acc23368e 100644
--- a/src/modules/siprepo/siprepo_mod.c
+++ b/src/modules/siprepo/siprepo_mod.c
@@ -58,6 +58,8 @@ static int w_sr_msg_check(sip_msg_t *msg, char *p1, char *p2);
 
 static void siprepo_timer_exec(unsigned int ticks, int worker, void *param);
 
+static int fixup_sr_msg_async_pull(void **param, int param_no);
+
 /* clang-format off */
 typedef struct sworker_task_param {
char *buf;
@@ -69,10 +71,10 @@ typedef struct sworker_task_param {
 static cmd_export_t cmds[]={
{"sr_msg_push", (cmd_function)w_sr_msg_push, 2, fixup_spve_igp,
fixup_free_spve_null, REQUEST_ROUTE|CORE_ONREPLY_ROUTE},
-   {"sr_msg_pull", (cmd_function)w_sr_msg_pull, 3, fixup_spve_all,
-   fixup_free_spve_all, REQUEST_ROUTE|CORE_ONREPLY_ROUTE},
-   {"sr_msg_async_pull", (cmd_function)w_sr_msg_async_pull, 5, 
fixup_spve_all,
-   fixup_free_spve_all, ANY_ROUTE},
+   {"sr_msg_pull", (cmd_function)w_sr_msg_pull, 4, fixup_sssi,
+   fixup_free_sssi, REQUEST_ROUTE|CORE_ONREPLY_ROUTE},
+   {"sr_msg_async_pull", (cmd_function)w_sr_msg_async_pull, 5, 
fixup_sr_msg_async_pull,
+   0, ANY_ROUTE},
{"sr_msg_rm", (cmd_function)w_sr_msg_rm, 2, fixup_spve_spve,
fixup_free_spve_spve, REQUEST_ROUTE|CORE_ONREPLY_ROUTE},
{"sr_msg_check", (cmd_function)w_sr_msg_check, 0, 0,
@@ -282,6 +284,15 @@ static int w_sr_msg_async_pull(sip_msg_t *msg, char 
*pcallid, char *pmsgid,
 }
 
 
+static int fixup_sr_msg_async_pull(void **param, int param_no)
+{
+   if(param_no >= 1 && param_no <= 4)
+   return fixup_spve_null(param, 1);
+   if(param_no == 5)
+   return fixup_igp_null(param, 1);
+   return 0;
+}
+
 /**
  *
  */

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


[sr-dev] git:master:fae2a467: rtpengine: show errno and error string in more places where it is useful (#3899)

2024-07-02 Thread GitHub via sr-dev
Module: kamailio
Branch: master
Commit: fae2a467cb7b543920cf8bea3ce655ad07b70969
URL: 
https://github.com/kamailio/kamailio/commit/fae2a467cb7b543920cf8bea3ce655ad07b70969

Author: Oded Arbel 
Committer: GitHub 
Date: 2024-07-02T08:19:11-04:00

rtpengine: show errno and error string in more places where it is useful (#3899)

Also fixed bind_force_send_ip() error log to use the same semantic as other 
places

---

Modified: src/modules/rtpengine/rtpengine.c

---

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

---

diff --git a/src/modules/rtpengine/rtpengine.c 
b/src/modules/rtpengine/rtpengine.c
index 54f22b1843f..7b97a2ae1ee 100644
--- a/src/modules/rtpengine/rtpengine.c
+++ b/src/modules/rtpengine/rtpengine.c
@@ -830,7 +830,7 @@ static int bind_force_send_ip(int sock_idx)
sizeof(ip6addr)))
< 0) {
LM_ERR("can't bind socket to required ipv6 
interface\n");
-   LM_ERR("ret=%d errno=%d\n", ret, errno);
+   LM_ERR("ret=%d (%s:%d)\n", ret, 
strerror(errno), errno);
return -1;
}
 
@@ -3598,7 +3598,7 @@ static char *send_rtpp_command(
struct rtpp_node *node, bencode_item_t *dict, int *outlen)
 {
struct sockaddr_un addr;
-   int fd, len, i, vcnt;
+   int fd = -1, len, i, vcnt;
int rtpengine_retr, rtpengine_tout_ms = 1000;
char *cp;
static char buf[0x4];
@@ -3632,8 +3632,8 @@ static char *send_rtpp_command(
goto badproxy;
}
if(connect(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
-   close(fd);
-   LM_ERR("can't connect to RTPEngine <%s>\n", 
node->rn_url.s);
+   LM_ERR("can't connect to RTPEngine <%s> (%s:%d)\n", 
node->rn_url.s,
+   strerror(errno), errno);
goto badproxy;
}
 
@@ -3641,18 +3641,19 @@ static char *send_rtpp_command(
len = writev(fd, v + 1, vcnt);
} while(len == -1 && errno == EINTR);
if(len <= 0) {
-   close(fd);
-   LM_ERR("can't send command to RTPEngine <%s>\n", 
node->rn_url.s);
+   LM_ERR("can't send command to RTPEngine <%s> (%s:%d)\n",
+   node->rn_url.s, strerror(errno), errno);
goto badproxy;
}
do {
len = read(fd, buf, sizeof(buf) - 1);
} while(len == -1 && errno == EINTR);
-   close(fd);
if(len <= 0) {
-   LM_ERR("can't read reply from RTPEngine <%s>\n", 
node->rn_url.s);
+   LM_ERR("can't read reply from RTPEngine <%s> (%s:%d)\n",
+   node->rn_url.s, strerror(errno), errno);
goto badproxy;
}
+   close(fd);
} else if(node->rn_umode == RNU_WS || node->rn_umode == RNU_WSS) {
/* assemble full request string, flatten iovec */
v[0].iov_base = gencookie();
@@ -3721,8 +3722,9 @@ static char *send_rtpp_command(
} while(len == -1 && (errno == EINTR || errno == 
ENOBUFS));
if(len <= 0) {
bencode_get_str(bencode_dictionary_get(dict, 
"command"), &cmd);
-   LM_ERR("can't send command \"%.*s\" to 
RTPEngine <%s>\n",
-   cmd.len, cmd.s, node->rn_url.s);
+   LM_ERR("can't send command \"%.*s\" to 
RTPEngine <%s> "
+  "(%s:%d)\n",
+   cmd.len, cmd.s, node->rn_url.s, 
strerror(errno), errno);
goto badproxy;
}
while((poll(fds, 1, rtpengine_tout_ms) == 1)
@@ -3734,8 +3736,9 @@ static char *send_rtpp_command(
bencode_get_str(

bencode_dictionary_get(dict, "command"), &cmd);
LM_ERR("can't read reply for command 
\"%.*s\" from "
-  "RTPEngine <%s>\n",
-   cmd.len, cmd.s, 
node->rn_url.s);
+  "RTPEngine <%s> (%s:%d)\n",
+   cmd.len, cmd.s, 
node->rn_url.s, strerror(errno),
+  

[sr-dev] git:master:b753682b: misc/examples/ims/icscf: removed always adding a plus as a prefix on requests arriving to the I-CSCF (#3900)

2024-07-02 Thread GitHub via sr-dev
Module: kamailio
Branch: master
Commit: b753682bdfa722280ed2dd3ca79b790f5c7529d1
URL: 
https://github.com/kamailio/kamailio/commit/b753682bdfa722280ed2dd3ca79b790f5c7529d1

Author: Dragos Vingarzan 
Committer: GitHub 
Date: 2024-07-02T11:41:25+02:00

misc/examples/ims/icscf: removed always adding a plus as a prefix on requests 
arriving to the I-CSCF (#3900)

---

Modified: misc/examples/ims/icscf/kamailio.cfg

---

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

---

diff --git a/misc/examples/ims/icscf/kamailio.cfg 
b/misc/examples/ims/icscf/kamailio.cfg
index 4434e6a25d6..1fb51fef680 100644
--- a/misc/examples/ims/icscf/kamailio.cfg
+++ b/misc/examples/ims/icscf/kamailio.cfg
@@ -238,10 +238,6 @@ route{
xlog("I-CSCF  $rm $ru ($fu => $tu ($si:$sp) to $tu, 
$ci)\n");
 #!endif
 
-   if !($rU =~ "\+.*") {
-   prefix("+");
-   }
-
# per request initial checks
route(REQINIT);
 

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


[sr-dev] git:master:0c7affcd: ims_registrar_scscf: drop subscription on notification failure (#3895)

2024-07-01 Thread GitHub via sr-dev
Module: kamailio
Branch: master
Commit: 0c7affcde380af433ce3373248a9544450261e1b
URL: 
https://github.com/kamailio/kamailio/commit/0c7affcde380af433ce3373248a9544450261e1b

Author: Dragos Vingarzan 
Committer: GitHub 
Date: 2024-07-01T21:34:17+02:00

ims_registrar_scscf: drop subscription on notification failure (#3895)

---

Modified: src/modules/ims_registrar_scscf/registrar_notify.c

---

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

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


[sr-dev] git:master:12c30d56: ims_registrar_scscf: fix for location AOR with empty host (#3897)

2024-07-01 Thread GitHub via sr-dev
Module: kamailio
Branch: master
Commit: 12c30d5606213eaf14c250e572545c3f8b37d50b
URL: 
https://github.com/kamailio/kamailio/commit/12c30d5606213eaf14c250e572545c3f8b37d50b

Author: Dragos Vingarzan 
Committer: GitHub 
Date: 2024-07-01T13:56:02+02:00

ims_registrar_scscf: fix for location AOR with empty host (#3897)

---

Modified: src/modules/ims_registrar_scscf/lookup.c

---

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

---

diff --git a/src/modules/ims_registrar_scscf/lookup.c 
b/src/modules/ims_registrar_scscf/lookup.c
index 99707dae0ce..6a6e7d70d4f 100644
--- a/src/modules/ims_registrar_scscf/lookup.c
+++ b/src/modules/ims_registrar_scscf/lookup.c
@@ -115,8 +115,9 @@ int lookup(struct sip_msg *_m, udomain_t *_d, char 
*ue_type_c)
// add user part
memcpy(aor.s + aor.len, _m->parsed_uri.user.s, _m->parsed_uri.user.len);
aor.len += _m->parsed_uri.user.len;
-   // add '@'
-   aor.s[aor.len++] = '@';
+   // add '@' - but only if there is a host part, else we make bad URIs 
like tel:+123@
+   if(_m->parsed_uri.host.len > 0)
+   aor.s[aor.len++] = '@';
// add host part
memcpy(aor.s + aor.len, _m->parsed_uri.host.s, _m->parsed_uri.host.len);
aor.len += _m->parsed_uri.host.len;

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


[sr-dev] git:master:96ada96f: rtpengine: add "active" field to rtpengine.show as alternate of "disabled" (#3898)

2024-06-30 Thread GitHub via sr-dev
Module: kamailio
Branch: master
Commit: 96ada96f69f606c35fd46a45def3b095026f2393
URL: 
https://github.com/kamailio/kamailio/commit/96ada96f69f606c35fd46a45def3b095026f2393

Author: Oded Arbel 
Committer: GitHub 
Date: 2024-06-30T12:40:53-04:00

rtpengine: add "active" field to rtpengine.show as alternate of "disabled" 
(#3898)

As per issue #3896, "active" is a boolean field that just describes whether the 
socket will be used,
while "disabled" now just describes whether the socket was disabled by an RPC 
command. Also make
"disabled" and "recheck_ticks" fields have a fixed value type of boolean and 
number respectively.

use `"recheck_ticks": -1` instead of "N/A" as per discussion

---

Modified: src/modules/rtpengine/rtpengine.c

---

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

---

diff --git a/src/modules/rtpengine/rtpengine.c 
b/src/modules/rtpengine/rtpengine.c
index 775542c5994..54f22b1843f 100644
--- a/src/modules/rtpengine/rtpengine.c
+++ b/src/modules/rtpengine/rtpengine.c
@@ -1784,13 +1784,14 @@ static int add_rtpp_node_info(
 
if((1 == crt_rtpp->rn_disabled)
&& (crt_rtpp->rn_recheck_ticks == 
RTPENGINE_MAX_RECHECK_TICKS)) {
-   rpc->struct_add(vh, "s", "disabled", "1(permanent)");
+   rpc->struct_add(vh, "b", "disabled", 1);
} else {
-   rpc->struct_add(vh, "d", "disabled", crt_rtpp->rn_disabled);
+   rpc->struct_add(vh, "b", "disabled", 0);
}
+   rpc->struct_add(vh, "b", "active", crt_rtpp->rn_disabled == 0);
 
if(crt_rtpp->rn_recheck_ticks == RTPENGINE_MAX_RECHECK_TICKS) {
-   rpc->struct_add(vh, "s", "recheck_ticks", "N/A");
+   rpc->struct_add(vh, "d", "recheck_ticks", -1);
} else {
rtpp_ticks = crt_rtpp->rn_recheck_ticks - get_ticks();
rtpp_ticks = rtpp_ticks < 0 ? 0 : rtpp_ticks;

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


[sr-dev] git:master:5e66ba23: modules/statsd: ensure statsd failures do not stop execution (#3819)

2024-04-28 Thread GitHub via sr-dev
Module: kamailio
Branch: master
Commit: 5e66ba23851f115bcb88d7e3f71f78ab33fc1e30
URL: 
https://github.com/kamailio/kamailio/commit/5e66ba23851f115bcb88d7e3f71f78ab33fc1e30

Author: Ostap 
Committer: GitHub 
Date: 2024-04-28T23:15:28+02:00

modules/statsd: ensure statsd failures do not stop execution (#3819)

* modules/statsd: avoid stopping flow when sending statsd metric fails

Currently statsd functions return bool: `true` or `false` depending when
the function succeeds or fails respectively.

This value gets implicitly converted to `int`: `true` -> `1`, `false` ->
`0`.

For Kamailio `1` means succesfull execution, but `0` means to stop
processing messages, which is not what we want as statsd should not impact
flow execution. Instead we want to return `-1` which signifies error,
but the flow continues.

* modules/statsd: do not fail module initilization when statsd init fails

statsd_init executes `statsd_connect` which tries to connect to statd
server.

If connection fails then kamailio fails to start.
This is not the desired behaviour as:
1. Kamailio should continue working even if statsd server is down,
   metrics should not impact runtime.
2. `statsd_connect` is also re-executed each time we try to send the metric 
https://github.com/salemove/kamailio/blame/master/src/modules/statsd/lib_statsd.c#L76,
so it's initial result is not essential.

Note, that before 5.8 the result of init was already ignored due to
implicit conversion of `false` to `0`
until after
https://github.com/kamailio/kamailio/commit/0186246fce8f0e4bb46b30c05174983cd957a3ba
was introduced (which could be considered a breaking change even if it
seemingly fixes a bug in conversion).

---

Modified: src/modules/statsd/statsd.c

---

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

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


[sr-dev] git:master:999d0c65: tools/kemi: escape docstrings when required (#3824)

2024-04-24 Thread GitHub via sr-dev
Module: kamailio
Branch: master
Commit: 999d0c65402c99491683d694d77a01a5c1f91ecf
URL: 
https://github.com/kamailio/kamailio/commit/999d0c65402c99491683d694d77a01a5c1f91ecf

Author: tsearle 
Committer: GitHub 
Date: 2024-04-24T11:28:49+02:00

tools/kemi: escape docstrings when required (#3824)

some of the documentation contains \ which need escaping

---

Modified: misc/tools/kemi/python_mock/kemi_mock.py

---

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

---

diff --git a/misc/tools/kemi/python_mock/kemi_mock.py 
b/misc/tools/kemi/python_mock/kemi_mock.py
index 145fcb34b3a..918551a1887 100755
--- a/misc/tools/kemi/python_mock/kemi_mock.py
+++ b/misc/tools/kemi/python_mock/kemi_mock.py
@@ -129,7 +129,7 @@ def generate_function_doc(module_name, func, prefix):
 print(prefix + "\t\"\"\"")
 documentation_lines = 
documentation[module_name]["functions"][function_prefix].split("\n")
 for line in documentation_lines:
-print(prefix + "\t" + line)
+print(prefix + "\t" + line.replace("\\", ""))
 print(prefix + "\t\"\"\"")
 break
 

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


[sr-dev] git:master:6b29df73: tools/kemi: add dockstrings to the mocking (#3818)

2024-04-22 Thread GitHub via sr-dev
Module: kamailio
Branch: master
Commit: 6b29df73115682424daf7b276d0138f004e274f7
URL: 
https://github.com/kamailio/kamailio/commit/6b29df73115682424daf7b276d0138f004e274f7

Author: tsearle 
Committer: GitHub 
Date: 2024-04-22T12:53:48+02:00

tools/kemi: add dockstrings to the mocking (#3818)

kemi_mock.py can now optionally consume documentation information
generated by the vscode-kamailio-hover project

---

Modified: misc/tools/kemi/python_mock/README.md
Modified: misc/tools/kemi/python_mock/kemi_mock.py

---

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

---

diff --git a/misc/tools/kemi/python_mock/README.md 
b/misc/tools/kemi/python_mock/README.md
index 5e72e738c58..385cbd5656a 100644
--- a/misc/tools/kemi/python_mock/README.md
+++ b/misc/tools/kemi/python_mock/README.md
@@ -2,7 +2,7 @@
 
 Generate a mocking framework base on the output of app_python.api_list
 
-Usage:
+### Usage:
 ```
 /usr/sbin/kamctl rpc app_python.api_list > api.json
 ./kemi_mock.py api.json > KSR.py
@@ -15,6 +15,19 @@ the Union type add the --no-union flag
 ./kemi_mock.py api.json --no-union > KSR.py
 ```
 
+### Usage with Documentation:
+run the generate.py from the following project
+
+https://github.com/braams/vscode-kamailio-hover
+
+this creates a modules.json file in a tmp directory. This file can be used to 
generate the KSR.py file with documentation
+
+pass the modules.json as a 2nd parameter to kemi_mock.py
+```
+./kemi_mock.py api.json modules.json > KSR.py
+```
+
+## Mocking 
 Return values can be injected through the dictionary \_mock\_data
 
 ```python
diff --git a/misc/tools/kemi/python_mock/kemi_mock.py 
b/misc/tools/kemi/python_mock/kemi_mock.py
index 48a73efa232..145fcb34b3a 100755
--- a/misc/tools/kemi/python_mock/kemi_mock.py
+++ b/misc/tools/kemi/python_mock/kemi_mock.py
@@ -113,21 +113,41 @@ def printFunction(module_name, func, indent):
 else:
 print(prefix + "def " + func['name'] +"("+params+"):")
 
+generate_function_doc(module_name, func, prefix)
+
 print(prefix + "\tprint(\"Calling " + log_format_params + "\" % 
"+log_params+")")
 printMocReturn(module_name, func, indent+1)
 print("")
 
 
+def generate_function_doc(module_name, func, prefix):
+if documentation is not None and module_name in documentation:
+function_parts = func['name'].split("_")
+for i in range(len(function_parts), 0, -1):
+function_prefix = "_".join(function_parts[:i])
+if function_prefix in documentation[module_name]["functions"]:
+print(prefix + "\t\"\"\"")
+documentation_lines = 
documentation[module_name]["functions"][function_prefix].split("\n")
+for line in documentation_lines:
+print(prefix + "\t" + line)
+print(prefix + "\t\"\"\"")
+break
+
+
 classes = defaultdict(list)
 
 if len(sys.argv) < 2:
 print("Please specify the json file to parse")
 sys.exit(-1)
 
+documentation = None
 if len(sys.argv) > 2:
 for i in range(2,len(sys.argv)):
 if sys.argv[i] == "--no-union":
 noUnion = True
+else:
+with open(sys.argv[i]) as f:
+documentation = json.load(f)
 
 if not noUnion:
 print("from typing import Union")
@@ -193,12 +213,23 @@ def printFunction(module_name, func, indent):
 print("")
 printFunction('', func, 0)
 
+
+def document_module(module_name):
+if documentation is not None and module_name in documentation:
+print("\"\"\"")
+documentation_lines = 
documentation[module_name]["overview"].split("\n")
+for line in documentation_lines:
+print("" + line)
+print("\"\"\"")
+
+
 for module_name in classes.keys():
 if module_name != "":
 if module_name in reserved_keywords:
 print("setattr(sys.modules[__name__], '" + module_name + "', " + 
module_name.capitalize() + "())")
 else:
 print(module_name + " = "+module_name.capitalize()+"()")
+document_module(module_name)
 
 print("")
 

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


[sr-dev] git:master:3e1a7bb5: tools/kemi: update kemi_mock for python (#3751)

2024-02-09 Thread GitHub via sr-dev
Module: kamailio
Branch: master
Commit: 3e1a7bb5f6143383b1f486b8c67c3bf97cb32a3f
URL: 
https://github.com/kamailio/kamailio/commit/3e1a7bb5f6143383b1f486b8c67c3bf97cb32a3f

Author: tsearle 
Committer: GitHub 
Date: 2024-02-09T10:17:58+01:00

tools/kemi: update kemi_mock for python (#3751)

fixes code generation when python keywords are uses
fixes formating issues of generated code
fixes crash from pv.setl reporting parameters as null instead of 'none'

---

Modified: misc/tools/kemi/python_mock/kemi_mock.py
Modified: misc/tools/kemi/python_mock/test.py

---

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

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


[sr-dev] git:master:dd5c9a52: file_out: Module to log custom strings to files (GH #3741)

2024-02-01 Thread GitHub via sr-dev
Module: kamailio
Branch: master
Commit: dd5c9a5204eb946e731550a0ee7f3046c7065515
URL: 
https://github.com/kamailio/kamailio/commit/dd5c9a5204eb946e731550a0ee7f3046c7065515

Author: Xenofon Karamanos 
Committer: GitHub 
Date: 2024-02-01T18:15:17+01:00

file_out: Module to log custom strings to files (GH #3741)

* add new module to log custom strings to files (GH #3741)
* support for multiple files and also file balancing
* smaller refactorings will be done afterwards (use string in function for 
names with internal matching, make worker sleep also configurable
* a round of tests has been done, but it will be certainly tested more in the 
next days

---

Added: src/modules/file_out/Makefile
Added: src/modules/file_out/doc/Makefile
Added: src/modules/file_out/doc/file_out.xml
Added: src/modules/file_out/doc/file_out_admin.xml
Added: src/modules/file_out/file_out.c
Added: src/modules/file_out/types.c
Added: src/modules/file_out/types.h

---

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

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


[sr-dev] git:master:76cd7979: ims_charging: Add option to get and use P-Access-Network-Info for terminating scenario (#3726)

2024-01-24 Thread GitHub via sr-dev
Module: kamailio
Branch: master
Commit: 76cd7979aae176b3fde3b3d73975629b06cd509c
URL: 
https://github.com/kamailio/kamailio/commit/76cd7979aae176b3fde3b3d73975629b06cd509c

Author: Morten Tryfoss 
Committer: GitHub 
Date: 2024-01-24T21:16:08+01:00

ims_charging: Add option to get and use P-Access-Network-Info for terminating 
scenario (#3726)

Add option to configure node functionality for Ro requests

---

Modified: src/modules/ims_charging/Ro_data.c
Modified: src/modules/ims_charging/config.h
Modified: src/modules/ims_charging/doc/ims_charging_admin.xml
Modified: src/modules/ims_charging/ims_charging_mod.c

---

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

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


[sr-dev] git:master:03456e5e: tls: set parameter name for tls_h_mod_randctx()

2024-01-16 Thread GitHub via sr-dev
Module: kamailio
Branch: master
Commit: 03456e5e5983e2236b8e182cf3317d14ebf34e18
URL: 
https://github.com/kamailio/kamailio/commit/03456e5e5983e2236b8e182cf3317d14ebf34e18

Author: Elena-Ramona Modroiu 
Committer: GitHub 
Date: 2024-01-16T16:07:43+01:00

tls: set parameter name for tls_h_mod_randctx()

- without it fails to compile on Unbuntu 22.04 with low latency kernel

---

Modified: src/modules/tls/tls_init.c

---

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

---

diff --git a/src/modules/tls/tls_init.c b/src/modules/tls/tls_init.c
index bb1d0f19207..6992d4a65e2 100644
--- a/src/modules/tls/tls_init.c
+++ b/src/modules/tls/tls_init.c
@@ -739,7 +739,8 @@ int tls_pre_init(void)
  * left here in case more complex requirements arise in
  * OpenSSL >= 3.2.
  */
-long tls_h_mod_randctx(void *) {
+long tls_h_mod_randctx(void *param)
+{
 do {
 OSSL_LIB_CTX *osslglobal = NULL;
 EVP_RAND_CTX *randctx = NULL;

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


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

2024-01-16 Thread GitHub via sr-dev
Module: kamailio
Branch: master
Commit: 695f155f3a127f0bbe220a6b44a0fc3887e1e4be
URL: 
https://github.com/kamailio/kamailio/commit/695f155f3a127f0bbe220a6b44a0fc3887e1e4be

Author: Federico Cabiddu 
Committer: GitHub 
Date: 2024-01-16T09:42:27+01:00

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

---

Modified: src/modules/dialog/dlg_req_within.c

---

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

---

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

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


[sr-dev] git:master:1068bbbf: README.md: remove irc reference

2023-12-19 Thread GitHub via sr-dev
Module: kamailio
Branch: master
Commit: 1068bbbf9a7f2bf96d9ee2cefa1b81fbabac9805
URL: 
https://github.com/kamailio/kamailio/commit/1068bbbf9a7f2bf96d9ee2cefa1b81fbabac9805

Author: Daniel-Constantin Mierla 
Committer: GitHub 
Date: 2023-12-19T21:18:03+01:00

README.md: remove irc reference

---

Modified: README.md

---

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

---

diff --git a/README.md b/README.md
index a4616f9d66c..d06dd7a7822 100644
--- a/README.md
+++ b/README.md
@@ -101,13 +101,6 @@ For more information about the mailing lists, please see:
 
   * https://www.kamailio.org/w/mailing-lists/
 
-### IRC Channel
-
-An open IRC discussion channel is managed by the community:
-
-  * irc server: irc.freenode.net
-  * irc channel: #kamailio
-
 ### Matrix Channel
 
 An open Matrix discussion channel is managed by the community:

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


[sr-dev] git:master:8bfe55c6: topoh: uses socket IP when no mask_ip is defined (#3341)

2023-11-27 Thread GitHub via sr-dev
Module: kamailio
Branch: master
Commit: 8bfe55c68a06492c93a327eff6813fa0da8399dd
URL: 
https://github.com/kamailio/kamailio/commit/8bfe55c68a06492c93a327eff6813fa0da8399dd

Author: TorPetterson <32388321+torpetter...@users.noreply.github.com>
Committer: GitHub 
Date: 2023-11-27T13:50:09+01:00

topoh: uses socket IP when no mask_ip is defined (#3341)

* topoh: uses socket IP when no mask_ip is defined

If the parameter mask_ip is not defined the module finds the socket IP
and uses that as mask IP for the message.
If the socket has an advertised IP it is used, otherwise the socket IP is used.

---

Modified: src/modules/topoh/doc/topoh_admin.xml
Modified: src/modules/topoh/th_msg.c
Modified: src/modules/topoh/th_msg.h
Modified: src/modules/topoh/topoh_mod.c

---

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

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


[sr-dev] git:master:02dd4e2c: http_client: add information about parameter loading (#3619)

2023-11-02 Thread GitHub via sr-dev
Module: kamailio
Branch: master
Commit: 02dd4e2c883585601f4dbcea0b63b858b4dd24d6
URL: 
https://github.com/kamailio/kamailio/commit/02dd4e2c883585601f4dbcea0b63b858b4dd24d6

Author: Benjamin <92934023+tiet...@users.noreply.github.com>
Committer: GitHub 
Date: 2023-11-02T13:09:57+01:00

http_client: add information about parameter loading (#3619)

* http_client: add information about parameter loading

- Inform that the order of the parameters is important when httpcon is loaded 
first

* http_client: docs - typos from previous commit

-

Co-authored-by: Daniel-Constantin Mierla 

---

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

---

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

---

diff --git a/src/modules/http_client/doc/http_client_admin.xml 
b/src/modules/http_client/doc/http_client_admin.xml
index 1449dc824d8..0e182cc95e3 100644
--- a/src/modules/http_client/doc/http_client_admin.xml
+++ b/src/modules/http_client/doc/http_client_admin.xml
@@ -88,6 +88,13 @@
 

Parameters
+   
+   The parameters are loaded in order. That can lead to unexpected 
behavior:
+   If httpcon is set at first, the default values for all other 
parameters are used,
+   and not the values that might be set after httpcon.
+   For example, if setting verify_peer=0 or verify_host=0 after 
httpcon,
+   the certificates are checked and self-signed certificates are 
rejected nevertheless.
+   

httpredirect (int)


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


[sr-dev] git:master:4ec11b1a: cdp: Add and apply cdp_openssl_clear_errors function (#3612)

2023-10-24 Thread GitHub via sr-dev
Module: kamailio
Branch: master
Commit: 4ec11b1a851d321959a0a38041bc7a6ea8107f39
URL: 
https://github.com/kamailio/kamailio/commit/4ec11b1a851d321959a0a38041bc7a6ea8107f39

Author: Xenofon Karamanos 
Committer: GitHub 
Date: 2023-10-24T20:07:36+02:00

cdp: Add and apply cdp_openssl_clear_errors function (#3612)

* cdp: Add and apply cdp_openssl_clear_errors function
- add new function to clear OpenSSL errors prior to any SSL_* call

---

Modified: src/modules/cdp/cdp_tls.c
Modified: src/modules/cdp/cdp_tls.h
Modified: src/modules/cdp/receiver.c

---

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

---

diff --git a/src/modules/cdp/cdp_tls.c b/src/modules/cdp/cdp_tls.c
index 903445b676d..3f1c15fd182 100644
--- a/src/modules/cdp/cdp_tls.c
+++ b/src/modules/cdp/cdp_tls.c
@@ -164,6 +164,22 @@ int load_certificates(SSL_CTX *ctx, str *cert, str *key)
return 0;
 }
 
+/*
+ * Get any leftover errors from OpenSSL and print them.
+ * ERR_get_error() also removes the error from the OpenSSL error stack.
+ * This is useful to call before any SSL_* IO calls to make sure
+ * we don't have any leftover errors from previous calls (OpenSSL docs).
+ */
+void cdp_openssl_clear_errors(void)
+{
+   int i;
+   char err[256];
+   while((i = ERR_get_error())) {
+   ERR_error_string(i, err);
+   LM_INFO("clearing leftover error before SSL_* calls: %s\n", 
err);
+   }
+}
+
 SSL *init_ssl_conn(int client_fd, SSL_CTX *ctx)
 {
X509 *cert = NULL;
@@ -184,6 +200,7 @@ SSL *init_ssl_conn(int client_fd, SSL_CTX *ctx)
goto cleanup;
}
/* Perform the TLS handshake */
+   cdp_openssl_clear_errors();
ssl_ret = SSL_connect(ssl);
if(ssl_ret != 1) {
error = SSL_get_error(ssl, ssl_ret);
diff --git a/src/modules/cdp/cdp_tls.h b/src/modules/cdp/cdp_tls.h
index b2e49408b34..a4981fbade9 100644
--- a/src/modules/cdp/cdp_tls.h
+++ b/src/modules/cdp/cdp_tls.h
@@ -67,6 +67,7 @@ static inline int tls_err_ret(char *s, SSL_CTX *ctx)
} while(0)
 
 int tls_parse_method(str *method);
+void cdp_openssl_clear_errors(void);
 void init_ssl_methods(void);
 SSL_CTX *init_ssl_ctx(int method);
 SSL *init_ssl_conn(int client_fd, SSL_CTX *ctx);
diff --git a/src/modules/cdp/receiver.c b/src/modules/cdp/receiver.c
index ceee98127f6..223d14dd403 100644
--- a/src/modules/cdp/receiver.c
+++ b/src/modules/cdp/receiver.c
@@ -537,6 +537,7 @@ static inline int do_read(serviced_peer_t *sp, char *dst, 
int n)
char *err_str;
 
if(sp->tls_conn) {
+   cdp_openssl_clear_errors();
cnt = SSL_read(sp->tls_conn, dst, n);
if(unlikely(cnt < 0)) {
ssl_err = SSL_get_error(sp->tls_conn, cnt);
@@ -687,6 +688,7 @@ static int do_write(serviced_peer_t *sp, const void *buf, 
int num)
char *err_str;
 
if(sp->tls_conn) {
+   cdp_openssl_clear_errors();
cnt = SSL_write(sp->tls_conn, buf, num);
if(unlikely(cnt <= 0)) {
ssl_err = SSL_get_error(sp->tls_conn, cnt);

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


[sr-dev] git:master:65ccf80c: smsops: avoid c99 error (#3597)

2023-10-10 Thread GitHub via sr-dev
Module: kamailio
Branch: master
Commit: 65ccf80c90e007d7636e973009d8cb2446cd8821
URL: 
https://github.com/kamailio/kamailio/commit/65ccf80c90e007d7636e973009d8cb2446cd8821

Author: mtryfoss 
Committer: GitHub 
Date: 2023-10-10T14:01:38+02:00

smsops: avoid c99 error (#3597)

---

Modified: src/modules/smsops/smsops_impl.c

---

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

---

diff --git a/src/modules/smsops/smsops_impl.c b/src/modules/smsops/smsops_impl.c
index 485a814774c..c8ccc2df4e1 100644
--- a/src/modules/smsops/smsops_impl.c
+++ b/src/modules/smsops/smsops_impl.c
@@ -511,8 +511,9 @@ int ucs2_to_utf8(char *ucs2, int ucs2_len, char *utf8)
uint16_t high_surrogate, low_surrogate;
uint32_t codepoint;
uint16_t ucs2_char;
+   size_t ucs2_index;
 
-   for(size_t ucs2_index = 0; ucs2_index < ucs2_len; ucs2_index += 2) {
+   for(ucs2_index = 0; ucs2_index < ucs2_len; ucs2_index += 2) {
ucs2_char = (unsigned char)ucs2[ucs2_index];
ucs2_char = (ucs2_char << 8) | (unsigned char)ucs2[ucs2_index + 
1];
if(ucs2_char <= 0x7F) {

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