<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello,<br>
<br>
you can use htable module to cache data in memory and access it from
config file or lua script via pv.<br>
<br>
Cheers,<br>
Daniel<br>
<br>
<div class="moz-cite-prefix">On 6/13/12 2:27 PM, Sharif Tanvir
Rahman wrote:<br>
</div>
<blockquote
cite="mid:CAHUL73mCPNwEt0aMc7fG18r1-1hiYJFbg8J-Mbjy44XkseXTZQ@mail.gmail.com"
type="cite">
<div dir="ltr">
<div><font face="trebuchet ms,sans-serif">Hi </font>Daniel, </div>
<div><br>
</div>
<div>I need to access custom database tables (i.e. not default
with kamailio) from a lua script (extending kamailio.cfg). </div>
<font face="trebuchet ms,sans-serif">
<div><font face="trebuchet ms,sans-serif"><br>
</font></div>
Processing any incoming SIP request starts with a lua function
and that in turn call other functions - and each one needs
database access for taking routing decision. </font><span
style="font-family:'trebuchet ms',sans-serif">This seems to be
a huge performance issue (connecting/querying db in several
functions for a sip invite). </span>
<div>
<font face="trebuchet ms, sans-serif"><br>
</font></div>
<div><font face="trebuchet ms, sans-serif">Could you please
suggest</font></div>
<div>
<ul style="">
<li style=""><font face="trebuchet ms, sans-serif">Any
global scope (loads only once during start-up, but valid
for each routing) in kamailio, where the required tables
could be cached.</font></li>
<li style=""><font face="trebuchet ms, sans-serif">Or any
other way to address this.</font><span
style="font-family:'trebuchet ms',sans-serif"> </span></li>
</ul>
</div>
<div><font face="trebuchet ms, sans-serif"><br>
</font>
<div>
<div><font face="trebuchet ms,sans-serif">Thanks in
advance. </font></div>
<div><font face="trebuchet ms,sans-serif"><br>
</font></div>
<div><font face="trebuchet ms,sans-serif"><br>
</font></div>
<div><font face="trebuchet ms,sans-serif"><br>
</font><br>
<div class="gmail_quote">On Tue, Jun 21, 2011 at 2:21 PM,
Daniel-Constantin Mierla <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> Hello,<br>
<br>
to rewrite the r-uri you can use the function for
setting PV value:<br>
<br>
sr.pv.sets("$ru", "_here_is_new_uri_");<br>
<br>
To add contact headers to reply, you should use:<br>
<br>
sr.hdr.append_to_reply("Contact:
<_here_is_your_uri_>\r\n");<br>
<br>
Cheers,<br>
Daniel
<div>
<div class="h5"><br>
<br>
On 6/20/11 3:23 PM, Sharif Tanvir Rahman wrote:
</div>
</div>
<blockquote type="cite">
<div>
<div class="h5">
<div dir="ltr"><font face="trebuchet
ms,sans-serif">Hello,<br clear="all">
</font>
<div><font face="'trebuchet ms', sans-serif"><br>
</font></div>
<div><font face="'trebuchet ms', sans-serif">We
plan to use Kamailio as redirect server.
Corresponding contact list is to be
fetched by a Lua script from DB. <br>
</font></div>
<div><br>
</div>
<div>The problem is about calling the
required 'rewriteuri' function:</div>
<div>
<ol>
<li>From lua script. both
'sr.rewriteuri()' and
'sr.modf("rewriteuri", ...)" fails to
write the 'contact' field.</li>
<li>I tried an alternative way; pushing
the value from lua (e.g.
sr.pv.sets("contact", <a
moz-do-not-send="true">"sip:..."</a>))
and got the value in the Kamailio.cfg
($var(contact)). But can't call the
rewriteuri function with this
variable's value as argument. This
seems to be a general problem of
calling a function from .cfg with a
variable's value as parameter.</li>
</ol>
<div>Any help much appreciated.</div>
</div>
<div><br>
</div>
<div>-- <br>
Sharif <br>
</div>
</div>
<br>
<fieldset></fieldset>
<br>
</div>
</div>
<pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a moz-do-not-send="true" href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a>
<a moz-do-not-send="true" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><span class="HOEnZb"><font color="#888888">
</font></span></pre>
<span class="HOEnZb"><font color="#888888"> </font></span></blockquote>
<span class="HOEnZb"><font color="#888888"> <br>
<pre cols="72">--
Daniel-Constantin Mierla -- <a moz-do-not-send="true" href="http://www.asipto.com" target="_blank">http://www.asipto.com</a>
<a moz-do-not-send="true" href="http://linkedin.com/in/miconda" target="_blank">http://linkedin.com/in/miconda</a> -- <a moz-do-not-send="true" href="http://twitter.com/miconda" target="_blank">http://twitter.com/miconda</a></pre>
</font></span></div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
Sharif Tanvir<br>
</div>
</div>
</div>
</div>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla - <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Kamailio Advanced Training, Seattle, USA, Sep 23-26, 2012 - <a class="moz-txt-link-freetext" href="http://asipto.com/u/katu">http://asipto.com/u/katu</a>
Kamailio Practical Workshop, Netherlands, Sep 10-12, 2012 - <a class="moz-txt-link-freetext" href="http://asipto.com/u/kpw">http://asipto.com/u/kpw</a></pre>
<br>
<br>
</body>
</html>