OpenSIPS / opensips

OpenSIPS is a GPL implementation of a multi-functionality SIP Server that targets to deliver a high-level technical solution (performance, security and quality) to be used in professional SIP server platforms.
https://opensips.org
Other
1.27k stars 578 forks source link

[CRASH] #2795

Closed thrill007 closed 2 years ago

thrill007 commented 2 years ago

OpenSIPS version you are running

opensips 3.2.4 (x86_64/linux)

Crash Core Dump

https://pastebin.com/X8hQ4tc6 Describe the traffic that generated the bug

just a few of normal calls, nothing particular, calls launched by freeswitch originate command(fs<--sip invite-->opensips<--pstn-->cell phone but I do make some changes into my opensips.cfg, mainly nathelper things like nat sip ping , setbflag(), which I am not sure if the crash is cause by these. To Reproduce

Relevant System Logs

OS/environment information

log_level=8 xlog_level=4 log_stderror=no log_facility=LOG_LOCAL0 open_files_limit=4096

fork=yes

udp_workers=8

/ uncomment the next line to enable the auto temporary blacklisting of not available destinations (default disabled) /

disable_dns_blacklist=no

/ uncomment the next line to enable IPv6 lookup after IPv4 dns lookup failures (default disabled) /

dns_try_ipv6=yes

socket=udp:192.168.101.49:5080 as 103.233.53.37:5080 # CUSTOMIZE ME

socket=udp:192.168.101.49:5080

socket=tcp:192.168.101.49:5080

socket=ws:192.168.101.49:7445 as 103.233.53.37:7445

socket=ws:192.168.101.49:7445#socket=wss:192.168.101.49:8045 as 103.233.53.37:8045 socket=wss:192.168.101.49:8044 #as 103.233.53.37:48045

HEPv1, v2, v3 listener

socket= hep_udp:192.168.101.49:6061 # change the listening IP alias=udp:customer1.domain.com:5080 alias=udp:customer2.domain.com:5080 alias=udp:customer3.domain.com:5080 alias=udp:customer4.domain.com:5080 alias=udp:customer5.domain.com:5080 alias=udp:customer6.domain.com:5080 alias=udp:gateway.domain.com:5080

gid/group=unioncloud

uid/user=unioncloud

####### Modules Section ########

set module path

mpath="/usr/local/lib64/opensips/modules/" loadmodule "textops.so" loadmodule "event_datagram.so" loadmodule "drouting.so" modparam("drouting", "rule_prefix_avp", "$avp(dr_prefix)") modparam("drouting", "db_url", "mysql://root:ntXBvIO&qxl4OcSJ@localhost/opensips") modparam("drouting", "no_concurrent_reload", 1)

loadmodule "proto_tcp.so"

SIGNALING module

loadmodule "signaling.so"

loadmodule "uac.so"

loadmodule "proto_hep.so"

modparam("proto_hep", "hep_port", 6666)

loadmodule "mi_script.so" modparam("mi_script", "pretty_printing", 1)

StateLess module

loadmodule "sl.so"

Transaction Module

loadmodule "tm.so" modparam("tm", "fr_timeout", 5) modparam("tm", "fr_inv_timeout", 30) modparam("tm", "restart_fr_on_each_reply", 0) modparam("tm", "onreply_avp_mode", 1)

Record Route Module

loadmodule "rr.so" / do not append from tag to the RR (no need for this script) / modparam("rr", "append_fromtag", 0)

modparam("rr", "enable_double_rr", 0)

MAX ForWarD module

loadmodule "maxfwd.so"

SIP MSG OPerationS module

loadmodule "sipmsgops.so"

FIFO Management Interface

loadmodule "mi_fifo.so" modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo") modparam("mi_fifo", "fifo_mode", 0666)

URI module

loadmodule "uri.so"

modparam("uri", "use_uri_table", 0)

MYSQL module

loadmodule "db_mysql.so"

USeR LOCation module

loadmodule "usrloc.so"

modparam("usrloc", "db_mode", 1)

modparam("usrloc", "nat_bflag", "NAT_BFLAG") modparam("usrloc", "working_mode_preset", "single-instance-sql-write-through") modparam("usrloc", "db_url", "mysql://root:ntXBvIO&qxl4OcSJ@localhost/opensips")

REGISTRAR module

loadmodule "registrar.so" modparam("registrar", "tcp_persistent_flag", "TCP_PERSISTENT") modparam("registrar", "received_avp", "$avp(received)") / uncomment the next line not to allow more than 10 contacts per AOR / modparam("registrar", "max_contacts", 1)

ACCounting module

loadmodule "acc.so" / what special events should be accounted ? / modparam("acc", "early_media", 0) modparam("acc", "report_cancels", 0) / by default we do not adjust the direct of the sequential requests. if you enable this parameter, be sure to enable "append_fromtag" in "rr" module / modparam("acc", "detect_direction", 0) modparam("acc", "db_url", "mysql://root:ntXBvIO&qxl4OcSJ@localhost/opensips")

AUTHentication modules

loadmodule "auth.so" loadmodule "auth_db.so" modparam("auth_db", "calculate_ha1", yes) modparam("auth_db", "password_column", "password") modparam("auth_db", "db_url", "mysql://root:ntXBvIO&qxl4OcSJ@localhost/opensips") # CUSTOMIZE ME modparam("auth_db", "load_credentials", "")

http module

loadmodule "httpd.so"

modparam("httpd", "ip", "0.0.0.0")

modparam("httpd", "port", 8005)

MI HTML module

loadmodule "mi_html.so" modparam("mi_html", "root", "opensips_mi")

loadmodule "mi_http.so" loadmodule "pi_http.so" modparam("pi_http", "framework", "/home/unioncloud/soft/opensips-3.2.4/examples/pi_framework.xml") loadmodule "mi_xmlrpc_ng.so"

loadmodule "proto_udp.so"

DIALOG module

loadmodule "dialog.so" modparam("dialog", "dlg_match_mode", 1) modparam("dialog", "default_timeout", 21600) # 6 hours timeout modparam("dialog", "db_mode", 2) modparam("dialog", "db_url", "mysql://root:ntXBvIO&qxl4OcSJ@localhost/opensips") # CUSTOMIZE ME

LOAD BALANCER module

loadmodule "load_balancer.so" modparam("load_balancer", "db_url", "mysql://root:ntXBvIO&qxl4OcSJ@localhost/opensips") # CUSTOMIZE ME modparam("load_balancer", "probing_method", "OPTIONS")

modparam("load_balancer", "probing_interval", 25)

loadmodule "domain.so" modparam("domain", "db_url", "mysql://root:ntXBvIO&qxl4OcSJ@localhost/opensips")

loadmodule "regex.so"

loadmodule "options.so"

loadmodule "nathelper.so" modparam("nathelper", "received_avp", "$avp(received)") modparam("nathelper", "natping_interval", 10) modparam("nathelper", "natping_partitions", 4) modparam("nathelper", "sipping_bflag", "SIPPING_ENABLE") modparam("nathelper", "remove_on_timeout_bflag", "SIPPING_RTO") modparam("nathelper", "ping_threshold", 10) modparam("nathelper", "sipping_from", "sip:ops@localhost") modparam("nathelper", "ping_nated_only", 1)

loadmodule "proto_tls.so" loadmodule "proto_wss.so" loadmodule "proto_ws.so" modparam("proto_ws", "trace_on", 1) loadmodule "tls_openssl.so" loadmodule "tls_mgm.so"

modparam("tls_mgm", "ca_list", "path/to/wellknownCAs")

modparam("tls_mgm", "server_domain", "dom1") modparam("tls_mgm", "match_ip_address", "[dom1]192.168.101.49:8044") modparam("tls_mgm", "match_sip_domain", "[dom1]*") modparam("tls_mgm", "certificate", "[dom1]/home/unioncloud/soft/opensips-3.2.4/etc/cctocloud.com.crt") modparam("tls_mgm", "private_key", "[dom1]/home/unioncloud/soft/opensips-3.2.4/etc/cctocloud.com.key")

modparam("tls_mgm", "tls_method", "[dom1]SSLv23") modparam("tls_mgm", "verify_cert", "[dom1]1") modparam("tls_mgm", "require_cert", "[dom1]0")

modparam("tls_mgm", "client_domain", "dom2") modparam("tls_mgm", "match_ip_address", "[dom2]") modparam("tls_mgm", "match_sip_domain", "[dom2]") modparam("tls_mgm", "certificate", "[dom2]/home/unioncloud/soft/opensips-3.2.4/etc/cctocloud.com.crt") modparam("tls_mgm", "private_key", "[dom2]/home/unioncloud/soft/opensips-3.2.4/etc/cctocloud.com.key")

modparam("tls_mgm", "tls_method", "[dom2]SSLv23") modparam("tls_mgm", "verify_cert", "[dom2]0") modparam("tls_mgm", "require_cert", "[dom2]0")

loadmodule "nat_traversal.so" modparam("nat_traversal", "keepalive_interval", 90) loadmodule "avpops.so" modparam("avpops", "db_url", "mysql://root:ntXBvIO&qxl4OcSJ@localhost/opensips")

modparam("avpops","avp_table","avptable")

loadmodule "event_route.so"

####### Routing Logic ######## ###########startup route ############### startup_route{ subscribe_event("E_UL_AOR_INSERT", "udp:192.168.23.208:5099"); subscribe_event("E_UL_AOR_DELETE", "udp:192.168.23.208:5099"); subscribe_event("E_UL_CONTACT_UPDATE", "udp:192.168.23.208:5099"); }

main request routing logic

route{

/*xlog("L_INFO","================= start TLS pseudo variables ===============\n");
xlog("L_INFO","$$tls_version                   = '$tls_version'\n");
xlog("L_INFO","$$tls_description               = '$tls_description'\n");
xlog("L_INFO","$$tls_cipher_info               = '$tls_cipher_info'\n");
xlog("L_INFO","$$tls_cipher_bits               = '$tls_cipher_bits'\n");
xlog("L_INFO","$$tls_peer_subject              = '$tls_peer_subject'\n");
xlog("L_INFO","$$tls_peer_issuer               = '$tls_peer_issuer'\n");
xlog("L_INFO","$$tls_my_subject                = '$tls_my_subject'\n");
xlog("L_INFO","$$tls_my_issuer                 = '$tls_my_issuer'\n");
xlog("L_INFO","$$tls_peer_version              = '$tls_peer_version'\n");
xlog("L_INFO","$$tls_my_version                = '$tls_my_version'\n");
xlog("L_INFO","$$tls_peer_serial               = '$tls_peer_serial'\n");
xlog("L_INFO","$$tls_my_serial                 = '$tls_my_serial'\n");
xlog("L_INFO","$$tls_peer_subject_cn           = '$tls_peer_subject_cn'\n");
xlog("L_INFO","$$tls_peer_issuer_cn            = '$tls_peer_issuer_cn'\n");
xlog("L_INFO","$$tls_my_subject_cn             = '$tls_my_subject_cn'\n");
xlog("L_INFO","$$tls_my_issuer_cn              = '$tls_my_issuer_cn'\n");
xlog("L_INFO","$$tls_peer_subject_locality     = '$tls_peer_subject_locality'\n");
xlog("L_INFO","$$tls_peer_issuer_locality      = '$tls_peer_issuer_locality'\n");
xlog("L_INFO","$$tls_my_subject_locality       = '$tls_my_subject_locality'\n");
xlog("L_INFO","$$tls_my_issuer_locality        = '$tls_my_issuer_locality'\n");
xlog("L_INFO","$$tls_peer_subject_country      = '$tls_peer_subject_country'\n");
xlog("L_INFO","$$tls_peer_issuer_country       = '$tls_peer_issuer_country'\n");
xlog("L_INFO","$$tls_my_subject_country        = '$tls_my_subject_country'\n");
xlog("L_INFO","$$tls_my_issuer_country         = '$tls_my_issuer_country'\n");
xlog("L_INFO","$$tls_peer_subject_state        = '$tls_peer_subject_state'\n");
xlog("L_INFO","$$tls_peer_issuer_state         = '$tls_peer_issuer_state'\n");
xlog("L_INFO","$$tls_my_subject_state          = '$tls_my_subject_state'\n");
xlog("L_INFO","$$tls_my_issuer_state           = '$tls_my_issuer_state'\n");
xlog("L_INFO","$$tls_peer_subject_organization = '$tls_peer_subject_organization'\n");
xlog("L_INFO","$$tls_peer_issuer_organization  = '$tls_peer_issuer_organization'\n");
xlog("L_INFO","$$tls_my_subject_organization   = '$tls_my_subject_organization'\n");
xlog("L_INFO","$$tls_my_issuer_organization    = '$tls_my_issuer_organization'\n");
xlog("L_INFO","$$tls_peer_subject_unit         = '$tls_peer_subject_unit'\n");
xlog("L_INFO","$$tls_peer_issuer_unit          = '$tls_peer_issuer_unit'\n");
xlog("L_INFO","$$tls_my_subject_unit           = '$tls_my_subject_unit'\n");
xlog("L_INFO","$$tls_my_issuer_unit            = '$tls_my_issuer_unit'\n");
xlog("L_INFO","$$tls_peer_san_email            = '$tls_peer_san_email'\n");
xlog("L_INFO","$$tls_my_san_email              = '$tls_my_san_email'\n");
xlog("L_INFO","$$tls_peer_san_hostname         = '$tls_peer_san_hostname'\n");
xlog("L_INFO","$$tls_my_san_hostname           = '$tls_my_san_hostname'\n");
xlog("L_INFO","$$tls_peer_san_uri              = '$tls_peer_san_uri'\n");
xlog("L_INFO","$$tls_my_san_uri                = '$tls_my_san_uri'\n");
xlog("L_INFO","$$tls_peer_san_ip               = '$tls_peer_san_ip'\n");
xlog("L_INFO","$$tls_my_san_ip                 = '$tls_my_san_ip'\n");
xlog("L_INFO","$$tls_peer_verified             = '$tls_peer_verified'\n");
xlog("L_INFO","$$tls_peer_revoked              = '$tls_peer_revoked'\n");
xlog("L_INFO","$$tls_peer_expired              = '$tls_peer_expired'\n");
xlog("L_INFO","$$tls_peer_selfsigned           = '$tls_peer_selfsigned'\n");
xlog("L_INFO","$$tls_peer_notBefore            = '$tls_peer_notBefore'\n");
xlog("L_INFO","$$tls_peer_notAfter             = '$tls_peer_notAfter'\n");
xlog("L_INFO","================= end TLS pseudo variables ===============\n");*/
if ($pr == "ws" || $pr == "wss")
    setflag("SRC_WS");
else
    setflag("SRC_SIP");
if (!mf_process_maxfwd_header(10)) {
    send_reply(483,"Too Many Hops");
    exit;
}
/*if (($rm=="REGISTER" || $rm=="SUBSCRIBE" ||   ($rm=="INVITE" && !has_totag())) && client_nat_test(10))
{
    nat_keepalive();
}*/
if (has_totag()) {
    # handle hop-by-hop ACK (no routing required)
    if ( is_method("ACK") && t_check_trans() ) {
        xlog("ack in hop by hop.................\n");
        t_relay();
        exit;
    }
    if (is_method("BYE")) {
        do_accounting("log", "failed");
        #xlog("du>>>>>>>>>>>>>>>>>>>>>>$du\n");
        t_relay();
        exit;
    }
    # sequential request within a dialog should
    # take the path determined by record-routing
    if ( !loose_route() ) {
        # we do record-routing for all our traffic, so we should not
        # receive any sequential requests without Route hdr.
        send_reply(404,"Not here");
        exit;
    }
    if (is_method("ACK")) {
        xlog("L_INFO", "ack for invite coming.................\n");
        #FIXME: why here the request-uri is 7445 not the real port in contact ?
        #$rP = "ws";
        #$ru = $dlg_val(contact);/*"sip:192.168.101.49:12345;transport=ws";*/
        #$ru = "sip:"+$(dlg_val(contact){s.substr,17,0});
        #xlog("ru, dlg_val(contact)=======================$ru, $dlg_val(contact)\n");
        if ($DLG_status!=NULL)
            if (!validate_dialog())
                fix_route_dialog();
        if (!t_relay()) {
            send_reply(500,"Internal Error");
        }
        exit;
    }
    /*if (is_method("BYE")) {
        # do accounting even if the transaction fails
        do_accounting("log","failed");
        xlog("du==========================$du\n");
        #$du="sip:192.168.101.49:5082";
        #t_relay();
    }*/
    if (check_route_param("nat=yes"))
       setflag("NAT_FLAG");
    # route it out to whatever destination was set by loose_route()
    # in $du (destination URI).
    route(relay);
    exit;
}

# CANCEL processing
if (is_method("CANCEL")) {
    if (t_check_trans())
        t_relay();
    exit;
}

# absorb retransmissions, but do not create transaction
t_check_trans();
if ( !(is_method("REGISTER") ) ) {
    $var(my-domain)=$hdr(X-My-Domain);
    #xlog("var(my-domain), fd============$var(my-domain), $fd\n");
    if (is_method("OPTIONS")) {
        send_reply(200, "OK");
        exit;
    }

    if (!is_myself("$fd") || !is_myself("$var(my-domain)")) {
        send_reply(403, "invalid domain");
        exit;
    }
    if (is_myself("$fd") && is_myself("$var(my-domain)")) {
        xlog("fd============$fd\n");
        # authenticate if from local subscriber
        # authenticate all initial non-REGISTER request that pretend to be
        # generated by local subscriber (domain from FROM URI is local)
        if (!proxy_authorize("$var(my-domain)", "subscriber")) {
            proxy_challenge("$var(my-domain)", "auth");
            exit;
        }
        if ($au!=$fU) {
            send_reply(403,"Forbidden auth ID");
            exit;
        }

        consume_credentials();
        # caller authenticated

    } else {
        # if caller is not local, then called number must be local
        if (!is_myself("$rd")) {
            send_reply(403,"Relay Forbidden");
            exit;
        }
    }

}
# preloaded route checking
if (loose_route()) {
    xlog("L_ERR",
        "Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");
    if (!is_method("ACK"))
        send_reply(403,"Preload Route denied");
    exit;
}

# record routing
if (!is_method("REGISTER|MESSAGE"))
    record_route();

# account only INVITEs
if (is_method("INVITE")) {
    create_dialog("Pp");
    do_accounting("log");
}
if (!is_myself("$rd")) {
    append_hf("P-hint: outbound\r\n");
    route(relay);
}
# requests for my domain

if (is_method("PUBLISH|SUBSCRIBE")) {
    send_reply(503, "Service Unavailable");
    exit;
}
#TODO: 对于需要nat ping的设备来说,不仅仅是可以注册的设备,外部的非注册设备如果发起了呼入,也应该nat ping
if (isflagset("SRC_WS") || (isflagset("SRC_SIP")&&client_nat_test(10))) {
    xlog("natted caller..................................\n");
    setflag("NAT_FLAG");
    fix_nated_contact();
}

if (is_method("REGISTER")) {
    #xlog("收到了注册请求..........\n");
    # authenticate the REGISTER requests
    #xlog("fd===================>>>>$fd\n");
    if (!is_myself("$fd")) {
        send_reply(503, "bad domain");
        exit;
    }
    if (!www_authorize("", "subscriber")) {
        www_challenge("$fd", "auth");
        exit;
    }

    if ($au!=$tU) {
        send_reply(403,"Forbidden auth ID");
        exit;
    }
    # store the registration and generate a SIP reply
    if (isflagset("NAT_FLAG")) {
        setbflag("NAT_BFLAG");
        setbflag("SIPPING_ENABLE");
        setbflag("SIPPING_RTO");
        fix_nated_register();
        xlog("avp(received)=================$avp(received)\n");
    }
    #if (!save("location", "c1f"))
    if (!save("location"))
        xlog("failed to register AoR $tu\n");
    #xlog("SIP contact ct:[$ct] [$tu] ci:[$ci] did not regist on, then check registe status for tU:[$tU].")     ;
    exit;
}
if ($rU==NULL) {
    # request with no Username in RURI
    send_reply(484,"Address Incomplete");
    exit;
}

# do lookup with method filtering
xlog("rd,fd========================$fd,$rd\n");
if (!lookup("location","m") && !is_from_local()) {
    if (!db_does_uri_exist("$ru","subscriber")) {
        send_reply(420,"Bad Extension");
        exit;
    }

    t_reply(404, "Not Found");
    exit;
}

# when routing via usrloc, log the missed calls also
do_accounting("log","missed");
t_on_failure("GW_FAILOVER");
route(relay);

}

route[relay] {

for INVITEs enable some additional helper routes

if (is_method("INVITE")) {
    # the contact might be replace by the vpn ip:192.168.xxx.xxx if contact is public ip:port
    # so comment below code snippets
    # TODO: 后期如果用rtpengine_offer()代替fix_nated_sdp()的话,需要添加isbflagset("NAT_BFLAG")判断
    if (isflagset("NAT_FLAG")) {
        if (has_body("application/sdp")) {
            fix_nated_sdp(10,,);
            xlog("route[relay]+nat_flag=======================\n");
        }
        add_rr_param(";nat=yes");
    }
    #append_branch("sip:1001@192.168.101.234:5061;transport=udp");
    t_on_branch("per_branch_ops");
    t_on_reply("handle_nat");
    t_on_failure("missed_call");

    #检查呼叫方向
    xlog("ru, si, sp==================$ru, $si, $sp\n");
    if ($rU =~"^[0-9]{4}$" || $rU=~"^18{5}[0-9]{5}1$" || $rU=~"^18{5}[0-9]{5}$"){
        xlog("这里呼出到分机.......\n");
        t_relay();
        exit;
    }
    else if (lb_is_destination("$si", $sp, 2)) {
        # outbound from fs to gw
        # TODO:这里需要根据具体的网关地址修改
        #sethostport("223.85.58.25:5066");
        if ($fU == "100") {
            $var(group_id) = 100;
        }
        else if ($fU == "110") {
            $var(group_id) = 110;
        }
        else if ($fU == "111") {
            $var(group_id) = 111;
        }
        else {  #a specific number is assigned
            $var(group_id) = 100;
        }
        if ($(fU{s.len}) <= 8) {
            if (!lb_start($var(group_id), "pstn")) {
                send_reply(500,"No Destination available");
                exit;
            }
            $var(from)=$(du{s.substr,4,13});
            xlog("du, var(from)======================$du, $var(from)\n");
            #uac_replace_from(,$du);
            replace($fU, $var(from));
            t_relay();
            exit;
        }
        else {
            loose_route();
            if (!lb_start($var(group_id), "pstn")) {
                send_reply(500,"No Destination available");
                exit;
            }
            t_relay();
            exit;
        }
    }
    else if (lb_is_destination("$si", $sp, 1)) {
        #inbound from gw to fs
        if (!lb_start_or_next(2, "pstn")) {
            send_reply(500,"No Destination available");
            exit;
        }

        # outbound from fs to gw
        # TODO:这里需要根据具体的网关地址修改
        #sethostport("223.85.58.25:5066");
        if ($(fU{s.substr, 0,3}) == "free") {
            xlog("du>>>>======================$du\n");
        }
        else {
            if (!lb_start_or_next(1, "pstn")) {
                send_reply(500,"No Destination available");
                exit;
            }
        }
    }
    else {
        sl_send_reply(403, "Forbidden address1111222");
        exit;
    }
    /*else {
        $var(fU)=$fU;
        /*$var(sub)=$(var(fU){s.substr,1,0});
        xlog("substr==================$var(sub)\n");

        $var(len)=$(var(fU){s.len});
        xlog("var(len)=============$var(len)\n");
        $var(int)=$(var(len){s.int});
        xlog("var(int)=================$var(int)\n");
        $var(sub)=$(var(fU){s.fill.left,"\",14});*/

        #replace 60108806 with real number get from gw attributes
        /*$var(1)=$(var(fU){s.substr,0,1});
        if ($var(1)=="+") {
            $var(sub)='\'+$var(fU);
        }
        xlog("var(sub)===============>>>>$var(sub)\n");*/

        /*$avp(dr_prefix)=$(fU{s.substr,1,0});
        xlog("avp(dr_prefix)=============$avp(dr_prefix)");
        $rU=$avp(dr_prefix)+$rU;
        do_routing(,,,,$var(gw_attributes));*/
        #replace($var(sub), $var(gw_attributes));
    }*/
    xlog("$C(xr) selected destination is: $du $C(xx) \n");

}
#TODO below snippet seems useless(never go here)
if (!t_relay()) {
    send_reply(500,"Internal Error");
}
exit;

}

