Giter VIP home page Giter VIP logo

kamailio / kamailio Goto Github PK

View Code? Open in Web Editor NEW
2.1K 171.0 903.0 106.14 MB

Kamailio - The Open Source SIP Server for large VoIP and real-time communication platforms -

Home Page: https://www.kamailio.org

License: Other

C 93.20% Shell 1.55% Makefile 1.05% PHP 0.04% C++ 2.43% Java 0.07% C# 0.01% Perl 0.23% XS 0.10% Python 0.48% Awk 0.01% Lex 0.24% Yacc 0.42% M4 0.06% GDB 0.01% HTML 0.01% Lua 0.03% JavaScript 0.03% Roff 0.04% Ragel 0.01%
kamailio sip voip webrtc volte iot telephony

kamailio's Introduction

Kamailio - The Open Source SIP Server

Build Status Code Triage Badge pre-commit

Project Website:

20 Years Of Kamailio Development: Sep 3, 2001 - Sep 3, 2021

Overview

Kamailio is an open source implementation of a SIP Signaling Server. SIP is an open standard protocol specified by the IETF. The core specification document is RFC3261.

The Kamailio SIP server is designed for scalability, targeting large deployments (e.g. for IP telephony operators or carriers, which have a large subscriber base or route a big volume of calls), but can be also used in enterprises or for personal needs to provide VoIP, Instant Messaging and Presence. Kamailio is well known for its flexibility, robustness, strong security and the extensive number of features - for more information, please see:

Kamailio development was started back in 2001 by Fraunhofer Fokus, a research institute in Berlin, Germany. At that time the project name was SIP Express Router (aka SER). In 2005, a fork named OpenSER was created, which was renamed to Kamailio in July 2008 due to trademark issues. Starting in the autumn of 2008, Kamailio and SER initiated the process to merge the two projects. After the merge was complete, Kamailio became the main name of the project, being better protected in terms of trademarks.

Fraunhofer Fokus is no longer actively involved in the evolution of the project. Kamailio is now developed and managed by its world wide community. Fokus still uses Kamailio in its research projects (such as OpenIMSCore) and it is hosting events related to the project, such as developer meetings or the Kamailio World Conference.

For more information about Kamailio, see the website of the project, where you can find pointers to documentation, the project wiki and much more.

Contributions

Github pull requests are the recommended way to contribute to Kamailio source code or documentation:

To keep a coherent and consistent history of the development, the commit messages format and content must follow the rules detailed at:

Contributions must conform with licensing rules of the Kamailio project.

License

Main License: GPLv2.

Each source code file refers to the license and copyright details in the top of the file. Most of the code is licensed under GPLv2, some parts of the code are licensed under BSD.

License Of New Code Contributions

New contributions to the core and several main modules (auth, corex, sl, tls, tm) have to be done under the BSD license. New contributions under the GPL must grant the GPL-OpenSSL linking exception. Contributions to existing components released under BSD must be done under BSD as well.

Documentation

The main index for documentation is available at:

The online documentation for modules in the latest stable branch:

The wiki collects a consistent number of tutorials, the indexes for variables, functions and parameters:

Please read the README file in the source code, one per module.

Installation

Step by step tutorials to install Kamailio from source code are available at:

Please read the INSTALL file from the source code for more information.

Repositories for Linux packages:

Issues And Bug Reports

To report a bug or make a request for new features, use the Issues Page in the Kamailio Github project:

Open Support And Community Discussions

Mailing Lists

Mailing list for discussions regarding stable versions of Kamailio:

Mailing list for discussions regarding the development of Kamailio and the state of master (devel) branch:

Mailing list for discussions with commercial purpose:

For more information about the mailing lists, please see:

Matrix Channel

An open Matrix discussion channel is managed by the community:

Useful Resources

News:

Thank you for flying Kamailio!

kamailio's People

Contributors

adubovikov avatar anomarme avatar btriller avatar camilleoudot avatar carstenbock avatar charlesrchance avatar danpascu avatar dilyanpalauzov avatar ffloimair avatar gaaf avatar grumvalski avatar henningw avatar janakj avatar jaybeepee avatar jchavanton avatar jiriatipteldotorg avatar juha-h avatar kamailio-dev avatar lazedo avatar linuxmaniac avatar miconda avatar mslehto avatar oej avatar ovidiusas avatar poandrei avatar rfuchs avatar sergey-safarov avatar sipidronov avatar sobomax avatar space88man avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kamailio's Issues

rename sercmd to kamcmd

Finish the migration from sercmd to kamcmd inside the code too, not only the name of the binary

ndb_redis lost connection

Hello. I try to do my own dispatcher with redis db. I have problem with disconnecting module ะฐrom redis. Redis server is remote microsoft public server. This good solution for many companies and it works stable
The First Issue I saw when used

modparam("ndb_redis", "server", "name=srv1;addr=non_local_serv;port=6379;db=4;pass=mypass")

[TOASTERISK]
redis_cmd("srv1", "EXISTS $si", "s");
    xlog("L_INFO","ASTERISK with ip $si is {$redis(s=>value)}");


    $var(setid)=0;
    if ($redis(s=>value) == 0) {    
          xlog("L_INFO","Request {$rm} from $si != {$var(dest)} It means call NOT from ASTRISK");
        }

And when this call begins I get s value. But If I EXISTS it from redis comsole there is successfull reply.

Sometimes I see this at kamailio log

redisc_exec(): Redis error: Server closed the connection

I tried MONITOR redis from cli, but nothing happends when disconnect. (nothing means -nothing at the cli)

So I tried one more thing:
I have some pools of requests

  1. When options recieved to kam from asterisk
