<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><DIV>Hi Daniel,</DIV>
<DIV>I looked at the module and it seems more suitable for my needs.</DIV>
<DIV>I have two questions regarding this module:</DIV>
<DIV>1. It says that it is possible to use psuedo variables in the query. How is it done? I would like to make a query of the from username.</DIV>
<DIV>2. If I query the whole column how can I look for a specific value? The only way is to go over all the values with a loop?</DIV>
<DIV>&nbsp;</DIV>
<DIV>Yaron.<BR></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><BR>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><FONT face=Tahoma size=2>
<HR SIZE=1>
<B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Daniel-Constantin Mierla &lt;miconda@gmail.com&gt;<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> yaron nahcum &lt;yaron_nachum@yahoo.com&gt;<BR><B><SPAN style="FONT-WEIGHT: bold">Cc:</SPAN></B> sr-users@lists.sip-router.org<BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Tue, June 29, 2010 6:57:53 PM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: [SR-Users] using avpops for querying an external db on kamailio 3.0.2<BR></FONT><BR>Hello,<BR><BR>look at sqlops module, it is more suitable for custom sql queries:<BR>http://kamailio.org/docs/modules/stable/modules_k/sqlops.html<BR><BR>Cheers,<BR>Daniel<BR><BR><BR>On 6/29/10 5:47 PM, yaron nahcum wrote: 
<BLOCKQUOTE type="cite">
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">
<DIV>Hi,</DIV>
<DIV>I have recently installed a kamailio server with release 3.0.2. </DIV>
<DIV>I would like to use the kamilio as a redirect server that would recieve REGISTER messages from users and query a proprietary database that holds users information - if the users are registered to the service&nbsp;it would redirect the user to the registrar. I need it for security reasons which I can't fully explain.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Now, I am using the avpops module. I have been able to make it work using the following configuration:</DIV>
<DIV>&nbsp;</DIV>
<DIV>modparam("avpops","db_url","mysql://user:pass@localhost/mysql")<BR>modparam("avpops","avp_table","proptable")<BR>modparam("avpops","db_scheme","scheme0:username_col=sipUsername;value_col=sipDomainName;table=proptable")</DIV>
<DIV>----------</DIV>
<DIV><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (is_method("REGISTER"))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (avp_db_load("$fu/username","$avp(s:CONSTANT_DOMAIN)/$scheme0"))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; append_branch(<A class=moz-txt-link-rfc2396E rel=nofollow>"sip:registrarIP"</A>);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sl_send_reply("302","Test Redirect");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sl_send_reply("404","Test Not found");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</DIV>
<DIV>--------------</DIV>
<DIV>&nbsp;</DIV>
<DIV>The thing is that I don't need to match the string CENTREX against the domain- it is something I added because I couldn't find another way to do it. I would like to match only the username. I tried wildcards or leaving it empty but it didn't work. I tried not to use the scheme and instead use the table it self but again it didn't work.</DIV>
<DIV>Is it possible? Do you know a better to do it?</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks,</DIV>
<DIV>Yaron.</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV></DIV><BR><PRE><FIELDSET class=mimeAttachmentHeader></FIELDSET>
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<A class=moz-txt-link-abbreviated href="mailto:sr-users@lists.sip-router.org" target=_blank rel=nofollow ymailto="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</A>
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
  </PRE></BLOCKQUOTE><BR><PRE class=moz-signature>-- 
Daniel-Constantin Mierla
http://www.asipto.com/
</PRE></DIV></DIV></div><br>

      </body></html>