[OpenSIPS-Users] New method in alias_db

Romanov Vladimir VRomanov at yota.ru
Wed Mar 25 21:26:09 CET 2009


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20090325/76e6f772/attachment.htm 


More information about the Users mailing list