[Serusers] Interdomain remote disconnect

Maciej Żwirski mzwirek at poczta.fm
Fri Dec 15 13:54:20 CET 2006


Hi,

I've a following problem: I'm dialing over voip to another domain. 
Everything swings except that when a remote party hangs up, I don't get 
a disconnect signal at my caller. Instead I'm getting ". I'm pretty sure 
I messed up something with my force/unforce proxy but I just can't get 
it working right. Note that when I'm calling to the PSTN (same transit 
proxy) through Asterisk I do get the disconnect signal. Any help would 
be appreciated :). Below is the config of my local proxy. I can post my 
transit proxy conf if needed.

Thanks,
Maciek

debug=3
fork=no
log_stderror=yes

listen=<local_proxy>
port=5060
children=4

mpath="/usr/local/lib/openser/modules/"

dns=no
rev_dns=no
alias="yam"
fifo="/tmp/ser_fifo"
fifo_db_url="mysql://openser:openserrw@localhost:3306/openser"

loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "rr.so"
loadmodule "maxfwd.so"
loadmodule "usrloc.so"
loadmodule "registrar.so"

loadmodule "mysql.so"

loadmodule "auth.so"
loadmodule "auth_db.so"

loadmodule "uri.so"
loadmodule "uri_db.so"

loadmodule "domain.so"
loadmodule "nathelper.so"
loadmodule "textops.so"

loadmodule "avpops.so"
loadmodule "permissions.so"
loadmodule "uac.so"

loadmodule "acc.so"
loadmodule "auth_radius.so"
loadmodule "group_radius.so"
loadmodule "avp_radius.so"

loadmodule "xlog.so"

loadmodule "cpl-c.so"
loadmodule "exec.so"

#modparam("auth_db","calculate_ha1",1)
#modparam("auth_db","password_column","password")
modparam("auth_db|permissions|uri_db|usrloc|cpl-c","db_url","mysql://openser:openserrw@localhost:3306/openser")

modparam("usrloc", "db_mode", 2)
modparam("usrloc|registrar","use_domain",1)
modparam("rr", "enable_full_lr", 1)

modparam("tm", "fr_inv_timer", 120)
#modparam("tm", "fr_inv_timer_avp", "inv_timeout")

modparam("permissions", "db_mode", 1)
modparam("permissions", "trusted_table", "trusted")

modparam("nathelper","rtpproxy_sock","unix:/var/run/rtpproxy.sock")
modparam("nathelper","natping_interval",0)
modparam("nathelper","ping_nated_only",1)

modparam("registrar","nat_flag",6)
modparam("registrar","sip_natping_flag",7)

modparam("avpops", "avp_url", 
"mysql://openser:openserrw@localhost:3306/openser")
modparam("avpops", "avp_table", "usr_preferences")
modparam("avpops", "use_domain", 1)

modparam("acc", "radius_flag",1)
modparam("acc", "radius_missed_flag", 2)
modparam("acc", "log_flag", 1)
modparam("acc", "log_missed_flag", 1)
modparam("acc", "service_type", 15)
modparam("acc", "radius_extra", "Sip-Src-IP=$si;Sip-Src-Port=$sp")
modparam("acc", "report_ack",1)
modparam("acc|auth_radius|group_radius|avp_radius","radius_config","/usr/local/etc/radiusclient-ng/radiusclient.conf")

modparam("group_radius", "use_domain", 1)

modparam("avpops", "avp_aliases", "day=i:101;time=i:102")

modparam("cpl-c","cpl_table","cpl")
modparam("cpl-c","cpl_dtd_file","/usr/local/etc/openser/cpl-06.dtd")
#modparam("cpl-c","log_dir","/var/log/openser")
modparam("cpl-c","lookup_domain","location")
modparam("cpl-c","use_domain",1)
modparam("cpl-c","nat_flag",6)
modparam("cpl-c","proxy_recurse",2)
modparam("cpl-c","proxy_route", 0)
#modparam("cpl-c","timer_avp","i:5")

