# Asterisk Project : Upgrading to Asterisk 13

Created and last modified by mjordan on Aug 10, 2014

# Overview

As Asterisk 13 is built on the architecture introduced in Asterisk 12, users upgrading to Asterisk 13 from an older version of Asterisk should be aware of the architectural changes that were made in the previous Standard release. It is recommended that you review:

- The upgrade notes on this page
- The New in 13 information, which lists the major new features in Asterisk 13
- The notes on Upgrading to Asterisk 12 if you are upgrading from a version of Asterisk prior to Asterisk 12
  The notes on what is New in 12 if if you are upgrading from a version of Asterisk prior to Asterisk 12.

# General Asterisk Updates

- The asterisk command line `-I` option and the `asterisk.conf` `internal_timing` option have been removed. Internal timing is always enabled if any timing module is loaded.
- The per console verbose level feature as previously implemented in Asterisk 11 caused a large performance penalty. The fix required some minor incompatibilities if the new `rasterisk` is used to connect to an earlier version. If the new `rasterisk` connects to an older Asterisk version then the root console verbose level is always affected by the `core set verbose` command of the remote console even though it may appear to only affect the current console. If an older version of `rasterisk` connects to the new version of Asterisk then the `core set verbose` command will have no effect.
- The asterisk compatibility options in `asterisk.conf` have been removed. These options enabled certain backwards compatibility features for `pbx_realtime`, `res_agi`, and `app_set` that made their behaviour similar to Asterisk 1.4. Users who used these backwards compatibility settings should update their dialplans to use `','` instead of `'|'` as a delimiter, and should use the Set dialplan application instead of the MSet dialplan application.

# Applications

## ConfBridge

- The `sound_place_into_conference` sound used in ConfBridge is now deprecated and is no longer functional. It has technically been broken since its inception and - to meet its documented use case - a different method is used to achieve the same goal. The new method is to use `sound_begin` to play a sound to the conference when `waitmarked` users are moved into the conference.

## SetMusicOnHold

- The SetMusicOnHold dialplan application was deprecated and has been removed. Users of the application should use the `CHANNEL` function's `musicclass` setting instead.

## WaitMusicOnHold

- The WaitMusicOnHold dialplan application was deprecated and has been removed. Users of the application should use MusicOnHold with a `duration` parameter instead.

On this Page

# Build System

- Sample config files have been moved from `configs/` to a sub-folder of that directory, `samples`.
- The `menuselect` utility has been pulled into the Asterisk repository. As a result, the `libxml2` development library is now a required dependency for Asterisk.

- A new Compiler Flag, `REF_DEBUG`, has been added. When enabled, reference counted objects will emit additional debug information to the `refs` log file located in the standard Asterisk log file directory. This log file is useful in tracking down object leaks and other reference counting issues. Prior to this version, this option was only available by modifying the source code directly. This change also includes a new script, `refcounter.py`, in the `contrib` folder that will process the `refs` log file. Note that this replaces the `refcounter` utility that could be built from the `utils` directory.

# CDR Backends

## cdr_sqlite

- The `cdr_sqlite` module was deprecated and has been removed. Users of this module should use the `cdr_sqlite3_custom` module instead.

# Channel Drivers

## chan_dahdi

- SS7 support now requires `libss7` v2.0 or later.
- Added the `inband_on_setup_ack` compatibility option to `chan_dahdi.conf` to deal with switches that don't send an inband progress indication in the `SETUP ACKNOWLEDGE` message. Default is now `no`.

## chan_gtalk

- This module was deprecated and has been removed. Users of `chan_gtalk` should use `chan_motif`.

## chan_h323

- This module was deprecated and has been removed. Users of `chan_h323` should use `chan_ooh323`.

## chan_jingle

- This module was deprecated and has been removed. Users of `chan_jingle` should use `chan_motif`.

## chan_pjsip

- Added a `force_avp` option to `chan_pjsip` which will force the usage of `RTP/AVP`, `RTP/AVPF`, `RTP/SAVP`, or `RTP/SAVPF` as the media transport type in SDP offers depending on settings, even when DTLS is used for media encryption. This option can be set to improve interoperability with WebRTC clients that don't use the RFC defined transport for DTLS.
- Added a `media_use_received_transport` option to `chan_pjsip` which will cause the SDP answer to use the media transport as received in the SDP offer.

## chan_sip