if (is_method("OPTIONS"))
        {
            if ($sp == 50600) {

                redis_cmd("srv1", "AUTH mylonglongpass"","r")
                redis_cmd("srv1", "SET $si $TS", "r");
                redis_cmd("srv1", "EXPIRE $si 20", "r");

            }
  }

It works fine (Intresting that this works fine with the PASS through modparam key too)

  1. pool when Kamailio choose ASTERISK to send INVITE from redis
        #DISPATCHER_NEW 
                #$setid - is another var that gets from sql db.
        $var(priority)=1;
        redis_cmd("srv1", "AUTH mylonglongpass", "p");

               while ($redis(b=>value) == 0)
        {
        xlog("L_INFO","{$rm} priority now is $var(priority) and setid $var(setid)\n");
        redis_cmd("srv1", "EXISTS $var(setid):$var(priority)", "e");
        xlog("L_INFO","ASTERISK with customer $var(setid) and priority $var(priority) id {$redis(e=>value)} (if 1 - exists, 0 - not exisits)");

            # Regis correctly get reply above always

        if ($redis(e=>value) == 1)
        {
            redis_cmd("srv1", "GET $var(setid):$var(priority)", "a"); 

                   #get IP of asterisk. Always get right value too

    xlog("L_INFO","ASTERISK with customer $var(setid) and priority $var(priority)  is {$redis(a=>value)} (if 0 - not exisits)");
            redis_cmd("srv1", "GET $redis(a=>value)", "b"); #check timestamp that set at redis OPTION request
     # There are I have trouble when use AUTH acommand because redis return <null> after above GET. If i do GET from cli - all ok.
            xlog("L_INFO","ASTERISK with customer $var(setid) and priority $var(priority) have timestamp {$redis(b=>value)} (if null - no timestamp. This means it down. Get new asterisk)");

            if ($redis(b=>value) == 1){

                $du="sip:"+$redis(a=>value)+":50600";
            }
            else{
                $var(priority)=$var(priority)+1;
                }
        }

Offcource I checked all parameteres - database name and another connection attrs of modparam

permissions: Core dump

NO traffic, just starting Kamailio and letting it run for a while with a lot of modules loaded.
git head.

(gdb) bt full
#0  0x00007fff8a92e866 in __pthread_kill ()
No symbol table info available.
#1  0x00007fff86b1235c in pthread_kill ()
No symbol table info available.
#2  0x00007fff869e9b1a in abort ()
No symbol table info available.
#3  0x00000001081ebc67 in fm_free (qm=0x10a78a000, p=0x5c, file=0x109ee9295 "permissions: hash.c", func=0x109eea05c "free_subnet_table", line=845) at mem/f_malloc.c:588
    f = (struct fm_frag *) 0x10aa0a698
#4  0x0000000109eb9990 in free_subnet_table (table=0x10aa0c340) at hash.c:845
    i = 0
#5  0x0000000109ea8cfc in clean_addresses () at address.c:442
No locals.
#6  0x0000000109ec5c7e in mod_exit () at permissions.c:682
    i = 1
#7  0x00000001080fc089 in destroy_modules () at sr_module.c:788
    t = (struct sr_module *) 0x108553540
    foo = (struct sr_module *) 0x1085531b8
#8  0x0000000107f533cb in cleanup (show_status=1) at main.c:512
    memlog = 0
#9  0x0000000107f5ad2b in shutdown_children (sig=15, show_status=1) at main.c:654
No locals.
#10 0x0000000107f56394 in handle_sigs () at main.c:684
    chld = 0
    chld_status = 0
    memlog = 0
#11 0x0000000107f5adb7 in sig_usr (signo=2) at main.c:781
    memlog = 0
#12 <signal handler called>

pipelimit: Depends on SL module

A not documented dependency

'
0(32734) ERROR: pipelimit [./../../modules/sl/sl.h:111]: sl_load_api(): cannot find bind_sl
0(32734) ERROR: pipelimit [pipelimit.c:374]: mod_init(): cannot bind to SL API
0(32734) ERROR: [sr_module.c:945]: init_mod(): Error while initializing module pipelimit (/usr/local/lib64/kamailio/modules/pipelimit.so)
'
Assigned to oej.

avpops: avp_copy add xavp

We have avp_copy on avpops module but we donโ€™t have anything to copy xavps.

// copy all the content of an avp to a xavp
$xavp(a[0]=>b) = $(avp(x)[*]);
// deleting left content
$xavp(a[0]=>b[*]) = $(avp(x)[*]);
// copy xavp to a xavp with index
$xavp(a[0]) = $xavp(b[1]);
// all
$xavp(a[*]) = $xavp(b[*]);
// copy all content of a xavp to a avp
$avp(x) = $xavp(a[0]=>b[*]);

missing BYE when 2 redundant kamailio servers share the same database

Hi, all

I'm trying to set up 2 kamailio servers for active-active redundancy. The two kamailio severs share the the same database with db_mode=3, and no registration replication. Use pjsua2 as SIP client for testing. The test setup is as follows:

kamailio server 1(k1): 10.0.1.30:5061
kamailio server 2(k2): 10.0.1.32:5061
sip client c1: sip:[email protected], client ip: 10.0.1.254
sip client c2: sip:[email protected], client ip: 10.0.1.254

c1 is registered with k1.
c2 is registered with k2.

When c1 calls c2, the call flow is as follows:
INVITE:
c1------>k1------>k2------>c2
200 OK:
c1<------k1<------k2<------c2

So far, the INVITE works. c1 and c2 can establish a call. However, when c2 hangs up and sends BYE, the BYE is forwarded all the way to k1, and then k1 gives a 500 server error.
The log on k1 seems to indicate k1 was attempting to create a TLS connection to itself instead of using the existing TLS connection to c1 to forward the BYE.

BYE:
c1 X k1<------k2<------c2
_______|
_______|------->Connection refused/500

Here is the kamailio log on k1:
Mar 16 10:34:21 kamailio.sip.com /usr/sbin/kamailio[13396]: ERROR: [tcp_main.c:2740]: tcpconn_1st_send(): connect 10.0.1.30:55999 failed (RST) Connection refused
Mar 16 10:34:21 kamailio.sip.com /usr/sbin/kamailio[13396]: ERROR: [tcp_main.c:2750]: tcpconn_1st_send(): 10.0.1.30:55999: connect & send for 0x7fc96a68a1a0 failed: Connection refused (111)

This is the routing logic for BYE in kamailio.cfg:
if (loose_route()) {
route(DLGURI);
if (is_method("BYE")) {
xlog("L_DBG", "=====BYE $ru from $fu $si:$sp to $du=====\n");
dlg_manage();
setflag(FLT_ACC); # do accounting ...
setflag(FLT_ACCFAILED); # ... even if the transaction fails
}
else if ( is_method("ACK") ) {
# ACK is forwarded statelessy
route(NATMANAGE);
}
else if ( is_method("NOTIFY") ) {
# Add Record-Route for in-dialog NOTIFY as per RFC 6665.
record_route();
}
route(RELAY);
exit;
} else {......

If I add location based routing for BYE from peer kamailio, then the BYE seems to be forwarded correctly:
if (loose_route()) {
route(DLGURI);
if (is_method("BYE")) {
xlog("L_DBG", "=====BYE $ru from $fu $si:$sp to $du=====\n");
dlg_manage();
setflag(FLT_ACC); # do accounting ...
setflag(FLT_ACCFAILED); # ... even if the transaction fails
# If BYE coming from Kamailio peer, route BYE by location
$var(peerlist)=$sel(cfg_get.trusted.peers);
$var(i) = 0;
while($var(i)&lt;$(var(peerlist){param.count})) {
xlog("L_DBG", "=====$(var(peerlist){param.count})=====$(var(peerlist){param.valueat,$var(i)})=====\n");
if(src_ip==$(var(peerlist){param.valueat,$var(i)})) {
lookup("location");
xlog("L_DBG", "=====BYE from $fu $si:$sp to $du=====\n");
break;
}
$var(i) = $var(i) + 1;
}
}
else if ( is_method("ACK") ) {
# ACK is forwarded statelessy
route(NATMANAGE);
}
else if ( is_method("NOTIFY") ) {
# Add Record-Route for in-dialog NOTIFY as per RFC 6665.
record_route();
}
route(RELAY);
exit;
} else {......

My first question is why k1 loose_route sends the BYE to itself instead of the client. Is this a bug?
My next question is whether the above location routing for BYE from peer kamailio a good/safe approach.

Thanks

Implement method to selectively disable MSILO offline notification

If Kamailio is globally configured to send offline notification replies using modparam("msilo", "from_address", "sip:[email protected]"), there is currently no way to disable the offline notification reply during script processing.

For example, a scenario where you might want to store the original MESSAGE but not send the offline notification reply is when you are also using the IMC module. When [email protected] is part of an IMC chat, but goes offline for some reason, the MSILO module will store original MESSAGE, then generate the offline notification reply back to the IMC chat, which generates another MESSAGE with [email protected] as a recipient... This instantly leads to thousands of MESSAGE generations.

I am thinking that it's a nice feature to have offline notification replies enabled when modparam("msilo", "from_address", "sip:[email protected]") is defined, but that the MSILO module could check the existence (nor non-existence) of a flag to determine whether or not it would generate an offline notification reply, so the logic would be something like:

#!define FLT_MSILO_DISABLE_OFFLINE_REPLY 13
modparam("msilo", "from_address", "sip:[email protected]")
modparam("msilo", "disable_offline_reply_flag", FLT_MSILO_DISABLE_OFFLINE_REPLY)

Then m_store() checks that from_address is valid and that disable_offline_reply_flag is not set.

dialplan: using $(avp("key")[*]) on match/subst rules

Enhancement to dialplan module.
A rule having an avp with index all([*]) will be checked with the avp values one by one.
Example:
Having $(avp(s:list)[*]) -> "111", "222"
'^(00|\+)?$(avp(s:list)[*])$' will be checked as:

  • '^(00|\+)?111$'
  • '^(00|\+)?222$'

core parsing of SIP message failed errors

I finally got everything working but see to consistently receive the following 3 errors (see below) over and over when a call is being collected?

Versions:
Homer 3.6
kamailio 4.3.0-dev4
Captagent 4.2.0

Any assistance would be appreciated.

Errors:
Mar 8 22:04:47 ce-homer2 /usr/local/kamailio/sbin/kamailio[9921]: ERROR: [parser/parse_fline.c:257]: parse_first_line(): parse_first_line: bad message (offset: 0)
Mar 8 22:04:47 ce-homer2 /usr/local/kamailio/sbin/kamailio[9921]: ERROR: [parser/msg_parser.c:688]: parse_msg(): ERROR: parse_msg: message=<HEP3#004>>
Mar 8 22:04:47 ce-homer2 /usr/local/kamailio/sbin/kamailio[9921]: ERROR: [receive.c:129]: receive_msg(): core parsing of SIP message failed (127.0.0.1:33264/1)
Mar 8 22:04:47 ce-homer2 /usr/local/kamailio/sbin/kamailio[9922]: ERROR: [parser/parse_fline.c:257]: parse_first_line(): parse_first_line: bad message (offset: 0)
Mar 8 22:04:47 ce-homer2 /usr/local/kamailio/sbin/kamailio[9922]: ERROR: [parser/msg_parser.c:688]: parse_msg(): ERROR: parse_msg: message=<HEP3#002รœ>
Mar 8 22:04:47 ce-homer2 /usr/local/kamailio/sbin/kamailio[9922]: ERROR: [receive.c:129]: receive_msg(): core parsing of SIP message failed (127.0.0.1:33264/1)

websocket: `tcpconn_get()` error gets turned into `E_OUT_OF_MEM` which becomes "500 No Error"

My websocket TLS server is full of these kinds of messages:

Jan 18 18:10:26 ws0 /usr/sbin/kamailio[19701]: NOTICE: <script>:
  http:217.120.x.x:55386: WS connection closed
...
Jan 18 18:10:26 ws0 /usr/sbin/kamailio[19689]: WARNING: <core>
  [msg_translator.c:2506]: via_builder(): TCP/TLS connection (id: 0) for WebSocket could not be found
Jan 18 18:10:26 ws0 /usr/sbin/kamailio[19689]: ERROR: <core>
  [msg_translator.c:1722]: build_req_buf_from_sip_req(): could not create Via header
Jan 18 18:10:26 ws0 /usr/sbin/kamailio[19689]: ERROR: tm
  [t_fwd.c:527]: prepare_new_uac(): could not build request
Jan 18 18:10:26 ws0 /usr/sbin/kamailio[19689]: ERROR: tm
  [t_fwd.c:1773]: t_forward_nonack(): ERROR: t_forward_nonack: failure to add branches
Jan 18 18:10:26 ws0 /usr/sbin/kamailio[19689]: ERROR: sl
  [sl_funcs.c:387]: sl_reply_error(): ERROR: sl_reply_error used: No error (2/SL)
(repeat these last errors for a bunch of attempted NOTIFY forwards)

The route block does basically something like this:

    # add_contact_alias(); # only for requests from the outside
    loose_route();
    if (!t_relay()) {
            sl_reply_error();
    }

The problem arises here:

}else if (send_info->proto==PROTO_WS){
...
    con = tcpconn_get(send_info->id, &ip, port, from, 0)
...
    if (con == NULL) {
        LM_WARN("TCP/TLS connection (id: %d) for WebSocket could not be found\n", send_info->id);

The NULL failure status gets returned up to prepare_new_uac in t_fwd.c:

    shbuf=build_req_buf_from_sip_req( i_req, &len, dst, BUILD_IN_SHM);
    if (!shbuf) {
            LM_ERR("could not build request\n");
            ret=E_OUT_OF_MEM;
            goto error01;
    }

At this point, ser_error will become E_OUT_OF_MEM while it should be something like E_SEND.

And E_OUT_OF_MEM gets translated to 500 No Error because we're not running in DEBUG mode.

What causes the connection to drop in the first place, you ask?

18:10:18.690738 IP 217.120.x.x.55386 > 195.35.x.x.443: Flags [S], seq 1323983240, win 8192, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
18:10:18.690863 IP 195.35.x.x.443 > 217.120.x.x.55386: Flags [S.], seq 4077761781, ack 1323983241, win 14600, options [mss 1460,nop,nop,sackOK,nop,wscale 3], length 0
18:10:18.710846 IP 217.120.x.x.55386 > 195.35.x.x.443: Flags [.], ack 1, win 256, length 0
18:10:18.808751 IP 217.120.x.x.55386 > 195.35.x.x.443: Flags [P.], seq 1:246, ack 1, win 256, length 245
...
18:10:19.233415 IP 195.35.x.x.443 > 217.120.x.x.55386: Flags [.], ack 31348, win 5126, length 0
18:10:26.489764 IP 217.120.x.x.55386 > 195.35.x.x.443: Flags [P.], seq 31348:32473, ack 34578, win 255, length 1125
...
18:10:26.501409 IP 195.35.x.x.443 > 217.120.x.x.55386: Flags [P.], seq 42255:42916, ack 46010, win 5046, length 661
18:10:26.527755 IP 217.120.x.x.55386 > 195.35.x.x.443: Flags [.], ack 36993, win 252, length 0
18:10:26.527860 IP 195.35.x.x.443 > 217.120.x.x.55386: Flags [.], seq 42916:47296, ack 46010, win 5278, length 4380
18:10:26.527888 IP 195.35.x.x.443 > 217.120.x.x.55386: Flags [FP.], seq 47296:48663, ack 46010, win 5278, length 1367
18:10:26.529179 IP 217.120.x.x.55386 > 195.35.x.x.443: Flags [.], ack 40501, win 254, length 0
18:10:26.529200 IP 217.120.x.x.55386 > 195.35.x.x.443: Flags [.], ack 42916, win 251, length 0
18:10:26.547276 IP 217.120.x.x.55386 > 195.35.x.x.443: Flags [.], ack 48664, win 251, length 0
18:10:26.549712 IP 217.120.x.x.55386 > 195.35.x.x.443: Flags [F.], seq 46010, ack 48664, win 251, length 0
18:10:26.549750 IP 195.35.x.x.443 > 217.120.x.x.55386: Flags [.], ack 46011, win 5278, length 0

Where you see that the FIN is initiated by 195.35.x.x which is the Kamailio websocket server.

The cause (probably) is the WS client closing the connection. In this case after re-subscribing with Expires:0. The presence server attempts to reply with a bunch of NOTIFYs with Subscription-State: terminated;reason=timeout but they bounce on the broken connection. If Kamailio would return a nice "477 Unfortunately error on sending to next hop occurred" it'd be prettier.

Getting less "error" messages (a total of 6 per expired/unsubscribed subscription) after this error --which is apparently very common -- would be beneficial too.

As for fixing:

  • We could change the via_builder to set ser_error (and check that in build_req_buf_from_sip_req), or
  • add error-code-out-parameters to all calls from build_req_buf_from_sip_req and down.
    I'm not sure if either is the best way.

As for the excessive error reporting, would looking at ser_error before printing (another) error be an acceptable fix?

Cheers,
Walter Doekes
OSSO B.V.

lookup_branches and rtpengine_manage

Hello. I need parallel forking calls with the same username. (Call to all contacts with name for example User123), my endpoints may be WebSocket based and standart UDP endpoints. And I use rtpengine_manage for managing calls wor webphones and standart softh/hard phones.

I get all contacts manually and than at the branch route set rtpengine_manage settings for every call.

It works fine but it works for one kamailio server.

When I use 2 kamailio servers as load balansers Server that handle call get all endpoints from location but call to only one, that registred only at ths server

for example I call user123
I have 3 contacts
[email protected] - was registered at kamailio 1
[email protected] - was registered at kamailio 2
[email protected] - was registered at kamailio 1

So if call goes through kamailio 1 it call only to [email protected] and [email protected]

I use this settings for usrloc at 2 kamailios to share all table between 2 servers

modparam("usrloc", "db_url", DBURL)
modparam("usrloc", "db_mode", 3)
modparam("usrloc", "user_column", "username")
modparam("usrloc", "contact_column", "contact")
modparam("usrloc", "expires_column", "expires")
modparam("usrloc", "q_column", "q")
modparam("usrloc", "callid_column", "callid")
modparam("usrloc", "cseq_column", "cseq")
modparam("usrloc", "methods_column", "methods")
modparam("usrloc", "cflags_column", "cflags")
modparam("usrloc", "user_agent_column", "user_agent")
modparam("usrloc", "received_column", "received")
modparam("usrloc", "socket_column", "socket")
modparam("usrloc", "path_column", "path")
modparam("usrloc", "ruid_column", "ruid")
modparam("usrloc", "instance_column", "instance")
modparam("usrloc", "use_domain", 1)

and this code for calling them

[GET_CONTACTS]
{
            sql_query("ca", "select contact from location where username='$tU'", "ra");
            xlog("rows: $dbr(ra=>rows) cols: $dbr(ra=>cols)\n");
            if($dbr(ra=>rows)>0){
                $var(i)=0;
                 while($var(i)<$dbr(ra=>rows)){

                    xlog("L_INFO","SQL query return contact {$dbr(ra=>[$var(i),0])} for {$tU} at step {$var(i)}\n");

                    if ($dbr(ra=>[$var(i),0])=~"transport=ws"){ 
                        xlog("L_INFO", "This is a Websocket call to endpoint");
                        sql_pvquery("ca", "select received from location where contact='$dbr(ra=>[$var(i),0])'","$var(recieved)");

                        $du=$var(recieved);
                        xlog("L_INFO","SQL query return recieved {$var(recieved)} for {$tU}. Destination is {$du}\n");
                        append_branch("sip:$tU@$(du{s.select,1,:})");


                    }

                    else
                    {   
                        xlog("L_INFO", "This is a classic UDP call to endpoint");
                        $var(recieved)='';
                        sql_pvquery("ca", "select received from location where contact='$dbr(ra=>[$var(i),0])'","$var(recieved)");
                        xlog("L_INFO", "SQL query return RECIEVED {$var(recieved)}");
                        if ($var(recieved)==0){
                            xlog("L_INFO", "Recieved string is EMPTY");
                            $du="sip:"+$(dbr(ra=>[$var(i),0]){s.select,1,@});
                        }
                        else {
                            xlog("L_INFO", "Recieved string is {$var(recieved)}");
                            $du=$var(recieved);
                        }
                        $var(UDP_contact)="sip:"+$(dbr(ra=>[$var(i),0]){s.select,1,@});                     

                        append_branch("sip:$tU@$(du{s.select,1,:})");

                        xlog("L_INFO","Classic Destination URI is {$dbr(ra=>[$var(i),0])} for {$tU}}. Destination is {$du}\n");
                    }
                    $var(i) = $var(i) + 1;

                }

            }
            t_on_branch("1");
            return;

        }
    }

}


branch_route[1]{

    if($du=~"transport=ws"){
            xlog("L_INFO","Websocket Branch is {$du} for {$tU}\n");
            rtpengine_manage("internal extenal force trust-address replace-origin replace-session-connection ICE=force RTP/SAVPF");
            t_on_reply("REPLY_FROM_WS");

            }
    else{
            xlog("L_INFO","UDP Branch is {$du)} for {$tU}\n");
            rtpengine_manage("replace-origin replace-session-connection ICE=remove RTP/AVP");
            t_on_reply("MANAGE_CLASSIC_REPLY");
    }
}

When it try to branch endpoint without registration at server that handle call I get errors that tm module can not build Via header

*via_builder(): TCP/TLS connection (id: 0) for WebSocket could not be
 found*
 *ERROR: <core> [msg_translator.c:1725]: build_req_buf_from_sip_req():
 could not create Via header*
 *ERROR: <core> [forward.c:607]: forward_request(): ERROR:
 forward_request: building failed*

UDP calls get errors something like above (sorry than can not share error code, This situation not often).

So I think I have this trouble because I use manually handling call and tried to substitute to lookup_branches function. but I have no Idea how to set rtpengine_manage paraments for each endpoint depending this is websocket or standart call.

IF there is write problem for callings thhrough 2 kamailios as load balansers please let me know about how to set rtpengine_manage parametrs wor endpoints for every fork. If not- can you tell me how I can call to all endpoints endepending of registration server (kamailio 1 or 2).

But with another side I can not understand why kamailio 2 don't see registrations at kamailio1 (or 1 from 2). May be this is trouble of usrloc module. That's why I write this problem here.
Thanks.

event on table location Duplicate entry for key 'ruid_idx'

Hello. We use 2 kamailio 4.3 (yes we know that it is master branch, but inly this branch correctly works with uac module for outbond registrations) servers cluster and we have porblems with db. Database failed pecause of error:

Could not execute Write_rows_v1 event on table production.location; Duplicate entry 'uloc-54aae947-86d-a67' for key 'ruid_idx', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log FIRST, end_log_pos 380, Internal MariaDB error code: 1062

But a location table no row 'ruid_idx' and no entry uloc-54aae947-86d-a67.

issue notifying subscribers with transport tcp/tls

Hi,

i noticed a weird behavior in 4.2 branch with this kamailio.cfg (snippet)

!substdef "!UDP_SIP!udp:MY_IP_ADDRESS:5060!g"

!substdef "!TCP_SIP!tcp:MY_IP_ADDRESS:5060!g"

listen=UDP_SIP
listen=TCP_SIP

# Routing Logic

route
{
# log the basic info regarding this call
xlog("L_INFO", "$ci|start|recieved $oP request $rm $ou");
.....
}

when clients using TCP send a SUBSCRIBE we get log info that it is a UDP operation.
when we send the first notify we get tcp errors.
for reference, i'm using Bria 4 in testing.

Dec 20 16:49:29 kamailio-05 kamailio[5085]: INFO: <script>: YzYwYWVlOTFiMGU0YmNjM2IyMDA1NmQ4NjdiMGEwZDY|start|recieved UDP request SUBSCRIBE sip:[email protected]
Dec 20 16:49:29 kamailio-05 kamailio[5072]: INFO: <script>: received dialog update for sip:[email protected]
Dec 20 16:49:29 kamailio-05 kamailio[5072]: INFO: presence [notify.c:1604]: send_notify_request(): NOTIFY sip:[email protected] via sip:[email protected]:62285;transpop on behalf of sip:[email protected] for event dialog
Dec 20 16:49:29 kamailio-05 kamailio[5072]: CRITICAL: <core> [pass_fd.c:157]: send_all(): send on 0 failed: Socket operation on non-socket
Dec 20 16:49:29 kamailio-05 kamailio[5072]: ERROR: <core> [tcp_main.c:2303]: tcpconn_send_put(): failed to get fd(write):Socket operation on non-socket (88)
Dec 20 16:49:29 kamailio-05 kamailio[5072]: ERROR: tm [../../forward.h:227]: msg_send(): tcp_send failed
Dec 20 16:49:29 kamailio-05 kamailio[5072]: ERROR: tm [uac.c:598]: send_prepared_request_impl(): t_uac: Attempt to send to precreated request failed

call_control :: Depends on pv

Call_control depends on pv, but it's not documented in the README

0(70806) ERROR: [pvapi.c:790]: pv_parse_spec2(): error searching pvar "avp"
0(70806) ERROR: [pvapi.c:994]: pv_parse_spec2(): wrong char [s/115] in [$avp(s:can_uri)] at [5 (5)]
0(70806) : call_control [call_control.c:1076]: mod_init(): invalid AVP specification for canonical_uri_avp: `$avp(s:can_uri)'
0(70806) ERROR: [sr_module.c:945]: init_mod(): Error while initializing module call_control

sca: Core dump

If I load the sca module in a minimal configuration without any sca modparams, it core dumps.

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 sca.so 0x000000010de29823 sca_db_get_connection + 35 (sca_db.c:158)
1 sca.so 0x000000010de411e7 sca_subscription_db_update + 55 (sca_subscribe.c:493)
2 sca.so 0x000000010ddd44e3 sca_mod_destroy + 19 (sca.c:367)
3 kamailio 0x000000010d1ab089 destroy_modules + 73 (sr_module.c:790)

statsd - missing new lines in error messages

Loading stated without config generates a list of error messages, not properly terminated with new line.

 0(70227) ERROR: statsd [statsd.c:65]: mod_init(): mod_init_values ip  (null) 0(70227) ERROR: statsd [statsd.c:66]: mod_init(): mod_init_values port (null) 0(70227) ERROR: statsd [lib_statsd.c:126]: statsd_init(): Statsd_init ip 127.0.0.1 0(70227) ERROR: statsd [lib_statsd.c:127]: statsd_init(): Statsd_init port 8125 0(70227) ERROR: statsd [statsd.c:68]: mod_init(): Error code in mod_init is 1 0(70227) WARNING: tls [tls_mod.c

Is cross module function call a good practice?

Started creating a new module auth_jwt, which supports JSON Web Token for auth. Need to access the database to validate some claims in the token. Wonder if I should just make a function call to auth_db or copy the code from auth_db? Which approach is a better approach? Thanks.

pike: Core dump

Just loading pike (with a lot of other modules) running without any traffic. git head.

(gdb) bt full
#0  0x000000010b83e045 in clean_routine (ticks=10264832, param=0x0) at pike_funcs.c:175
    mask = '\0' <repeats 31 times>
    head = {
  next = 0x62642e6f696c6961, 
  prev = 0x0
}
    ll = (struct list_link *) 0x6d616b2f62642f73
    dad = (struct ip_node *) 0x0
    node = (struct ip_node *) 0x0
    i = 1936026741
#1  0x0000000109aedc61 in compat_old_handler (ti=164237316, tl=0x10c365db8, data=0x10c365db8) at timer.c:996
    t = (struct sr_timer *) 0x10c365db8
#2  0x0000000109aee43f in slow_timer_main () at timer.c:1130
    n = 0
    ret = 4294967295
    tl = (struct timer_ln *) 0x10c365db8
    i = 0
    sig = 31
#3  0x000000010989af00 in main_loop () at main.c:1336
    i = 166504192
    pid = 0
    si = (struct socket_info *) 0x109e9dff8
    si_desc = "\b\000\000\0000\000\000\000??EV?\000\000\000\000\000\000\000\000\000\000???\t\001\000\000\000\001", '\0' <repeats 47 times>, "?EV?\000\000?\024?\t\001\000\000\000\020j?\t\001\000\000\000\000\000\000\000\006\000\000\000?9?\t\001\000\000\000\001\000\000\000\000\000\000"
    nrprocs = 1
#4  0x00000001098a722d in main (argc=8, argv=0x7fff5645ba88) at main.c:2508

jsonrpc-c

The jsonrpc-c module doesn't compile on OS/X

CC (gcc) [M jsonrpc-c.so]       jsonrpc_io.o
jsonrpc_io.c:31:10: fatal error: 'sys/timerfd.h' file not found
#include <sys/timerfd.h>
         ^
1 error generated.

rtpengine module error with new masterbranch

Hello. We Build 4.3 masterbranch (latest branch) . We install it today and not changed config from old build (4.3 masterbranch) that builded december 26. IT means - keys of rtpengine module the same for all configs.

Jan 14 05:09:58 Kamailio rtpengine[482]: [7dd25def58ced3
[email protected]:50600 port 30080] Error parsing RTP header: invalid header version
Jan 14 05:09:58 Kamailio rtpengine[482]: [[email protected]:50600 port 30081] Error parsing RTCP header: invalid header version

Sorry. Different versions of rtpengine
3.7 and 3.8 with new build. I thnk it is rtpengine. Not module.

corex: Modify parameter name

Reported by [email protected]

please correct typos in the "COREX" module documentation (verified in current devel moduleยดs documentation), chapter 1.3 ff:

modparam("corex", "min_msg_len", 32)

The modparam "min_msg_len" (= http://kamailio.org/docs/modules/devel/modules/corex.html#idm14680) is always named "msg_min_len" in the README file and online documentation. Only the exemplary kamailio.cfg excerpt is using the right name of this module parameter. Please use the right parameters name "min_msg_len" in the whole document.

userblacklist (?) : Core dump

As other cases, just starting Kamailio and trying to stop it. Config with a lot of modules and no messages. Git head.

(gdb) bt full
#0  0x00000001139744be in dtrie_delete (root=0x10fabdec0, node=0x40000000000, delete_payload=0, branches=10) at dtrie.c:82
    i = 0
#1  0x00000001139744d1 in dtrie_delete (root=0x10fabdec0, node=0x10fabdec0, delete_payload=0, branches=10) at dtrie.c:82
    i = 0
#2  0x0000000113974b10 in dtrie_destroy (root=0x11396e788, delete_payload=0, branches=10) at dtrie.c:104
No locals.
#3  0x000000011395c3ef in mod_destroy () at userblacklist.c:742
No locals.
#4  0x000000010d20a089 in destroy_modules () at sr_module.c:788
    t = (struct sr_module *) 0x10d671600
    foo = (struct sr_module *) 0x10d6712b0
#5  0x000000010d0613cb in cleanup (show_status=1) at main.c:512
    memlog = 0
#6  0x000000010d068d2b in shutdown_children (sig=15, show_status=1) at main.c:654
No locals.
#7  0x000000010d064394 in handle_sigs () at main.c:684
    chld = 0
    chld_status = 0
    memlog = 0
#8  0x000000010d068db7 in sig_usr (signo=2) at main.c:781
    memlog = 0
#9  <signal handler called>
No symbol table info available.

Reproducible Builds

Debian has this goal
https://wiki.debian.org/ReproducibleBuilds/

As you can see here https://reproducible.debian.net/rb-pkg/kamailio.html we are using TIME and DATE macros

gcc -funroll-loops -Wcast-align -m64 -minline-all-stringops -falign-loops -ftree-vectorize -fno-strict-overflow -Wall -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Werror=date-time -D_FORTIFY_SOURCE=2   -DNAME='"kamailio"' -DVERSION='"4.2.0"' -DARCH='"x86_64"' -DOS='linux_' -DOS_QUOTED='"linux"' -DCOMPILER='"gcc 4.9.2"' -D__CPU_x86_64 -D__OS_linux -DSER_VER=4002000 -DCFG_DIR='"/etc/kamailio/"' -DPKG_MALLOC -DSHM_MEM -DSHM_MMAP -DDNS_IP_HACK -DUSE_MCAST -DUSE_TCP -DDISABLE_NAGLE -DHAVE_RESOLV_RES -DUSE_DNS_CACHE -DUSE_DNS_FAILOVER -DUSE_DST_BLACKLIST -DUSE_NAPTR -DWITH_XAVP -DF_MALLOC -DDBG_F_MALLOC -DMEM_JOIN_FREE -DUSE_TLS -DTLS_HOOKS -DUSE_CORE_STATS -DSTATISTICS -DMALLOC_STATS -DWITH_AS_SUPPORT -DFAST_LOCK -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024 -DCC_GCC_LIKE_ASM -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD -DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H -DHAVE_TIMEGM -DHAVE_SCHED_SETSCHEDULER -DUSE_RAW_SOCKS -DHAVE_EPOLL -DHAVE_SIGIO_RT -DSIGINFO64_WORKARROUND -DUSE_FUTEX -DHAVE_SELECT   -c ver.c -o ver.o -MMD -MP
ver.c:38:35: error: macro "__TIME__" might prevent reproducible builds [-Werror=date-time]
 const char ver_compiled_time[] =  __TIME__ " " __DATE__ ;
                                   ^
ver.c:38:48: error: macro "__DATE__" might prevent reproducible builds [-Werror=date-time]
 const char ver_compiled_time[] =  __TIME__ " " __DATE__ ;
                                                ^
cc1: some warnings being treated as errors

Can we introduce a Make option to avoid this?

call_control :: Depends on pv

Call_control depends on pv, but it's not documented in the README

0(70806) ERROR: [pvapi.c:790]: pv_parse_spec2(): error searching pvar "avp"
0(70806) ERROR: [pvapi.c:994]: pv_parse_spec2(): wrong char [s/115] in [$avp(s:can_uri)] at [5 (5)]
0(70806) : call_control [call_control.c:1076]: mod_init(): invalid AVP specification for canonical_uri_avp: `$avp(s:can_uri)'
0(70806) ERROR: [sr_module.c:945]: init_mod(): Error while initializing module call_control

ERROR: topoh th_mask_decode(): invalid input string"[email protected]"

The author described the problem - Alex Balashov
Link to source: http://sip-router.1086192.n5.nabble.com/topoh-and-locally-generated-requests-td132581.html
Hello,

I have found that topoh does not seem to operate correctly on
locally-generated requests, such as dialog timeout-fired BYEs.

e.g.

Nov 17 17:20:16 centosity6 /usr/local/sbin/kamailio[10357]: INFO:
[R-TM-LOCAL-REQUEST:[email protected]] Local
request BYE to sip:[email protected]:5060
Nov 17 17:20:16 centosity6 /usr/local/sbin/kamailio[10357]: INFO:
[R-TM-LOCAL-REQUEST:[email protected]] Local
request BYE to sip:172.30.110.5:5060;transport=UDP
Nov 17 17:20:16 centosity6 /usr/local/sbin/kamailio[10348]: ERROR: topoh
[th_mask.c:165]: th_mask_decode(): invalid input
string"[email protected]"
Nov 17 17:20:16 centosity6 /usr/local/sbin/kamailio[10348]: ERROR: topoh
[th_msg.c:484]: th_unmask_callid(): cannot decode callid

You can see these BYEs are not TOPOH'd at all:

17:23:34.097128 IP 172.30.110.4.sip > 127.0.1.1.sip: SIP, length: 346
E..v....@.?]..n..........b..BYE sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP
172.30.110.4;branch=z9hG4bK00ac.30df1375000000000000000000000000.0
To: sip:[email protected]:5060;tag=3287SIPpTag001
From: sip:[email protected]:5060;tag=2117SIPpTag015
CSeq: 1 BYE
Call-ID: [email protected]
Content-Length: 0
Max-Forwards: 70

17:23:34.097239 IP 172.30.110.4.sip > 172.30.110.5.sip: SIP, length: 358
[email protected]...n...n......n5.BYE sip:172.30.110.5:5060;transport=UDP SIP/2.0
Via: SIP/2.0/UDP
172.30.110.4;branch=z9hG4bKdf9c.08ed9677000000000000000000000000.0
To: sip:[email protected]:5060;tag=2117SIPpTag015
From: sip:[email protected]:5060;tag=3287SIPpTag001
CSeq: 2 BYE
Call-ID: [email protected]
Content-Length: 0
Max-Forwards: 70

in contrast to the other messages in this dialog:

7:23:30.871062 IP 172.30.110.5.sip > 172.30.110.4.sip: SIP, length: 844
E..h!5@.@.. ..n...n......Th.SIP/2.0 200 OK
Via: SIP/2.0/UDP
172.30.110.4;branch=z9hG4bK00ac.127fd0993a0e4c8a82474038472e09d2.0,
SIP/2.0/UDP
172.30.110.4;branch=z9hG4bKsr-goq-nEDchKUa9vuehzD2nruchwxHmrgFJru63LarksqBks-Uhz3WnrhFnrPHhKxWmd9D0s97YrRS3LvcjBeUXrqi9E9SwWoEhre2nzPRhu**
From: sipp sip:[email protected];tag=3287SIPpTag001
To: 17069950290 sip:[email protected]:5060;tag=2117SIPpTag015
Call-ID: CSEVhwoohreOhEeEnzjOhEuxmGjRhzjOhr32JWoEhre2-GPWJWxFnrPch-**
Record-Route:
sip:172.30.110.4;lr=on;ftag=3287SIPpTag001;fromcor=ejFwbUZxUmpUUFNBejFwbUZxUm9RUFBfZS5wZ111ZFo-;dlgcor=9c9.77a1
CSeq: 1 INVITE
Contact: sip:172.30.110.5:5060;transport=UDP
Content-Type: application/sdp
Content-Length: 135

v=0
o=user1 53655765 2353687637 IN IP4 172.30.110.5
s=-
c=IN IP4 172.30.110.5
t=0 0
m=audio 6000 RTP/AVP 0
a=rtpmap:0 PCMU/8000

Maybe this is not possible to fix because of where topoh intercepts the
messages (transparently to the config script writer) in relation to how
the TM API is used to generate spoof requests. I just thought I would
report it.

multiple /tmp file vulnerabilities

Reported by: Helmut Grohne [email protected]

The kamailio package now installs /etc/kamailio/kamailio-basic.cfg which
can be selected via the CFGFILE= setting in /etc/default/kamailio. The
configuration contains:

modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")

This setting is insecure and may allow local users to elevate privileges
to the kamailio user.

The issue extends to kamailio-advanced.cfg. It seems that this is due to
an incomplete fix of #712083. Looking further, the state of /tmp file
vulnerabilities in kamailio looks worrisome. Most of the results of the
following command (to be executed in the kamailio source) are likely
vulnerable if executed:

grep '/tmp/[a-z0-9_.-]\+\(\$\$\)\?\([" ]\|$\)' -r .

Granted, some of the results are examples, documentation or obsolete.
But quite a few reach the default settings:

  • kamcmd defaults to connecting to unixs:/tmp/kamailio_ctl.
  • The kamailio build definitely is vulnerable as can be seen in
    utils/kamctl/Makefile.

More research clearly is required here. Given these findings, the
security team may want to veto the inclusion of kamailio in a stable
release, which would be very unfortunate as kamailio is quite a unique
piece of software with little competitors in its field.

Helmut

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=775681

usrloc: REGISTER with new callid gets updated on memory but not on DB

First REGISTER with callid X gets registered with no problem ( mem and db are in sync )
If the UAC send a new REGISTER before getting expire and this new REGISTER has a different callid in memory the register is OK but on DB the register is never updated.

The main problem in my opinion is that we donโ€™t obey the match_option at db_update_ucontact_addr nor db_delete_ucontact_addr.

The callid is in the where part of the query.

Fixed in trunk e8a795a should be backported to 4.1/4.2 branches when tested

use of [group] causes increase of mysql connections

Below is an example kamailio.conf, where addition of [group] to "db_url" value increases number of mysql connections from 36 to 70. [group] is defined in in my.cfg as:

[group]
ssl-ca=/etc/mysql/ca-cert.pem
ssl-cert=/etc/mysql/client-cert.pem
ssl-key=/etc/mysql/client-key.pem

With sqlops module alone the number of mysql connections is the same with or without [group].

kamailio.conf:

listen=192.98.102.33:5060
fork=yes
log_stderror=no
log_facility=LOG_LOCAL0
debug=2

loadmodule "tm"
loadmodule "auth"
loadmodule "sl"
loadmodule "pv"
loadmodule "auth_db"
loadmodule "dialplan"
loadmodule "domain"
loadmodule "htable"
loadmodule "permissions"
loadmodule "pua"
loadmodule "db_mysql"
loadmodule "sqlops"
loadmodule "xlog"

modparam("auth_db|dialplan|domain|htable|permissions|pua", "db_url", "mysql://user:pass@[group]127.0.0.1/sip_proxy")
modparam("sqlops", "sqlcon", "sip_proxy => mysql://user:pass@[group]127.0.0.1/sip_proxy")

route {

    sql_query("sip_proxy", "show status like 'ssl_cipher'", "result"); 
    xlog("L_INFO", "**** got result <variable=$dbr(result=>[0, 0])/value=$dbr(result=>[0, 1])>\n"); 
    sql_result_free("result"); 
    exit;

}

append_branch add to branch route first R_URI twice

Hello I use this version of kamailio

 kamailio -v
version: kamailio 4.3.0-dev3 (x86_64/linux) 8cdbe7
flags: STATS: Off, USE_TCP, USE_TLS, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, F_MALLOC, DBG_F_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: 8cdbe7
compiled on 17:54:50 Jan 20 2015 with gcc 4.8.2

I hav an issue with append branches to branch route when I need fork call to one endpoint woth different destionations.

I use my own algorithm for call to this devices because with lookup("location") I can not use RTPENGINE for different types of endpoints (web endoints and standart UDP endpoints)

My alg is here:

{

            sql_query("ca", "select contact from location where username='$tU'", "ra");
            xlog("L_INFO","rows: $dbr(ra=>rows) cols: $dbr(ra=>cols)\n");
            if($dbr(ra=>rows)>0){
                $var(i)=0;
                 while($var(i)<$dbr(ra=>rows)){

                    xlog("L_INFO","SQL query return contact {$dbr(ra=>[$var(i),0])} for {$tU} at step {$var(i)}\n");

                    if ($dbr(ra=>[$var(i),0])=~"transport=ws"){ 
                        xlog("L_INFO", "This is a Websocket call to endpoint");
                        sql_pvquery("ca", "select received from location where contact='$dbr(ra=>[$var(i),0])'","$var(recieved)");

                        $du=$var(recieved);
                        xlog("L_INFO","SQL query return recieved {$var(recieved)} for {$tU}. Destination is {$du}\n");


                            append_branch("sip:$tU@$(du{s.select,1,:})");


                    }

                    else
                    {   

                        xlog("L_INFO", "This is a classic UDP call to endpoint");
                        $var(recieved)='';
                        sql_pvquery("ca", "select received from location where contact='$dbr(ra=>[$var(i),0])'","$var(recieved)");
                        xlog("L_INFO", "SQL query return RECIEVED {$var(recieved)}");
                        if ($var(recieved)==0){
                            xlog("L_INFO", "Recieved string is EMPTY");
                            $du="sip:"+$(dbr(ra=>[$var(i),0]){s.select,1,@});
                        }
                        else {
                            xlog("L_INFO", "Recieved string is {$var(recieved)}");
                            $du=$var(recieved);
                        }
                        $var(UDP_contact)="sip:"+$(dbr(ra=>[$var(i),0]){s.select,1,@});                     

                                append_branch("sip:$tU@$(du{s.select,1,:})");

                        xlog("L_INFO","Classic Destination URI is {$dbr(ra=>[$var(i),0])} for {$tU}}. Destination is {$du}\n");
                    }
                    $var(i) = $var(i) + 1;

                }   
            }
            else{
            exit;
            }
            t_on_branch("1");
            return;

        }
    }

}


