[sr-dev] [kamailio/kamailio] Possible bug with track_cseq_updates set in dialog (#789)

yasir ay yasiray at gmail.com
Fri Sep 30 09:07:43 CEST 2016


hai team,

version: kamailio 4.4.3 (x86_64/linux)
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS,
DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC,
Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX,
FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR,
USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16,
MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown

modules loaded in kam.cfg
### LOG Levels: 3=DBG, 2=INFO, 1=NOTICE, 0=WARN, -1=ERR
debug=3
log_stderror=no

memdbg=5
memlog=5

log_facility=LOG_LOCAL0

fork=yes
children=4

/* uncomment the next line to disable TCP (default on) */
#disable_tcp=yes

/* uncomment the next line to disable the auto discovery of local aliases
   based on reverse DNS on IPs (default on) */
#auto_aliases=no

/* add local domain aliases */
alias=ALIAS

/* uncomment and configure the following line if you want Kamailio to
   bind on a specific interface/port/proto (default bind on all available)
*/
mhomed=1
#listen=VTRAN:VIP:VPORT
#listen=tcp:CCEIP:CCEPORT



#/* port to listen to
# * - can be specified more than once if needed to listen on many ports */
#port=5060

#enable_tls=yes

# life time of TCP connection when there is no traffic
# - a bit higher than registration expires to cope with UA behind NAT
#tcp_connection_lifetime=3605

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

mpath="/usr/local/lib64/kamailio/modules/"

loadmodule "db_mysql.so"
loadmodule "ipops.so"
loadmodule "mi_fifo.so"
loadmodule "kex.so"
loadmodule "corex.so"
loadmodule "tm.so"
loadmodule "tmx.so"
loadmodule "sl.so"
loadmodule "rr.so"
loadmodule "pv.so"
loadmodule "maxfwd.so"
loadmodule "textops.so"
loadmodule "siputils.so"
loadmodule "xlog.so"
loadmodule "sanity.so"
loadmodule "ctl.so"
loadmodule "cfg_rpc.so"
loadmodule "mi_rpc.so"
*loadmodule "uac.so"*
loadmodule "rtpproxy.so"
loadmodule "dialog.so"

loadmodule "auth.so"
loadmodule "auth_db.so"
#loadmodule "tls.so"

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

modparam("dialog", "dlg_flag", 1)
modparam("dialog", "track_cseq_updates", 1)

# ----- uac params -----
*modparam("uac", "reg_db_url", "mysql://127.0.0.1/kamailio
<http://127.0.0.1/kamailio>")*

*modparam("uac","root","$avp(auser)")*
*modparam("uac","root","$avp(apass)")*
*modparam("uac","$null","$avp(arealm)")*

#modparam("uac", "reg_timer_interval", 60)
#modparam("uac", "reg_retry_interval", 60)
modparam("uac", "reg_db_table", "uacreg")
modparam("uac", "reg_contact_addr", "VIP:5060")

# ----- tm params -----
# auto-discard branches from previous serial forking leg
modparam("tm", "failure_reply_mode", 3)
# default retransmission timeout: 30sec
modparam("tm", "fr_timer", 30000)
# default invite retransmission timeout after 1xx: 120sec
modparam("tm", "fr_inv_timer", 120000)


# ----- rr params -----
# set next param to 1 to add value to ;lr param (helps with some UAs)
modparam("rr", "enable_full_lr", 0)
# do not append from tag to the RR (no need for this script)
modparam("rr", "append_fromtag", 1)


# ----- rtpproxy params -----
modparam("rtpproxy", "rtpproxy_sock", "udp:127.0.0.1:7722")


#!ifdef WITH_TLS
# ----- tls params -----
#modparam("tls", "config", "/etc/kamailio/tls.cfg")
#!endif

#!ifdef WITH_DEBUG
# ----- debugger params -----
modparam("debugger", "cfgtrace", 1)
modparam("debugger", "log_level_name", "exec")
#!endif

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

# Main SIP request routing logic
# - processing of any incoming SIP request starts with this route
# - note: this is the same as route { ... }
route {

        dlg_manage();
        t_on_failure("TRUNKAUTH");

        # chaeck for options
        if(uri==myself) {
                if ((method==OPTIONS) && (! uri=~"sip:.*[@]+.*")) {
                        options_reply();
                        exit();
                }

        }

        # per request initial checks
        route(REQINIT);

        # do media anchoring
        route(RTPPROXY);

        # handle requests within SIP dialogs
        route(WITHINDLG);

        ### only initial requests (no To tag)

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

        t_check_trans();

        # record routing for dialog forming requests (in case they are
routed)
        # - remove preloaded route headers
        remove_hf("Route");
        if (is_method("INVITE|SUBSCRIBE"))
                record_route();

        # handle registrations
        route(REGISTRAR);

        if ($rU==$null)
        {
                # request with no Username in RURI
                sl_send_reply("484","Address Incomplete");
                exit;
        }

        # dispatch destinations
        route(DISPATCH);

}

failure_route[TRUNKAUTH] {

    if (t_is_canceled()) {
        exit;
    }
    if(t_check_status("401|407")) {
        $avp(arealm) = "AUTH_REALM";
        $avp(auser) = "AUTH_USER";
        $avp(apass) = "AUTH_PASS";
        if (uac_auth()) {
                xlog("L_INFO", "CSeq diff: $dlg_var(cseq_diff)");
                t_relay();
        } else {
                xlog("L_INFO", "UAC_AUTH(): credentials not found");
        }
        exit;
    }
}

# Per SIP request initial checks
route[REQINIT] {
        if (!mf_process_maxfwd_header("10")) {
                sl_send_reply("483","Too Many Hops");
                exit;
        }

        if(!sanity_check("1511", "7"))
        {
                xlog("Malformed SIP message from $si:$sp\n");
                exit;
        }
}

# Handle requests within SIP dialogs
route[WITHINDLG] {
        if (has_totag()) {
                # sequential request withing a dialog should
                # take the path determined by record-routing
                if (loose_route()) {
                        if (is_method("BYE")) {
                                setflag(1); # do accounting ...
                                setflag(3); # ... even if the transaction
fails
                        }
                        if(is_method("PRACK")) {
                                $var(rack_sequ) = $(hdr(Rack){s.select,0, }{
s.int});
                                $var(rack_meth) = $(hdr(Rack){s.select,2,
});
                                $var(new_rack_cseq) =
$(hdr(Rack){s.select,1, }{s.int}) + $(dlg_var(cseq_diff){s.int});
                                remove_hf("RAck");
                                insert_hf("RAck: $var(rack_sequ)
$var(new_rack_cseq) $var(rack_meth)\r\n");
                        }
                        route(DISPATCH);
                } else {
                        if (is_method("SUBSCRIBE") && uri == myself) {
                                # in-dialog subscribe requests
                                exit;
                        }
                        if ( is_method("ACK") ) {
                                if ( t_check_trans() ) {
                                        # non loose-route, but stateful ACK;
                                        # must be ACK after a 487 or e.g.
404 from upstream server
                                        t_relay();
                                        exit;
                                } else {
                                        # ACK without matching transaction
... ignore and discard.
                                        exit;
                                }
                        }
                        sl_send_reply("404","Not here");
                }
                exit;
        }
}

# Handle SIP registrations
route[REGISTRAR] {
        if(!is_method("REGISTER"))
                return;
        sl_send_reply("404", "No registrar");
        exit;
}

# Dispatch requests
route[DISPATCH] {

        if(dst_ip == VIP ) {
                $rd = "MEDIATION_FQDN";
                $rp = "MEDIATION_PORT";
                $td = $rd;
                if(!t_relay_to_tcp()) {
                        sl_reply_error();
                }
        }
        else
        {
                $rd = "TRUNK_DOMAIN";
                $td = $rd;
                $du = "sip:SBC_SRV";
                remove_hf("Privacy");
                remove_hf("P-Asserted-Identity");

subst('/^From:(.*)sip:([^@]*)@([a-zA-Z0-9.]+?)(.*)$/From:\1sip:\2@
\3;otg=TRUNK_OTG\4/ig');
                if (!t_relay()) {
                        sl_reply_error();
                }

        }
        exit;

}

# RTPProxy control
route[RTPPROXY] {

        if (is_method("INVITE")){
                        if(dst_ip == VIP ) {
                                rtpproxy_manage("rwei");
                        }
                        else
                        {
                                rtpproxy_manage("rwie");
                        }
        }

        return;
}

onreply_route {

    if (af==INET)
    {
        rtpproxy_manage("cwei");
    }

    return(1);
}




Sep 30 03:01:25 divox kamailio[2734]: 0(2743) : <core> [cfg.y:3371]:
yyerror_at(): parse error in config file
/usr/local/kamailio-4.4/etc/kamailio/kamailio.cfg, line 189, column 32:
unknown command, missing loadmodule?
Sep 30 03:01:25 divox kamailio[2734]: 0(2743) ERROR: <core> [pvapi.c:828]:
pv_parse_spec2(): error searching pvar "avp"
Sep 30 03:01:25 divox kamailio[2734]: 0(2743) ERROR: <core> [pvapi.c:1032]:
pv_parse_spec2(): wrong char [a/97] in [$avp(arealm)] at [5 (5)]
Sep 30 03:01:25 divox kamailio[2734]: 0(2743) : <core> [cfg.y:3368]:
yyerror_at(): parse error in config file
/usr/local/kamailio-4.4/etc/kamailio/kamailio.cfg, line 190, column 9-20:
Can't get from cache: $avp(arealm)
Sep 30 03:01:25 divox kamailio[2734]: ERROR: bad config file (51 errors)
Sep 30 03:01:25 divox kamailio[2734]: 0(2743) DEBUG: <core> [ppcfg.c:224]:
pp_ifdef_level_check(): same number of pairing preprocessor directives
#!IF[N]DEF - #!ENDIF
Sep 30 03:01:25 divox kamailio[2734]: 0(2743) INFO: <core>
[sctp_core.c:53]: sctp_core_destroy(): SCTP API not initialized
Sep 30 03:01:25 divox kamailio[2734]: 0(2743) DEBUG: <core>
[mem/shm.c:174]: shm_core_lock_destroy(): destroying the shared memory lock
Sep 30 03:01:25 divox kamailio[2734]: 0(2743) DEBUG: <core>
[mem/shm.c:266]: shm_destroy_manager(): destroying memory manager: f_malloc
Sep 30 03:01:25 divox kamailio[2734]: 0(2743) DEBUG: <core> [mem/pkg.c:89]:
pkg_destroy_manager(): destroying memory manager: f_malloc



On Thu, Sep 29, 2016 at 7:18 PM, scfcplummy <notifications at github.com>
wrote:

> kam.cfg.txt
> <https://github.com/kamailio/kamailio/files/500785/kam.cfg.txt>
>
> Thats my full config with the !#defines and !#subst taken out.
>
>> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <https://github.com/kamailio/kamailio/issues/789#issuecomment-250470775>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AF36ZVgagM4XZOtscypxADCX3R6sbtb_ks5qu8GhgaJpZM4KBSky>
> .
>
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20160930/ed71d613/attachment-0001.html>


More information about the sr-dev mailing list