<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">This fails miserably:<div><br></div><div><div><font face="courier new, monospace">kamailio -f /etc/kamailio/kamailio.cfg -E \</font></div><div><font face="courier new, monospace"> -A "DBURL mysql://admin:mypass@db.mydomaincom/kamailio" \</font></div><div><font face="courier new, monospace"> -A "CBDBURL cb=>mysql://admin:mypass@db.mydomaincom/kamailio" \</font></div><div><font face="courier new, monospace"> -A "ASGDBURL asg=>mysql://admin:mypass@db.mydomaincom/kamailio" -DDDD</font></div><div><br></div></div><div><br></div><div><font face="courier new, monospace">modparam("sqlops","sqlcon", CBDBURL)</font><br></div><div><br></div><div>As does this:</div><div><br></div><div><div><font face="courier new, monospace">kamailio -f /etc/kamailio/kamailio.cfg -E \</font></div><div><font face="courier new, monospace"> -A "DBURL mysql://admin:mypass@db.mydomaincom/kamailio" \</font></div><div><font face="courier new, monospace"> -A "CBDBURL cb=>mysql://admin:mypass@db.mydomaincom/kamailio" \</font></div><div><font face="courier new, monospace"> -A "ASGDBURL asg=>mysql://admin:mypass@db.mydomaincom/kamailio" -DDDD</font></div><div><br></div></div><div><br></div><div>cfg</div><div><br></div><div><font face="courier new, monospace">modparam("sqlops","sqlcon", "CBDBURL")<br></font></div><div><font face="courier new, monospace">...</font></div><div><font face="courier new, monospace">$var(rows)=$sqlrows(cb);<br></font></div><div><br></div><div>When running:</div><div><br></div><div><font face="courier new, monospace"> 0(27514) CRITICAL: <core> [core/cfg.y:3424]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 1200, column 13-24: Can't get from cache: $sqlrows(cb</font>)<br></div><div><br></div><div><br></div><div>while hardcoded does work...</div><div><br></div><div>Don't really know where to go from here... It seems sqlops just doesn't take a define as the dburl source</div><div><br clear="all"><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,</div><div><br></div>David Villasmil<div>email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a></div><div>phone: +34669448337</div></div></div></div><br></div></div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, May 12, 2019 at 8:38 AM Daniel-Constantin Mierla <<a href="mailto:miconda@gmail.com">miconda@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<p>Try first something like:</p>
<p>modparam("sqlops","sqlcon","cb=>" DBURL )</p>
<p>If doesn't work, then:</p>
<p>modparam("sqlops","sqlcon", CBDBURL)</p>
<p>and have -A twice, one for DBURL and another one for CBDBURL.</p>
<p>The latest dev version (iirc) has the option to evaluate
variables in the defines, so you can use there the environment
pseudo-variables.</p>
<p>Cheers,<br>
Daniel<br>
</p>
<div class="gmail-m_-5915151816868306151moz-cite-prefix">On 11.05.19 11:56, David Villasmil
wrote:<br>
</div>
<blockquote type="cite">
<div>
<div dir="auto">Thanks Daniel;</div>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">The thing is I’m trying to implement password-less
starts (no hardcoded password)</div>
<div dir="auto"><br>
</div>
<div dir="auto">So I’m querying the password on start from aws ssm
and injecting it as a define, like.</div>
<div dir="auto"><br>
</div>
<div dir="auto">Kamailio -f kamailio.cfg -A “DBURL
`script-than-returns-MySQL-dburl-lambda.sh`“</div>
<div dir="auto"><br>
</div>
<div dir="auto">Is it possible to do substrdef from the command
line?</div>
<div dir="auto"><br>
</div>
<div dir="auto">Better yet, do you have a different. Approach to
doing this?</div>
<div dir="auto"><br>
</div>
<div dir="auto">David</div>
<div dir="auto"><br>
</div>
<div dir="auto"><br>
</div>
<div><br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Sat, 11 May 2019 at
07:12, Daniel-Constantin Mierla <<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<p>Hello,</p>
<p>use:</p>
<p><font face="monospace, monospace">#!substdef
"!DBURL!mysql://user:password@localhost/dbname!"</font></p>
<p><font face="monospace, monospace">The define is
replacing only standalone tokens, not inside string
values, like you have for sqlcon.</font></p>
<p><font face="monospace, monospace">More docs about
should be in core cookbook from wiki.<br>
</font></p>
<p><font face="monospace, monospace">Cheers,<br>
Daniel<br>
</font></p>
</div>
<div bgcolor="#FFFFFF">
<div class="gmail-m_-5915151816868306151m_-7489467460128768697moz-cite-prefix">On
11.05.19 02:05, David Villasmil wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">yes that works.
<div><br>
</div>
<div>My problem is not with sqlops.</div>
<div><br>
</div>
<div>My problem is with the DEFINE.</div>
<div><br>
</div>
<div>If I define:</div>
<div><br>
</div>
<div>#!define DBURL
"mysql://user:password@localhost/dbname"</div>
<div><br>
</div>
<div>and later:</div>
<div><br>
</div>
<div><span style="font-family:monospace,monospace">modparam("domain",
"db_url", DBURL)</span><br>
</div>
<div><span style="font-family:monospace,monospace"><br>
</span></div>
<div><span style="font-family:monospace,monospace">and
then:</span></div>
<div><span style="font-family:monospace,monospace"><br>
</span></div>
<div>modparam("sqlops","sqlcon","cb=>mysql://user:password@localhost/dbname")<span style="font-family:monospace,monospace"><br>
</span></div>
<div><br>
</div>
<div>Everything works properly.</div>
<div><br>
</div>
<div><br>
</div>
<div>My problem is how to use that DEFINE on ALL
instances where i need to use it.</div>
<div>i.e.</div>
<div><br>
</div>
<div>
<div><font face="monospace, monospace">#!define
DBURL "mysql://user:password@localhost/dbname"</font></div>
<div><font face="monospace, monospace">modparam("domain",
"db_url", DBURL)<br>
</font></div>
<div><font face="monospace, monospace">modparam("sqlops","sqlcon","cb=>mysql://user:password@localhost/dbname")<br>
</font></div>
<br class="gmail-m_-5915151816868306151m_-7489467460128768697gmail-Apple-interchange-newline">
</div>
<div>works, but;</div>
<div><br>
</div>
<div>
<div><font face="monospace, monospace">#!define
DBURL ©</font></div>
<div><font face="monospace, monospace">modparam("domain",
"db_url", DBURL)<br>
</font></div>
<div><font face="monospace, monospace">modparam("sqlops","sqlcon","cb=>DBURL")<br>
</font></div>
<br class="gmail-m_-5915151816868306151m_-7489467460128768697gmail-Apple-interchange-newline">
</div>
<div>does NOT, since</div>
<div>DBURL translates <span style="font-family:monospace,monospace">"mysql://user:password@</span><span style="font-family:monospace,monospace">localhost/dbname"
(quotes included)</span></div>
<div><span style="font-family:monospace,monospace"><br>
</span></div>
<div><span style="font-family:monospace,monospace">so </span></div>
<div><span style="font-family:monospace,monospace">modparam("sqlops","sqlcon","</span><span style="font-family:monospace,monospace">cb=>DBURL</span><span style="font-family:monospace,monospace">")</span><span style="font-family:monospace,monospace"><br>
</span></div>
<div><span style="font-family:monospace,monospace">translates
into</span></div>
<div><span style="font-family:monospace,monospace">modparam("sqlops","sqlcon","</span><span style="font-family:monospace,monospace">cb=></span><span style="font-family:monospace,monospace">"mysql://user:password@</span><span style="font-family:monospace,monospace">localhost/dbname"</span><span style="font-family:monospace,monospace">")</span></div>
<div><span style="font-family:monospace,monospace"><br>
</span></div>
<div><span style="font-family:monospace,monospace">and
that, of course, fails.</span></div>
<div><span style="font-family:monospace,monospace"><br>
</span></div>
<div><span style="font-family:monospace,monospace"><br>
</span></div>
<div><br>
</div>
<div><br clear="all">
<div>
<div dir="ltr" class="gmail-m_-5915151816868306151m_-7489467460128768697gmail_signature">
<div dir="ltr">
<div>Regards,</div>
<div><br>
</div>
David Villasmil
<div>email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a></div>
<div>phone: +34669448337</div>
</div>
</div>
</div>
<br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Sat, May 11, 2019
at 12:59 AM Sergiu Pojoga <<a href="mailto:pojogas@gmail.com" target="_blank">pojogas@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div dir="ltr">does is work like below? That's how
mine is set, probably for the same reason.
<div><br>
</div>
<div>modparam("sqlops","sqlcon","cb=>mysql://user:password@localhost/dbname")<br>
</div>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Fri, May 10,
2019 at 7:47 PM David Villasmil <<a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div dir="ltr">No,
<div><br>
</div>
<div>DBURL translates into </div>
<div><br>
</div>
<div><font face="monospace, monospace">"mysql://user:admin@dbuser/dbname"</font></div>
<div><br>
</div>
<div>so in sqlops:</div>
<div><font face="monospace, monospace" color="#000000"><br>
</font></div>
<div><font face="monospace, monospace" color="#000000">modparam("sqlops","sqlcon","cb=>DBURL") <br>
<br class="gmail-m_-5915151816868306151m_-7489467460128768697gmail-m_8999421816691597067gmail-m_8656473738726116412gmail-Apple-interchange-newline">
</font></div>
<div><font face="monospace, monospace" color="#000000">translates into:</font></div>
<div><font face="monospace, monospace" color="#000000"><br>
</font></div>
<div><font face="monospace, monospace" color="#000000">modparam("sqlops","sqlcon","cb=>"mysql://user:admin@dbuser/dbname"") <br>
</font><br class="gmail-m_-5915151816868306151m_-7489467460128768697gmail-m_8999421816691597067gmail-m_8656473738726116412gmail-Apple-interchange-newline">
</div>
<div>that works great on </div>
<div><br>
</div>
<div><font face="monospace, monospace">modparam("domain",
"db_url", DBURL)<br>
</font></div>
<div><font face="monospace, monospace"><br>
</font></div>
<div><font face="monospace, monospace">because
it translates into:</font></div>
<div><font face="monospace, monospace"><br>
</font></div>
<div><span style="font-family:monospace,monospace">modparam("domain",
"db_url", </span><span style="font-family:monospace,monospace">"mysql://user:admin@dbuser/dbname"</span><span style="font-family:monospace,monospace">)</span><font face="monospace, monospace"><br>
</font></div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>But not on the sqlops case</div>
<div><br clear="all">
<div>
<div dir="ltr" class="gmail-m_-5915151816868306151m_-7489467460128768697gmail-m_8999421816691597067gmail-m_8656473738726116412gmail_signature">
<div dir="ltr">
<div>Regards,</div>
<div><br>
</div>
David Villasmil
<div>email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a></div>
<div>phone: +34669448337</div>
</div>
</div>
</div>
<br>
</div>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Sat, May
11, 2019 at 12:32 AM Sergiu Pojoga <<a href="mailto:pojogas@gmail.com" target="_blank">pojogas@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div dir="ltr">You've got a typo<br>
</div>
<div dir="ltr"><br>
</div>
<div dir="ltr"><span style="font-family:monospace,monospace">modparam("sqlops","sqlcon","</span><span style="font-family:monospace,monospace">cb=>DBURL")</span> <br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Fri,
May 10, 2019 at 7:02 PM David Villasmil
<<a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div dir="ltr">Hello guys,
<div><br>
</div>
<div>So, i'm defining:</div>
<div><font face="monospace,
monospace"><br>
</font></div>
<div><font face="monospace,
monospace">DBURL
"mysql://user:password@dbhost/dbname"</font></div>
<div><br>
</div>
<div>and later on...</div>
<div><font face="monospace,
monospace"><br>
</font></div>
<div><font face="monospace,
monospace">modparam("sqlops","sqlcon","cb=>"DBURL)</font><br>
</div>
<div><br>
</div>
<div>and this fails miserably..</div>
<div><br>
</div>
<div>What do do on this case?</div>
<div><br>
</div>
<div><br>
</div>
<div>Thanks all!</div>
<div><br clear="all">
<div>
<div dir="ltr" class="gmail-m_-5915151816868306151m_-7489467460128768697gmail-m_8999421816691597067gmail-m_8656473738726116412gmail-m_8802530709471158215gmail-m_5431859416023029500m_-8960971401531193641gmail_signature">
<div dir="ltr">
<div>Regards,</div>
<div><br>
</div>
David Villasmil
<div>email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a></div>
<div>phone: +34669448337</div>
</div>
</div>
</div>
</div>
</div>
</div>
_______________________________________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote>
</div>
_______________________________________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote>
</div>
_______________________________________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote>
</div>
_______________________________________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote>
</div>
<br>
<fieldset class="gmail-m_-5915151816868306151m_-7489467460128768697mimeAttachmentHeader"></fieldset>
<pre class="gmail-m_-5915151816868306151m_-7489467460128768697moz-quote-pre">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="gmail-m_-5915151816868306151m_-7489467460128768697moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a>
<a class="gmail-m_-5915151816868306151m_-7489467460128768697moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
</blockquote>
<pre class="gmail-m_-5915151816868306151m_-7489467460128768697moz-signature" cols="72">--
Daniel-Constantin Mierla -- <a class="gmail-m_-5915151816868306151m_-7489467460128768697moz-txt-link-abbreviated" href="http://www.asipto.com" target="_blank">www.asipto.com</a>
<a class="gmail-m_-5915151816868306151m_-7489467460128768697moz-txt-link-abbreviated" href="http://www.twitter.com/miconda" target="_blank">www.twitter.com/miconda</a> -- <a class="gmail-m_-5915151816868306151m_-7489467460128768697moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda" target="_blank">www.linkedin.com/in/miconda</a></pre>
</div>
</blockquote>
</div>
</div>
-- <br>
<div dir="ltr" class="gmail-m_-5915151816868306151gmail_signature">
<div dir="ltr">
<div>Regards,</div>
<div><br>
</div>
David Villasmil
<div>email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a></div>
<div>phone: +34669448337</div>
</div>
</div>
</blockquote>
<pre class="gmail-m_-5915151816868306151moz-signature" cols="72">--
Daniel-Constantin Mierla -- <a class="gmail-m_-5915151816868306151moz-txt-link-abbreviated" href="http://www.asipto.com" target="_blank">www.asipto.com</a>
<a class="gmail-m_-5915151816868306151moz-txt-link-abbreviated" href="http://www.twitter.com/miconda" target="_blank">www.twitter.com/miconda</a> -- <a class="gmail-m_-5915151816868306151moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda" target="_blank">www.linkedin.com/in/miconda</a></pre>
</div>
</blockquote></div>