[OpenSIPS-Users] About L4 Swtich + 2 * opensips

Nick Chang nick.chang at kland.com.tw
Thu Jul 12 10:40:10 CEST 2012


Hello Ali

 

It’s my config

 

I try save location after register. But, It still failed.

Can you give me a suggest??

 

Thanks for your help.

Nick

 

route{

        force_rport();

        if (nat_uac_test("19")) {

                if (is_method("REGISTER")) {

                        fix_nated_register();

                } else {

                        fix_nated_contact();

                        search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes');

                }

                setflag(5);

        }

        if (has_totag()) {

                if (loose_route()) {

                        if (is_method("BYE")) {

                                setflag(1);

                                setflag(3); 

                        } else if (is_method("INVITE")) {

                                record_route();

                        }

                        route(generic_relay);

                } else {

                        if (is_method("SUBSCRIBE") && $rd == "10.1.3.130") {

                                # in-dialog subscribe requests

                                route(presence_handling);

                                exit;

                        }

                        if ( is_method("ACK") ) {

                                if ( t_check_trans() ) {

                                        t_relay();

                                        exit;

                                } else {

                                        exit;

                                }

                        }

                        send_reply("404","Not here");

                }

                exit;

        }

        if (is_method("CANCEL")) {

                if (t_check_trans())

                        t_relay();

                exit;

        }

        t_check_trans();

        if ( !is_from_local()  && !is_uri_host_local() ) {

                send_reply("403","No relaying");

                exit;

        }

        if (!is_method("REGISTER") && is_from_local()) {

                if(!is_from_gw() && !is_method("INVITE"))

                {

                        if (!proxy_authorize("", "subscriber")) {

                                proxy_challenge("", "0");

                                exit;

                        }

                        if (!db_check_from()) {

                                send_reply("403","Forbidden auth ID");

                                exit;

                        }

                        consume_credentials();

                }

        }

        if (loose_route()) {

                xlog("L_ERR",

                "Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");

                if (!is_method("ACK"))

                        send_reply("403","Preload Route denied");

                exit;

        }

        if (!is_method("REGISTER|MESSAGE"))

                record_route();

        if (is_method("INVITE")) {

                setflag(1); 

                $avp(caller) = $fu;

                create_dialog();

        }

        if (!is_uri_host_local()) {

                $avp(callee) = $ru;

                route(generic_relay);

                exit;

        }

        if (is_method("REGISTER")) {

                if (!www_authorize("", "subscriber")) {

                        www_challenge("", "0");

save(“location”);

                        exit;

                }

                if (!db_check_to()) {

                        send_reply("403","Forbidden auth ID");

                        exit;

                }

                if (isflagset(5)) {

                        setbflag(6);

                        setbflag(7);

                };

                if (!save("location"))

                        sl_reply_error();

                exit;

        }

        if ($rU==NULL) {

                send_reply("484","Address Incomplete");

                exit;

        }

        alias_db_lookup("dbaliases");

        if(!dp_translate("0","$ruri.user/$ruri.user")){

                send_reply("420", "Invalid Destination");

                exit;

        }

        xlog("$avp(dest)");

        $avp(callee) = $ru;

        if ($avp(dest)=="usrloc") {

                #Route to usrloc

                route(user_location);

        }

        send_reply("420", "Invalid Extension");

        exit;

}

route[generic_relay] {

        if (subst_uri('/((sip:.*)||(sip:.*:.*));nat=yes/\1/')){

                setbflag(6);

        };

        if (isflagset(5)||isbflagset(6)) {

                route(nat_fixups);

        };

        if (!t_relay()) {

                sl_reply_error();

        };

        exit;

}

route[user_location]{

        if (!lookup("location", "m")) {

                switch ($retcode) {

                        case -1:

                        case -3:

                                t_newtran();

                                send_reply("404", "Not Found");

                                exit;

                        case -2:

                                send_reply("405", "Method Not Allowed");

                                exit;

                }

        }

        setflag(2); 

        t_on_failure("user_failure");

        route(generic_relay);

}

}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20120712/f8c391c4/attachment-0001.htm>


More information about the Users mailing list