branch_route[per_branch_ops] { xlog("-------branch=$T_branch_idx, branch flags=$bf\n"); if (isbflagset("NAT_BFLAG")) xlog("current branch is marked as natted\n"); xlog("new branch at $ru\n"); }

onreply_route[handle_nat] { $dlg_val(contact) = $hdr(Contact); /if (search("Contact: <sip:18888888886@192.168.101.49:[0-9]{5};transport=wss")) { $var(port)=$(ct.fields(uri){uri.port}); xlog("L_ERR", "ct of 200ok=================$var(port)\n"); replace("Contact: <sip:18888888886@192.168.101.49:[0-9]{5};transport=wss", "Contact: <sip:18888888886@192.168.101.49:$var(port);transport=ws"); }/ $dlg_val(contact)=$ct; xlog("dlg_val(contact)==================$dlg_val(contact)\n");

#在invite设置的nat_flag会传到onreply里, 不仅仅是transaction好像是dialog都可以?
if (isflagset("NAT_FLAG") || isbflagset("NAT_BFLAG")) {
    if (t_check_status("(183)||(200)") && has_body("application/sdp")) {
        fix_nated_contact();
        fix_nated_sdp(10,,);
        xlog("natted callee================================\n");
    }
}
#xlog("incoming reply\n");

}

