Skip to content

Migration from 2.4.x to 3.0.0

This section is meant to provide useful help in migrating your OpenSIPS installations from the 2.4.0 version to 3.0.0.

You can find the all the new additions in the 3.0.0 release compiled under this page. The ChangeLog may help your understanding of the migration / update process.


You can migrate your 2.4.x MySQL DB to the 3.0.x format by using the opensips-cli tool :

Terminal window
$ opensips-cli -x database migrate 2.4_to_3.0 opensips_2_4 opensips_3_0

where :

  • opensips_2_4 is the existing DB name corresponding to version 2.4.x format
  • opensips_3_0 is the DB name to be created for 3.0.x format

See the opensips-cli documentation for more details.


The following is the full list of backwards-incompatible syntax or functional changes in the OpenSIPS configuration script (some of them are fixes):

  • the children parameter is replaced by udp_workers parameter. The old name is marked as obsolete, but it still can be used (it will be effectively removed in the next release)

  • the tcp_children parameter is replaced by tcp_workers parameter. The old name is marked as obsolete, but it still can be used (it will be effectively removed in the next release)

  • the use_children option inside the listen parameter is replaced by use_workers. The old name is marked as obsolete, but it still can be used (it will be effectively removed in the next release)

  • global parameter xlog_default_level was renamed as xlog_print_level, with no change in its behavior

As a result of the enhancement of the interface for module functions (for generic support of script variables in the parameters), some parameters will have be passed without quotes (like if they are numerical values or returning variables).

For example:

send_reply( "200", "OK");

is now

send_reply( 200, "OK");

as the first parameter requires a numerical value.

Also :

check_source_address( "4", "$avp(ctx)");

is now

check_source_address( 4, $avp(ctx));

as the first parameter requires a numerical value and the second one requires a returning variable.

Escape ”$” characters in plain-text strings

Section titled “Escape ”$” characters in plain-text strings”

Since all OpenSIPS strings which get passed to functions have become format strings in 3.0, each singular ”$” sign must be escaped using its ”$$” form, otherwise the parser will expect a variable over there!

For example:

avp_subst("$avp(sdp_ip)", "/^c=IN IP[46] (.*)$/\1/");

becomes:

avp_subst("$avp(sdp_ip)", "/^c=IN IP[46] (.*)$$/\1/");

There are many changes as the ones listed above. IF during the startup, while the config file is parsed to get an error like:

ERROR:core:fix_cmd: Param [n] expected to be an integer or variable
ERROR:core:fix_actions: Failed to fix command <name_of_function>

it means the n-th parameter of the module function name_of_function changed from string type to integer or variable type.

To do the translation to the right type of parameter, check the documentation of faulty function - there you can find the required type for each parameter. If you have doubts how to pass the certain parameters (depending on their type), please check this documentation.

  • avp_insert() was dropped in favour of the equivalent, already existing syntax: $(avp(foo)[append]) = “bar”; (for appending to end-of-list) and $(avp(foo)[3]) = “bar”; (for writing at a specific AVP index)
  • buf_size query printing buffer was removed in favour of the new generic format string buffer setting, pv_print_buf_size
  • the tls_client_domain module parameter was removed in favor of a new way of enabling TLS for specific MySQL connections via the DB URL.
  • the current_id, current_info and neighbor_info module parameters were renamed to my_node_id, my_node_info and neighbor_node_info respectively.
  • dp_translate() parameters have been reworked to be more clear:
    • the composite “partition:id” parameter was split into “id” (mandatory) and “partition” (optional)
    • the composite “src/dest” parameter was split into “input” (mandatory) and “out_var” (optional)
  • ds_select_dst() parameters have been reworked to be easier to understand and maintain. Specifically:
    • the “s” (skip destination) flag was dropped (equivalent logic: “$du == NULL && ds_select_dst()”)
    • the “a” (append destination) flag was added, replacing all the complex set / algorithm / flags list-parameter logic in favour of simply calling ds_select_dst() multiple times.
    • the “set” composite parameter was decoupled into two basic parameters: “set” (mandatory) and “partition” (optional)
  • ds_select_domain() parameters have been reworked to be easier to understand and maintain. The changes follow the same pattern as ds_select_dst().
  • ds_count()‘s complex “set” parameter has been split in two simple parameters: “set” (mandatory) and “partition” (optional).
  • ds_is_in_list()‘s complex “set” parameter has been split in two simple parameters: “set” (mandatory) and “partition” (optional).
  • the old module parameter status_replication_cluster was renamed as cluster_id.
  • do_routing()‘s composite “[partition:]group_id” parameter has been split in two parameters: “group_id” (mandatory) and “partition” (optional)
  • route_to_carrier()‘s composite “[partition:]carrier_id” parameter has been split in two parameters: “carriers” (mandatory) and “partition” (optional)
  • route_to_gw()‘s composite “[partition:]gw_id” parameter has been split in two parameters: “gw_id” CSV (mandatory) and “partition” (optional)
  • use_next_gw()‘s parameter order has been changed for consistency reasons (“partition” is last now)
  • goes_to_gw()‘s parameter order has been changed for consistency reasons (“partition” is last now)
  • is_from_gw()‘s parameter order has been changed for consistency reasons (“partition” is last now)
  • dr_is_gw()‘s parameter order has been changed for consistency reasons (“partition” is last now)
  • fetch_event_params() function has been completely dropped - in order to fetch the parameters of an event, you will have to use the $params(name) variable in the route. As an example, the following snippets have the same meaning in the two different versions:
# route used in OpenSIPS 2.4
event_route[E_PIKE_BLOCKED] {
fetch_event_params("ip=$avp(pike-ip)");
xlog("IP $avp(pike-ip) has been blocked\n");
}
# route used in OpenSIPS 3.0
event_route[E_PIKE_BLOCKED] {
xlog("IP $param(ip) has been blocked\n");
}
  • the mi_http module has been renamed to mi_html module. you have to replace your modparam("mi_http"... lines with modparam("mi_html"... lines
  • the mi_json module has been renamed to mi_http module. you have to replace your modparam("mi_json"... lines with modparam("mi_http"... lines
  • as the protocol for MI interaction has been shifted to JSON-RPC, you must now use POST instead of GET as HTTP request method.
  • check_address()‘s composite “[partition:]group_id” parameter has been split in two parameters: “group_id” (mandatory) and “partition” (optional)
  • check_source_address()‘s composite “[partition:]group_id” parameter has been split in two parameters: “group_id” (mandatory) and “partition” (optional)
  • get_source_group()‘s composite “[partition:]var” parameter has been split in two parameters: “var” (mandatory) and “partition” (optional)
  • the siptrace module has been renamed to tracer module. you have to replace your modparam("siptrace"... lines with modparam("tracer"... lines
  • function sip_trace() was renamed in the new module to trace()
  • MI function sip_trace was renamed in the new module to trace
  • the address column from the tls_mgm table was removed and the TLS domain matching is now driven by two new columns: match_ip_address and match_sip_domain
  • the syntax for the server_domain and client_domain parameters now only accepts the TLS domain name
  • the client_domain_avp module parameter was renamed to client_tls_domain_avp
  • the “uac_replace_xxx()” functions requires now 2 parameters (display and URI), where the first one may be optional. Instead of uac_replace_from(“URI”), simply use uac_replace_from( , “URI”)
  • get_redirects() -> the deprecated “reason” parameter, along with the accounting logic behind it have been completely dropped