- Made set `SIPREFERREDBYHDR` as inheritable for better `chan_pjsip` interoperability.
- The `SIPPEER` dialplan function no longer supports using a colon as a delimiter for parameters. The parameters for the function should be delimited using a comma.
- The `SIPCHANINFO` dialplan function was deprecated and has been removed. Users of the function should use the `CHANNEL` function instead.
- Added a `force_avp` option for `chan_sip`. When enabled this option will cause the media transport in the offer or answer SDP to be `RTP/AVP`, `RTP/AVPF`, `RTP/SAVP`, or `RTP/SAVPF` even if a DTLS stream has been configured. This option can be set to improve interoperability with WebRTC clients that don't use the RFC defined transport for DTLS.
- The `dtlsverify` option in `chan_sip` now has additional values besides `yes` and `no`. If `yes` is specified both the certificate and fingerprint will be verified. If `no` is specified then neither the certificate or fingerprint is verified. If `certificate` is specified then only the certificate is verified. If `fingerprint` is specified then only the fingerprint is verified.
- A `dtlsfingerprint` option has been added to `chan_sip` which allows the hash to be specified for the DTLS fingerprint placed in SDP. Supported values are `sha-1` and `sha-256` with `sha-256` being the default.
- The `progressinband=never` option is now more zealous in the persecution of progress messages coming from Asterisk. Channels bridged with a SIP channel that has `progressinband=never` set will not be able to forward their progress indications through to the SIP device. `chan_sip` will now turn such progress indications into a 180 Ringing (if a 180 has not yet been transmitted) if `progressinband=never`.
- The codec preference order in an SDP during an offer is slightly different than previous releases. Prior to Asterisk 13, the preference order of codecs used to be:

1. 1. Our preferred codec
   2. Our configured codecs
   3. Any non-audio joint codecs

Internal Implementation Details Ahead

Icon

One of the ways the new media format architecture in Asterisk 13 improves performance is by reference counting formats, such that they can be reused in many places without additional allocation. To not require a large amount of locking, an instance of a format is immutable by convention. This works well except for formats with attributes. Since a media format with an attribute is a different object than the same format without an attribute, we have to carry over the formats with attributes from an inbound offer so that the correct attributes are offered in an outgoing INVITE request. This requires some subtle tweaks to the preference order to ensure that the media format with attributes is offered to a remote peer, as opposed to the same media format (but without attributes) that may be stored in the peer object.

Now, in Asterisk 13, the preference order of codecs is:

1. 1. Our preferred codec
   2. Any joint codecs offered by the inbound offer
   3. All other codecs that are not the preferred codec and not a joint codec offered by the inbound offer

- chan_sip is now an extended support module.

## chan_unistim

- The `unistim.conf` `dateformat` has changed the meaning of options values to conform to the values used inside Unistim protocol.
- Added `dtmf_duration` option with changing default operation to disable received DTMF playback on a Unistim phone.

# Core

- The behaviour of `accountcode` has changed somewhat to support `peeraccount`. The main change is that Local channels now cross `accountcode` and `peeraccount` settings across the special bridge between the `;1` and `;2` channels just like channels between normal bridges. See New in 13 for more information.

## ARI

- The ARI version has been changed to 1.5.0. This is to reflect the backwards compatible changes listed in New in 13.
- A bug fix in bridge creation has caused a behavioural change in how subscriptions are created for bridges. A bridge created through ARI, does not, by itself, have a subscription created for any particular Stasis application. When a channel in a Stasis application joins a bridge, an implicit event subscription is created for that bridge as well. Previously, when a channel left such a bridge, the subscription was leaked; this allowed for later bridge events to continue to be pushed to the subscribed applications. That leak has been fixed; as a result, bridge events that were delivered after a channel left the bridge are no longer delivered. An application must subscribe to a bridge through the applications resource if it wishes to receive all events related to a bridge.

## AMI

- The AMI version has been changed to 2.5.0. This is to reflect the backwards compatible changes listed in New in 13.
- MixMonitor AMI actions now require users to have authorization classes:
  - MixMonitor - `system`
  - MixMonitorMute - `call` or `system`
  - StopMixMonitor - `call` or `system`
- The undocumented `manager.conf` setting `block-sockets` has been removed. It interferes with TCP/TLS inactivity timeouts.
- The response to the PresenceState AMI action has historically contained two Message keys. The first of these is used as an informative message regarding the success/failure of the action; the second contains a Presence state specific message. Having two keys with the same unique name in an AMI message is cumbersome for some client; hence, the Presence specific Message has been deprecated. The message will now contain a PresenceMessage key for the presence specific information; the Message key containing presence information will be removed in the next major version of AMI.

- The `manager.conf` setting `eventfilter` now takes an "extended" regular expression instead of a "basic" one.

## CDR

- The `endbeforehexten` setting now defaults to `yes`, instead of `no`. When set to `no`, this setting will cause a new CDR to be generated when a channel enters into hangup logic (either the `'h'` extension or a hangup handler subroutine). In general, this is not the preferred default: this causes extra CDRs to be generated for a channel in many common dialplans.

## CLI

- `core show settings` now lists the current console verbosity in addition to the root console verbosity.
- `core set verbose` has not been able to support the by module verbose logging levels since verbose logging levels were made per console. That syntax is now removed and a silence option added in its place.

