Hi Vladimir.<br><br>It looks useful; please submit a patch on tracker, so that developers can review it.<br><br>Thanks and regards.<br><br>Sergio<br><br><div class="gmail_quote">2009/3/25 Romanov Vladimir <span dir="ltr">&lt;<a href="mailto:VRomanov@yota.ru">VRomanov@yota.ru</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">








<div link="blue" vlink="purple" lang="RU">

<div>

<p><span lang="EN-US">Hi!</span></p>

<p><span lang="EN-US">I implement new  method in alias_db module –
alias_db_find(“tablename”,”avp”). This method  similar to
alias_db_lookup but use avp as instead of message RURI.</span></p>

<p><span lang="EN-US">I use this this new method in in this case:</span></p>

<p><span lang="EN-US"> </span></p>

<p><span lang="EN-US">if (uri==myself) {</span></p>

<p><span lang="EN-US">        if
(is_method(&quot;REGISTER&quot;)) {</span></p>

<p><span lang="EN-US">            sl_send_reply(&quot;100&quot;,
&quot;Trying&quot;);</span></p>

<p><span lang="EN-US">            $avp(s:alias):=$tu;</span></p>

<p><span lang="EN-US">            if
(alias_db_find(&quot;dbaliases&quot;,&quot;$avp(s:alias)&quot;)) {</span></p>

<p><span lang="EN-US">                xlog(&quot;L_INFO&quot;,
&quot;Registration was aliased - $tu -&gt; $avp(s:alias)\n&quot;);</span></p>

<p><span lang="EN-US">            }</span></p>

<p><span lang="EN-US"> </span></p>

<p><span lang="EN-US">            if
(!www_authorize(&quot;_SIP_DOMAIN&quot;, &quot;subscriber&quot;)) {</span></p>

<p><span lang="EN-US">                 
www_challenge(&quot;_SIP_DOMAIN&quot;, &quot;0&quot;);</span></p>

<p><span lang="EN-US">                  return;</span></p>

<p><span lang="EN-US">            };</span></p>

<p><span lang="EN-US">            if (!check_to()) {</span></p>

<p><span lang="EN-US">                 xlog(&quot;L_INFO&quot;,
&quot;Spoofed To-URI detected - M=$rm RURI=$ru F=$fu T=$tu IP=$si
ID=$ci\n&quot;);</span></p>

<p><span lang="EN-US">                
sl_send_reply(&quot;403&quot;, &quot;Spoofed To-URI Detected&quot;);</span></p>

<p><span lang="EN-US">                 exit;</span></p>

<p><span lang="EN-US">            };</span></p>

<p><span lang="EN-US">            if
(!save(&quot;location&quot;,&quot;0&quot;,&quot;$avp(s:alias)&quot;))  {</span></p>

<p><span lang="EN-US">                xlog(&quot;L_ERR&quot;, &quot;Saving
contact failed - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n&quot;);</span></p>

<p><span lang="EN-US">                sl_reply_error();</span></p>

<p><span lang="EN-US">            }</span></p>

<p><span lang="EN-US">            exit;</span></p>

<p><span lang="EN-US">        };</span></p>

<p><span lang="EN-US"> </span></p>

<p><span lang="EN-US">This method implementationin main part  is
copypaste from alias_db_lookup. Is this interesting to OpenSips users?</span></p>

<p><span style="font-size: 10.5pt; font-family: Consolas;" lang="EN-US">-----------------</span></p>

<p><span style="font-size: 10.5pt; font-family: Consolas;" lang="EN-US">Vladimir
Romanov</span></p>

<p><span style="font-size: 10.5pt; font-family: Consolas;" lang="EN-US">Scartel
Star Lab</span></p>

<p><span style="font-size: 10.5pt; font-family: Consolas;" lang="EN-US">CTO</span></p>

<p><span style="font-size: 10.5pt; font-family: Consolas;">+7 (960)
239-0853</span></p>

<p> </p>

</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><br clear="all"><br>-- <br>Sergio Gutiérrez<br>