Upgrade Kamailio from v4.4.x to v5.0.0

The page contains the details about the changes that were made to old components during the development of v5.0.0 compared with what existed in v4.4.x. It does not include the brand new modules, focusing on how to upgrade database and configuration file from v4.4.x to run with Kamailio devel.

Previous Stable Release

If you look for the guidelines to upgrade to previous stable release, see:

Remarks

Following tokens are used to mark the changes:

  • INF - the change doesn't really have any direct impact - no action required in old config
  • CPM - the change was used with the new value via explicit parameter in default config file from old releases
  • RCM - the change is recommended to be done if you had an explicit different or lower value for this parameter in old config

Modules

Removed Modules

mi_datagram

The jsonrpcs module can be used instead to execute RPC commands over datagram sockets (unix socket file, IPv4 or IPv6).

mi_fifo

The jsonrpcs module can be used instead to execute RPC commands over a FIFO file.

mi_xmlrpc

The xmlrpc module can be used instead to execute RPC commands over HTTP/S XMLRPC.

pua_mi

The pua_rpc module can be used instead to trigger presence PUBLISH or SUBSCRIBE requests via RPC commands.

purple

It is no longer working, not being updated to use latest libs for a very long time

iptrtpproxy

It is no longer working, not being updated to use latest libs for a very long time

Renamed Modules

The module that had a '-' (dash/minus) in the name were renamed to remove it, respectively:

  • cpl-c => cplc
  • janssonrpc-c => janssonrpcc
  • jsonrpc-c => jsonrpcc
  • jsonrpc-s => jsonrpcs

Impacted Modules

jsonrpcs

  • the default transports are set to FIFO file and unixsocket file, allowing to be used with kamctl and kamacmd via default kamailio.cfg
  • if you use it together with xhttp module (json-rpc via http), then you have to set the transport parameter accordingly

utils

  • http_query() function has been removed, use http_client module instead

Internal Libraries

kcore

The library has been removed.

Parts of its code have been removed or merged into other components.

kmi

The library has been removed.

The entire Management Interface (MI) code was removed. Instead of MI commands use RPC commands. The tool kamctl is using now RPC commands via jsonrpcs module.

Core

Parameters

Database

MySQL Database Structure

Run following SQL statements in MySQL client to upgrade database structure from v4.4 to v5.0:

--table: dialplan
ALTER TABLE dialplan CHANGE COLUMN repl_exp repl_exp varchar(256) NOT NULL; -- was varchar(64) NOT NULL

--table: sca_subscriptions
ALTER TABLE sca_subscriptions ADD COLUMN server_id int(11) NOT NULL DEFAULT '0';
ALTER TABLE sca_subscriptions DROP INDEX sca_expires_idx; # was INDEX (expires)
ALTER TABLE sca_subscriptions ADD INDEX sca_expires_idx (server_id,expires);
UPDATE version SET table_version=2 WHERE table_name="sca_subscriptions";

--table: subscriber
ALTER TABLE subscriber CHANGE COLUMN rpid rpid varchar(128) DEFAULT NULL; -- was varchar(64) DEFAULT NULL
ALTER TABLE subscriber CHANGE COLUMN email_address email_address varchar(128) DEFAULT NULL; -- was varchar(64) NOT NULL DEFAULT ''
ALTER TABLE subscriber CHANGE COLUMN password password varchar(64) NOT NULL DEFAULT ''; -- was varchar(25) NOT NULL DEFAULT ''
ALTER TABLE subscriber CHANGE COLUMN ha1 ha1 varchar(128) NOT NULL DEFAULT ''; -- was varchar(64) NOT NULL DEFAULT ''
ALTER TABLE subscriber CHANGE COLUMN ha1b ha1b varchar(128) NOT NULL DEFAULT ''; -- was varchar(64) NOT NULL DEFAULT ''
UPDATE version SET table_version=7 WHERE table_name="subscriber";


--table: uacreg
ALTER TABLE uacreg CHANGE COLUMN auth_proxy auth_proxy varchar(128) NOT NULL DEFAULT ''; -- was varchar(64) NOT NULL DEFAULT ''
ALTER TABLE uacreg CHANGE COLUMN l_domain l_domain varchar(64) NOT NULL DEFAULT ''; -- was varchar(128) NOT NULL DEFAULT ''
ALTER TABLE uacreg CHANGE COLUMN r_domain r_domain varchar(64) NOT NULL DEFAULT ''; -- was varchar(128) NOT NULL DEFAULT ''
ALTER TABLE uacreg ADD COLUMN auth_ha1 varchar(128) NOT NULL DEFAULT '';
UPDATE version SET table_version=3 WHERE table_name="uacreg";

Tools

kamctl

By default, kamctl uses now JSONRPC protocol over FIFO file, instead of the old MI protocol. The commands are more or less the same, but the output is now in JSON format, incompatible with the old output.

Config Snippets

This section collects configuration file snippets that can help migrating to v5.0.

Replace MI With RPC

The default configuration file for v4.4 has following snippets using MI components:

...
loadmodule "mi_fifo.so"
...
loadmodule "mi_rpc.so"
...
# ----- mi_fifo params -----
#modparam("mi_fifo", "fifo_name", "/var/run/kamailio/kamailio_fifo")
...

Replace them with next snippets to upgrade to v5.0:

...
loadmodule "jsonrpcs.so"
...
# ----- jsonrpcs params -----
modparam("jsonrpcs", "pretty_format", 1)
/* set the path to RPC fifo control file */
# modparam("jsonrpcs", "fifo_name", "/var/run/kamailio/kamailio_rpc.fifo")
/* set the path to RPC unix socket control file */
# modparam("jsonrpcs", "dgram_socket", "/var/run/kamailio/kamailio_rpc.sock")
...