<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 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>"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 href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a>
<a 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 href="http://www.asipto.com" target="_blank">http://www.asipto.com</a>
<a href="http://linkedin.com/in/miconda" target="_blank">http://linkedin.com/in/miconda</a> -- <a 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>