[Serusers] Asterisk -> SER one way audio call issue

Thorsten serusers at thorko.de
Fri Oct 24 17:33:21 CEST 2008


Hi guys
does someone have experience about the interaction of asterisk and SER.
I have a strange behavior.
I terminate a call from an Asterisk to SER and then to a interconnection
partner which runs also on asterisk.
Whenever I make a call after a long (3-5 mins) idle time I got a one way
audio call because the interconnection partner sends it back to SER
instead of asterisk. But the call after works like a charm. And this
happens all the time.
This is my SER config

# ----------- global configuration parameters ------------------------

#debug=4
debug=2
fork=yes
log_stderror=yes # (cmd line: -E)


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

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

loadmodule "/usr/local/ser/current/lib/ser/modules/sl.so"
loadmodule "/usr/local/ser/current/lib/ser/modules/exec.so"
loadmodule "/usr/local/ser/current/lib/ser/modules/tm.so"
loadmodule "/usr/local/ser/current/lib/ser/modules/rr.so"
loadmodule "/usr/local/ser/current/lib/ser/modules/maxfwd.so"
loadmodule "/usr/local/ser/current/lib/ser/modules/usrloc.so"
loadmodule "/usr/local/ser/current/lib/ser/modules/registrar.so"
loadmodule "/usr/local/ser/current/lib/ser/modules/textops.so"
loadmodule "/usr/local/ser/current/lib/ser/modules/avpops.so"
#loadmodule "/usr/local/ser/current/lib/ser/modules/group.so"
loadmodule "/usr/local/ser/current/lib/ser/modules/xlog.so"
loadmodule "/usr/local/ser/current/lib/ser/modules/auth.so"
#loadmodule "/usr/local/ser/current/lib/ser/modules/nathelper.so"
loadmodule "/usr/local/ser/current/lib/ser/modules/uri.so"
#loadmodule "/usr/local/ser/current/lib/ser/modules/uri_db.so"

# ----------------- setting module-specific parameters ---------------


modparam("usrloc", "db_mode",   0)

# -- rr params --
# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)

# -------------------------  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") {
                        save("location");
                        break;
                };
                # only forward if from our nat ip
                if (method=="INVITE" && (src_ip==82.98.89.146 ||
src_ip==82.98.89.147 || src_ip==82.98.89.129)) {
                        #record_route();
                
                        if (uri =~ "sip:[0-9]*@*") {
                                #record_route();
                                route(3);
                                break;
                        }
                  
                }
                else {
                        sl_send_reply("401", "Unauthorized");
                };
                if (method=="CANCEL") {
                        route(1);
                        break;
                };
                if (method=="BYE") {
                        route(1);
                        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]
{
        # strip the first 4 characters 1991
        #strip(4);
        #rewritehost("62.134.16.104");
        rewritehostport("62.134.16.104:5060");
        #t_relay_to_udp("62.134.16.104", "5060");
        xlog("L_WARN", "[%Tf]: Call forwarded to BT from: [%fu] to:
[%tu] next: [%ds]\r\n");
        route(1);
        break;
}

The asterisk dialplan looks like this
; route everything to SER
exten => _X.,1,Noop(${SIP_HEADER(FROM)})
exten => _X.,n,Set(SIP_CODEC="gsm")
exten => _X.,n,Dial(sip/${EXTEN}@82.98.89.140)
exten => _X.,n,Hangup()


The asterisk server has the public IP 82.98.89.146 and SER 82.98.89.140.
BT which is  our interconnection partner has the IP 62.134.16.104.

Could someone help me with this?
Thanks
Ciao
Thorsten Kohlhepp




More information about the sr-users mailing list