I have been playnig with SER for a few weeks now on an internal
network (all 192.168.X.X) I now want to set up SER to handle NAT so
that I can give it a public IP and have my Cisco ATA188's and X-Lite
Softphones connect from anywhere. I followed the guide/instructions
fron
www.onsip.org I ahve SER-0.9 and MediaProxy1.3 up and running.
Using the same ser.cfg from
onsip.org I thought things were good. I
can call from one internal Cisco ATA to another, but there is no
sound. During the call if I run sessions.py I see the call although
the from and To IP addesses are "XXX.XXX.XXX.XXX" and the status is
"Inactive". I assume that is correct as it shouldn't use proxying for
an internal to internal call. I am NOT using mediaidspather as both
SER and MediaProxy are on the same machine. I want to get internal to
internal calling to work before I go back to testing NAT. I am not
sure how to debug this further. Any help would be great. Below is my
ser.cfg, and mediaproxy.ini
SER.cfg
# file with Nat'ing setup
#
#set all Master Level Flags
#
debug=3
#fork=yes
#log_stderror=no
/*
fork=no
log_stderror=yes
*/
dns=no
rev_dns=no
fifo="/tmp/ser_fifo"
#
# Load all Modules
#
loadmodule "//lib/ser/modules/mysql.so"
loadmodule "//lib/ser/modules/sl.so"
loadmodule "//lib/ser/modules/tm.so"
loadmodule "//lib/ser/modules/rr.so"
loadmodule "//lib/ser/modules/maxfwd.so"
loadmodule "//lib/ser/modules/usrloc.so"
loadmodule "//lib/ser/modules/registrar.so"
loadmodule "//lib/ser/modules/auth.so"
loadmodule "//lib/ser/modules/auth_db.so"
loadmodule "//lib/ser/modules/uri.so"
loadmodule "//lib/ser/modules/uri_db.so"
#loadmodule "//lib/ser/modules/avpops.so"
loadmodule "//lib/ser/modules/textops.so"
loadmodule "//lib/ser/modules/domain.so"
loadmodule "//lib/ser/modules/mediaproxy.so"
loadmodule "//lib/ser/modules/nathelper.so"
#
#Set Module Parameters
#
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","/etc/ser/sip-clients")
modparam("mediaproxy","rtp_asymmetrics","/etc/ser/rtp-clients")
modparam("usrloc", "db_mode", 2)
modparam("registrar", "nat_flag", 6)
modparam("rr", "enable_full_lr", 1)
#
# begin Main Route Block
#
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")) {*/
if (method=="INVITE") {
#record_route_preset("192.168.122.135:5060;nat=yes"); # insert IP address
#} 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") {
if (client_nat_test("3") || search("^Route:.*;nat=yes")) {
setflag(6);
# use_media_proxy();
};
};
route(1);
break;
};
# -----------------------------------------------------------------
# Call Type Processing Section
# -----------------------------------------------------------------
if (uri==myself) {
if (method=="INVITE") {
route(3);
break;
} else if (method=="REGISTER") {
route(2);
break;
};
if (!lookup("location")) {
if (uri=~"^sip:30") {
rewritehost("162.168.191.1");
};
if (uri=~"^sip:83") {
rewritehost("192.168.194.1");
};
};
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();
};
if (!www_authorize("a.b.c ","subscriber")) {
www_challenge("a.b.c ","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 (!lookup("location")) {
if (uri=~"^sip:30") {
rewritehost("162.168.191.1");
};
if (uri=~"^sip:83") {
rewritehost("192.168.194.1");
};
};
if (!proxy_authorize("a.b.c ","subscriber")) {
proxy_challenge("a.b.c","0");
break;
} else if (!check_from()) {
sl_send_reply("403", "Use From=ID");
break;
};
consume_credentials();
if (isflagset(6) || isflagset(7)) {
use_media_proxy();
};
route(1);
}
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();
};
}
Mediaproxy.ini
;
; Configuration file for MediaProxy
;
[Dispatcher]
;socket = /var/run/proxydispatcher.sock
;group = ser
;defaultProxy = /var/run/mediaproxy.sock
[MediaProxy]
;socket = /var/run/mediaproxy.sock
;group = ser
;listen = None
allow = any
;proxyIP = 10.0.0.1
;portRange = 35000:65000
;TOS = 0xb8
;idleTimeout = 60
;holdTimeout = 3600
;forceClose = 0
accounting = off
[Accounting]
user = dbuser
password = dbpass
host = dbhost
database = radius
table = radacct