Hi all!

To follow-up on this issue, I created sample config file which is killing
Kamailio. :)

Please find in attachment kamailio config and dispatcher config file.

To crash kamailio dispatcher list file should contain at least 2 records
and all destinations(It looks like it is enough even if 1 destination are
unavaillable) should not be available. I tested with dispatcher list in DB
and same result.

If we remove attribute bla, from dispatcher list then kamailio is not
crashing:

1 sip:192.168.5.233:5060;transport=udp 2 0
1 sip:192.168.5.232:5060;transport=udp 2 0


I believe this is rare case, but I think it is a bug. :)

Please help. :)

Thank you!

With kind regards,

Jurijs



2015-12-17 12:25 GMT+02:00 Jurijs Ivolga <jurij....@gmail.com>:

> Hi,
>
> Just quick question, before sending some more debug info.
>
> I just figured out that issue is related to dispatcher list, I'm using
> text file. Following dispatcher list do not work:
>
> 1 sip:1.1.1.1;transport=udp 0 0 bla
> 1 sip:2.2.2.2;transport=udp 0 0 blabla
>
> But if I use below one, it works without any issue:
>
> 1 sip:1.1.1.1;transport=udp 0 0
> 1 sip:2.2.2.2;transport=udp 0 0
>
> Maybe my attributes are incorrect?
>
> With kind regards,
>
> Jurijs
>
>
>
> 2015-12-17 10:45 GMT+02:00 Daniel-Constantin Mierla <mico...@gmail.com>:
>
>> Hello,
>>
>> reproduce the case with 'ulimit -c unlimited' executed in the terminal
>> before starting kamailio. You should get a corefile and then get the output
>> of 'bt full' in the gdb (gdb /path/to/kamailio /path/to/corefile). Send the
>> output here to investigate it.
>>
>> Cheers,
>> Daniel
>>
>> On 17/12/15 09:41, Jurijs Ivolga wrote:
>>
>> Hi,
>>
>> I have weird behavior, when I'm trying to compare AVP with string:
>>
>> if ($avp(AVP_ATTRS) != "bla") {
>>                 ds_next_dst();
>>         }
>>
>> $avp(AVP_ATTRS) contains Dispatcher attribute.
>>
>> Kamailio crashes:
>>
>> Dec 17 03:39:30 /usr/local/sbin/kamailio[4844]: CRITICAL: <core>
>> [pass_fd.c:275]: receive_fd(): EOF on 15
>> Dec 17 03:39:30 /usr/local/sbin/kamailio[4810]: ALERT: <core>
>> [main.c:728]: handle_sigs(): child process 4816 exited by a signal 11
>> Dec 17 03:39:30 /usr/local/sbin/kamailio[4810]: ALERT: <core>
>> [main.c:731]: handle_sigs(): core was not generated
>> Dec 17 03:39:30 /usr/local/sbin/kamailio[4810]: INFO: <core>
>> [main.c:743]: handle_sigs(): terminating due to SIGCHLD
>> Dec 17 03:39:30 /usr/local/sbin/kamailio[4843]: INFO: <core>
>> [main.c:798]: sig_usr(): signal 15 received
>> Dec 17 03:39:30 /usr/local/sbin/kamailio[4842]: INFO: <core>
>> [main.c:798]: sig_usr(): signal 15 received
>> Dec 17 03:39:30 /usr/local/sbin/kamailio[4841]: INFO: <core>
>> [main.c:798]: sig_usr(): signal 15 received
>> Dec 17 03:39:30 /usr/local/sbin/kamailio[4840]: INFO: <core>
>> [main.c:798]: sig_usr(): signal 15 received
>> Dec 17 03:39:30 /usr/local/sbin/kamailio[4839]: INFO: <core>
>> [main.c:798]: sig_usr(): signal 15 received
>> Dec 17 03:39:30 /usr/local/sbin/kamailio[4838]: INFO: <core>
>> [main.c:798]: sig_usr(): signal 15 received
>> Dec 17 03:39:30 /usr/local/sbin/kamailio[4837]: INFO: <core>
>> [main.c:798]: sig_usr(): signal 15 received
>> Dec 17 03:39:30 /usr/local/sbin/kamailio[4836]: INFO: <core>
>> [main.c:798]: sig_usr(): signal 15 received
>> Dec 17 03:39:30 /usr/local/sbin/kamailio[4835]: INFO: <core>
>> [main.c:798]: sig_usr(): signal 15 received
>> Dec 17 03:39:30 /usr/local/sbin/kamailio[4834]: INFO: <core>
>> [main.c:798]: sig_usr(): signal 15 received
>> Dec 17 03:39:30 /usr/local/sbin/kamailio[4829]: INFO: <core>
>> [main.c:798]: sig_usr(): signal 15 received
>> Dec 17 03:39:30 /usr/local/sbin/kamailio[4814]: INFO: <core>
>> [main.c:798]: sig_usr(): signal 15 received
>> Dec 17 03:39:30 /usr/local/sbin/kamailio[4815]: INFO: <core>
>> [main.c:798]: sig_usr(): signal 15 received
>> Dec 17 03:39:30 /usr/local/sbin/kamailio[4823]: INFO: <core>
>> [main.c:798]: sig_usr(): signal 15 received
>> Dec 17 03:39:30 /usr/local/sbin/kamailio[4813]: INFO: <core>
>> [main.c:798]: sig_usr(): signal 15 received
>> Dec 17 03:39:30 /usr/local/sbin/kamailio[4821]: INFO: <core>
>> [main.c:798]: sig_usr(): signal 15 received
>> Dec 17 03:39:30 /usr/local/sbin/kamailio[4812]: INFO: <core>
>> [main.c:798]: sig_usr(): signal 15 received
>> Dec 17 03:39:30 /usr/local/sbin/kamailio[4818]: INFO: <core>
>> [main.c:798]: sig_usr(): signal 15 received
>> Dec 17 03:39:30 /usr/local/sbin/kamailio[4825]: INFO: <core>
>> [main.c:798]: sig_usr(): signal 15 received
>> Dec 17 03:39:30 /usr/local/sbin/kamailio[4819]: INFO: <core>
>> [main.c:798]: sig_usr(): signal 15 received
>> Dec 17 03:39:30 /usr/local/sbin/kamailio[4822]: INFO: <core>
>> [main.c:798]: sig_usr(): signal 15 received
>> Dec 17 03:39:30 /usr/local/sbin/kamailio[4844]: INFO: <core>
>> [main.c:798]: sig_usr(): signal 15 received
>> Dec 17 03:39:30 /usr/local/sbin/kamailio[4830]: INFO: <core>
>> [main.c:798]: sig_usr(): signal 15 received
>>
>> Following code works fine:
>>
>> if ($avp(AVP_ATTRS) == "bla") {
>>                 ds_next_dst();
>>         }
>>
>> Kamailio version:
>>
>> version: kamailio 4.3.4 (x86_64/linux) a56227
>> 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,
>> DBG_QM_MALLOC, 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: a56227
>> compiled on 03:29:23 Dec 17 2015 with gcc 4.4.7
>>
>> Thak you!
>>
>> With kind regards,
>>
>> Jurijs
>>
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing 
>> listsr-us...@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>
>>
>> --
>> Daniel-Constantin Mierlahttp://twitter.com/#!/miconda - 
>> http://www.linkedin.com/in/miconda
>> Book: SIP Routing With Kamailio - http://www.asipto.comhttp://miconda.eu
>>
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>> sr-users@lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>
>>
>
1 sip:192.168.5.233:5060;transport=udp 2 0 bla
1 sip:192.168.5.232:5060;transport=udp 2 0 bla
#!KAMAILIO
#
# sample config file for dispatcher module
# - load balancing of VoIP calls with round robin
# - no TPC listening
# - don't dispatch REGISTER and presence requests
#
# Kamailio (OpenSER) SIP Server v3.2
#     - web: http://www.kamailio.org
#     - git: http://sip-router.org
#
# Direct your questions about this file to: sr-users@lists.sip-router.org
#
# Refer to the Core CookBook at http://www.kamailio.org/dokuwiki/doku.php
# for an explanation of possible statements, functions and parameters.
#
# Several features can be enabled using '#!define WITH_FEATURE' directives:
#
# *** To run in debug mode: 
#     - define WITH_DEBUG
#

