[OpenSIPS-Users] rtpproxy from external to internal network
Ghaith ALKAYYEM
ghaith.alkayyem at telecom-bretagne.eu
Sun Aug 16 16:00:24 CEST 2009
Hello,
I'm trying to test rtpproxy with nathelper module to forward RTP traffic
between two networks, my architecture is as follow:
------------------- --------------------------------------
--------------------
UAC (172.23.1.22) | | |
| UAC (172.1.1.21) |
|=======>| 172.23.1.20 (OpenSIPS) 172.1.1.166 |
=======>| |
Internal Network | | |
| External Network |
------------------- --------------------------------------
--------------------
I run rtpproxy:
rtpproxy -fF -l 172.1.1.166/172.23.1.20
Then I tried to establish a call from internal net (172.23.1.22) to
external net(172.1.1.21) and the connection established succussfully
with perfect RTP relay through (172.1.1.166) interface.
But when I tried to call from external network towards internal, the RTP
traffic relay didn't work?.
Following is the part related to nathelper and routing logic in my
configuration file:
loadmodule "nathelper.so"
modparam("nathelper", "natping_interval", 30)
modparam("nathelper", "ping_nated_only", 1)
modparam("nathelper", "rtpproxy_sock", "unix:/var/run/rtpproxy.sock")
modparam("nathelper", "received_avp", "$avp(i:42)")
modparam("registrar", "received_avp", "$avp(i:42)")
modparam("usrloc", "nat_bflag", 6)
modparam("registrar", "method_filtering", 1)
mhomed=1
route {
# -----------------------------------------------------------------
# Sanity Check Section
# -----------------------------------------------------------------
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483", "Too Many Hops");
#break;
return();
};
if (msg:len > max_len) {
sl_send_reply("513", "Message Overflow");
#break;
return();
};
# -----------------------------------------------------------------
# Record Route Section
# -----------------------------------------------------------------
if (method!="REGISTER") {
record_route();
};
if (method=="BYE" || method=="CANCEL") {
unforce_rtp_proxy();
}
# -----------------------------------------------------------------
# Loose Route Section
# -----------------------------------------------------------------
if (loose_route()) {
if ((method=="INVITE" || method=="REFER") && !has_totag()) {
sl_send_reply("403", "Forbidden");
#break;
return();
};
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 (nat_uac_test("19")) {
setflag(6);
force_rport();
fix_nated_contact();
};
force_rtp_proxy("l");
};
route(1);
#break;
return();
};
# -----------------------------------------------------------------
# Call Type Processing Section
# -----------------------------------------------------------------
if (uri!=myself) {
route(4);
route(1);
#break;
return();
};
if (method=="ACK") {
route(1);
#break;
return();
} if (method=="CANCEL") {
route(1);
#break;
return();
} else if (method=="INVITE") {
route(3);
#break;
return();
} else if (method=="REGISTER") {
route(2);
#break;
return();
};
lookup("aliases");
if (uri!=myself) {
route(4);
route(1);
#break;
return();
};
if (!lookup("location")) {
sl_send_reply("404", "User Not Found");
#break;
return();
};
route(1);
}
route[1] {
# -----------------------------------------------------------------
# Default Message Handler
# -----------------------------------------------------------------
t_on_reply("1");
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")) {
setflag(6);
fix_nated_register();
force_rport();
};
sl_send_reply("100", "Trying");
#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 (!proxy_authorize("","subscriber")) {
# proxy_challenge("","0");
# break;
#} else if (!check_from()) {
# sl_send_reply("403", "Use From=ID");
# break;
#};
# consume_credentials();
if (nat_uac_test("19")) {
setflag(6);
}
lookup("aliases");
if (uri!=myself) {
route(4);
route(1);
#break;
return();
};
if (!lookup("location")) {
sl_send_reply("404", "User Not Found");
#break;
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();
};
}#end of route.
branch_route[2] {
xlog("new branch at $ru\n");
}
onreply_route[2] {
xlog("incoming reply\n");
}
failure_route[1] {
if (t_was_cancelled()) {
exit;
}
# uncomment the following lines if you want to block client
# redirect based on 3xx replies.
##if (t_check_status("3[0-9][0-9]")) {
##t_reply("404","Not found");
## exit;
##}
# uncomment the following lines if you want to redirect the
failed
# calls to a different new destination
##if (t_check_status("486|408")) {
## sethostport("192.168.2.100:5060");
## # do not set the missed call flag again
## t_relay();
##}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20090816/5a917398/attachment.htm
More information about the Users
mailing list