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

2022-02-16 Thread Gavin Henry
> Another great thing is that you appear to have exposed your ad hoc SIP
> parser as a module, which means it could potentially be imported and used
> in other tools.
>

There didn't seem to be many SIP parsers when I looked when I chose C
instead of Go to use libosip2 which is very, very mature.

Looking forward to trying this in my GitHub Actions as I was about to plumb
in SIPp scenarios:

https://github.com/SentryPeer/SentryPeer/actions

I also looked at Rust SIP crates, not many either...

Nice work.

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


Re: [sr-dev] Releasing Kamailio v5.5.4

2022-02-16 Thread Daniel-Constantin Mierla
Hello,

the quick reminder that today Kamailio v.5.5.4 is going to be release,
therefore any commits to branch 5.5 have to be announced to sr-dev
mailing list or matrix channel before pushing them to repository to
avoid conflicts with building the release. Once the announcement is out,
commits can be pushed in as usual.

Cheers,
Daniel

On 14.02.22 12:57, Daniel-Constantin Mierla wrote:
> Hello,
>
> I am considering to release Kamailio v5.5.4 later this week, likely on
> Thursday, Feb 17, 2022. This is the usual heads up
> notification to see if anyone is aware of issues not yet reported to bug
> tracker and if yes, do it as soon as possible to give them a chance to
> be fixed.
>
> Cheers,
> Daniel
>
> -- 
> Daniel-Constantin Mierla -- www.asipto.com
> www.twitter.com/miconda -- www.linkedin.com/in/miconda
> Kamailio Advanced Training - Online
>   Feb 21-24, 2022 (America Timezone)
>   * https://www.asipto.com/sw/kamailio-advanced-training-online/
>
-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - Online
  Feb 21-24, 2022 (America Timezone)
  * https://www.asipto.com/sw/kamailio-advanced-training-online/


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


[sr-dev] git:master:e721e926: core: sruid - functions to get sruid with suffix from hasing a string

2022-02-16 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: e721e9262c4b48c3c2f5107f5f5d6195243662db
URL: 
https://github.com/kamailio/kamailio/commit/e721e9262c4b48c3c2f5107f5f5d6195243662db

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2022-02-16T13:34:05+01:00

core: sruid - functions to get sruid with suffix from hasing a string

---

Modified: src/core/utils/sruid.c
Modified: src/core/utils/sruid.h

---

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

---

diff --git a/src/core/utils/sruid.c b/src/core/utils/sruid.c
index d9f089e685..510da8bb81 100644
--- a/src/core/utils/sruid.c
+++ b/src/core/utils/sruid.c
@@ -36,6 +36,9 @@
 #include "../../core/dprint.h"
 #include "../../core/globals.h"
 #include "../../core/pt.h"
+#include "../../core/ut.h"
+#include "../../core/trim.h"
+#include "../../core/hashes.h"
 
 #include "sruid.h"
 
@@ -211,6 +214,25 @@ int sruid_nextx(sruid_t *sid, str *x)
return 0;
 }
 
+/**
+ *
+ */
+int sruid_nexthid(sruid_t *sid, str *sval)
+{
+   char buf_int[INT2STR_MAX_LEN];
+   str hval = str_init("0");
+   unsigned int hid = 0;
+
+   if(sval==NULL || sval->s==NULL || sval->len<=0) {
+   return sruid_nextx(sid, );
+   }
+   hval = *sval;
+   trim();
+   hid = get_hash1_raw(hval.s, hval.len);
+   hval.s = int2strbuf(hid, buf_int, INT2STR_MAX_LEN, );
+   return sruid_nextx(sid, );
+}
+
 /**
  *
  */
@@ -228,6 +250,15 @@ int sruid_nextx_safe(sruid_t *sid, str *x)
return sruid_nextx(sid, x);
 }
 