#!ifndef DBURL
#!define DBURL "mysql://kamailio:kamailiorw@localhost/kamailio"
#!endif

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

#!ifdef WITH_DEBUG
debug=4
log_stderror=yes
#!else
debug=2
log_stderror=no
#!endif

#!define FLT_FS 10


memdbg=5
memlog=5

log_facility=LOG_LOCAL0

fork=yes
children=4

/* comment the next line to enable TCP */
disable_tcp=yes

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

/* add local domain aliases */
# alias="mysipserver.com"

port=5060

/* uncomment and configure the following line if you want Kamailio to 
   bind on a specific interface/port/proto (default bind on all available) */
# listen=udp:127.0.0.1:5060

sip_warning=no

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

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

loadmodule "db_mysql.so"
loadmodule "mi_fifo.so"
loadmodule "kex.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 "mi_rpc.so"
loadmodule "acc.so"
loadmodule "path.so"
loadmodule "dispatcher.so"

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


# ----- mi_fifo params -----
modparam("mi_fifo", "fifo_name", "/var/run/kamailio/kamailio_fifo")

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


# ----- acc params -----
modparam("acc", "log_flag", 1)
modparam("acc", "failed_transaction_flag", 3)
modparam("acc", "log_extra", 
        
"src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd;src_ip=$si")

