[Serusers] SER+Mediaproxy + X-LITE in the same LAN.

pistara_bros at tin.it pistara_bros at tin.it
Fri Sep 14 18:39:31 CEST 2007


Hi all, i'm newbie in SER,
I want to route RTP packets between 2 
computers with x-lite client voip
in the same network through 
Mediaproxy. I know this may have
no sense, but it's just a test 
configuration.
The call use_media_proxy() seems to have no effect,
the 
RTP packets go directly from one computer to
another, no packet trough 
Mediaproxy.
This is my environment:
SER and Mediaproxy on the same PC 
(192.168.123.186)
X-lite client_A running on 192.168.123.10
X-lite 
client_B running on 192.168.123.168
Client_A call Client_B that accept, 
but mediaproxy refuses to
proxy the call.

This is my ser.cfg

# 
----------- global configuration parameters ------------------------
debug=3         # debug level 
listen=192.168.123.186
port=5060
log_facility=LOG_LOCAL6

fork=no
log_stderror=yes


check_via=no    # 
(cmd. line: -v)
dns=no           # (cmd. line: -r)
rev_dns=no      # 
(cmd. line: -R)
fifo="/tmp/ser_fifo"
fifo_db_url="mysql://ser:
heslo at localhost/ser"

# ------------------ module loading 
----------------------------------
loadmodule 
"/usr/local1/lib/ser/modules/mysql.so"
loadmodule 
"/usr/local1/lib/ser/modules/sl.so"
loadmodule 
"/usr/local1/lib/ser/modules/tm.so"
loadmodule 
"/usr/local1/lib/ser/modules/rr.so"
loadmodule 
"/usr/local1/lib/ser/modules/maxfwd.so"
loadmodule 
"/usr/local1/lib/ser/modules/usrloc.so"
loadmodule 
"/usr/local1/lib/ser/modules/registrar.so"
loadmodule 
"/usr/local1/lib/ser/modules/textops.so"
loadmodule 
"/usr/local1/lib/ser/modules/uri.so"
loadmodule 
"/usr/local1/lib/ser/modules/uri_db.so"
loadmodule 
"/usr/local1/lib/ser/modules/domain.so"
loadmodule 
"/usr/local1/lib/ser/modules/auth.so"
loadmodule 
"/usr/local1/lib/ser/modules/auth_db.so"

#MEDIA PROXY module needed
loadmodule "/usr/local1/lib/ser/modules/mediaproxy.so"
loadmodule 
"/usr/local1/lib/ser/modules/nathelper.so"

# ----------------- setting 
module-specific parameters ---------------

# -- usrloc params --
modparam("usrloc", "db_mode", 2)

# -- auth params --
modparam
("auth_db", "calculate_ha1", yes)
#
# If you set "calculate_ha1" 
parameter to yes (which true in this config),
# uncomment also the 
following parameter)
#
modparam("auth_db", "password_column", 
"password")


