Hi,
I am trying to deploy a openser solution supporting NAT traversal. So far
I have dome some testing with rtpproxy and have yet to look into the
media proxy solution. I have IP Phones that support both audio and video
calls and as a requirement the setup should be able to do NAT traversal
for both audio and video streams.
Initially two phones connect with only audio streams active. Any side can
activate a video request in which case a reinvite is sent to the other
side indicating video codecs in the SDP. In case, any one or both sides
are nated the server should rewrite SDP port to route traffic through
itself. I tried to use a config with nathelper and rtpproxy, Initially
audio ports and IP in the SDP are rewritten correctly but when one phone
sends a reinvite for video the video port in the 200OK reply message is
not rewritten and is sent as received. This results in the video being
sent to an incorrect port on the server (running rtpporxy) and therefore
no video is relayed.
I see the following error message on my openser log when the 200ok is
processed
8(16501) force_rtp_proxy2: incorrect port in reply from rtp proxy
While on the rtpproxy I see the following error message:
received command "L bf73ff3d2a9d46ac82d3d3e06ddad3cc(a)192.168.1.3
12.33.44.55 36060 630e4f5ec9a842b2ad8c8427c551df66;2
67a41f2f40a84712a591616e973e8f71"
lookup request failed: session
bf73ff3d2a9d46ac82d3d3e06ddad3cc(a)192.168.1.3, tags
630e4f5ec9a842b2ad8c8427c551df66;2/67a41f2f40a84712a591616e973e8f71 not
found sending reply "0
From what I understand, for some reason, rtpproxy was
not able to rewrite
the video port in the 200 OK SDP.
Iam also attaching my cfg for reference.
Looking forward to any pointers.
Regards,
Danish
ps: I am using cvs (development head) for both openser and rtpproxy
ser.cfg
-------------
debug=2
fork=yes
log_stderror=yes
port=5065
children=4
check_via=no
dns=no
rev_dns=no
fifo="/tmp/ser_fifo"
loadmodule "/usr/local/lib/openser/modules/sl.so"
loadmodule "/usr/local/lib/openser/modules/tm.so"
loadmodule "/usr/local/lib/openser/modules/rr.so"
loadmodule "/usr/local/lib/openser/modules/maxfwd.so"
loadmodule "/usr/local/lib/openser/modules/usrloc.so"
loadmodule "/usr/local/lib/openser/modules/textops.so"
loadmodule "/usr/local/lib/openser/modules/registrar.so"
loadmodule "/usr/local/lib/openser/modules/uri.so"
loadmodule "/usr/local/lib/openser/modules/nathelper.so"
loadmodule "/usr/local/lib/openser/modules/xlog.so"
modparam("nathelper", "natping_interval", 30)
modparam("nathelper", "ping_nated_only", 1)
#modparam("nathelper", "rtpproxy_sock",
"unix:/var/run/rtpproxy.sock")
modparam("usrloc", "db_mode", 0)
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");
return;
};
if (msg:len > max_len) {
sl_send_reply("513", "Message Overflow");
return;
};
# -----------------------------------------------------------------
# Record Route Section
# -----------------------------------------------------------------
if (!method=="REGISTER") {
record_route();
};
if (method=="BYE" || method=="CANCEL") {
unforce_rtp_proxy();
}
# -----------------------------------------------------------------
# Loose Route Section
# -----------------------------------------------------------------
if (loose_route()) {
if (has_totag() && (method=="INVITE" || method=="ACK")) {
if (nat_uac_test("19")) {
setflag(6);
force_rport();
fix_nated_contact();
};
force_rtp_proxy("l");
};
route(1);
return;
};
# -----------------------------------------------------------------
# Call Type Processing Section
# -----------------------------------------------------------------
if (!uri==myself) {
log("LOG: uri!=myself\n");
route(4);
route(1);
return;
};
if (method=="CANCEL") {
route(1);
return;
} else if (method=="INVITE") {
route(3);
return;
} else if (method=="REGISTER") {
route(2);
return;
};
lookup("aliases");
if (!uri==myself) {
route(4);
route(1);
return;
};
if (!lookup("location")) {
sl_send_reply("404", "User Not Found");
return;
};
route(1);
}
route[1] {
# -----------------------------------------------------------------
# Default Message Handler
# -----------------------------------------------------------------
t_on_reply("1");
xlog("L_NOTICE","Danish Route[1]: Relaying message [$rm]\n");
if (!t_relay()) {
if (method=="INVITE" && isflagset(6)) {
unforce_rtp_proxy();
};
sl_reply_error();
};
}
route[2] {
# -----------------------------------------------------------------
# REGISTER Message Handler
# ----------------------------------------------------------------
if (!search("^Contact:[ ]*\*") && nat_uac_test("19"))
{
xlog("L_NOTICE","Danish: Inroute[2] Found Nated
contact\n");
setflag(6);
fix_nated_register();
force_rport();
};
sl_send_reply("100", "Trying");
if (!save("location")) {
sl_reply_error();
};
}
route[3] {
# -----------------------------------------------------------------
# INVITE Message Handler
# -----------------------------------------------------------------
if (nat_uac_test("19")) {
setflag(6);
}
lookup("aliases");
if (!uri==myself) {
route(4);
route(1);
return;
};
if (!lookup("location")) {
sl_send_reply("404", "User Not Found");
return;
};
route(4);
route(1);
}
route[4] {
# -----------------------------------------------------------------
# NAT Traversal Section
# -----------------------------------------------------------------
if (isflagset(6)) {
force_rport();
fix_nated_contact();
force_rtp_proxy();
}
}
onreply_route[1] {
if (isflagset(6) && status=~"(180)|(183)|2[0-9][0-9]") {
if (!search("^Content-Length:[ ]*0")) {
force_rtp_proxy();
};
};
if (nat_uac_test("1")) {
fix_nated_contact();
};
}