# ----- tm params -----
modparam("tm", "fr_timer", 2000)
modparam("tm", "fr_inv_timer", 40000)

# ----- dispatcher params -----
#modparam("dispatcher", "db_url", DBURL)
#modparam("dispatcher", "table_name", "dispatcher")
modparam("dispatcher", "list_file", "/usr/local/etc/kamailio/dispatcher.lst")
modparam("dispatcher", "flags", 2)
modparam("dispatcher", "dst_avp", "$avp(AVP_DST)")
modparam("dispatcher", "grp_avp", "$avp(AVP_GRP)")
modparam("dispatcher", "cnt_avp", "$avp(AVP_CNT)")
modparam("dispatcher", "sock_avp", "$avp(dssocket)")
modparam("dispatcher", "attrs_avp", "$avp(dsattrs)")

modparam("path", "use_received", 1)

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


# main request routing logic

route {

        # per request initial checks
        route(REQINIT);

        if(ds_is_from_list())
        {
        setflag(FLT_FS);
        }

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


        if (isflagset(FLT_FS)) {
                route(FROM_FS);
                exit;
        }


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

        # account only INVITEs
        if (is_method("INVITE"))
        {
                setflag(1); # do accounting
        }

        # handle presence related requests
        route(PRESENCE);

        # handle registrations
        route(REGISTRAR);

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

        # dispatch destinations
        route(DISPATCH);
}


route[FROM_FS]
{
        record_route();
        route(RELAY);
        exit;
}



route[RELAY] {
        if (!t_relay()) {
                sl_reply_error();
        }
        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
                        }
                        route(RELAY);
                } else {
                        if (is_method("SUBSCRIBE") && uri == myself) {
                                # in-dialog subscribe requests
                                route(PRESENCE);
                                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;
        add_path_received();
        route(DISPATCH);
}

# Presence server route
route[PRESENCE] {
        if(!is_method("PUBLISH|SUBSCRIBE"))
                return;

        sl_send_reply("404", "Not here");
        exit;
}

# Dispatch requests
route[DISPATCH] {
        # round robin dispatching on gateways group '1'
        if(!ds_select_dst("1", "2"))
        {
                send_reply("404", "No destination");
                exit;
        }

xlog("L_NOTICE", "     ===> All dispatcher destinations $(avp(AVP_DST)[*]), 
amount of dispatchers $cnt($avp(AVP_DST))\n");
xlog("L_NOTICE", "     ===> Attribute $avp(dsattrs)\n");

        xlog("L_DBG", "--- SCRIPT: going to <$ru> via <$du>\n");
        t_on_failure("RTF_DISPATCH");
        route(RELAY);
        exit;
}

# Sample failure route
failure_route[RTF_DISPATCH] {
        if (t_is_canceled()) {
                exit;
        }
        # next DST - only for 500 or local timeout
        if (t_check_status("500")
                        or (t_branch_timeout() and !t_branch_replied()))
        {
                if(ds_next_dst())
                {
                        t_on_failure("RTF_DISPATCH");
                        route(RELAY);
                        exit;
                }
        }
}
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to