Table of Contents

Tips for Kamailio migration

The page collects tips to migrate Kamailio to SIP-Router and get same behaviour. There are Kamailio functions that do not exist in SIP Router, but alternatives are available to get more or less same behaviour.

TCP Connection Lifetime

Log levels

Module loading

http://sip-router.org/wiki/cookbooks/core-cookbook/devel#loadpath

Branch Flags Operations

http://sip-router.org/docbook/sip-router/branch/master/modules_k/kex/kex.html

Script Flags Operations

http://sip-router.org/docbook/sip-router/branch/master/modules_k/kex/kex.html

Dst URI Operations

http://sip-router.org/docbook/sip-router/branch/master/modules_k/kex/kex.html

TM Extensions

http://sip-router.org/docbook/sip-router/branch/master/modules_k/tmx/tmx.html

Core parameters

http://sip-router.org/docbook/sip-router/branch/master/modules_k/pv/pv.html

http://sip-router.org/wiki/cookbooks/core-cookbook/devel#dns_cache_negative_ttl

By default, use_dns_failover is currently "off". Hopefully, the default can be changed to "on" in order to be compatible with Kamailio default.

Core Functions

Script syntax

Test operator [...]

Bit tests must be written in conditions without brackets [ and ], for example,

    if ($var(a) & 4)
        log("var a has third bit set\n");

Operator :=

   # Kamailio: $avp(abc) := 'xyz';
   $(avp(abc)[*]) = 'xyz';
 
   # Kamailio: $avp(abc) := null;
   $(avp(abc)[*]) = $null;

Module parameters

In SIP Router, AVPs that are set in request route are always visible in branch, failure, and onreply_route. In other words, SIP Router behaves like Kamailio when onreply_avp_mode is set to value 1.

In SIP Router, AVP value of tm module parameters fr_timer, fr_inv_timer, and contacts_avp is currently written without $avp(), for example, "i:705". This is to be fixed.

In SIP Router, time value of the above parameters is given in milliseconds, whereas in Kamailio they are given in seconds (see tm timers for more details). In order to make migration easier, perhaps a new tm module parameter could be introduced to specify, in which units time values are given.

Module functions

Module parameter "auto_inv_100" can be used to globally turn off gneration of provisional replies (default is 1 == "on"). It is also possible to dynamically control generation of provisional replies using function t_set_auto_inv_100().

t_relay() does not send a negative reply implicitly. Negative reply is auto-generated at the end of the script if no reply was explicitly sent from the script.

Core parameter "use_dns_failover" can be used to globally turn off DNS failover (default is "off").

Route blocks

Check request sanity at the beginning of script (see sanity module).

null keyword

null keyword is not present in SIP Router. Use pseudo-variable $null instead.

In addition, the operator defined can be used to check if a value is null or not.

if( ! defined $avp(x) ) {
   # the avp is null
   ...
}