branch_route[1]{

    if($du=~"transport=ws"){
            xlog("L_INFO","Websocket Branch is {$du} for {$tU}\n");

            rtpengine_manage("internal extenal force trust-address replace-origin replace-session-connection ICE=force RTP/SAVPF");
            t_on_reply("REPLY_FROM_WS");

            }
    else{
            xlog("L_INFO","UDP Branch is {$du)} for {$tU}\n");

            rtpengine_manage("replace-origin replace-session-connection ICE=remove RTP/AVP");
            t_on_reply("MANAGE_CLASSIC_REPLY");
    }
} 

So as you see I choose array of devices and then set its to branches.

At the kamailio console I see output

This is output of alg that above.

I have 3 devices: 2 websocket devices and 1 udp
But when you look at dump where rtpengine make changes with packets you can see that it runs for 4 devices and 1 and 4 devices is the same.
You can see start of every branch from words of log "Websocket Branch is" or "UDP Branch is"

So this bug gives a mistake because some of hardphones can not handlie double INVITE and kamilio response for this devices cancel with 200 cause because hardphone set 482 reply to kamialio.
(you can see it reply at the log)

Feb  8 23:04:43 Kamailio2 kamailio[59406]: INFO: <script>: rows: 3 cols: 1
Feb  8 23:04:43 Kamailio2 kamailio[59406]: INFO: <script>: SQL query return contact {sip:[email protected];transport=ws} for {123455678} at step {0}
Feb  8 23:04:43 Kamailio2 kamailio[59406]: INFO: <script>: This is a Websocket call to endpoint
Feb  8 23:04:43 Kamailio2 kamailio[59406]: INFO: <script>: SQL query return recieved {sip:85.6.14.8:4328;transport=WS} for {123455678}. Destination is {sip:85.6.14.8:4328;transport=WS}
Feb  8 23:04:43 Kamailio2 kamailio[59406]: INFO: <script>: SQL query return contact {sip:[email protected];transport=ws} for {123455678} at step {1}
Feb  8 23:04:43 Kamailio2 kamailio[59406]: INFO: <script>: This is a Websocket call to endpoint
Feb  8 23:04:43 Kamailio2 kamailio[59406]: INFO: <script>: SQL query return recieved {sip:85.2.10.3:58509;transport=WS} for {123455678}. Destination is {sip:85.2.10.3:58509;transport=WS}
Feb  8 23:04:43 Kamailio2 kamailio[59406]: INFO: <script>: SQL query return contact {sip:[email protected];transport=ws} for {123455678} at step {2}
Feb  8 23:04:43 Kamailio2 kamailio[59406]: INFO: <script>: This is a Websocket call to endpoint
Feb  8 23:04:43 Kamailio2 kamailio[59406]: INFO: <script>: SQL query return recieved {sip:18.9.18.10:56917;transport=WS} for {123455678}. Destination is {sip:18.9.18.10:56917;transport=WS}
Feb  8 23:04:43 Kamailio2 kamailio[59406]: INFO: <script>: Websocket Branch is {sip:18.9.18.10:56917;transport=WS} for {123455678}
Feb  8 23:04:43 Kamailio2 rtpengine[55410]: Got valid command from 127.0.0.1:52689: offer - { "sdp": "v=0#015#012o=root 1141861088 1141861088 IN IP4 12.34.56.78#015#012s=Asterisk PBX 13.1.0#015#012c=IN IP4 12.34.56.78#015#012t=0 0#015#012m=audio 12230 RTP/AVP 9 8 107 0 101#015#012a=rtpmap:9 G722/8000#015#012a=rtpmap:8 PCMA/8000#015#012a=rtpmap:107 opus/48000/2#015#012a=rtpmap:0 PCMU/8000#015#012a=rtpmap:101 telephone-event/8000#015#012a=fmtp:101 0-16#015#012a=maxptime:60#015#012a=sendrecv#015#012", "ICE": "force", "direction": [ "internal" ], "flags": [ "extenal", "force", "trust-address" ], "replace": [ "origin",  ...
Feb  8 23:04:43 Kamailio2 rtpengine[55410]: ... "session-connection" ], "transport-protocol": "RTP/SAVPF", "call-id": "[email protected]:50600", "received-from": [ "IP4", "12.34.56.78" ], "from-tag": "as4f0c032f", "command": "offer" }
Feb  8 23:04:43 Kamailio2 rtpengine[55410]: Unknown flag encountered: 'extenal'
Feb  8 23:04:43 Kamailio2 rtpengine[55410]: Unknown flag encountered: 'force'
Feb  8 23:04:43 Kamailio2 rtpengine[55410]: [[email protected]:50600] Creating new call
Feb  8 23:04:43 Kamailio2 rtpengine[55410]: [[email protected]:50600] Returning to SIP proxy: d3:sdp747:v=0#015#012o=root 1141861088 1141861088 IN IP4 23.101.139.216#015#012s=Asterisk PBX 13.1.0#015#012c=IN IP4 23.101.139.216#015#012t=0 0#015#012a=ice-lite#015#012m=audio 38518 RTP/SAVPF 9 8 107 0 101#015#012a=rtpmap:9 G722/8000#015#012a=rtpmap:8 PCMA/8000#015#012a=rtpmap:107 opus/48000/2#015#012a=rtpmap:0 PCMU/8000#015#012a=rtpmap:101 telephone-event/8000#015#012a=fmtp:101 0-16#015#012a=maxptime:60#015#012a=sendrecv#015#012a=rtcp:38519#015#012a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:f31jYQjjKBdYoqWYijx0V/ZtTfP17pTVW8NJGVQ4#015#012a=setup:actpass#015#012a=fingerprint:sh ...
Feb  8 23:04:43 Kamailio2 rtpengine[55410]: [[email protected]:50600] ... a-1 00:E3:0F:B6:C0:9F:D4:16:52:D2:41:A8:01:24:51:CD:3F:FB:B2:55#015#012a=ice-ufrag:VfqUSGBP#015#012a=ice-pwd:t5bLzDaNcqWUwzh7iEtyAZfweGo6#015#012a=candidate:04GQy5683m4TP1Da 1 UDP 2130706431 23.101.139.216 38518 typ host#015#012a=candidate:04GQy5683m4TP1Da 2 UDP 2130706430 23.101.139.216 38519 typ host#015#0126:result2:oke
Feb  8 23:04:43 Kamailio2 kamailio[59406]: INFO: <script>: Websocket Branch is {sip:85.6.14.8:4328;transport=WS} for {123455678}
Feb  8 23:04:43 Kamailio2 rtpengine[55410]: Got valid command from 127.0.0.1:52689: offer - { "sdp": "v=0#015#012o=root 1141861088 1141861088 IN IP4 12.34.56.78#015#012s=Asterisk PBX 13.1.0#015#012c=IN IP4 12.34.56.78#015#012t=0 0#015#012m=audio 12230 RTP/AVP 9 8 107 0 101#015#012a=rtpmap:9 G722/8000#015#012a=rtpmap:8 PCMA/8000#015#012a=rtpmap:107 opus/48000/2#015#012a=rtpmap:0 PCMU/8000#015#012a=rtpmap:101 telephone-event/8000#015#012a=fmtp:101 0-16#015#012a=maxptime:60#015#012a=sendrecv#015#012", "ICE": "force", "direction": [ "internal" ], "flags": [ "extenal", "force", "trust-address" ], "replace": [ "origin",  ...
Feb  8 23:04:43 Kamailio2 rtpengine[55410]: ... "session-connection" ], "transport-protocol": "RTP/SAVPF", "call-id": "[email protected]:50600", "received-from": [ "IP4", "12.34.56.78" ], "from-tag": "as4f0c032f", "command": "offer" }
Feb  8 23:04:43 Kamailio2 rtpengine[55410]: Unknown flag encountered: 'extenal'
Feb  8 23:04:43 Kamailio2 rtpengine[55410]: Unknown flag encountered: 'force'
Feb  8 23:04:43 Kamailio2 rtpengine[55410]: [[email protected]:50600] Returning to SIP proxy: d3:sdp747:v=0#015#012o=root 1141861088 1141861088 IN IP4 23.101.139.216#015#012s=Asterisk PBX 13.1.0#015#012c=IN IP4 23.101.139.216#015#012t=0 0#015#012a=ice-lite#015#012m=audio 38518 RTP/SAVPF 9 8 107 0 101#015#012a=rtpmap:9 G722/8000#015#012a=rtpmap:8 PCMA/8000#015#012a=rtpmap:107 opus/48000/2#015#012a=rtpmap:0 PCMU/8000#015#012a=rtpmap:101 telephone-event/8000#015#012a=fmtp:101 0-16#015#012a=maxptime:60#015#012a=sendrecv#015#012a=rtcp:38519#015#012a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:f31jYQjjKBdYoqWYijx0V/ZtTfP17pTVW8NJGVQ4#015#012a=setup:actpass#015#012a=fingerprint:sh ...
Feb  8 23:04:43 Kamailio2 rtpengine[55410]: [[email protected]:50600] ... a-1 00:E3:0F:B6:C0:9F:D4:16:52:D2:41:A8:01:24:51:CD:3F:FB:B2:55#015#012a=ice-ufrag:VfqUSGBP#015#012a=ice-pwd:t5bLzDaNcqWUwzh7iEtyAZfweGo6#015#012a=candidate:04GQy5683m4TP1Da 1 UDP 2130706431 23.101.139.216 38518 typ host#015#012a=candidate:04GQy5683m4TP1Da 2 UDP 2130706430 23.101.139.216 38519 typ host#015#0126:result2:oke
Feb  8 23:04:43 Kamailio2 kamailio[59406]: INFO: <script>: Websocket Branch is {sip:85.2.10.3:58509;transport=WS} for {123455678}
Feb  8 23:04:43 Kamailio2 rtpengine[55410]: Got valid command from 127.0.0.1:52689: offer - { "sdp": "v=0#015#012o=root 1141861088 1141861088 IN IP4 12.34.56.78#015#012s=Asterisk PBX 13.1.0#015#012c=IN IP4 12.34.56.78#015#012t=0 0#015#012m=audio 12230 RTP/AVP 9 8 107 0 101#015#012a=rtpmap:9 G722/8000#015#012a=rtpmap:8 PCMA/8000#015#012a=rtpmap:107 opus/48000/2#015#012a=rtpmap:0 PCMU/8000#015#012a=rtpmap:101 telephone-event/8000#015#012a=fmtp:101 0-16#015#012a=maxptime:60#015#012a=sendrecv#015#012", "ICE": "force", "direction": [ "internal" ], "flags": [ "extenal", "force", "trust-address" ], "replace": [ "origin",  ...
Feb  8 23:04:43 Kamailio2 rtpengine[55410]: ... "session-connection" ], "transport-protocol": "RTP/SAVPF", "call-id": "[email protected]:50600", "received-from": [ "IP4", "12.34.56.78" ], "from-tag": "as4f0c032f", "command": "offer" }
Feb  8 23:04:43 Kamailio2 rtpengine[55410]: Unknown flag encountered: 'extenal'
Feb  8 23:04:43 Kamailio2 rtpengine[55410]: Unknown flag encountered: 'force'
Feb  8 23:04:43 Kamailio2 rtpengine[55410]: [[email protected]:50600] Returning to SIP proxy: d3:sdp747:v=0#015#012o=root 1141861088 1141861088 IN IP4 23.101.139.216#015#012s=Asterisk PBX 13.1.0#015#012c=IN IP4 23.101.139.216#015#012t=0 0#015#012a=ice-lite#015#012m=audio 38518 RTP/SAVPF 9 8 107 0 101#015#012a=rtpmap:9 G722/8000#015#012a=rtpmap:8 PCMA/8000#015#012a=rtpmap:107 opus/48000/2#015#012a=rtpmap:0 PCMU/8000#015#012a=rtpmap:101 telephone-event/8000#015#012a=fmtp:101 0-16#015#012a=maxptime:60#015#012a=sendrecv#015#012a=rtcp:38519#015#012a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:f31jYQjjKBdYoqWYijx0V/ZtTfP17pTVW8NJGVQ4#015#012a=setup:actpass#015#012a=fingerprint:sh ...
Feb  8 23:04:43 Kamailio2 rtpengine[55410]: [[email protected]:50600] ... a-1 00:E3:0F:B6:C0:9F:D4:16:52:D2:41:A8:01:24:51:CD:3F:FB:B2:55#015#012a=ice-ufrag:VfqUSGBP#015#012a=ice-pwd:t5bLzDaNcqWUwzh7iEtyAZfweGo6#015#012a=candidate:04GQy5683m4TP1Da 1 UDP 2130706431 23.101.139.216 38518 typ host#015#012a=candidate:04GQy5683m4TP1Da 2 UDP 2130706430 23.101.139.216 38519 typ host#015#0126:result2:oke
Feb  8 23:04:43 Kamailio2 kamailio[59406]: INFO: <script>: Websocket Branch is {sip:18.9.18.10:56917;transport=WS} for {123455678}
Feb  8 23:04:43 Kamailio2 rtpengine[55410]: Got valid command from 127.0.0.1:52689: offer - { "sdp": "v=0#015#012o=root 1141861088 1141861088 IN IP4 12.34.56.78#015#012s=Asterisk PBX 13.1.0#015#012c=IN IP4 12.34.56.78#015#012t=0 0#015#012m=audio 12230 RTP/AVP 9 8 107 0 101#015#012a=rtpmap:9 G722/8000#015#012a=rtpmap:8 PCMA/8000#015#012a=rtpmap:107 opus/48000/2#015#012a=rtpmap:0 PCMU/8000#015#012a=rtpmap:101 telephone-event/8000#015#012a=fmtp:101 0-16#015#012a=maxptime:60#015#012a=sendrecv#015#012", "ICE": "force", "direction": [ "internal" ], "flags": [ "extenal", "force", "trust-address" ], "replace": [ "origin",  ...
Feb  8 23:04:43 Kamailio2 rtpengine[55410]: ... "session-connection" ], "transport-protocol": "RTP/SAVPF", "call-id": "[email protected]:50600", "received-from": [ "IP4", "12.34.56.78" ], "from-tag": "as4f0c032f", "command": "offer" }
Feb  8 23:04:43 Kamailio2 rtpengine[55410]: Unknown flag encountered: 'extenal'
Feb  8 23:04:43 Kamailio2 rtpengine[55410]: Unknown flag encountered: 'force'
Feb  8 23:04:43 Kamailio2 rtpengine[55410]: [[email protected]:50600] Returning to SIP proxy: d3:sdp747:v=0#015#012o=root 1141861088 1141861088 IN IP4 23.101.139.216#015#012s=Asterisk PBX 13.1.0#015#012c=IN IP4 23.101.139.216#015#012t=0 0#015#012a=ice-lite#015#012m=audio 38518 RTP/SAVPF 9 8 107 0 101#015#012a=rtpmap:9 G722/8000#015#012a=rtpmap:8 PCMA/8000#015#012a=rtpmap:107 opus/48000/2#015#012a=rtpmap:0 PCMU/8000#015#012a=rtpmap:101 telephone-event/8000#015#012a=fmtp:101 0-16#015#012a=maxptime:60#015#012a=sendrecv#015#012a=rtcp:38519#015#012a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:f31jYQjjKBdYoqWYijx0V/ZtTfP17pTVW8NJGVQ4#015#012a=setup:actpass#015#012a=fingerprint:sh ...
Feb  8 23:04:43 Kamailio2 rtpengine[55410]: [[email protected]:50600] ... a-1 00:E3:0F:B6:C0:9F:D4:16:52:D2:41:A8:01:24:51:CD:3F:FB:B2:55#015#012a=ice-ufrag:VfqUSGBP#015#012a=ice-pwd:t5bLzDaNcqWUwzh7iEtyAZfweGo6#015#012a=candidate:04GQy5683m4TP1Da 1 UDP 2130706431 23.101.139.216 38518 typ host#015#012a=candidate:04GQy5683m4TP1Da 2 UDP 2130706430 23.101.139.216 38519 typ host#015#0126:result2:oke
Feb  8 23:04:43 Kamailio2 kamailio[59438]: INFO: <script>: Reply from webrtc client {18.9.18.10:56917} for method {INVITE}: 100
Feb  8 23:04:43 Kamailio2 kamailio[59438]: INFO: <script>: Manage_Reply from webrtc client {18.9.18.10:56917} for method {INVITE}: 100

