首页 文章

force_rtp_proxy_body:来自rtpproxy的回复中的端口0不正确

提问于
浏览
1

我能够连接opensips和rtpproxy服务器 . 我可以在没有rtpproxy的情况下调用/我为rtpproxy和opensip连接配置opensip.cfg文件,但是当我拨打任何号码时我收到错误 .

Apr 12 19:15:46 jpc /usr/local/sbin/opensips[8099]: ERROR:rtpproxy:force_rtp_proxy: Unable to parse body
Apr 12 19:15:46 jpc rtpproxy[8076]: DBUG:handle_command: received command "8097_5 Lc0,8,101 EmT25eujw9 66.109.20.153 17242 zTZujAf~s;1 as232a3dd2;1"
Apr 12 19:15:46 jpc rtpproxy[8076]: INFO:handle_command: lookup request failed: session EmT25eujw9, tags zTZujAf~s;1/as232a3dd2;1 not found
Apr 12 19:15:46 jpc rtpproxy[8076]: DBUG:doreply: sending reply "8097_5 0 27.113.254.248#012"
Apr 12 19:15:46 jpc /usr/local/sbin/opensips[8097]: ERROR:rtpproxy:force_rtp_proxy_body: incorrect port 0 in reply from rtp proxy
Apr 12 19:15:46 jpc /usr/local/sbin/opensips[8099]: ERROR:rtpproxy:force_rtp_proxy: Unable to parse body
Apr 12 19:15:46 jpc /usr/local/sbin/opensips[8097]: ERROR:rtpproxy:force_rtp_proxy: Unable to parse body
Apr 12 19:16:02 jpc /usr/local/sbin/opensips[8096]: ERROR:rtpproxy:force_rtp_proxy: Unable to parse body
Apr 12 19:16:07 jpc rtpproxy[8076]: DBUG:handle_command: received command "8097_6 D EmT25eujw9 as232a3dd2 zTZujAf~s"
Apr 12 19:16:07 jpc rtpproxy[8076]: INFO:handle_command: delete request failed: session EmT25eujw9, tags as232a3dd2/zTZujAf~s not found
Apr 12 19:16:07 jpc rtpproxy[8076]: DBUG:doreply: sending reply "8097_6 E8#012"
Apr 12 19:16:07 jpc /usr/local/sbin/opensips[8100]: ERROR:rtpproxy:force_rtp_proxy: Unable to parse body

请帮忙 . 我该如何解决这个错误?

我的opensips.cfg文件如下:

#
# $Id: opensips.cfg 9742 2013-02-05 10:24:48Z vladut-paiu $
#
# OpenSIPS residential configuration script
#     by OpenSIPS Solutions <team@opensips-solutions.com>
#
# This script was generated via "make menuconfig", from
#   the "Residential" scenario.
# You can enable / disable more features / functionalities by
#   re-generating the scenario with different options.#
#
# Please refer to the Core CookBook at:
#      http://www.opensips.org/Resources/DocsCookbooks
# for a explanation of possible statements, functions and parameters.
#


####### Global Parameters #########

debug=3
log_stderror=no
log_facility=LOG_LOCAL0

fork=yes
children=4

/* uncomment the following lines to enable debugging */
#debug=6
#fork=no
#log_stderror=yes

/* 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

/* comment the next line to enable the auto discovery of local aliases
   based on revers DNS on IPs */
auto_aliases=yes


#listen=udp:127.0.0.1:5060   # CUSTOMIZE ME

listen=udp:192.168.1.28:5080

disable_tcp=yes
listen=tcp:192.168.1.28:5080

disable_tls = yes
listen = tls:192.168.1.28:5081
tls_verify_server = 1
tls_verify_client = 1
tls_require_client_certificate = 0
tls_method = TLSv1
tls_certificate = "/usr/local/etc/opensips/tls/server/server-cert.pem"
tls_private_key = "/usr/local/etc/opensips/tls/server/server-privkey.pem"
tls_ca_list = "/usr/local/etc/opensips/tls/server/server-calist.pem"


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


#set module path
mpath="/usr/local/lib64/opensips/modules/"

#### Auth db module


loadmodule "db_mysql.so"



loadmodule "auth_db.so"

loadmodule "auth.so"

modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")
modparam("auth_db", "use_domain", 1)
modparam("auth_db", "db_url", "mysql://root:admin@localhost/opensips")

# !! Nathelper 
loadmodule "nathelper.so" 
#loadmodule "nat_traversal.so" 
loadmodule "rtpproxy.so" 
loadmodule "textops.so"
# ----------------- setting module-specific parameters --------------- 

modparam("rtpproxy", "rtpproxy_sock", "udp:localhost:7890") 

# !! Nathelper 

modparam("nathelper","sipping_bflag",8) 
modparam("nathelper", "ping_nated_only", 1)   # Ping only clients behind NAT 

#### SIGNALING module
loadmodule "signaling.so"

#### StateLess module
loadmodule "sl.so"

#### Transaction Module
loadmodule "tm.so"
modparam("tm", "fr_timer", 5)
modparam("tm", "fr_inv_timer", 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)

#### 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)

#### USeR LOCation module
loadmodule "usrloc.so"
modparam("usrloc","nat_bflag",6) 
modparam("usrloc", "db_mode",   0)

#### REGISTRAR module
loadmodule "registrar.so"
modparam("registrar", "tcp_persistent_flag", "TCP_PERSISTENT")

/* uncomment the next line not to allow more than 10 contacts per AOR */
#modparam("registrar", "max_contacts", 10)
modparam("registrar","received_avp", "$avp(42)")
modparam("nathelper","received_avp", "$avp(42)")
mhomed=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 the enable "append_fromtag"
   in "rr" module */
modparam("acc", "detect_direction", 0)
modparam("acc", "failed_transaction_flag", "ACC_FAILED")
/* account triggers (flags) */
modparam("acc", "log_flag", "ACC_DO")
modparam("acc", "log_missed_flag", "ACC_MISSED")


####### Routing Logic ########

# main routing logic


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

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

    # -----------------------------------------------------------------
    # Loose Route Section nat_uac_test("3")
    # -----------------------------------------------------------------
    if (loose_route()) 
    {
        if ((method=="INVITE" || method=="REFER") && !has_totag()) 
        {
            sl_send_reply("403", "Forbidden");
            exit;
        };
        if (method=="INVITE") 
        {
            if (nat_uac_test("19")) 
            {
                #setflag(6);
                setbflag(6);
                setbflag(8);
                force_rport();
                fix_nated_contact();
            };

               rtpproxy_answer();
        };

        route(1);
        exit;
    };

    # -----------------------------------------------------------------
    # Call Type Processing Section
    # -----------------------------------------------------------------
    if (uri!=myself) 
    {
        route(4);
        route(1);
        exit;
    };

    if (method=="ACK") 
    {
        route(1);
        exit;
    } 
    if (method=="CANCEL") 
    {
        route(1);
        exit;
    } 
    else if (method=="INVITE") 
    {
        route(3);
        exit;
    } 
    else if (method=="REGISTER") 
    {
        route(2);
        exit;
    };
    lookup("aliases");
    if (uri!=myself) 
    {
        route(4);
        route(1);
        exit;
    };
    if (!lookup("location")) 
    {
        sl_send_reply("404", "User Not Found");
        exit;
    };

    route(1);
}


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



         # if client or server know to be behind a NAT, enable relay
        if (isflagset(6) || isflagset(7)) {
                force_rport();
                fix_nated_contact();
                rtpproxy_answer();
        };

    t_on_reply("1");

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