## HTTP

- Added `http.conf` `session_inactivity` timer option to close HTTP connections that aren't doing anything.
- Added support for persistent HTTP connections. To enable persistent HTTP connections configure the keep alive time between HTTP requests. The keep alive time between HTTP requests is configured in `http.conf` with the `session_keep_alive` parameter.

## Logging

- The `verbose` setting in logger.conf still takes an optional argument, specifying the verbosity level for each logging destination. However, the default is now to once again follow the current root console level. As a result, using the AMI Command action with `core set verbose` could again set the root console verbose level and affect the verbose level logged.

## RealTime

Whoops

Icon

The database migration script that adds the `extensions` table had to be modified due to an error when installing for MySQL. The `extensions` table's `id` column was changed to be a primary key. This could potentially cause a migration problem. If so, it may be necessary to manually alter the affected table/column to bring it back in line with the migration scripts.

- A number of Alembic scripts have been updated between Asterisk 12 and Asterisk 13. These include the following:
  - For the `config` RealTime schemas:

    - `1758e8bbf6b_increase_useragent_column_size.py` - increase the size of the `useragent` column in `sippeers` from `20` characters to `255` characters.

    - `1d50859ed02e_create_accountcode.py` - add the `accountcode` column to the `ps_endpoints` table.

    - `21e526ad3040_add_pjsip_debug_option.py` - add the `debug` column to the `ps_globals` table.

    - `28887f25a46f_create_queue_tables.py` - creates the various Queue related tables.

    - `2fc7930b41b3_add_pjsip_endpoint_options_for_12_1.py` - adds the `ps_system`s, `ps_globals`, `ps_transports`, and `ps_registrations` tables. Adds several new columns for `ps_endpoints`, `ps_contacts`, and `ps_aors`.

    - `3855ee4e5f85_add_missing_pjsip_options.py` - adds the `message_context` column for the `ps_endpoints` table and the `user_agent` column for the `ps_contacts` table.

    - `4c573e7135bd_fix_tos_field_types.py` - changes the type of the `ps_endpoints.tos_audio`, `ps_endpoints.tos_video`, and `ps_transports.tos` columns.

    - `5139253c0423_make_q_member_uniqueid_autoinc.py` - modifies the `uniqueid` column on the `queue_members` table to be a unique auto-incrementing index, if the database supports it.

    - `51f8cb66540e_add_further_dtls_options.py` - adds the `force_avp` and `media_use_received_transport` columns to the `ps_endpoints` table.

    - `c6d929b23a8_create_pjsip_subscription_persistence_.py` - adds the `ps_subscription_persistence` table.

    - `e96a0b8071c_increase_pjsip_column_size.py` - increases the size of the columns `ps_globals.user_agent`, `ps_contacts.id`, `ps_contacts.uri`, `ps_contacts.user_agent`, `ps_registrations.client_uri`, and `ps_registrations.server_uri`.

  - For the `voicemail` ODBC backend schemas:

    - 39428242f7f5_increase_recording_column_size.py - changed the type of the `voicemail_messages.recording` column to `LargeBinary`, with a max size of `4294967295`.

  - Added a new family of schemas for CDR backends, `cdr`.

# Resources

## res_http_websocket

- Added a compatibility option to `ari.conf`, `sip.conf`, and `pjsip.conf` - `websocket_write_timeout`. When a websocket connection exists where Asterisk writes a substantial amount of data to the connected client, and the connected client is slow to process the received data, the socket may be disconnected. In such cases, it may be necessary to adjust this value. Default is 100 ms.

## res_odbc

- The compatibility setting, `allow_empty_string_in_nontext`, has been removed. Empty column values will be stored as empty strings during RealTime updates.

## res_jabber

- This module was deprecated and has been removed. Users of this module should use `res_xmpp` instead.

# Scripts

## safe_asterisk

- The `safe_asterisk` script was previously not installed on top of an existing version. This caused bug-fixes in that script not to be deployed. If your `safe_asterisk` script is customized, be sure to keep your changes. Custom values for variables should be created in `*.sh` file(s) inside `ASTETCDIR/startup.d/`. For more information, see the original bug report that necessitated this change, ASTERISK-21965.
- Changed a log message in `safe_asterisk` and the `$NOTIFY` mail subject. If you use tools to parse either of them, update your parse functions accordingly. The changed strings are:
  - `"Exited on signal $EXITSIGNAL"` => `"Asterisk exited on signal $EXITSIGNAL."`
  - `"Asterisk Died"` => `"Asterisk on $MACHINE died (sig $EXITSIGNAL)"`

# Utilities

## refcounter

- The `refcounter` program has been removed in favour of the `refcounter.py` script in `contrib/scripts`.