On 8/9/13 1:13 PM, Grant Bagdasarian wrote:

Yeah, I do need a dynamic GUID.

 

From what I understood from Daniel:

use $sruid to get the unique id (it will be a new value for each use of it).

yes, for clarification:

$var(x) = $sruid;
$var(y) = $sruid;

the result is that $var(x) != $var(y)

Does this mean that for each request the $sruid variable returns a new unique id or the same for each kamailio instance?


For a better understanding, the value is made of several components:
- server_id global parameter, only if set in config and different than 0 (which is default value)
- timestamp when kamailio is started
- process id for each worker
- an incremented value for each sruid (or a random value each time, but this is not exported in config)

The collision across many instances even if server_id is not set is very unlikely. It would require that the instances are started at the same time and the task scheduler gives the same PID values for kamailio processes. But as said, if you have multiple instances, you can just set different server_id values.

Adding the alternative to use values generated by libuuid should not be that hard at all, for what I needed so far, $sruid was never colliding (and again, is very unlikely to happen anyhow).

Cheers,
Daniel

 

-----Original Message-----
From: sr-users-bounces@lists.sip-router.org [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Alex Balashov
Sent: Friday, August 9, 2013 11:32 AM
To: Kamailio (SER) - Users Mailing List
Subject: Re: [SR-Users] Generate UUID in Kamailio Script

 

Oh, I thought you were looking for a dynamic GUID, not a constant UID for an instance.

 

 

Grant Bagdasarian <GB@cm.nl> wrote:

>Nice!

> 

>Thanks!

> 

>-----Original Message-----

>From: sr-users-bounces@lists.sip-router.org

>[mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of

>Daniel-Constantin Mierla

>Sent: Thursday, August 8, 2013 4:50 PM

>To: Kamailio (SER) - Users Mailing List

>Subject: Re: [SR-Users] Generate UUID in Kamailio Script

> 

>Actually there is a variable giving an unique id for kamailio - just

>load kex module and use $sruid to get the unique id (it will be a new

>value for each use of it).

> 

>If you have multiple instances of kamailio, then set server_id global

>parameter to make the values unique across instances.

> 

>Cheers,

>Daniel

> 

> 

>On 8/8/13 4:43 PM, Grant Bagdasarian wrote:

>> That's too bad. Any idea if this already on the backlog for future

>Kamailio versions?

>> 

>> I guess the only option left is to use the EXEC module to run the

>uuidgen command to get a new UUID?

>> 

>> -----Original Message-----

>> From: sr-users-bounces@lists.sip-router.org

>> [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Alex

>> Balashov

>> Sent: Thursday, August 8, 2013 3:36 PM

>> To: sr-users@lists.sip-router.org

>> Subject: Re: [SR-Users] Generate UUID in Kamailio Script

>> 

>> Unfortunately, there is no transformation or core function that emits

>a GUID.

>> 

>> There probably should be one.

>> 

>> On 08/08/2013 09:33 AM, Grant Bagdasarian wrote:

>> 

>>> Hello,

>>> 

>>> Is it possible to generate a UUID inside the kamailio script? Is

>>> there a module available which does this already or do I need to

>call

>>> something external from the script?

>>> 

>>> Regards,

>>> 

>>> Grant

>>> 

>>> 

>>> 

>>> _______________________________________________

>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing

>>> list sr-users@lists.sip-router.org

>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

>>> 

>> 

>> --

>> Alex Balashov - Principal

>> Evariste Systems LLC

>> 235 E Ponce de Leon Ave

>> Suite 106

>> Decatur, GA 30030

>> United States

>> Tel: +1-678-954-0670

>> Web: http://www.evaristesys.com/, http://www.alexbalashov.com/

>> 

>> _______________________________________________

>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing

>> list sr-users@lists.sip-router.org

>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

>> 

>> _______________________________________________

>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing

>> list sr-users@lists.sip-router.org

>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

> 

>--

>Daniel-Constantin Mierla - http://www.asipto.com

>http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda

> 

> 

>_______________________________________________

>SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list

>sr-users@lists.sip-router.org

>http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

> 

>_______________________________________________

>SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list

>sr-users@lists.sip-router.org

>http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

 

--

Sent from my mobile, and thus lacking in the refinement one might expect from a fully fledged keyboard.

 

Alex Balashov - Principal

Evariste Systems LLC

235 E Ponce de Leon Ave

Suite 106

Decatur, GA 30030

United States

Tel: +1-678-954-0670

Web: http://www.evaristesys.com/, http://www.alexbalashov.com

 

_______________________________________________

SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users



_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda