[OpenSIPS-Devel] [ opensips-Patches-2713792 ] New method in alias_db - alias_db_find

SourceForge.net noreply at sourceforge.net
Tue Apr 28 20:03:10 CEST 2009


Patches item #2713792, was opened at 2009-03-26 09:44
Message generated for change (Settings changed) made by bogdan_iancu
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086412&aid=2713792&group_id=232389

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: modules
Group: trunk
Status: Open
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: Vladimir Romanov (v-romanov)
>Assigned to: Bogdan-Andrei Iancu (bogdan_iancu)
Summary: New method in alias_db - alias_db_find

Initial Comment:
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. Also some refactoring to remove repeated code.
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;
        };



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086412&aid=2713792&group_id=232389



More information about the Devel mailing list