[OpenSIPS-Users] New method in alias_db

Sergio Gutierrez saguti at gmail.com
Wed Mar 25 21:34:55 CET 2009


Hi Vladimir.

It looks useful; please submit a patch on tracker, so that developers can
review it.

Thanks and regards.

Sergio

2009/3/25 Romanov Vladimir <VRomanov at yota.ru>

>  Hi!
>
> 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.
>
> I use this this new method in in this case:
>
>
>
> if (uri==myself) {
>
>         if (is_method("REGISTER")) {
>
>             sl_send_reply("100", "Trying");
>
>             $avp(s:alias):=$tu;
>
>             if (alias_db_find("dbaliases","$avp(s:alias)")) {
>
>                 xlog("L_INFO", "Registration was aliased - $tu ->
> $avp(s:alias)\n");
>
>             }
>
>
>
>             if (!www_authorize("_SIP_DOMAIN", "subscriber")) {
>
>                   www_challenge("_SIP_DOMAIN", "0");
>
>                   return;
>
>             };
>
>             if (!check_to()) {
>
>                  xlog("L_INFO", "Spoofed To-URI detected - M=$rm RURI=$ru
> F=$fu T=$tu IP=$si ID=$ci\n");
>
>                  sl_send_reply("403", "Spoofed To-URI Detected");
>
>                  exit;
>
>             };
>
>             if (!save("location","0","$avp(s:alias)"))  {
>
>                 xlog("L_ERR", "Saving contact failed - M=$rm RURI=$ru F=$fu
> T=$tu IP=$si ID=$ci\n");
>
>                 sl_reply_error();
>
>             }
>
>             exit;
>
>         };
>
>
>
> This method implementationin main part  is copypaste from alias_db_lookup.
> Is this interesting to OpenSips users?
>
> -----------------
>
> Vladimir Romanov
>
> Scartel Star Lab
>
> CTO
>
> +7 (960) 239-0853
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>


-- 
Sergio Gutiérrez
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20090325/33925d73/attachment-0001.htm 


More information about the Users mailing list