[Serusers] Ser+Media proxy
KM
tank30 at hotmail.com
Thu Nov 3 08:55:38 CET 2005
----- Original Message -----
From: "Andrei Pelinescu-Onciul" <andrei at iptel.org>
To: "KM" <tank30 at hotmail.com>
Cc: <serusers at lists.iptel.org>
Sent: Wednesday, November 02, 2005 8:43 PM
Subject: Re: [Serusers] Ser+Media proxy
> On Nov 02, 2005 at 20:15, KM <tank30 at hotmail.com> wrote:
>> This is the plain text version.
>> Sorry!
>>
>>
>>
>> I have installed SER 0.9.3.2 and media proxy 1.2.1 on the same machine.
>> The machine is on public network.
>> Calls work ok except when I have a UA on a LAN behind NAT calling to a UA
>> that is in the same LAN.
>> In this case I get :
>>
>>
>> | username | contact | received |
>>
>> | 22000001 | sip:22000001 at 192.168.1.7:5060 | sip:xxx.xxx.xxx.xxx:5060 |
>> | 22000002 | sip:22000002 at 192.168.1.6:5060 | sip:xxx.xxx.xxx.xxx:2557 |
>>
>>
>> The number that takes up port 5060 on the NAT server,which is 22000001
>> can
>> call the other UA but not the other way round.
>> 22000002 can only receive calls.
>
> Without the ser config and packet dumps is hard to say for sure, but try
> adding a force_rport() in your config.
>
>
> Andrei
>
Andrei thanks for the reply. I already have a force_rport(). I include the
ser.config to check . How do i get the packet dumps?
>From syslog? As you can tell i am a newbie in SER ..
debug=3
fork=no
log_stderror=yes
listen=***.***.141.179
port=5060
children=8
dns=no
rev_dns=no
fifo="/tmp/ser_fifo"
fifo_db_url="mysql://ser:*******@localhost/ser"
loadmodule "/usr/lib/ser/modules/mysql.so"
loadmodule "/usr/lib/ser/modules/sl.so"
loadmodule "/usr/lib/ser/modules/tm.so"
loadmodule "/usr/lib/ser/modules/rr.so"
loadmodule "/usr/lib/ser/modules/maxfwd.so"
loadmodule "/usr/lib/ser/modules/usrloc.so"
loadmodule "/usr/lib/ser/modules/registrar.so"
loadmodule "/usr/lib/ser/modules/auth.so"
loadmodule "/usr/lib/ser/modules/auth_db.so"
loadmodule "/usr/lib/ser/modules/uri.so"
loadmodule "/usr/lib/ser/modules/uri_db.so"
loadmodule "/usr/lib/ser/modules/domain.so"
loadmodule "/usr/lib/ser/modules/mediaproxy.so"
loadmodule "/usr/lib/ser/modules/nathelper.so"
loadmodule "/usr/lib/ser/modules/textops.so"
#KM added module
loadmodule "/usr/lib/ser/modules/exec.so"
modparam("auth_db|domain|uri_db|usrloc", "db_url",
"mysql://ser:*******@localhost/ser")
modparam("auth_db", "calculate_ha1", 1)
modparam("auth_db", "password_column", "password")
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/etc/ser/sip-clients")
modparam("mediaproxy","rtp_asymmetrics","/usr/etc/ser/rtp-clients")
modparam("usrloc", "db_mode", 2)
modparam("registrar", "nat_flag", 6)
modparam("rr", "enable_full_lr", 1)
route {
# -----------------------------------------------------------------
# Sanity Check Section
# -----------------------------------------------------------------
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483", "Too Many Hops");
break;
};
if (msg:len > max_len) {
sl_send_reply("513", "Message Overflow");
break;
};
# -----------------------------------------------------------------
# Record Route Section
# -----------------------------------------------------------------
if (method=="INVITE" && client_nat_test("3")) {
record_route_preset("***.***.141.179;nat=yes");
log(1,"Record Route section:NAT found, changing ip to ***.***.141.179
\n");
} else if (method!="REGISTER") {
record_route();
};
# -----------------------------------------------------------------
# Call Tear Down Section
# -----------------------------------------------------------------
if (method=="BYE" || method=="CANCEL") {
end_media_session();
};
# -----------------------------------------------------------------
# Loose Route Section
# -----------------------------------------------------------------
if (loose_route()) {
if (has_totag() && (method=="INVITE" || method=="ACK")) {
if (client_nat_test("3") || search("^Route:.*;nat=yes")) {
setflag(6);
use_media_proxy();
log(1,"route:NATED caller in loose route \n");
};
};
route(1);
break;
};
# -----------------------------------------------------------------
# Call Type Processing Section
# -----------------------------------------------------------------
if (uri!=myself) {
route(4);
route(1);
break;
};
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;
};
route(1);
}
route[1] {
# -----------------------------------------------------------------
# Default Message Handler
# -----------------------------------------------------------------
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();
log(1,"route[2]REGISTER:Nated registrar \n");
};
if (!www_authorize("","subscriber")) {
log(1,"route[2]REGISTER: www_challenge sends 401 \n");
www_challenge("","0");
break;
};
if (!check_to()) {
log(1,"route[2]REGISTER: check_to sends 401 \n");
sl_send_reply("401", "Unauthorized");
break;
};
consume_credentials();
if (!save("location")) {
sl_reply_error();
};
}
route[3] {
# -----------------------------------------------------------------
# INVITE Message Handler
# -----------------------------------------------------------------
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")) {
setflag(7);
force_rport();
fix_nated_contact();
log(1,"route[3]INVITE:Called number is NATed \n");
};
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)) {
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();
};
}
More information about the sr-users
mailing list