Feb  8 23:04:43 Kamailio2 kamailio[59438]: INFO: <script>: Reply from webrtc client {18.9.18.10:56917} for method {INVITE}: 180
Feb  8 23:04:43 Kamailio2 kamailio[59438]: INFO: <script>: Manage_Reply from webrtc client {18.9.18.10:56917} for method {INVITE}: 180

Feb  8 23:04:43 Kamailio2 kamailio[59438]: INFO: <script>: Reply from webrtc client {18.9.18.10:56917} for method {INVITE}: 482
Feb  8 23:04:43 Kamailio2 kamailio[59442]: INFO: <script>: Reply from webrtc client {85.2.10.3:58509} for method {INVITE}: 100
Feb  8 23:04:43 Kamailio2 kamailio[59442]: INFO: <script>: Manage_Reply from webrtc client {85.2.10.3:58509} for method {INVITE}: 100

SCA crash when db not configured

Loading the module in small config with no modparams crash. Updated and installed latest git head after patch to sca for previous crash.

#0  0x000000010a294823 in sca_db_get_connection () at sca_db.c:158
No locals.
#1  0x000000010a2ac1e7 in sca_subscription_db_update () at sca_subscribe.c:493
    db_con = (db1_con_t *) 0x0
    ht = (sca_hash_table *) 0x69687720726f7272
    entry = (sca_hash_entry *) 0x65203a524f525245
    sub = (sca_subscription *) 0x7fff8c8362dd
    i = 0
    rc = -1
    now = 1422480694