route{
 #--------------------------------------
 # Sanity Check Section
 #--------------------------------------
    if (!mf_process_maxfwd_header("10")){
        sl_send_reply("483", "Too Many Hops");
         return;
    };
    if (msg:len > max_len){
        sl_send_reply("513", "Message Overflow");
        return;
    };


 #--------------------------------------
 # Record Route Section
 #--------------------------------------
    if (method!="REGISTER") {
        record_route();
    };

    if (method=="BYE" || method=="CANCEL"){
        xlog("L_INFO","$tu\n $fu\n $ru\n");
        unforce_rtp_proxy();   
    };

 #--------------------------------------
 # Loose Route Section
 #--------------------------------------
    if (loose_route()) {
        log(1,"loose route\n");
        if (is_method("BYE")) {
            unforce_rtp_proxy();
            sl_send_reply("200","Bye");
#            acc_rad_request("200");
#            acc_log_request("200");
        }

        if((method=="INVITE" || method=="REFER") && !has_totag()) {
            sl_send_reply("403","Forbidden");
            return;
        };

        if (method=="INVITE") {
            if (!allow_trusted()) {
                if (!radius_www_authorize("")) {
                    www_challenge("","0");
                    return;
                }
            else if(!check_from()) {
                    sl_send_reply("403","Use From=ID");
                    return;
                };

                consume_credentials();
            };
            if (nat_uac_test("19")) {
                setflag(6);
                force_rport();
                fix_nated_contact();
            };
#            force_rtp_proxy("1");
            force_rtp_proxy("s");
        };

        route(1);
        return;
    };

 #--------------------------------------
 # Call Type Processing Section
 #--------------------------------------

    if (!is_uri_host_local()) {
        if (is_from_local() || allow_trusted()) {
            route(4);
            route(1);
        }
        else {
            sl_send_reply("403", "Forbidden");
        };
        return;
    };

    if (method=="ACK") {
        route(1);
          return;
    }
    else if(method=="CANCEL"){
        route(1);
        return;
    }
    else if (method=="INVITE"){
        if(!cpl_run_script("incoming", "is_stateless")) {
        # script execution failed
        t_reply("500", "CPL script execution failed");
        };
        route(3);
        return;
    }
    else if (method=="REGISTER") {
        cpl_process_register();
        route(2);
        return;
    };

    lookup("aliases");
    if (!is_uri_host_local()) {
        route(4);
        route(1);
         return;
    };
 
    if (!lookup("location")){
    #    xlog("L_INFO"," $ru \n, $fu \n, $tu \n");
        sl_send_reply("404", "User Not Found");
        return;
    };

    route(1);
}

route[1] {
 #--------------------------------------
 # Default Message Handler
 #--------------------------------------

    t_on_reply("1");
   
    if (!t_relay()) {
        if(method=="INVITE" && isflagset(6)) {
            unforce_rtp_proxy();
        };
        sl_reply_error();
    };
}

route[2] {
 #--------------------------------------
 # REGISTER Message Handler
 #--------------------------------------
    sl_send_reply("100", "Trying");

    if(!search("^Contact:[ ]*\*") && nat_uac_test("19")) {
        setflag(6);
        fix_nated_register();
        force_rport();
    };

    sl_send_reply("100","Trying");

    if(!radius_www_authorize("")) {
        www_challenge("","0");
        return;
    };

    if(!check_to()){
        sl_send_reply("401","Unauthorized");
        return;
    };

    consume_credentials();

    if (!save("location")) {
        sl_reply_error();
    };
}

route[3] {
#-----------------------
# INVITE Message Handler
#-----------------------

    if (!allow_trusted()) {

    if(!radius_www_authorize("")) {
   
        www_challenge("","0");
        return;
    }
    else if (!check_from()){
        sl_send_reply("403","Use From=ID");
        return;
    };

    consume_credentials();
    };

    if(nat_uac_test("19")) {
    setflag(6);
    };
   
    avp_load_radius("caller");

#    setflag(1);
#    setflag(2);

    route(9); # CLIP/CLIR
    route(8); # Check if number is blocked
    route(7); # Set/remove call forwarding

    route(10); # VPABX

    lookup("aliases");

    if(!is_uri_host_local()) {
        route(4);
    route(1);
    return;
    };

    if (avp_db_load("$ru/username", "$avp(s:callfwd)")) {
    setflag(22);
    avp_pushto("$ru", "$avp(s:callfwd)");
    route(6);
    return;
    };

    if (!lookup("location")) {    #Outbound domain

    if (uri=~"^sip:[0-9]{10}@") {
        route(4);
        route(5);
        return;
    };
    sl_send_reply("404", "User Not Found");
    return;
    };

    if (avp_db_load("$ru/username", "$avp(s:fwdonbusy)")) {
    if (!avp_check("$ru(s:fwdonbusy)", "eq/$ru/i")) {
        setflag(26);
    };
    };

    if (avp_db_load("$ru/username", "$avp(s:fwdnoanswer)")) {
    if (!avp_check("$avp(s:fwdnoanswer)", "eq/$ru/i")) {
        setflag(27);
    };
    };

    t_on_failure("1");
    route(4);
    route(1);
}

route[4] {
# ----------------------
# NAT Traversal Section
# ----------------------

    if (isflagset(6)) {
        force_rport();
        fix_nated_contact();
#        force_rtp_proxy("i");
        force_rtp_proxy();
    };
}


route[5] {
#----------------------
# Main Domain Handler
#----------------------

if (uri=~"^sip:022448755[0-9]@"){
    sl_send_reply("404","User Not Found");
    drop;
}

xlog("L_INFO","Main domain Handler: address changed to <outbound_proxy>\n");
#rewritehostport("<outbound_proxy>:5061");
rewritehost("<outbound_proxy>");
t_on_failure("1");

route(1);
}

