[Serusers] SER+MEDIAPROXY+ B2BUA

Amit.Chawre at relianceinfo.com Amit.Chawre at relianceinfo.com
Tue Sep 20 08:26:38 CEST 2005


Hello

I want to test a scenario with SER, MEDIAPROXY and Vovida B2BUA, but I'm
having some
problems. If someone has tested this before, I would like to ask you the
config files to help me.

When NATedUA1 calls NATedUA2,  invite reaches NATedUA2. NATedUA2 sends
responses back to SER (100 trying 180 ringing) but SER doesn’t forward it
further  to NATedUA1.I'm having problems when NatedUA2 send '100 Trying'
and '180 ringing' to SER, it forwards it to B2BUA, but then there is no
flow of messages.

                   NATedUA2
                         ^
                         | 4.INVITE
                         |
          1.INVITE                2.INVITE
NATedUA1   ---->   SER+MEDIAPROXY  ------> B2BUA
                                        <-----
                                       3. INVITE

ser.cfg is:

# Example ser.cfg for mediaproxy functionality

check_via=no   # (cmd. line: -v)
dns=no           # (cmd. line: -r)
rev_dns=no      # (cmd. line: -R)
listen=72.21.40.107
port=5060
children=4
fifo="/tmp/ser_fifo"
# fifo_db_url="mysql://ser:heslo@localhost/ser"

loadmodule "/usr/local/lib/ser/modules/mysql.so"
loadmodule "/usr/local/lib/ser/modules/textops.so"
loadmodule "/usr/local/lib/ser/modules/sl.so"
loadmodule "/usr/local/lib/ser/modules/tm.so"
loadmodule "/usr/local/lib/ser/modules/rr.so"
loadmodule "/usr/local/lib/ser/modules/maxfwd.so"
loadmodule "/usr/local/lib/ser/modules/usrloc.so"
loadmodule "/usr/local/lib/ser/modules/registrar.so"
loadmodule "/usr/local/lib/ser/modules/domain.so"
loadmodule "/usr/local/lib/ser/modules/uri.so"
loadmodule "/usr/local/lib/ser/modules/mediaproxy.so"
loadmodule "/usr/local/lib/ser/modules/auth.so"
loadmodule "/usr/local/lib/ser/modules/auth_radius.so"

modparam("usrloc", "db_mode", 0)

#modparam("usrloc", "db_url","mysql://ser:heslo@localhost/ser")
modparam("mediaproxy", "natping_interval", 60)
modparam("registrar",  "nat_flag",         2)

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 (!radius_www_authorize("72.21.40.107")) {
                 www_challenge("72.21.40.107", "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();
    };

    # 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") {
        use_media_proxy();
    };
 if(!(src_port==5065 && src_ip==72.21.40.107)){
    if (method=="INVITE" || method=="BYE") {
     log("amit: Forwarding to B2bua\n");
     forward(72.21.40.107,5065);
     break;
    };
    };
    if (loose_route()) {
        if (method=="INVITE" || method=="ACK") {
            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;
   };


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

failure_route[1] {


    end_media_session();
}

onreply_route[1] {

    #if (status=~"(183)|(2[0-9][0-9])") {
    if (status=~"[1-2][0-9][0-9])") {
        if (client_nat_test("1")) {
            fix_contact();
        };
        use_media_proxy();
    };

}


Thanks for your help

amit


More information about the sr-users mailing list