#SQL settings
modparam("auth_db", "db_url", "mysql://ser:
heslo at localhost/ser")
modparam("usrloc", "db_url", "mysql://ser:
heslo at localhost/ser")

#MEDIAPROXY settings
#---------------------------
# configurazione moduli
#---------------------------
modparam("nathelper", "rtpproxy_disable", 
1)
modparam("nathelper", "natping_interval", 0)
modparam("mediaproxy","
natping_interval", 30)
modparam("mediaproxy","mediaproxy_socket","
/var/run/mediaproxy.sock")
modparam("mediaproxy","sip_asymmetrics","
/usr/local1/etc/ser/sip-clients")
modparam("mediaproxy","
rtp_asymmetrics","/usr/local1/etc/ser/rtp-clients")
modparam
("registrar", "nat_flag", 6)

# -- rr params --
# add value to ;lr 
param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)

# -------------------------  request routing logic -------------------
# main routing logic

route{
        # initial sanity checks -- 
messages with
        # max_forwards==0, or excessively long requests
        if (!mf_process_maxfwd_header("10")) {
                
sl_send_reply("483","Too Many Hops");
                break;
        };
        if (msg:len >=  2048 ) {
                sl_send_reply("513", 
"Message too big");
                break;
        };

        # we 
record-route all messages -- to make sure that
        # subsequent 
messages will go through our proxy; that's
        # particularly good 
if upstream and downstream entities
        # use different transport 
protocol

        #if (method=="INVITE" && client_nat_test("3")) {
        #       record_route_preset("192.168.123.186:5060;nat=yes");
        #} else if (method!="REGISTER") {
        #       
record_route();
        #};

        if (method=="INVITE" ) {
                if (client_nat_test("3")) {                
                    record_route_preset("192.168.123.186:5060;
nat=yes");
                } else record_route_preset
("192.168.123.186");
        }
        else if (method!="REGISTER") {
                        record_route();
        };
        if (method=="
BYE" || method=="CANCEL") {
                end_media_session();
        };

        # subsequent messages withing a dialog should take 
the
        # path determined by record-routing
        # 
-----------------------------------------------------------------
        # Loose Route Section
        # 
-----------------------------------------------------------------
        if (loose_route()) {
                if ((method=="INVITE" || 
method=="REFER") && !has_totag()) {
                        
sl_send_reply("403", "Forbidden");
                        break;
                };
                if (method=="INVITE") {
                        if (!proxy_authorize("","subscriber")) {
                                proxy_challenge("","0");
                                break;
                        } else 
if (!check_from()) {
                                sl_send_reply
("403", "Use From=ID");
                                break;
                        };
                        
consume_credentials();
                        if (client_nat_test("3") 
|| search("^Route:.*;nat=yes")) {
                                
setflag(6);
                                use_media_proxy();
                        };
                };
                route(1);
                break;
        };


        if (!uri==myself) {
                route(4);
                route(1);
                
break;
        };

        # if the request is for other domain use 
UsrLoc
        # (in case, it does not work, use the following command
        # with proper names and addresses in it)
        if 
(uri==myself) {
                if (method=="ACK") {
                        route(1);
                        break;
                } else if (method=="CANCEL") {
                        
route(1);
                        break;
                } else if 
(method=="INVITE") {
                        route(3);
                        break;
                } else if (method=="
REGISTER") {
                        route(2);
                        
break;
                };

                lookup("aliases");
                if (uri!=myself) {
                        route(4);
                        route(1);
                        break;
                };

                if (!lookup("location")) {
                        sl_send_reply("404", "User Not Found");
                        break;
                };

        };
        
append_hf("P-hint: usrloc applied\r\n");
        route(1);
}

route[1]
{
        # send it out now; use stateful forwarding as it works 
reliably
        # even for UDP2TCP
        t_on_reply("1");
        if 
(!t_relay()) {
                if (method=="INVITE" || method=="ACK") {
                        end_media_session();
                };
                sl_reply_error();
        };
}

route[2] {

        # 
-----------------------------------------------------------------
        # REGISTER Message Handler
        # 
----------------------------------------------------------------

        sl_send_reply("100", "Trying");

        if (!search("^Contact:
[ ]*\*") && client_nat_test("7")) {
                setflag(6);
                fix_nated_register();
                force_rport();
        };

        if (!www_authorize("","subscriber")) {
                www_challenge("","0");
                break;
        
};

        if (!check_to()) {
                sl_send_reply("401", 
"Unauthorized");
                break;
        };

        
consume_credentials();

        if (!save("location")) {
                sl_reply_error();
        };
}

route[3] {

        # 
-----------------------------------------------------------------
        # INVITE Message Handler
        # 
-----------------------------------------------------------------

        if (client_nat_test("3")) {
                setflag(7);
                force_rport();
                fix_nated_contact();
        };

        if (!proxy_authorize("","subscriber")) {
                proxy_challenge("","0");
                break;
        
} else if (!check_from()) {
                sl_send_reply("403", "Use 
From=ID");
                break;
        };

        
consume_credentials();

        lookup("aliases");
        if (uri!
=myself) {
                route(4);
                route(1);
                break;
        };

        if (!lookup("location")) {
                sl_send_reply("404", "User Not Found");
                
break;
        };

        route(4);
        route(1);
}

route[4] {

        # 
-----------------------------------------------------------------
        # NAT Traversal Section
        # 
-----------------------------------------------------------------

        if (isflagset(6) || isflagset(7)) {
                if (!
isflagset(8)) {
                        setflag(8);
                        use_media_proxy();
                };
        
};
}

onreply_route[1] {

        if ((isflagset(6) || isflagset(7)) && 
(status=~"(180)|(183)|2[0-9][0-9]")) {

                if (!search
("^Content-Length:[ ]*0")) {
                        use_media_proxy();
                };
        };

        if (client_nat_test("1")) {
                fix_nated_contact();
        };
}


And this is 
Mediaproxy Log:

Listening for commands on local socket 
`/var/run/mediaproxy.sock'
Listening for remote commands on `192.
168.123.186:25060'
Remote commands are allowed from: 192.168.123.186, 
127.0.0.1
Using IP address `192.168.123.186' for the RTP/RTCP proxy

request B390Opu7cB 192.168.123.168:25500:audio 192.168.123.168 sip.
antech.it local 192.168.123.186 remote unknown-agent info=from:
orazio at sip.antech.it,to:j2me at sip.antech.it,
fromtag:As94,totag:
session 
B390Opu7cB: started. listening on 192.168.123.186:52010
execution 
time:  1.71 ms
lookup B390Opu7cB 192.168.123.186:25500:audio 
192.168.123.186 sip.antech.it local sip.antech.it unknown unknown-agent 
info=from:orazio at sip.antech.it,to:j2me at sip.antech.it,fr
omtag:As94,
totag:oePf
execution time:  0.57 ms
session B390Opu7cB: caller signed 
in from 192.168.123.168:25500 (RTP) (will return to 192.168.123.168:
25500)
status
execution time:  0.14 ms
session B390Opu7cB: 2/0/0 
packets, 344/0/0 bytes (caller/called/relayed)
session B390Opu7cB: 
ended (did timeout).
delete B390Opu7cB info=
execution time:  0.14 ms


and this is dump of session.py

[root at sip mediaproxy]# ./sessions.py 

Caller                  Via                     Called     Status    
Duration  Codec  Type   Traffic
----------------------------------------------------------------------------------------------------
192.168.123.168:25500 - 192.168.123.186:52010 - ?.?.?.?:?  inactive     
0'32"  GSM    Audio  344/0/0

Total traffic:  0bps/0bps/0bps 
(in1/in2/out)
Session count:  1
Proxy version:  1.9.0



Is mediaproxy 
working just between different networks
or it's an error in my 
configuration file?

Please help me. Any suggestions?

Orazio



More information about the sr-users mailing list