Upgrade Kamailio from v5.1.x to v5.2.0

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

Previous Stable Release

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


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
  • UPG - the change has to be done, older config does not work any longer


Upgraded Modules


UPG: Several parameters that were used to specify AVP names were removed, you have to remove the appropriate config modparams:

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(AVP_SOCK)")
modparam("dispatcher", "attrs_avp", "$avp(AVP_ATTRS)")

Starting with v5.2.0, the module is using XAVPs instead of those AVPs, the related parameters are:

  • xavp_dst
  • xavp_dst_mode
  • xavp_ctx
  • xavp_ctx_mode

See: https://www.kamailio.org/docs/modules/devel/modules/dispatcher.html


A new column 'ruid' has been added to the presentity table (used for distributing presence documents via dmq). This table holds the records corresponding to the PUBLISH requests sent by UAs.

The cleanest way to upgrade is:

  • stop kamailio 5.1
  • delete records from presentity table
  • update the structure of presentity table
  • start kamailio 5.2

The UAs will send new PUBLISH periodically, so the table will get populated again. If you want to shorten the interval for PUBLISH requests, set max_expire parameter for presence module, then restart and wait some time until all UAs send another PUBLISH. Do the upgrade as described above, and then set back the max_expire to the older value.

Removed Modules

  • none

Renamed Modules

  • none

Internal Libraries




Log Messages

The order of the attributes printed in the log messages was changed to have the log level first -- it was:

$log-prefix $log-level $log-message

Now it is:

$log-level $log-prefix $log-message


MySQL Database Structure

Run following SQL statements in MySQL client to upgrade database structure from v5.1 to v5.2:

-- location table - optional update
ALTER TABLE location_attrs CHANGE COLUMN avalue avalue varchar(512) NOT NULL DEFAULT '';

-- presentity table
ALTER TABLE presentity CHANGE COLUMN etag etag varchar(128) NOT NULL;
CREATE UNIQUE INDEX ruid_idx ON presentity (ruid);
UPDATE version SET table_version=5 WHERE table_name='presentity';

-- pua table - optional update
ALTER TABLE pua CHANGE COLUMN etag etag varchar(128) NOT NULL;

-- subscriber table - optional update
ALTER TABLE subscriber DROP COLUMN rpid;
ALTER TABLE subscriber DROP COLUMN email_address;

-- xcap table - optional update
ALTER TABLE xcap CHANGE COLUMN etag etag varchar(128) NOT NULL;