<!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>
On 6/29/10 6:39 PM, yaron nahcum wrote:
<blockquote cite="mid:924267.54746.qm@web54601.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 Daniel,</div>
  <div>Thanks a lot for the quick response. I will look at it.</div>
  </div>
</blockquote>
<br>
fyi: keep cc-ing the mailing list for any discussion that started there
- message sent privately are usually ignored.<br>
<br>
Daniel<br>
<br>
<blockquote cite="mid:924267.54746.qm@web54601.mail.re2.yahoo.com"
 type="cite">
  <div
 style="font-family: times new roman,new york,times,serif; font-size: 12pt;">
  <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 <a class="moz-txt-link-rfc2396E" href="mailto:miconda@gmail.com">&lt;miconda@gmail.com&gt;</a><br>
  <b><span style="font-weight: bold;">To:</span></b> yaron nahcum
<a class="moz-txt-link-rfc2396E" href="mailto:yaron_nachum@yahoo.com">&lt;yaron_nachum@yahoo.com&gt;</a><br>
  <b><span style="font-weight: bold;">Cc:</span></b>
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><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>
<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 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 moz-do-not-send="true"
 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 moz-do-not-send="true" 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>
<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">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-freetext" href="http://www.asipto.com/">http://www.asipto.com/</a>
  </pre>
  </div>
  </div>
  </div>
  <br>
</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>