[SR-Users] Lua script calling rewriteuri

Daniel-Constantin Mierla miconda at gmail.com
Thu Jun 14 10:17:46 CEST 2012


Hello,

you can use htable module to cache data in memory and access it from 
config file or lua script via pv.

Cheers,
Daniel

On 6/13/12 2:27 PM, Sharif Tanvir Rahman wrote:
> Hi Daniel,
>
> I need to access custom database tables (i.e. not default with 
> kamailio)  from a lua script (extending kamailio.cfg).
>
> 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. This seems to be a huge performance issue 
> (connecting/querying db in several functions for a sip invite).
>
> Could you please suggest
>
>   * Any global scope (loads only once during start-up, but valid for
>     each routing) in kamailio, where the required tables could be cached.
>   * Or any other way to address this.
>
>
> Thanks in advance.
>
>
>
>
> On Tue, Jun 21, 2011 at 2:21 PM, Daniel-Constantin Mierla 
> <miconda at gmail.com <mailto:miconda at gmail.com>> wrote:
>
>     Hello,
>
>     to rewrite the r-uri you can use the function for setting PV value:
>
>     sr.pv.sets("$ru", "_here_is_new_uri_");
>
>     To add contact headers to reply, you should use:
>
>     sr.hdr.append_to_reply("Contact: <_here_is_your_uri_>\r\n");
>
>     Cheers,
>     Daniel
>
>
>     On 6/20/11 3:23 PM, Sharif Tanvir Rahman wrote:
>>     Hello,
>>
>>     We plan to use Kamailio as redirect server. Corresponding contact
>>     list is to be fetched by a Lua script from DB.
>>
>>     The problem is about calling the required 'rewriteuri' function:
>>
>>      1. From lua script. both 'sr.rewriteuri()' and
>>         'sr.modf("rewriteuri", ...)" fails to write the 'contact' field.
>>      2. I tried an alternative way; pushing the value from lua (e.g.
>>         sr.pv.sets("contact", "sip:...")) 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.
>>
>>     Any help much appreciated.
>>
>>     -- 
>>     Sharif
>>
>>
>>     _______________________________________________
>>     SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>>     sr-users at lists.sip-router.org  <mailto:sr-users at lists.sip-router.org>
>>     http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>     -- 
>     Daniel-Constantin Mierla --http://www.asipto.com
>     http://linkedin.com/in/miconda  --http://twitter.com/miconda
>
>
>
>
> -- 
> Sharif Tanvir

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Training, Seattle, USA, Sep 23-26, 2012 - http://asipto.com/u/katu
Kamailio Practical Workshop, Netherlands, Sep 10-12, 2012 - http://asipto.com/u/kpw



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20120614/dae35cd2/attachment-0001.htm>


More information about the sr-users mailing list