From volga629@skillsearch.ca Sun Nov 27 05:29:49 2016 From: Slava Bendersky To: sr-users@lists.kamailio.org Subject: Re: [SR-Users] msilo Date: Sat, 26 Nov 2016 23:29:39 -0500 Message-ID: <1073817313.85630437.1480220979414.JavaMail.zimbra@skillsearch.ca> In-Reply-To: <1188251604.85608033.1480220423270.JavaMail.zimbra@skillsearch.ca> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1270443011==" --===============1270443011== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hello Everyone,=20 I tried use sr.pv.sets, but not sure how to pass value to it.=20 #!/usr/bin/lua=20 math.randomseed(os.time())=20 ruid =3D string.format("uloc-%08x-%03x-%x", math.random(0xffffffff), math.ran= dom(0xfff), math.random(0xf))=20 print(ruid) ---> Works=20 sr.pv.sets("$var(ruid)", "ruid") ---> In kamailio just static ruid=20 Output=20 AOR: New user Ruid -->[ruid]=20 Slava.=20 From: "volga629" =20 To: "sr-users" =20 Sent: Saturday, 26 November, 2016 23:41:46=20 Subject: Re: [SR-Users] msilo=20 Hello Everyone,=20 Can't find how actually return actual value from lua script not 1.=20 Because my setup is pass through REGISTER to B2BUA, I can't use registrar mod= ule. I though insert manually, but location table require ruid entry. I insta= lled small lua script to generate it. Not sure if this good approach for it. = When user send first REGISTER in request do like this=20 if(is_method("REGISTER")) {=20 add_path_received();=20 xlog("L_INFO", "MSILO: New user request saving contact [$ct]\n");=20 $var(ruid) =3D lua_dofile("/usr/bin/ruid.lua");=20 xlog("L_INFO", "AOR: New user Ruid -->[$var(ruid)]\n");=20 sql_query_async("cb","INSERT INTO location(id, username, expires, contact, us= er_agent, domain, callid, ruid) VALUES(0, '$au', $TS, '$ct', '$ua', '$fd', '$= ci', '$var(ruid)')");=20 }=20 Slava.=20 From: "volga629" =20 To: "sr-users" =20 Sent: Friday, 25 November, 2016 02:14:59=20 Subject: Re: [SR-Users] msilo=20 Hello Everyone,=20 I am trying run small lua script to generate random formatted string, but alw= ays get 1. Is script need be set in special way ? That related=20 to MSILO setup which I am trying to do.=20 xlog("L_INFO", "MSILO: New user request saving contact [$ct]\n");=20 $var(ruid) =3D lua_dofile("/usr/bin/ruid.lua");=20 xlog("L_INFO", "AOR: New user Ruid -->[$var(ruid)]\n");=20 Output=20 Nov 25 01:06:54 cavprx00 /usr/sbin/kamailio[3345]: INFO: