Hello all,
I've got a working conf on which RTPs work perfectly with TCP, but
fails to work with UDP... can anyont tell me why??
Here's my conf:
#
# sample config file to be used with nathelper/rtpproxy
#
# start RTPProxy with: rtpproxy -l your_public_ip -s udp:localhost:8899
#
# ----------- global configuration parameters ------------------------
debug=3 # debug level (cmd line: -dddddddddd)
fork=yes
log_stderror=yes # (cmd line: -E)
/* Uncomment these lines to enter debugging mode
fork=no
log_stderror=yes
*/
check_via=no # (cmd. line: -v)
dns=no # (cmd. line: -r)
rev_dns=no # (cmd. line: -R)
port=5060
children=10
#fifo="/tmp/openser_fifo"
# --- module loading
mpath="/lib/openser/modules/"
loadmodule "mysql.so"
loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "rr.so"
loadmodule "maxfwd.so"
loadmodule "usrloc.so"
loadmodule "registrar.so"
loadmodule "textops.so"
#loadmodule "dispatcher.so"
loadmodule "nathelper.so"
loadmodule "auth.so"
loadmodule "auth_db.so"
loadmodule "xlog.so"
#loadmodule "/usr/lib/openser/modules/acc.so"
#modparam("acc", "early_media", 0)
#modparam("acc", "report_cancels", 1)
#modparam("acc", "db_flag", 2)
#modparam("acc", "db_url",
"mysql://user:pwd@localhost/openser")
#modparam("acc", "report_ack", 0)
#modparam("acc", "db_missed_flag", 3)
#modparam("acc", "failed_transaction_flag", 4)
#modparam("acc", "db_extra", "from_uri=$fu ; to_uri=$tu ;
from_user=$fU;
source_ip=$si")
# --- setting module parameters
modparam("usrloc|auth_db","db_url","mysql://user:pwd@localhost/openser")
# --- setting module parameters
#modparam("dispatcher", "list_file",
"/etc/openser/dispatcher.list")
# -- usrloc params --
modparam("usrloc", "db_mode", 2)
modparam("usrloc", "nat_bflag", 3)
# -- registrar params --
#modparam("registrar", "received_avp", "$avp(s:rcv)")
# -- auth params --
modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")
# -- rr params --
modparam("rr", "enable_full_lr", 1)
# -- nathelper
modparam("registrar|nathelper", "received_avp",
"$avp(i:42)")
modparam("nathelper", "rtpproxy_sock",
"unix:/var/run/rtpproxy.sock")
modparam("nathelper", "natping_interval", 30)
modparam("nathelper", "ping_nated_only", 1)
modparam("nathelper", "sipping_bflag", 7)
modparam("nathelper", "sipping_from",
"sip:pinger@whatever.com")
#modparam("nathelper", "received_avp", "$avp(s:rcv)")
# -- xlog
modparam("xlog", "buf_size", 8192)
modparam("registrar", "max_contacts", 5)
# --- main routing logic
route{
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
exit;
};
# NAT detection
route(2);
if (!method=="REGISTER")
record_route();
if (loose_route()) {
append_hf("P-hint: rr-enforced\r\n");
route(1);
};
if (!uri==myself) {
append_hf("P-hint: outbound\r\n");
route(1);
};
if (uri==myself) {
if (method=="REGISTER") {
if (!www_authorize("OPENSER_IP", "subscriber"))
{
www_challenge("OPENSER_IP", "0");
exit;
};
if (isflagset(5)) {
setbflag(6);
# if you want OPTIONS natpings uncomment
next
# setflag(7);
};
save("location");
exit;
};
#
# - TERMINATIONS
#
if (method=="INVITE") {
if (!proxy_authorize("OPENSER_IP","subscriber"))
{
if($si=="GW_IP"){
xlog("L_NOTICE", "\n************** ALLOWING
INCOMING CALL AS IT COMES FROM $si ************\n");
}else{
proxy_challenge("OPENSER_IP","0");
exit;
}
}
if (uri=~"^sip:00"){
xlog("L_NOTICE", "\n************** GOT OUTSIDE
CALL
************\n");
strip(2);
prefix("M3ll4m0d4v1d");
rewritehostport("GW_IP:5060");
sl_send_reply("100","Trying");
forward();
exit();
}
}
if (!lookup("location")) {
sl_send_reply("404", "Not Found");
exit;
};
append_hf("P-hint: usrloc applied\r\n");
};
route(1);
}
route[1] {
if (subst_uri('/(sip:.*);nat=yes/\1/')){
setbflag(6);
};
if (isflagset(5)||isbflagset(6)) {
route(3);
}
if (!t_relay()) {
sl_reply_error();
};
exit;
}
route[2]{
force_rport();
if (nat_uac_test("19")) {
if (method=="REGISTER") {
fix_nated_register();
} else {
fix_nated_contact();
};
setflag(5);
};
}
route[3] {
if (is_method("BYE|CANCEL")) {
unforce_rtp_proxy();
} else if (is_method("INVITE")){
force_rtp_proxy();
t_on_failure("1");
};
if (isflagset(5))
search_append('Contact:.*sip:[^>[:cntrl:]]*',
';nat=yes');
t_on_reply("1");
}
failure_route[1] {
if (isbflagset(6) || isflagset(5)) {
unforce_rtp_proxy();
}
}
onreply_route[1] {
if ((isflagset(5) || isbflagset(6)) &&
status=~"(183)|(2[0-9][0-9])") {
force_rtp_proxy();
}
search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes');
if (isbflagset(6)) {
fix_nated_contact();
}
exit;
}
MANY thanks to all.
David