<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hello,<br>
<br>
look at sqlops module, it is more suitable for custom sql queries:<br>
<a class="moz-txt-link-freetext" href="http://kamailio.org/docs/modules/stable/modules_k/sqlops.html">http://kamailio.org/docs/modules/stable/modules_k/sqlops.html</a><br>
<br>
Cheers,<br>
Daniel<br>
<br>
<br>
On 6/29/10 5:47 PM, yaron nahcum wrote:
<blockquote cite="mid:131182.13613.qm@web54605.mail.re2.yahoo.com"
 type="cite">
  <style type="text/css"><!-- DIV {margin:0px;} --></style>
  <div
 style="font-family: times new roman,new york,times,serif; font-size: 12pt;">
  <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" href="sip:registrarIP">"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 wrap="">
<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">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
  </pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-freetext" href="http://www.asipto.com/">http://www.asipto.com/</a>
</pre>
</body>
</html>