#2  0x000000010a23f4d9 in sca_mod_destroy () at sca.c:370
No locals.
#3  0x000000010932fe49 in destroy_modules () at sr_module.c:788
    t = (struct sr_module *) 0x10977b620
    foo = (struct sr_module *) 0x10977b090
#4  0x0000000109185dfb in cleanup (show_status=0) at main.c:512
    memlog = 0
#5  0x000000010918d75b in shutdown_children (sig=15, show_status=0) at main.c:654
No locals.
#6  0x00000001091a264d in main (argc=3, argv=0x7fff56b61a98) at main.c:2541

sipcapture: Repeating error message

With the sip capture module loaded, but not activated, this error message is repeated many times - with no traffic.

 0(93552) ERROR: sipcapture [hep.c:61]: hep_msg_received(): sipcapture:hep_msg_received HEP is not enabled
 0(93552) ERROR: sipcapture [hep.c:61]: hep_msg_received(): sipcapture:hep_msg_received HEP is not enabled
 0(93552) ERROR: sipcapture [hep.c:61]: hep_msg_received(): sipcapture:hep_msg_received HEP is not enabled
 0(93552) ERROR: sipcapture [hep.c:61]: hep_msg_received(): sipcapture:hep_msg_received HEP is not enabled
 0(93552) ERROR: sipcapture [hep.c:61]: hep_msg_received(): sipcapture:hep_msg_received HEP is not enabled
 0(93552) ERROR: sipcapture [hep.c:61]: hep_msg_received(): sipcapture:hep_msg_received HEP is not enabled
 0(93552) ERROR: sipcapture [hep.c:61]: hep_msg_received(): sipcapture:hep_msg_received HEP is not enabled
 0(93552) ERROR: sipcapture [hep.c:61]: hep_msg_received(): sipcapture:hep_msg_received HEP is not enabled
 0(93552) ERROR: sipcapture [hep.c:61]: hep_msg_received(): sipcapture:hep_msg_received HEP is not enabled

