[Serusers] Asterisk SER NAT issue

Thorsten serusers at thorko.de
Wed Apr 30 09:45:50 CEST 2008


Hi guys,
I'm trying to get this constellation running

Asterisk (priavte IP)---->SER (public IP)---->Asterisk  (public IP)

I've already Asterisk set up to put the external IP to the SIP messages 
with this parameter in sip.conf
externip = 82.98.89.129
but I'm not sure what I have to configure on SER. Do I need the nathelper?
My config of SER looks like this:
# ----------- global configuration parameters ------------------------
debug=4         # debug level (cmd line: -dddddddddd)
#debug=0
fork=no
log_stderror=yes # (cmd line: -E)

check_via=no    # (cmd. line: -v)
dns=no           # (cmd. line: -r)
rev_dns=no      # (cmd. line: -R)
#listen=10.4.1.80
port=5060
children=4
fifo="/tmp/ser_fifo"

# ------------------ module loading ----------------------------------
loadmodule "/usr/local/ser/lib/ser/modules/sl.so"
loadmodule "/usr/local/ser/lib/ser/modules/tm.so"
loadmodule "/usr/local/ser/lib/ser/modules/rr.so"
loadmodule "/usr/local/ser/lib/ser/modules/maxfwd.so"
loadmodule "/usr/local/ser/lib/ser/modules/usrloc.so"
loadmodule "/usr/local/ser/lib/ser/modules/registrar.so"
loadmodule "/usr/local/ser/lib/ser/modules/textops.so"
loadmodule "/usr/local/ser/lib/ser/modules/avpops.so"
loadmodule "/usr/local/ser/lib/ser/modules/xlog.so"
loadmodule "/usr/local/ser/lib/ser/modules/auth.so"
loadmodule "/usr/local/ser/lib/ser/modules/nathelper.so"
loadmodule "/usr/local/ser/lib/ser/modules/uri.so"


# ----------------- setting module-specific parameters ---------------
# -- usrloc params --
modparam("usrloc", "db_mode",   0)
modparam("rr", "enable_full_lr", 1)
modparam("registrar", "nat_flag", 6)
modparam("nathelper", "natping_interval", 30) # Ping interval 30 s
modparam("nathelper", "ping_nated_only", 1)   # Ping only clients behind NAT
route{
        if (!mf_process_maxfwd_header("10")) {
                sl_send_reply("483","Too Many Hops");
                break;
        };
        if (msg:len >=  2048 ) {
                sl_send_reply("513", "Message too big");
                break;
        };

if (!method=="REGISTER") record_route();
if (loose_route()) {
                # mark routing logic in request
                append_hf("P-hint: rr-enforced\r\n");
                route(1);
                break;
        };
 if (!uri==myself) {
                # mark routing logic in request
                append_hf("P-hint: outbound\r\n");
                route(1);
                break;
        };
 if (uri==myself) {
                if (method=="ACK") {
                        route(1);
                        break;
                }

                if (method=="REGISTER") {
                        record_route();
                        save("location");
                        break;
                };
                if (method=="INVITE") {
                        if (uri =~ "sip:0[0-9]@*") {
                                route(3);
                                break;
                        }
                };

                lookup("aliases");
                if (!uri==myself) {
                       append_hf("P-hint: outbound alias\r\n");
                        route(1);
                        break;
                };

                # native SIP destinations are handled using our USRLOC DB
                if (!lookup("location")) {
                        sl_send_reply("404", "Not Found");
                        break;
                };
        };
        append_hf("P-hint: usrloc applied\r\n");
        route(1);
}

route[1]
{
        if (!t_relay()) {
               sl_reply_error();
        };
                #log(1, 
"----------------------------Ringing--------------------\n");
                #sl_send_reply("180", "Ringing");
}

route[3]
{
        if (uri =~ "sip:0[0-9]@*") {
                log(1, "Forwarding to MG03 \n");
                rewritehostport("82.98.89.176:5060");
                route(1);
                break;
        }
}

I appreciate any help
Thanks
Thorsten




More information about the sr-users mailing list