failure_route[missed_call] { if (t_was_cancelled()) { exit; }

# uncomment the following lines if you want to block client
# redirect based on 3xx replies.
##if (t_check_status("3[0-9][0-9]")) {
##t_reply(404,"Not found");
##  exit;
##}

}

failure_route[GW_FAILOVER] { if (t_was_cancelled()) { exit; }

# failure detection with redirect to next available trunk
if (t_check_status("(408)|([56][0-9][0-9])")) {
    xlog("Failed trunk $rd/$du detected \n");
        if ( lb_next() ) {
            t_on_failure("GW_FAILOVER");
            t_relay();
            exit;
        }

        send_reply(500,"All GW are down");
}

} /*event_route[E_UL_AOR_INSERT] { xlog("first parameters is $param(aor)\n"); } event_route[E_UL_CONTACT_UPDATE] { xlog("first parameters is $param(aor)\n"); xlog("first parameters is $param(uri)\n"); xlog("first parameters is $param(received)\n"); xlog("first parameters is $param(path)\n"); xlog("first parameters is $param(qval)\n"); xlog("first parameters is $param(socket)\n"); xlog("first parameters is $param(bflags)\n"); xlog("first parameters is $param(expires)\n"); xlog("first parameters is $param(callid)\n");

}*/

bogdan-iancu commented 2 years ago

This seems the same crash as #2777 , because of the the invalid list of of ongoing pings from nathelper.

thrill007 commented 2 years ago

This seems the same crash as #2777 , because of the the invalid list of of ongoing pings from nathelper.

thank you for the reply, but It looks #2777 not fixed yet

bogdan-iancu commented 2 years ago

yes, still working on that

stale[bot] commented 2 years ago

Any updates here? No progress has been made in the last 15 days, marking as stale. Will close this issue if no further updates are made in the next 30 days.

thrill007 commented 2 years ago

thanks to bogdan-iancu, I disable nat ping as below and it works (the last statement):
if (nat_uac_test(18)) { fix_nated_register(); setbflag("NAT_BFLAG"); setbflag("SIPPING_ENABLE");

setbflag("SIPPING_RTO"); #TODO: this statement may cause crash, disabled!!

} no crash happens again, so far I got a work-around, the root cause is beyond I can find out, It looks I have to give up keep alive function

github-actions[bot] commented 2 years ago

Any updates here? No progress has been made in the last 15 days, marking as stale. Will close this issue if no further updates are made in the next 30 days.

github-actions[bot] commented 2 years ago

Marking as closed due to lack of progress for more than 30 days. If this issue is still relevant, please re-open it with additional details.