route[6] {
# -------------------------
# Call Forwarding Handler
# -------------------------

    if (uri=~"^sip:1[0-9]{10}@") {
        strip(1);
    };

    lookup("aliases");
    revert_uri();
    append_branch();
    if (!is_uri_host_local()) {
        if (!isflagset(22)) {
            append_branch();
        };
        route(4);
        route(1);
        return;
    };

    if (uri=~"^sip:00[0-9]{10}@") {
        route(4);
        route(1);
        return;
    };

    if (!lookup("location")) {
        if (uri=~"^sip:[0-9]{10}@") {
            route(4);
            route(1);
            return;
        };
        sl_send_reply("404", "3User Not Found");
    };

    route(4);
    route(1);
}

route[7] {
#######################################
# Call forwarding setters
#######################################

    if(uri=~"^sip:\*21\*"){
        subst_uri('/^sip:\*21\*(.*)@(.*)$/sip:\1 at yam/');
        avp_db_delete("$fu","$avp(s:callfwd)");
        avp_write("$ru","$avp(s:callfwd)");
        avp_db_store("$fu","$avp(s:callfwd)");
        sl_send_reply("603", "Call forwarding set");
        drop;
    };

    if(uri=~"^sip:\*31\*"){
        subst_uri('/^sip:\*31\*(.*)@(.*)$/sip:\1 at yam/');
        avp_db_delete("$fu","$avp(s:fwdonbusy)");
        avp_write("$ru","$avp(s:fwdonbusy)");
        avp_db_store("$fu","$avp(s:fwdonbusy)");
        exec_msg("/home/pgrabowski/busy_fwd_cpl");
        sl_send_reply("603", "Call forwarding on busy set");
        drop;
    };

    if(uri=~"^sip:\*41\*"){
        subst_uri('/^sip:\*31\*(.*)@(.*)$/sip:\1 at yam/');
        avp_db_delete("$fu","$avp(s:fwdnoanswer)");
        avp_write("$ru","$avp(s:fwdnoanswer)");
        avp_db_store("$fu","$avp(s:fwdnoanswer)");
        exec_msg("/home/pgrabowski/noanswer_fwd_cpl");
        sl_send_reply("603", "Call forwarding on no answer set");
        drop;
    };

    if(uri=~"^sip:\*22\*"){
        avp_db_delete("$fu","$avp(s:callfwd)");
        sl_send_reply("603", "Call forwarding removed");
        drop;
    };

    if(uri=~"^sip:\*32\*"){
        avp_db_delete("$fu","$avp(s:fwdonbusy)");
        exec_msg("/home/pgrabowski/ser_work/rm_busy_fwd_cpl");
        sl_send_reply("603", "Call forwarding on busy removed");
        drop;
    };

    if(uri=~"^sip:\*42\*"){
        avp_db_delete("$fu","$avp(s:fwdnoanswer)");
        exec_msg("/home/pgrabowski/ser_work/rm_noanswer_fwd_cpl");
        sl_send_reply("603", "Call forwarding on no answer removed");
        drop;
    };


}

route[8] {
##################################
# Outgoing number blocking
##################################

    if(avp_check("$avp(s:caller_blocked)","eq/$tu")){
        sl_send_reply("403", "Forbidden");
        return;
    };
}

route[9] {
#################################
# CLIP/CLIR
#################################
    if(is_avp_set("$avp(s:caller_clip)")){
        uac_replace_from("$avp(s:caller_clip)","");
    };
    if(is_avp_set("$avp(s:clir)")){
        uac_replace_from("Restricted","sip:restricted@<local_proxy>");
    };

}

route[10] {
#################################
# VPABX
#################################
    if(uri=~"^sip:[0-9]{3}@"){
        if (is_avp_set("$avp(s:caller_vpabx)")) {
            xlog("L_INFO","VPABX\n");
            subst_uri('/^sip:(.*)$/sip:$avp(s:caller_vpabx)\1/');
            xlog("$ru $tu\n");
        }
    }
   
}

onreply_route[1] {
    if (isflagset(6) && (status=~"(180)|(183)|2[0-9][0-9]")) {
        if(!search("^Content-Length:[ ]*0")) {
            force_rtp_proxy();
        };
    };

    if (nat_uac_test("1")) {
        fix_nated_contact();
    };
}

failure_route[1] {

    if (t_check_status("487")) {
    return;
    };
   
    subst_uri('/^sip:(.*)@(.*)$/sip:100.\1@<local_proxy>/');
    rewritehostport("<local_proxy>:5061");
    append_branch();
    t_relay();
}

----------------------------------------------------------------------
smieszne, muzyka, pilka, sexy, kibice, kino, ciekawe, extreme, kabaret
http://link.interia.pl/f19d4 - najlepsze filmy w intermecie




More information about the sr-users mailing list