+/**
+ *
+ */
+int sruid_nexthid_safe(sruid_t *sid, str *sval)
+{
+   if(unlikely(sid->pid!=my_pid())) sruid_reinit(sid, sid->mode);
+   return sruid_nexthid(sid, sval);
+}
+
 /**
  *
  */
diff --git a/src/core/utils/sruid.h b/src/core/utils/sruid.h
index 7fdde96a95..8d44635619 100644
--- a/src/core/utils/sruid.h
+++ b/src/core/utils/sruid.h
@@ -51,4 +51,7 @@ int sruid_next_safe(sruid_t *sid);
 int sruid_nextx(sruid_t *sid, str *x);
 int sruid_nextx_safe(sruid_t *sid, str *x);
 
+int sruid_nexthid(sruid_t *sid, str *sval);
+int sruid_nexthid_safe(sruid_t *sid, str *sval);
+
 #endif


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


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

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

Federico

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

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


[sr-dev] git:master:88f1a1a6: tmx: use trimmed call-id value for hashing

2022-02-16 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: 88f1a1a671c4486e5000415b3d52eb42e6ad4cbb
URL: 
https://github.com/kamailio/kamailio/commit/88f1a1a671c4486e5000415b3d52eb42e6ad4cbb

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2022-02-16T12:45:33+01:00

tmx: use trimmed call-id value for hashing

---

Modified: src/modules/tmx/tmx_pretran.c

---

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

---

diff --git a/src/modules/tmx/tmx_pretran.c b/src/modules/tmx/tmx_pretran.c
index 256c82bf16..7bb2315fd3 100644
--- a/src/modules/tmx/tmx_pretran.c
+++ b/src/modules/tmx/tmx_pretran.c
@@ -243,7 +243,7 @@ int tmx_check_pretran(sip_msg_t *msg)
sftag = get_from(msg)->tag_value;
trim();
 
-   chid = get_hash1_raw(msg->callid->body.s, msg->callid->body.len);
+   chid = get_hash1_raw(scallid.s, scallid.len);
slotid = chid & (_tmx_ptran_size-1);
 
