[Serusers] Asterisk->SER rtp problems

Thorsten serusers at thorko.de
Tue May 13 12:09:39 CEST 2008


Hi,
I have an asterisk server running with an private IP. This asterisk 
forwards all calls to a SER server with a public IP. The SER server then 
forwards its calls to a public SIP provider. The problem now is that SER 
tries to stay in the loop which it shouldn't because there is no media 
proxy running. I don't get any audio because of this issue. But if I 
register the asterisk box directly to the SIP provider it works. Does 
anybody know how to fix this.
My ser.cfg
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=0.0.0.0
#listen=82.98.89.140
port=5060
children=4
fifo="/tmp/ser_fifo"

# ------------------ module loading ----------------------------------

# Uncomment this if you want to use SQL database
#loadmodule "/opt/ser/lib/ser/modules/mysql.so"

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/group.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"

# Uncomment this if you want digest authentication
# mysql.so must be loaded !
#loadmodule "/opt/ser/lib/ser/modules/auth.so"
#loadmodule "/opt/ser/lib/ser/modules/auth_db.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


# -------------------------  request routing logic -------------------

# main routing logic

route{

        # initial sanity checks -- messages with
        # max_forwards==0, or excessively long requests
        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;
        };


        # we record-route all messages -- to make sure that
        # subsequent messages will go through our proxy; that's
        # particularly good if upstream and downstream entities
        # use different transport protocol
        if (!method=="REGISTER") record_route();

        # subsequent messages withing a dialog should take the
        # path determined by record-routing
        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 the request is for other domain use UsrLoc
        # (in case, it does not work, use the following command
        # with proper names and addresses in it)
        if (uri==myself) {
                if (method=="ACK") {
                        route(1);
                        break;
                }

                if (method=="REGISTER") {
                        #record_route();
                        save("location");
                        break;
                };
                if (method=="INVITE") {
                        #if (uri =~ "sip:[0-9]@*") {
                        #       if (nat_uac_test("19")) {
                        #               fix_nated_contact();
                        #               fix_nated_sdp("3");
                        #       }
                        #       route(3);
                        #       break;
                        #}
                        if (uri =~ "sip:[0-9]@*") {
                        #       record_route();
                                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]
{
        # send it out now; use stateful forwarding as it works reliably
        # even for UDP2TCP
        if (!t_relay()) {
                sl_reply_error();
        };
}

route[3]
{
        if (uri =~ "sip:[0-9]@*") {
                log(1, "Forwarding to mg3.net-m.de \n");
                #rewritehostport("192.168.13.102:5060");
                rewritehostport("62.214.145.199:5060");
                #forward(62.214.145.199, 5060);
                route(1);
                break;
        }
}

My extensions.conf
[toser]
exten => _X.,1,Dial(sip/${EXTEN}@82.98.89.139)

Thanks for any help
Ciao
Thorsten



More information about the sr-users mailing list