[Serusers] nat

kcassidy at kakelma.mine.nu kcassidy at kakelma.mine.nu
Fri Jan 7 10:34:00 CET 2005


Hi All,

 I've successfully installed media proxy and it's working with ser.0.8.14
just fine.  I'm using the ser config that comes with media proxy module.
The thing is I don't want all my RTP streams to pass thru the media proxy
(e.g. Clients using public IP).  I've tried the isflagset command but it
doesn't seem to work.  I've placed a isflagset(2) in my config below but 
all my traffic doesn't pass thru the media proxy.

TIA.


route{
    if (!mf_process_maxfwd_header("10")) {
        if (method!="ACK") {
            sl_send_reply("483", "Too many hops");
        };
        break;
    };

    if (msg:len >= max_len) {
        if (method!="ACK") {
            sl_send_reply("513", "Message too big");
        };
        break;
    };

    if (method=="REGISTER") {
        if (is_from_local()) {
            # Mark as NAT'ed
            if (client_nat_test("3")) {
                setflag(2);
                force_rport();
                fix_contact();
            };

            if (!www_authorize("", "subscriber")) {
                www_challenge("", "0");
                break;
            } else if (!check_to()) {
                sl_send_reply("403", "Username!=To not allowed");
                break;
            };

            if (!save("location")) {
                sl_reply_error();  
            };
        } else {
            sl_send_reply("403", "This domain is not served here");
        };

        break;
    };

    if (method=="INVITE") {
        if (!(is_from_local() || is_uri_host_local())) {
            sl_send_reply("403", "Relaying is forbidden");
            break;
        };
        t_on_failure("1");
    } else if (method == "BYE" || method == "CANCEL") {
        end_media_session();
    };

    if (loose_route()) { 
        if (method=="INVITE" || method=="ACK") && (isflagset(2)) {
            use_media_proxy();
        };
        # end media session for BYE and CANCEL is done above
        # before entering the loose route. no need to call it here
        t_relay();
        break;
    };

    # Force subsequent messages to pass trough this proxy
    if (method == "INVITE") {
        record_route();
    };

    if (client_nat_test("3") && !search("^Record-Route:")) {
        # Mark as NAT'ed
        force_rport();
        fix_contact();
    };

    if (method=="INVITE") {
        t_on_reply("1");
    };

    if (is_uri_host_local()) {
        if (!lookup("location")) {
            sl_send_reply("404", "User not found");
            break;
        };
    };

    if (method=="INVITE" || method=="ACK")  && (isflagset(2)) {
        use_media_proxy();
    };

    if (!t_relay()) {
        if (method=="INVITE" || method=="ACK") {
            end_media_session();
        };
        sl_reply_error();
    };
}






More information about the sr-users mailing list