[SR-Users] Can you use the sr.modf() method / function to call append_branch?
Daniel-Constantin Mierla
miconda at gmail.com
Thu Jan 8 19:42:49 CET 2015
Hello,
I think that append_branch() is not exported directly to lua and calling
it via sr.modf() can expose you to memory leaks
Adding a new branch is possible via pseudo-variable, your sequence of
functions is same as:
$ru = "sip:a at example.com";
$branch(uri) = "sip:b at example.com";
$branch(uri) = "sip:c at example.com";
$branch(uri) = "sip:d at example.com";
In lua, you can use:
http://www.kamailio.org/wiki/embeddedapi/devel/lua#srpvsets
That should be safer.
Cheers,
Daniel
On 31/12/14 19:24, J Lee wrote:
> I would like to know if there's a way to do parallel forking via lua
> code.
>
> So specifically, I'd like to be able to do something like this:
> seturi("sip:a at example.com <mailto:sip%3Aa at example.com>");
> append_branch("sip:b at example.com <mailto:sip%3Ab at example.com>");
> append_branch("sip:c at example.com <mailto:sip%3Ac at example.com>");
> append_branch("sip:d at example.com <mailto:sip%3Ad at example.com>");
>
> t_relay();
>
> except via lua, because the list of branches is dynamic. I've tried the following:
>
> sr.modf("append_branch","sip:10.x.x.x")
>
> but the error message I'm getting is:
> /usr/sbin/kamailio[7437]: ERROR: app_lua [app_lua_sr.c:177]: lua_sr_modf(): function 'append_branch' is not available
>
> Just wondering if I "should" be able to do this.
> I've been reading http://www.kamailio.org/wiki/embeddedapi/devel/lua#srtm_package but haven't seen any references to append_branch.
>
> The other alternative I'm looking at is to just use lua to generate the list of destinations and pass back a hashtable of sorts to
> the cfg file. Then from there I will try to loop through the hashtable and do the append_branch command for each entry
> in the table.
>
> If you have other suggestions, I'd appreciate it.
> Thanks.
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20150108/edc7720f/attachment.html>
More information about the sr-users
mailing list