It's been a while since I've needed this but I think gflags + avpops might be slightly more elegant. YMMV.<div><br></div><div>I'm not sure what the overheard to calling a perl function is (however i hear with the perl mod, it's very fast). I'd love to hear feedback on this....</div>
<div><br><div>-Brett</div><div><br><br><div class="gmail_quote">On Thu, May 28, 2009 at 1:42 AM, Alex Massover <span dir="ltr"><<a href="mailto:alex@jajah.com">alex@jajah.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div lang="EN-US" link="blue" vlink="purple">
<div>
<p><span style="font-size:11.0pt;color:#1F497D">Not exactly, but something like this is possible – the script
will run on every INVITE transaction, but it will do a query only once at first
run (once per every process/child).</span></p>
<p><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p><span style="font-size:11.0pt;color:#1F497D">You run a perl script for example on every INVITE, inside the
script you have something like:</span></p>
<p><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p><span style="font-size:11.0pt;color:#1F497D">our $query_result;</span></p>
<p><span style="font-size:11.0pt;color:#1F497D">unless(defined($query_result))</span></p>
<p><span style="font-size:11.0pt;color:#1F497D">{</span></p>
<p><span style="font-size:11.0pt;color:#1F497D"> $query_result=………
#run your query here</span></p>
<p><span style="font-size:11.0pt;color:#1F497D">}</span></p>
<p><span style="font-size:11.0pt;color:#1F497D">#pass your query result to avp values or whatever</span></p>
<p><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p><span style="font-size:11.0pt;color:#1F497D">The $query_result will be stored in the memory.</span></p><div class="im">
<p><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p><span style="font-size:10.0pt;color:#1F497D">--</span><span style="color:#1F497D"></span></p>
<p><span style="font-size:10.0pt;color:#1F497D">Best Regards,</span><span style="color:#1F497D"></span></p>
<p><span style="font-size:10.0pt;color:#1F497D">Alex Massover</span><span style="color:#1F497D"></span></p>
<p><span style="font-size:10.0pt;color:#1F497D">VoIP R&D TL</span><span style="color:#1F497D"></span></p>
<p><span style="font-size:10.0pt;color:#1F497D">Jajah Inc.</span><span style="font-size:11.0pt;color:#1F497D"></span></p>
</div><div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p><b><span style="font-size:10.0pt">From:</span></b><span style="font-size:10.0pt"> Sharath
[mailto:<a href="mailto:sharath.kumar79@gmail.com" target="_blank">sharath.kumar79@gmail.com</a>] <br>
<b>Sent:</b> Thursday, May 28, 2009 1:38 AM<br>
<b>To:</b> Alex Massover<br>
<b>Cc:</b> <a href="mailto:users@lists.opensips.org" target="_blank">users@lists.opensips.org</a><br>
<b>Subject:</b> Re: [OpenSIPS-Users] Sqlops in opensips ?</span></p>
</div><div class="im">
<p> </p>
<p style="margin-bottom:12.0pt">Is it possible to load *custom
values from a database from a custom table during init time. Am I correct in
assuming the AVPops module is scoped only for a call within a transaction ? Can
the perl module be used to make a db query at init time ?<br>
<br>
thanks for answering.<br>
-Sharath</p>
<div>
<p>On Wed, May 27, 2009 at 7:46 AM, Alex Massover <<a href="mailto:alex@jajah.com" target="_blank">alex@jajah.com</a>> wrote:</p>
<div>
<div>
<div>
<p> </p>
<p><span style="font-size:11.0pt;color:#1F497D">I think perl module is most
practical for you.</span></p>
<p><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p><span style="font-size:10.0pt;color:#1F497D">--</span></p>
<p><span style="font-size:10.0pt;color:#1F497D">Best Regards,</span></p>
<p><span style="font-size:10.0pt;color:#1F497D">Alex Massover</span></p>
<p><span style="font-size:10.0pt;color:#1F497D">VoIP R&D TL</span></p>
<p><span style="font-size:10.0pt;color:#1F497D">Jajah Inc.</span></p>
<div style="border:none;border-top:solid windowtext 1.0pt;padding:3.0pt 0in 0in 0in;border-color:-moz-use-text-color -moz-use-text-color">
<p><b><span style="font-size:10.0pt">From:</span></b><span style="font-size:10.0pt"> <a href="mailto:users-bounces@lists.opensips.org" target="_blank">users-bounces@lists.opensips.org</a>
[mailto:<a href="mailto:users-bounces@lists.opensips.org" target="_blank">users-bounces@lists.opensips.org</a>]
<b>On Behalf Of </b>Sharath<br>
<b>Sent:</b> Wednesday, May 27, 2009 12:42 AM<br>
<b>To:</b> <a href="mailto:users@lists.opensips.org" target="_blank">users@lists.opensips.org</a><br>
<b>Subject:</b> [OpenSIPS-Users] Sqlops in opensips ?</span></p>
</div>
<p> </p>
</div>
<p>hello,</p>
<div>
<div>
<p style="margin-bottom:12.0pt"><br>
Is there any module equivalent to sqlops of openser in opensips ? Basically I
want to run sql queries from proprietary tables and use them in the route
script file.<br>
<br>
thank you<br>
-Sharath</p>
</div>
</div>
<div>
<p>This mail was received via Mail-SeCure System.</p>
</div>
</div>
</div>
<div>
<div>
<p><br>
<br>
This mail was sent via Mail-SeCure System.</p>
</div>
</div>
<p style="margin-bottom:12.0pt"><br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a></p>
</div>
<p><br>
<br clear="all">
<br>
<br>
<br>
This mail was received via Mail-SeCure System.</p>
</div></div>
</div><div><div></div><div class="h5">
<br><br>
This mail was sent via Mail-SeCure System.<br>
</div></div><br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br></blockquote></div><br></div></div>