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"><<a href="mailto:VRomanov@yota.ru">VRomanov@yota.ru</a>></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("REGISTER")) {</span></p>
<p><span lang="EN-US"> sl_send_reply("100",
"Trying");</span></p>
<p><span lang="EN-US"> $avp(s:alias):=$tu;</span></p>
<p><span lang="EN-US"> if
(alias_db_find("dbaliases","$avp(s:alias)")) {</span></p>
<p><span lang="EN-US"> xlog("L_INFO",
"Registration was aliased - $tu -> $avp(s:alias)\n");</span></p>
<p><span lang="EN-US"> }</span></p>
<p><span lang="EN-US"> </span></p>
<p><span lang="EN-US"> if
(!www_authorize("_SIP_DOMAIN", "subscriber")) {</span></p>
<p><span lang="EN-US">
www_challenge("_SIP_DOMAIN", "0");</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("L_INFO",
"Spoofed To-URI detected - M=$rm RURI=$ru F=$fu T=$tu IP=$si
ID=$ci\n");</span></p>
<p><span lang="EN-US">
sl_send_reply("403", "Spoofed To-URI Detected");</span></p>
<p><span lang="EN-US"> exit;</span></p>
<p><span lang="EN-US"> };</span></p>
<p><span lang="EN-US"> if
(!save("location","0","$avp(s:alias)")) {</span></p>
<p><span lang="EN-US"> xlog("L_ERR", "Saving
contact failed - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");</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>