if(unlikely(_tmx_proc_ptran == NULL)) {


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


Re: [sr-dev] [SR-Users] Info: SIP resources collection

2022-02-16 Thread Henning Westerholt
Hi Daniel,

thanks for the reply. I previously only found pjsip, but I missed it in the CLI 
section.

Cheers,

Henning

-Original Message-
From: Daniel-Constantin Mierla  
Sent: Wednesday, February 16, 2022 11:49 AM
To: Henning Westerholt ; Kamailio (SER) - Users Mailing List 
; Kamailio (SER) - Devel Mailing List 

Subject: Re: [SR-Users] Info: SIP resources collection

It is already in two sections, do you consider it should be added somewhere 
else?

Cheers,
Daniel

On 16.02.22 11:22, Henning Westerholt wrote:
> Thank you Daniel.
>
> You might want to add this one https://www.pjsip.org/pjsua.htm
>
> This is a command line softphone from the pjsip project, somewhat similar to 
> the sipexer tool at least in basic call scenarios. It supports media as well, 
> which can be handy.
>
> Cheers,
>
> Henning
>
> --
> Henning Westerholt – https://skalatan.de/blog/ Kamailio services – 
> https://gilawa.com
>
> -Original Message-
> From: sr-users  On Behalf Of 
> Daniel-Constantin Mierla
> Sent: Wednesday, February 16, 2022 11:17 AM
> To: Kamailio (SER) - Users Mailing List ; 
> Kamailio (SER) - Devel Mailing List 
> Subject: [SR-Users] Info: SIP resources collection
>
> Hello,
>
> over the 20 years I used various SIP applications, libraries and tools but 
> after a while I forgot many of them, therefore I tried to collect many in a 
> list hosted on github at:
>
>   * https://github.com/miconda/sip-resources
>
> Hoping it proves useful for some of you!
>
> Cheers,
> Daniel
>
> --
> Daniel-Constantin Mierla -- www.asipto.com www.twitter.com/miconda -- 
> www.linkedin.com/in/miconda Kamailio Advanced Training - Online
>   Feb 21-24, 2022 (America Timezone)
>   * https://www.asipto.com/sw/kamailio-advanced-training-online/
>
>
> __
> Kamailio - Users Mailing List - Non Commercial Discussions
>   * sr-us...@lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to the 
> sender!
> Edit mailing list options or unsubscribe:
>   * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

--
Daniel-Constantin Mierla -- www.asipto.com www.twitter.com/miconda -- 
www.linkedin.com/in/miconda Kamailio Advanced Training - Online
  Feb 21-24, 2022 (America Timezone)
  * https://www.asipto.com/sw/kamailio-advanced-training-online/

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


[sr-dev] git:master:0d688a69: async: exported functions to kemi to get async group name and data

2022-02-16 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: 0d688a69e27b1ea49bf8c06469e1ce2e11006d95
URL: 
https://github.com/kamailio/kamailio/commit/0d688a69e27b1ea49bf8c06469e1ce2e11006d95

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2022-02-16T12:05:40+01:00

async: exported functions to kemi to get async group name and data

---

Modified: src/modules/async/async_mod.c
Modified: src/modules/async/async_sleep.c
Modified: src/modules/async/async_sleep.h

---

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

---

diff --git a/src/modules/async/async_mod.c b/src/modules/async/async_mod.c
index 60cd10e677..ee69e96e14 100644
--- a/src/modules/async/async_mod.c
+++ b/src/modules/async/async_mod.c
@@ -674,6 +674,16 @@ static sr_kemi_t sr_kemi_async_exports[] = {
{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
+   { str_init("async"), str_init("get_gname"),
+   SR_KEMIP_XVAL, ki_async_get_gname,
+   { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+   SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+   },
+   { str_init("async"), str_init("get_data"),
+   SR_KEMIP_XVAL, ki_async_get_data,
+   { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+   SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+   },
 
{ {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
 };
diff --git a/src/modules/async/async_sleep.c b/src/modules/async/async_sleep.c
index cfbfe98cef..b51887e351 100644
--- a/src/modules/async/async_sleep.c
+++ b/src/modules/async/async_sleep.c
@@ -675,3 +675,44 @@ int pv_parse_geoip_name(pv_spec_t *sp, str *in)
LM_ERR("unknown PV time name %.*s\n", in->len, in->s);
return -1;
 }
+
+/**
+ *
+ */
+static sr_kemi_xval_t _ksr_kemi_async_xval = {0};
+
+/**
+ *
+ */
+sr_kemi_xval_t* ki_async_get_gname(sip_msg_t *msg)
+{
+   async_wgroup_t *awg = NULL;
+
+   memset(&_ksr_kemi_async_xval, 0, sizeof(sr_kemi_xval_t));
+
+   awg = async_task_workers_get_crt();
+   if(awg==NULL || awg->name.s==NULL || awg->name.len<0) {
+   sr_kemi_xval_null(&_ksr_kemi_async_xval, 
SR_KEMI_XVAL_NULL_EMPTY);
+   return &_ksr_kemi_async_xval;
+   }
+   _ksr_kemi_async_xval.vtype = SR_KEMIP_STR;
+   _ksr_kemi_async_xval.v.s = awg->name;
+   return &_ksr_kemi_async_xval;
+}
+
+/**
+ *
+ */
+sr_kemi_xval_t* ki_async_get_data(sip_msg_t *msg)
+{
+   memset(&_ksr_kemi_async_xval, 0, sizeof(sr_kemi_xval_t));
+
+   if(_ksr_async_data_param==NULL || _ksr_async_data_param->sval.s==NULL
+   || _ksr_async_data_param->sval.len<0) {
+   sr_kemi_xval_null(&_ksr_kemi_async_xval, 
SR_KEMI_XVAL_NULL_EMPTY);
+   return &_ksr_kemi_async_xval;
+   }
+   _ksr_kemi_async_xval.vtype = SR_KEMIP_STR;
+   _ksr_kemi_async_xval.v.s = _ksr_async_data_param->sval;
+   return &_ksr_kemi_async_xval;
+}
diff --git a/src/modules/async/async_sleep.h b/src/modules/async/async_sleep.h
index bb7dd042ce..254962bd70 100644
--- a/src/modules/async/async_sleep.h
+++ b/src/modules/async/async_sleep.h
@@ -56,4 +56,7 @@ int async_send_data(sip_msg_t *msg, cfg_action_t *act, str 
*cbname, str *gname,
 int pv_get_async(sip_msg_t *msg, pv_param_t *param, pv_value_t *res);
 int pv_parse_async_name(pv_spec_t *sp, str *in);
 
+sr_kemi_xval_t* ki_async_get_gname(sip_msg_t *msg);
+sr_kemi_xval_t* ki_async_get_data(sip_msg_t *msg);
+
 #endif


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


Re: [sr-dev] [SR-Users] Info: SIP resources collection

2022-02-16 Thread Daniel-Constantin Mierla
It is already in two sections, do you consider it should be added
somewhere else?

Cheers,
Daniel

On 16.02.22 11:22, Henning Westerholt wrote:
> Thank you Daniel.
>
> You might want to add this one https://www.pjsip.org/pjsua.htm
>
> This is a command line softphone from the pjsip project, somewhat similar to 
> the sipexer tool at least in basic call scenarios. It supports media as well, 
> which can be handy.
>
> Cheers,
>
> Henning
>
> -- 
> Henning Westerholt – https://skalatan.de/blog/
> Kamailio services – https://gilawa.com
>
> -Original Message-
> From: sr-users  On Behalf Of 
> Daniel-Constantin Mierla
> Sent: Wednesday, February 16, 2022 11:17 AM
> To: Kamailio (SER) - Users Mailing List ; 
> Kamailio (SER) - Devel Mailing List 
> Subject: [SR-Users] Info: SIP resources collection
>
> Hello,
>
> over the 20 years I used various SIP applications, libraries and tools but 
> after a while I forgot many of them, therefore I tried to collect many in a 
> list hosted on github at:
>
>   * https://github.com/miconda/sip-resources
>
> Hoping it proves useful for some of you!
>
> Cheers,
> Daniel
>
> --
> Daniel-Constantin Mierla -- www.asipto.com www.twitter.com/miconda -- 
> www.linkedin.com/in/miconda Kamailio Advanced Training - Online
>   Feb 21-24, 2022 (America Timezone)
>   * https://www.asipto.com/sw/kamailio-advanced-training-online/
>
>
> __
> Kamailio - Users Mailing List - Non Commercial Discussions
>   * sr-us...@lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to the 
> sender!
> Edit mailing list options or unsubscribe:
>   * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - Online
  Feb 21-24, 2022 (America Timezone)
  * https://www.asipto.com/sw/kamailio-advanced-training-online/


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


Re: [sr-dev] [SR-Users] Info: SIP resources collection

2022-02-16 Thread Henning Westerholt
Thank you Daniel.

You might want to add this one https://www.pjsip.org/pjsua.htm

This is a command line softphone from the pjsip project, somewhat similar to 
the sipexer tool at least in basic call scenarios. It supports media as well, 
which can be handy.

Cheers,

Henning

-- 
Henning Westerholt – https://skalatan.de/blog/
Kamailio services – https://gilawa.com

-Original Message-
From: sr-users  On Behalf Of 
Daniel-Constantin Mierla
Sent: Wednesday, February 16, 2022 11:17 AM
To: Kamailio (SER) - Users Mailing List ; Kamailio 
(SER) - Devel Mailing List 
Subject: [SR-Users] Info: SIP resources collection

Hello,

over the 20 years I used various SIP applications, libraries and tools but 
after a while I forgot many of them, therefore I tried to collect many in a 
list hosted on github at:

  * https://github.com/miconda/sip-resources

Hoping it proves useful for some of you!

Cheers,
Daniel

--
Daniel-Constantin Mierla -- www.asipto.com www.twitter.com/miconda -- 
www.linkedin.com/in/miconda Kamailio Advanced Training - Online
  Feb 21-24, 2022 (America Timezone)
  * https://www.asipto.com/sw/kamailio-advanced-training-online/


__
Kamailio - Users Mailing List - Non Commercial Discussions
  * sr-us...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:
  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] Info: SIP resources collection

2022-02-16 Thread Daniel-Constantin Mierla
Hello,

over the 20 years I used various SIP applications, libraries and tools
but after a while I forgot many of them, therefore I tried to collect
many in a list hosted on github at:

  * https://github.com/miconda/sip-resources

Hoping it proves useful for some of you!

Cheers,
Daniel

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - Online
  Feb 21-24, 2022 (America Timezone)
  * https://www.asipto.com/sw/kamailio-advanced-training-online/


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


[sr-dev] git:master:e81f2e31: uuid: use define for buffer size

2022-02-16 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: e81f2e318bc32802d152ef69d005b8194e17ca42
URL: 
https://github.com/kamailio/kamailio/commit/e81f2e318bc32802d152ef69d005b8194e17ca42

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2022-02-16T10:18:17+01:00

uuid: use define for buffer size

- log error if uuid was not generated in safe mode

---

Modified: src/modules/uuid/uuid_mod.c

---

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

---

diff --git a/src/modules/uuid/uuid_mod.c b/src/modules/uuid/uuid_mod.c
index a5aae589d8..247d5830ab 100644
--- a/src/modules/uuid/uuid_mod.c
+++ b/src/modules/uuid/uuid_mod.c
@@ -34,12 +34,18 @@
 
 MODULE_VERSION
 
+#ifdef UUID_LEN_STR
+#define KSR_UUID_BSIZE (UUID_LEN_STR + 4)
+#else
+#define KSR_UUID_BSIZE 40
+#endif
+
 static int  mod_init(void);
 static int  child_init(int);
 static void mod_destroy(void);
 
 static uuid_t _k_uuid_val;
-static char   _k_uuid_str[40];
+static char   _k_uuid_str[KSR_UUID_BSIZE];
 
 int pv_get_uuid(sip_msg_t *msg, pv_param_t *param,
pv_value_t *res);
@@ -162,8 +168,10 @@ int pv_get_uuid(sip_msg_t *msg, pv_param_t *param,
break;
case 3:
 #ifndef __OS_darwin
-   if(uuid_generate_time_safe(_k_uuid_val))
+   if(uuid_generate_time_safe(_k_uuid_val)!=0) {
+   LM_ERR("uuid not generated in a safe mode\n");
return pv_get_null(msg, param, res);
+   }
 #else
uuid_generate_time(_k_uuid_val);
 #endif


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


[sr-dev] git:master:b311a01c: modules: readme files regenerated - async ... [skip ci]

2022-02-16 Thread Kamailio Dev
Module: kamailio
Branch: master
Commit: b311a01cde334106cea4ee777d40a75f0fab491f
URL: 
https://github.com/kamailio/kamailio/commit/b311a01cde334106cea4ee777d40a75f0fab491f

Author: Kamailio Dev 
Committer: Kamailio Dev 
Date: 2022-02-16T09:46:22+01:00

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

---

Modified: src/modules/async/README

---

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

---

diff --git a/src/modules/async/README b/src/modules/async/README
index 744e98bf3e..8e165efa95 100644
--- a/src/modules/async/README
+++ b/src/modules/async/README
@@ -36,6 +36,8 @@ Daniel-Constantin Mierla
   4.4. async_ms_sleep(milliseconds)
   4.5. async_task_route(routename)
   4.6. async_task_group_route(routename, groupname)
+  4.7. async_task_data(routename, data)
+  4.8. async_task_group_data(routename, groupname, data)
 
List of Examples
 
@@ -48,6 +50,8 @@ Daniel-Constantin Mierla
1.7. async_workers usage
1.8. async_task_route usage
1.9. async_task_group_route usage
+   1.10. async_task_data usage
+   1.11. async_task_group_data usage
 
 Chapter 1. Admin Guide
 
@@ -72,6 +76,8 @@ Chapter 1. Admin Guide
 4.4. async_ms_sleep(milliseconds)
 4.5. async_task_route(routename)
 4.6. async_task_group_route(routename, groupname)
+4.7. async_task_data(routename, data)
+4.8. async_task_group_data(routename, groupname, data)
 
 1. Overview
 
@@ -143,6 +149,8 @@ modparam("async", "ms_timer", 10)
4.4. async_ms_sleep(milliseconds)
4.5. async_task_route(routename)
4.6. async_task_group_route(routename, groupname)
+   4.7. async_task_data(routename, data)
+   4.8. async_task_group_data(routename, groupname, data)
 
 4.1.  async_route(routename, seconds)
 
@@ -335,3 +343,54 @@ route[RESUME] {
exit;
 }
 ...
+
+4.7.  async_task_data(routename, data)
+
+   Send the data to a asynchronous task process (in the first group) that
+   executes the route[rountename] and makes the data available via
+   $async(data).
+
+   The current SIP message is not suspended and it is not available in the
+   asynchronous task process, a local faked SIP request is used there.
+
+   The parameters can contain variables.
+
+   This function can be used from ANY_ROUTE.
+
+   Example 1.10. async_task_data usage
+...
+async_workers_group="name=abc;workers=4;nonblock=0;usleep=0"
+...
+request_route {
+...
+async_task_data("RESUME", "caller: $fU - callee: $tU");
+...
+}
+route[RESUME] {
+   xinfo("$async(data)\n");
+   exit;
+}
+...
+
+4.8.  async_task_group_data(routename, groupname, data)
+
+   Similar to async_task_route(), but allows to specify the name of the
+   group for asynchronous workers. See also 'async_workers_group' core
+   global parameter.
+
+   This function can be used from ANY_ROUTE.
+
+   Example 1.11. async_task_group_data usage
+...
+async_workers_group="name=abc;workers=4;nonblock=0;usleep=0"
+...
+request_route {
+...
+async_task_data("RESUME", "abc", "caller: $fU - callee: $tU");
+...
+}
+route[RESUME] {
+   xinfo("$async(data)\n");
+   exit;
+}
+...


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


[sr-dev] git:master:e9595b5f: async: allow async task data functions in any route

2022-02-16 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: e9595b5fcc758a50cea5dcaa0d9109e2f349ecca
URL: 
https://github.com/kamailio/kamailio/commit/e9595b5fcc758a50cea5dcaa0d9109e2f349ecca

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2022-02-16T09:39:43+01:00

async: allow async task data functions in any route

---

Modified: src/modules/async/async_mod.c

---

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

---

diff --git a/src/modules/async/async_mod.c b/src/modules/async/async_mod.c
index 69717273b9..60cd10e677 100644
--- a/src/modules/async/async_mod.c
+++ b/src/modules/async/async_mod.c
@@ -79,9 +79,9 @@ static cmd_export_t cmds[]={
{"async_task_group_route", (cmd_function)w_async_task_group_route, 2, 
fixup_async_task_route,
0, REQUEST_ROUTE|FAILURE_ROUTE},
{"async_task_data", (cmd_function)w_async_task_data, 2, 
fixup_async_task_route,
-   0, REQUEST_ROUTE|FAILURE_ROUTE},
+   0, ANY_ROUTE},
{"async_task_group_data", (cmd_function)w_async_task_group_data, 3, 
fixup_async_task_route,
-   0, REQUEST_ROUTE|FAILURE_ROUTE},
+   0, ANY_ROUTE},
 
{0, 0, 0, 0, 0, 0}
 };
@@ -104,7 +104,7 @@ struct module_exports exports = {
cmds,
params,
0,  /* exported RPC methods */
-   0,  /* exported pseudo-variables */
+   mod_pvs,/* exported pseudo-variables */
0,  /* response function */
mod_init,   /* module initialization function */
child_init, /* per child init function */


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


[sr-dev] git:master:6462571b: async: docs for async task data functions

2022-02-16 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: 6462571bbdf1270516243b6759a26625ca874b80
URL: 
https://github.com/kamailio/kamailio/commit/6462571bbdf1270516243b6759a26625ca874b80

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2022-02-16T09:39:43+01:00

async: docs for async task data functions

---

Modified: src/modules/async/doc/async_admin.xml

---

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

---

diff --git a/src/modules/async/doc/async_admin.xml 
b/src/modules/async/doc/async_admin.xml
index 1db4d60e9e..b0e5ec45bd 100644
--- a/src/modules/async/doc/async_admin.xml
+++ b/src/modules/async/doc/async_admin.xml
@@ -370,6 +370,74 @@ route[RESUME] {
exit;
 }
 ...
+
+   
+   
+   
+   
+   async_task_data(routename, 
data)
+   
+   
+   Send the data to a asynchronous task process (in the first 
group) that
+   executes the route[rountename] and makes the data available via 
$async(data).
+   
+   
+   The current SIP message is not suspended and it is not 
available in
+   the asynchronous task process, a local faked SIP request is 
used there.
+   
+   
+   The parameters can contain variables.
+   
+   
+   This function can be used from ANY_ROUTE.
+   
+   
+   async_task_data usage
+   
+...
+async_workers_group="name=abc;workers=4;nonblock=0;usleep=0"
+...
+request_route {
+...
+async_task_data("RESUME", "caller: $fU - callee: $tU");
+...
+}
+route[RESUME] {
+   xinfo("$async(data)\n");
+   exit;
+}
+...
+
+   
+   
+   
+   
+   async_task_group_data(routename, groupname, data)
+   
+   
+   Similar to async_task_route(), but allows to specify the name 
of the group
+   for asynchronous workers. See also 'async_workers_group' core 
global
+   parameter.
+   
+   
+   This function can be used from ANY_ROUTE.
+   
+   
+   async_task_group_data usage
+   
+...
+async_workers_group="name=abc;workers=4;nonblock=0;usleep=0"
+...
+request_route {
+...
+async_task_data("RESUME", "abc", "caller: $fU - callee: $tU");
+...
+}
+route[RESUME] {
+   xinfo("$async(data)\n");
+   exit;
+}
+...
 




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


[sr-dev] git:master:a2b08993: async: added variable $async(key)

2022-02-16 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: a2b089939afc5309fc86d68bc9d43619bda4fec5
URL: 
https://github.com/kamailio/kamailio/commit/a2b089939afc5309fc86d68bc9d43619bda4fec5

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2022-02-16T09:39:43+01:00

async: added variable $async(key)

- get async task group name and async task data

---

Modified: src/modules/async/async_mod.c
Modified: src/modules/async/async_sleep.c
Modified: src/modules/async/async_sleep.h

---

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

---

diff --git a/src/modules/async/async_mod.c b/src/modules/async/async_mod.c
index 1020cd0c46..69717273b9 100644
--- a/src/modules/async/async_mod.c
+++ b/src/modules/async/async_mod.c
@@ -92,6 +92,12 @@ static param_export_t params[]={
{0, 0, 0}
 };
 
+static pv_export_t mod_pvs[] = {
+   { {"async", sizeof("async")-1}, PVT_OTHER, pv_get_async, 0,
+   pv_parse_async_name, 0, 0, 0 },
+   { {0, 0}, 0, 0, 0, 0, 0, 0, 0 }
+};
+
 struct module_exports exports = {
"async",
DEFAULT_DLFLAGS, /* dlopen flags */
diff --git a/src/modules/async/async_sleep.c b/src/modules/async/async_sleep.c
index 7c46174284..cfbfe98cef 100644
--- a/src/modules/async/async_sleep.c
+++ b/src/modules/async/async_sleep.c
@@ -619,3 +619,59 @@ int async_send_data(sip_msg_t *msg, cfg_action_t *act, str 
*cbname, str *gname,
 
return 0;
 }
+
+
+/**
+ *
+ */
+int pv_get_async(sip_msg_t *msg, pv_param_t *param, pv_value_t *res)
+{
+   async_wgroup_t *awg = NULL;
+
+   switch(param->pvn.u.isname.name.n) {
+   case 0:
+   if(_ksr_async_data_param==NULL || 
_ksr_async_data_param->sval.s==NULL
+   || _ksr_async_data_param->sval.len<0) {
+   return pv_get_null(msg, param, res);
+   }
+   return pv_get_strval(msg, param, res, 
&_ksr_async_data_param->sval);
+   case 1:
+   awg = async_task_workers_get_crt();
+   if(awg==NULL || awg->name.s==NULL || awg->name.len<0) {
+   return pv_get_null(msg, param, res);
+   }
+   return pv_get_strval(msg, param, res, >name);
+   default:
+   return pv_get_null(msg, param, res);
+   }
+}
+
+/**
+ *
+ */
+int pv_parse_geoip_name(pv_spec_t *sp, str *in)
+{
+   if(sp==NULL || in==NULL || in->len<=0)
+   return -1;
+
+   switch(in->len) {
+   case 4:
+   if(strncmp(in->s, "data", 4)==0)
+   sp->pvp.pvn.u.isname.name.n = 0;
+   break;
+   case 5:
+   if(strncmp(in->s, "gname", 5)==0)
+   sp->pvp.pvn.u.isname.name.n = 1;
+   break;
+   default:
+   goto error;
+   }
+   sp->pvp.pvn.type = PV_NAME_INTSTR;
+   sp->pvp.pvn.u.isname.type = 0;
+
+   return 0;
+
+error:
+   LM_ERR("unknown PV time name %.*s\n", in->len, in->s);
+   return -1;
+}
diff --git a/src/modules/async/async_sleep.h b/src/modules/async/async_sleep.h
index 2da46556f2..bb7dd042ce 100644
--- a/src/modules/async/async_sleep.h
+++ b/src/modules/async/async_sleep.h
@@ -53,4 +53,7 @@ int async_send_task(sip_msg_t *msg, cfg_action_t *act, str 
*cbname, str *gname);
 int async_send_data(sip_msg_t *msg, cfg_action_t *act, str *cbname, str *gname,
str *sdata);
 
+int pv_get_async(sip_msg_t *msg, pv_param_t *param, pv_value_t *res);
+int pv_parse_async_name(pv_spec_t *sp, str *in);
+
 #endif


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


[sr-dev] git:master:5f32e36b: async: functions to execute async tasks only with custom data

2022-02-16 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: 5f32e36b94ec21836fa910062e4121a8e47019fc
URL: 
https://github.com/kamailio/kamailio/commit/5f32e36b94ec21836fa910062e4121a8e47019fc

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2022-02-16T09:39:43+01:00

async: functions to execute async tasks only with custom data

- variants which don't suspend transaction, just pass some custom data
  to async workers to execute route blocks with faked message

---

Modified: src/modules/async/async_mod.c
Modified: src/modules/async/async_sleep.c
Modified: src/modules/async/async_sleep.h

---

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


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