Table of Contents

Migrating Kamailio v3.0.x to v3.1.0

Database Structure

The structure of following DB tables that existed in v3.0.x was changed:

Next is the MySQL script to update tables for dialog, dispatcher and permissions modules. By using it, the existing data in these tables is not lost, just the structure is updated.

ALTER TABLE dialog DROP COLUMN toroute;
ALTER TABLE dialog ADD COLUMN toroute_name VARCHAR(32);
UPDATE version SET table_version=5 WHERE table_name='dialog';
ALTER TABLE dispatcher ADD COLUMN attrs VARCHAR(128) DEFAULT '' NOT NULL;
UPDATE version SET table_version=4 WHERE table_name='dispatcher';
ALTER TABLE address ADD COLUMN tag VARCHAR(64);
UPDATE version SET table_version=4 WHERE table_name='address';

lcr tables

You can migrate from old data and db structure of lcr module to new version by using migration script available at:

If you want to do by hand or you don't have any data in lcr module tables, then next is the MySQL script to update tables for lcr module. Beware that by running the script as provided next, you will lose old data you had for lcr module since the new version requires new tables, therefore old tables are removed.

DROP TABLE gw;
DROP TABLE lcr;
DELETE FROM version WHERE table_name='gw';
DELETE FROM version WHERE table_name='lcr';
 
INSERT INTO version (table_name, table_version) values ('lcr_gw','1');
CREATE TABLE lcr_gw (
    id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
    lcr_id SMALLINT UNSIGNED NOT NULL,
    gw_name VARCHAR(128),
    ip_addr VARCHAR(15),
    hostname VARCHAR(64),
    port SMALLINT UNSIGNED,
    params VARCHAR(64),
    uri_scheme TINYINT UNSIGNED,
    transport TINYINT UNSIGNED,
    strip TINYINT UNSIGNED,
    tag VARCHAR(16) DEFAULT NULL,
    flags INT UNSIGNED DEFAULT 0 NOT NULL,
    defunct INT UNSIGNED DEFAULT NULL,
    CONSTRAINT lcr_id_ip_addr_port_hostname_idx UNIQUE (lcr_id, ip_addr, port, hostname)
) ENGINE=MyISAM;
 
INSERT INTO version (table_name, table_version) values ('lcr_rule_target','1');
CREATE TABLE lcr_rule_target (
    id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
    lcr_id SMALLINT UNSIGNED NOT NULL,
    rule_id INT UNSIGNED NOT NULL,
    gw_id INT UNSIGNED NOT NULL,
    priority TINYINT UNSIGNED NOT NULL,
    weight INT UNSIGNED DEFAULT 1 NOT NULL,
    CONSTRAINT rule_id_gw_id_idx UNIQUE (rule_id, gw_id)
) ENGINE=MyISAM;
 
CREATE INDEX lcr_id_idx ON lcr_rule_target (lcr_id);
 
INSERT INTO version (table_name, table_version) values ('lcr_rule','1');
CREATE TABLE lcr_rule (
    id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
    lcr_id SMALLINT UNSIGNED NOT NULL,
    prefix VARCHAR(16) DEFAULT NULL,
    from_uri VARCHAR(64) DEFAULT NULL,
    stopper INT UNSIGNED DEFAULT 0 NOT NULL,
    enabled INT UNSIGNED DEFAULT 1 NOT NULL,
    CONSTRAINT lcr_id_prefix_from_uri_idx UNIQUE (lcr_id, prefix, from_uri)
) ENGINE=MyISAM;

Modules

modules_k/auth

modules_k/auth_db

modules_k/auth_radius

modules_k/dialog

modules_k/dispatcher

modules/lcr

modules_k/nathelper

modules_k/permissions

modules_k/ratelimit

modules_k/sl

modules_k/sms

modules/tm

IMPORTANT - pay attention to next changes

Core