route[2] 
{
    # -----------------------------------------------------------------
    # REGISTER Message Handler
    # ----------------------------------------------------------------

    xlog("route[2]  REGISTER Message Handler \n");

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

    sl_send_reply("100", "Trying");

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

route[3] 
{
    # -----------------------------------------------------------------
    # INVITE Message Handler
    # -----------------------------------------------------------------
    #if (nat_uac_test("19")) 
    #{
    #   setflag(6);
    #}
    xlog("route[3]  INVITE Message Handler \n");
    #linha incluida por mim para fazer com que todo INVITE utilize o rtpproxy
        #setflag(6);
    setbflag(6);
    setbflag(8);

    lookup("aliases");

    if (uri!=myself) 
    {
        route(4);
        route(1);
        exit;
    };

    if (!lookup("location")) 
    {
        sl_send_reply("404", "User Not Found");
        exit;
    };
    route(4);
    route(1);
}

route[4]
{
    # -----------------------------------------------------------------
    # NAT Traversal Section
    # -----------------------------------------------------------------
    if (isbflagset(6)) 
    {
        force_rport();
        fix_nated_contact();
        rtpproxy_answer(); 
    }
}

onreply_route[1] 
{

    #rtpproxy_answer(); 
    force_rport();
    fix_nated_contact();
    rtpproxy_answer(); 
    #rtpproxy_offer();

    if (isbflagset(6) && status=~"(180)|(183)|2[0-9][0-9]") 
    {
        xlog("onreply_route[1]  if1 \n");
        if (!search("^Content-Length:[ ]*0")) 
        {
             rtpproxy_answer(); 
        };
    };
    if (nat_uac_test("1")) 
    {
            xlog("onreply_route[1]  if2 \n");
        fix_nated_contact();
    };
}




#================================================================================= 
/*
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");
        exit;
    };
    if (msg:len >=  2048 ) {
        sl_send_reply("513", "Message too big");
        exit;
    };

    # !! Nathelper
    # Special handling for NATed clients; first, NAT test is
    # executed: it looks for via!=received and RFC1918 addresses
    # in Contact (may fail if line-folding is used); also,
    # the received test should, if completed, should check all
    # vias for rpesence of received
    if (nat_uac_test("3")) {
        # Allow RR-ed requests, as these may indicate that
        # a NAT-enabled proxy takes care of it; unless it is
        # a REGISTER

        if (is_method("REGISTER") || !is_present_hf("Record-Route")) {
            log("LOG: Someone trying to register from private IP, rewriting\n");

            # This will work only for user agents that support symmetric
            # communication. We tested quite many of them and majority is
            # smart enough to be symmetric. In some phones it takes a configuration
            # option. With Cisco 7960, it is called NAT_Enable=Yes, with kphone it is
            # called "symmetric media" and "symmetric signalling".

            fix_nated_contact(); # Rewrite contact with source IP of signalling
            if ( is_method("INVITE") ) {
                fix_nated_sdp("1"); # Add direction=active to SDP
            };
            force_rport(); # Add rport parameter to topmost Via
            setbflag(6);    # Mark as NATed

            # if you want sip nat pinging
            # setbflag(8);
        };
    };

    # 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 (!is_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);
        exit;
    };

    if (!uri==myself) {
        # mark routing logic in request
        append_hf("P-hint: outbound\r\n"); 
        route(1);
        exit;
    };

    # 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=="REGISTER") {

# Uncomment this if you want to use digest authentication
#           if (!www_authorize("siphub.org", "subscriber")) {
#               www_challenge("siphub.org", "0");
#               return;
#           };

            save("location");
            exit;
        };

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

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

route[1] 
{
    # !! Nathelper
    if (uri=~"[@:](192\.168\.|10\.|172\.(1[6-9]|2[0-9]|3[0-1])\.)" && !search("^Route:")){
        sl_send_reply("479", "We don't forward to private IP addresses");
        exit;
    };

    # if client or server know to be behind a NAT, enable relay
    if (isbflagset(6)) {
        force_rtp_proxy();
    };

    # NAT processing of replies; apply to all transactions (for example,
    # re-INVITEs from public to private UA are hard to identify as
    # NATed at the moment of request processing); look at replies
    t_on_reply("1");

    # send it out now; use stateful forwarding as it works reliably
    # even for UDP2TCP
    if (!t_relay()) {
        sl_reply_error();
    };
}

# !! Nathelper
onreply_route[1] {
    # NATed transaction ?
    if (isbflagset(6) && status =~ "(183)|2[0-9][0-9]") {
        fix_nated_contact();
        force_rtp_proxy();
    # otherwise, is it a transaction behind a NAT and we did not
    # know at time of request processing ? (RFC1918 contacts)
    } else if (nat_uac_test("1")) {
        fix_nated_contact();
    };
}

*/

1 回答

  • 0

    你需要转储包,结果错误“无法解析身体”

    很可能是没有任何rtp数据的数据包 .

    SHOULD NOT 对此类数据包使用rtpproxy_offer / rtpproxy_answer .

相关问题