db_sqlite: Core dump at mod_Init

Trying to load my server in the background, the main process core dumps at init of db_sqlite
Git head, os/x

(gdb) bt full
#0  0x00007fff8610c66a in _dispatch_barrier_async_f_slow ()
No symbol table info available.
#1  0x00007fff8acd13bd in sqlite3_initialize ()
No symbol table info available.
#2  0x0000000104b75ba3 in sqlite_mod_init () at db_sqlite.c:69
No locals.
#3  0x00000001033bc93c in init_mod (m=0x103809b80) at sr_module.c:943
No locals.
#4  0x00000001033bc414 in init_mod (m=0x103809e58) at sr_module.c:940
No locals.

Kamailio v 4.3 failled

version: kamailio 4.3.0-dev5 (x86_64/linux) ab4271
flags: STATS: Off, USE_TCP, USE_TLS, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, F_MALLOC, DBG_F_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: ab4271


Mar 17 16:22:28 Kamailio2 kamailio[1376]: ALERT: <core> [main.c:727]: handle_sigs(): child process 1381 exited by a signal 11
Mar 17 16:22:28 Kamailio2 kamailio[1376]: ALERT: <core> [main.c:730]: handle_sigs(): core was generated
Mar 17 16:22:28 Kamailio2 kamailio[1376]: INFO: <core> [main.c:742]: handle_sigs(): terminating due to SIGCHLD
Mar 17 16:22:28 Kamailio2 kamailio[1379]: INFO: <core> [main.c:793]: sig_usr(): signal 15 received

