Table of Contents

Migrating Kamailio v1.5.x to Kamailio v3.0.0

Note: This is not a full list. There are much more changes than stated in this document. E.g. haven't found the change for memlog=0 yet … … http://www.kamailio.org/dokuwiki/doku.php/core-cookbook:3.1.x?s[]=memlog#memlog

Changes in core

* Kamailio 3.0.0 is first release that uses the core of http://sip-router.org project

* IMPORTANT put next line first in your config file

#!KAMAILIO

Changes in modules

* Kamailio 3.0.0 is first release that uses the TM module of http://sip-router.org project * kex and tmx modules must be loaded – they provide functionalities existing in core or tm of Kamailio 1.5.x

Changes in database schema

LCR

Dialog

Permissions

Tips for migration to Kamailio 3.0.0

The section collects tips to migrate Kamailio 1.5.x to 3.0.0 in order to get as much compatibility and functionality as possible. There are Kamailio 1.5.x functions that do not exist in Kamailio 3.0.0, but alternatives are available to get more or less same behaviour.

TCP Connection Lifetime

Log levels

Module loading

http://www.kamailio.org/dokuwiki/doku.php/core-cookbook:3.0.x#loadpath

Branch Flags Operations

http://kamailio.org/docs/modules/3.0.x/modules_k/kex.html

Script Flags Operations

http://kamailio.org/docs/modules/3.0.x/modules_k/kex.html

Dst URI Operations

http://kamailio.org/docs/modules/3.0.x/modules_k/kex.html

TM Extensions

http://kamailio.org/docs/modules/3.0.x/modules_k/tmx.html

Core parameters

http://kamailio.org/docs/modules/3.0.x/modules_k/pv.html

http://www.kamailio.org/dokuwiki/doku.php/core-cookbook:3.0.x#dns_cache_negative_ttl

By default, use_dns_failover is currently “off”.

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 1.5.x: $avp(abc) := 'xyz';
   $(avp(abc)[*]) = 'xyz';
 
   # Kamailio 1.5.x: $avp(abc) := null;
   $(avp(abc)[*]) = $null;

Modulo %

$var(x) = $var(y) mod 5;

Module parameters

In Kamailio 3.0.0, AVPs that are set in request route are always visible in branch, TM-reply and failure routes. If you set AVPS in an onreply_route, they are also visible after execution of this onreply_route.

In Kamailio 3.0.0, time value of the above parameters is given in milliseconds, whereas in Kamailio 1.5.x they are given in seconds (see tm timers for more details).

In Kamailio 3.x, if you use an AVP for the code parameter (first one), make sure to assign it an integer value. Example: old versions would accept these statements

$avp(s:example) = "404";
sl_send_reply("$avp(s:example)", "Some Reason");

But after 3.x Kamailio will tell you “Could not convert PV to int” in this case. Some possible workarounds are:

$avp(s:example) = 404;

or:

$avp(s:example) = (int) $avp(s:example);

Module functions

t_relay

Translations:

1.5.x 3.0.0
t_relay() t_relay()
t_relay(proxy) t_relay_to(proxy)
t_relay(flags) t_relay_to(flags)
t_relay(proxy, flags) t_relay_to(proxy, flags)

Examples:

1.5.x 3.0.0
t_relay() t_relay()
t_relay(“udp:1.2.3.4”) t_relay_to(“udp:1.2.3.4”)
t_relay(“0x01”) t_relay_to(“0x01”)
t_relay(“udp:1.2.3.4”, “0x01”) t_relay_to(“udp:1.2.3.4”, “0x01”)

Module parameter “auto_inv_100” can be used to globally turn off generation 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().

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

t_was_cancelled

t_check_trans

See http://sip-router.org/docbook/sip-router/branch/3.1/modules/tm/tm.html#t_check_trans


Note that the e2e ACK matching is more of a hint then a certainty. A delayed e2e ACK might arrive after the transaction wait time elapses, when the INVITE transaction no longer exists and thus would not match anything. There are also cases when tm would not keep all the information needed for e2e ACK matching (since this is not needed for a statefull proxy and it requires additional memory, tm will not keep this information unless needed by some other module or callbacks).


Route blocks

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

null keyword

null keyword is not present in Kamailio 3.0.0. 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
   ...
}

not operator in if()

if (!$fd=~“regexp”) must now be written as if (!($fd=~“regexp”)) for what reason ever.

Notice: the operator !~ seems not to be working for some reason as well. e.g.: ($fd !~ 'not this') must be replaced with !($fd =~ 'not this')

empty tree

Some empty { } section are not possible anymore. E.g.

if (expr) {
   setflag(1);
} else if (expr) {
   # do nothing in this case
} else if (expr) {
   setflag(2);
} else {
   setflag(3);
}

gives a syntax error in the line behind the comment for whatever reason.