Hi,

Is there a better way to test if a call is from a registered user without
authentication than the code below?  If not, then let me request that
does_uri_exist() take an argument specifying the variable to test against.

Mike

if (src_ip != 'x.x.x.28' && !lookup("location"))
{
        if (registered("location")) { xlog("L_NOTICE", "cs<$cs> si<$si:$sp>
ci<$ci> route3: matched registered()\n"); }
        if (!registered("location")) { xlog("L_NOTICE", "cs<$cs> si<$si:$sp>
ci<$ci> route3: matched !registered()\n"); }

        ### send DIDs to asterisk directly because it doesn't handle
unauthenticated calls via a proxy properly
        #change request uri to from uri so that does_uri_exist() can test
against it
        $var(orig_ru) = $ru;
        $ru = $fu;
        if (does_uri_exist()) { xlog("L_NOTICE", "cs<$cs> si<$si:$sp>
ci<$ci> route3: matched does_uri_exist()\n"); }
        if (!does_uri_exist()) { xlog("L_NOTICE", "cs<$cs> si<$si:$sp>
ci<$ci> route3: matched !does_uri_exist()\n"); }

        #10 digit DID and is not from one of our users
        if ($var(orig_ru) =~ "^sip:[0-9]{10}" && !does_uri_exist())
        {
                xlog("L_NOTICE", "cs<$cs> si<$si:$sp> ci<$ci> route3: 302
redirect to asterisk\n");
                $var(dstredir) = "sip:" + $tU + "@x.x.x.28";
                $ru=$var(dstredir);
                sl_send_reply("302", "Moved Temporarily");
                exit;
                #route(1);
        };
        #END DIDs to asterisk and change request uri back
        $ru = $var(orig_ru);
}



_______________________________________________
Users mailing list
[email protected]
http://lists.openser.org/cgi-bin/mailman/listinfo/users

Reply via email to