TCP packets are Malformed

Hi Team,

Recently we upgraded our kamailo server to 4.2.1 and it was running successfuly with out any issue. We are seeing some issue with the TCP calls which are relayed from the kamilio.

We have set of physical servers and the calls are distributed by checking the dispacther module. Sometimes we are seeing the TCP packets are malformed from kamilio to one server. We can see the UDP calls are working fine with the same server at the same time TCP packets are malformed. That means there is no issue with the network connectivity between the kamailio server and our media server. Once we restart the kamilio we are not seeing this issue and the TCP calls will start working with kamilio and media server.

Can you help us to answer these questions.

  1. Any idea about this TCP packet malformed error ?. We were not able to reproduce this TCP packet issue and we are seeing this error in our production environment.
  2. Sometimes we have some errors for TCP max conn (ERROR) : 2048 (the default). We are plannig to increase the TCP connection to 4096 (tcp_max_connections=4096). Whether it will create any issue if we are increasing to 4096 or it will affect kamailio performance ?.

Thanks for looking in to this.

SCA: Inbound calls show SCA apperance until call is picked up

Using Kamailio 4.1.3 and now 4.2.3 I get a scenario that an incoming call from an Audiocodes Gateway (MP-114 or Mediant-1000) shows the call appearance on the Phones (Polycom VVX-310, VVX-410 and SPIP-650). When a phone picks up the call, the appearances disappear from the other phones.
The other side of that, when one of the Polycom's calls out, the line appearance act normally.
Used the latest kamailio.cfg with the additions of the module based configs from the 4.2 wiki.

debugger: config test report

In testing environment It would be nice to be able to append sip headers X-Kamailio-test and X-Kamailio-test-ID as a way to identify a collection of request/responses related to a a single test.

Be able to generate tests reports via debugger RPC command using the value of X-Kamailio-test as key.

The content of report could be:

  • SIP message received
  • SIP messages sended
  • flow of config execution routes ( start, end, exit )
  • list of the variable and its value

API for ruby

I'm using Kamailio with a RoR, and i want to add a SIP user from my application , i wonder if there is an API to do that !!

Thanks for help

sipcapture: "core parsing of SIP message failed" with tcp defragmented message

Contact: sip:[email protected]:5060;alias=x.x.x.x480942;+g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service>
4(21951) ERROR: [receive.c:149]: receive_msg(): core parsing of SIP message failed (x.x.x.x:5060/1)
4(21951) ERROR: [parser/msg_parser.c:277]: get_hdr_field(): ERROR: get_hdr_field: bad body for <Contact: sip:[email protected]:5060;alias=x.x.x.x~48094~2;+g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service>(7)
4(21951) INFO: [parser/msg_parser.c:355]: parse_headers(): ERROR: bad header field [Contact: <sip:xxxxx]
4(21951) ERROR: [parser/msg_parser.c:705]: parse_msg(): ERROR: parse_msg: message=<INVITE sip:[email protected]:5060;alias=x.x.x.x50601 SIP/2.0

cnxcc: fails to send BYE to websocket-connected call-leg

See the end of quoted log. It tries to resolve <sip:[email protected];transport=ws> as traditional SIP URI, and fails. Need support of WS and WSS URIs.

Feb 13 19:57:18 vmwrtc /usr/local/sbin/kamailio[12467]: DEBUG: cnxcc [cnxcc_check.c:87]: check_calls_by_money(): CID [kqBcNZPwNa], start_timestamp [1423857429], seconds alive [9], consumed credit [10.000000]
Feb 13 19:57:18 vmwrtc /usr/local/sbin/kamailio[12467]: INFO: cnxcc [cnxcc_check.c:96]: check_calls_by_money(): ec=0.000000, ca=10.000000, ca2=9.000000
Feb 13 19:57:18 vmwrtc /usr/local/sbin/kamailio[12467]: DEBUG: cnxcc [cnxcc_check.c:109]: check_calls_by_money(): Client [customer_name] | Ended-Calls-Credit-Spent: 0.000000  TotalCredit/MaxCredit: 10.000000/10.000000
Feb 13 19:57:18 vmwrtc /usr/local/sbin/kamailio[12467]: DEBUG: cnxcc [cnxcc_mod.c:894]: terminate_all_calls(): Killing call with CID [kqBcNZPwNa]
Feb 13 19:57:18 vmwrtc /usr/local/sbin/kamailio[12467]: DEBUG: cnxcc [cnxcc_mod.c:967]: terminate_call(): Got kill signal for call [kqBcNZPwNa] client [customer_name] h_id [4713] h_entry [335]. Dropping it now
Feb 13 19:57:18 vmwrtc /usr/local/sbin/kamailio[12467]: DEBUG: dialog [dlg_req_within.c:492]: mi_terminate_dlg(): h_entry 335 h_id 4713
Feb 13 19:57:18 vmwrtc /usr/local/sbin/kamailio[12467]: DEBUG: dialog [dlg_hash.c:633]: dlg_lookup(): ref dlg 0x7ff48c38bde8 with 1 -> 3
Feb 13 19:57:18 vmwrtc /usr/local/sbin/kamailio[12467]: DEBUG: dialog [dlg_hash.c:635]: dlg_lookup(): dialog id=4713 found on entry 335
Feb 13 19:57:18 vmwrtc /usr/local/sbin/kamailio[12467]: DEBUG: dialog [dlg_req_within.c:347]: send_bye(): sending BYE to caller
Feb 13 19:57:18 vmwrtc /usr/local/sbin/kamailio[12467]: DEBUG: tm [uac.c:249]: t_uac_prepare(): DEBUG:tm:t_uac: next_hop=<sip:[email protected]:1904>
Feb 13 19:57:18 vmwrtc /usr/local/sbin/kamailio[12467]: DEBUG: tm [uac.c:150]: dlg2hash(): DEBUG: dlg2hash: 61830
Feb 13 19:57:18 vmwrtc /usr/local/sbin/kamailio[12467]: DEBUG: dialog [dlg_req_within.c:380]: send_bye(): BYE sent to caller
Feb 13 19:57:18 vmwrtc /usr/local/sbin/kamailio[12467]: DEBUG: dialog [dlg_req_within.c:347]: send_bye(): sending BYE to callee
Feb 13 19:57:18 vmwrtc /usr/local/sbin/kamailio[12467]: DEBUG: tm [uac.c:249]: t_uac_prepare(): DEBUG:tm:t_uac: next_hop=<sip:[email protected];transport=ws>
Feb 13 19:57:18 vmwrtc /usr/local/sbin/kamailio[12467]: ERROR: <core> [resolve.c:1693]: sip_hostport2su(): could not resolve hostname: "r2r3d4o15av3.invalid"
Feb 13 19:57:18 vmwrtc /usr/local/sbin/kamailio[12467]: ERROR: tm [ut.h:319]: uri2dst2(): failed to resolve "r2r3d4o15av3.invalid"
Feb 13 19:57:18 vmwrtc /usr/local/sbin/kamailio[12467]: ERROR: tm [uac.c:272]: t_uac_prepare(): t_uac: no socket found
Feb 13 19:57:18 vmwrtc /usr/local/sbin/kamailio[12467]: ERROR: dialog [dlg_req_within.c:374]: send_bye(): failed to send the BYE request
Feb 13 19:57:18 vmwrtc /usr/local/sbin/kamailio[12467]: DEBUG: dialog [dlg_hash.c:851]: dlg_unref(): unref dlg 0x7ff48c38bde8 with 1 -> 2
Feb 13 19:57:18 vmwrtc /usr/local/sbin/kamailio[12467]: ERROR: cnxcc [cnxcc_mod.c:1013]: terminate_call(): Error executing dlg_end_dlg command. Return code was [500]

I'm trying to fix this in code by myself, but any guidance and help is appreciated, as I'm not experienced in Kamailio internals.

Errors work BLF modules pua and presence

Errors work BLF modules pua and presence:

loadmodule "presence.so"
loadmodule "presence_xml.so"
loadmodule "presence_dialoginfo.so"
loadmodule "pua.so"
loadmodule "pua_dialoginfo.so"

modparam("presence", "db_url", DBURL)
modparam("presence_xml", "db_url", DBURL)
modparam("presence_xml", "force_active", 1)
modparam("presence_dialoginfo", "force_single_dialog", 1)


 5(18085) ERROR: presence [publish.c:139]: msg_presentity_clean(): event not found
 5(18085) ERROR: db_mysql [km_dbase.c:123]: db_mysql_submit_query(): driver error on query: Duplicate entry 'a.1425449702.18081.57.5---' for key 'pua_idx'
 5(18085) ERROR: <core> [db_query.c:335]: db_do_update(): error while submitting query
 5(18085) ERROR: pua [pua.c:1079]: db_update(): while updating in database

pua: E_Tag miss match due to race between consecutive PUBLISH requests

If a PUBLISH request is sent before a 200 OK for the previous PUBLISH request is received, the E-Tag is reset which leads to inconsistent presentity data in the presence server.
This is happening because the second PUBLISH is sent with the same E-Tag as the previous one, but the presence server has an updated the E-Tag (generated while handling the first PUBLISH).
The pua module should implement a queuing mechanism for subsequent PUBLISH request while a previous PUBLISH transaction is in progress. No new PUBLISH requests should be sent before a response to the previous PUBLISH request was received and the E-Tag updated.

introduce RUN_DIR

In order to get rid of any occurrence of /tmp in modules, introduce a RUN_DIR make option and every module should honor it

default could be /var/run/$(NAME)

Related to #48

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.