asterisk/contrib/ast-db-manage
George Joseph 2b9aa6b5bb res_pjsip_pubsub: Prune subs with reliable transports at startup
In an earlier release, inbound registrations on a reliable transport
were pruned on Asterisk restart since the TCP connection would have
been torn down and become unusable when Asterisk stopped.  This same
process is now also applied to inbound subscriptions.

Also fixed issues in res_pjsip_registrar where it wasn't handling the
monitoring correctly when multiple registrations came in over the same
transport.

To accomplish this, the pjsip_transport_event feature needed to
be refactored to allow multiple monitors (multiple subcriptions or
registrations from the same endpoint) to exist on the same transport.
Since this changed the API, any external modules that may have used the
transport monitor feature (highly unlikey) will need to be changed.

ASTERISK-27612
Reported by: Ross Beer

Change-Id: Iee87cf4eb9b7b2b93d5739a72af52d6ca8fbbe36
2018-01-30 09:29:51 -06:00
..
cdr Remove as much trailing whitespace as possible. 2017-12-22 09:23:22 -05:00
config res_pjsip_pubsub: Prune subs with reliable transports at startup 2018-01-30 09:29:51 -06:00
voicemail Remove as much trailing whitespace as possible. 2017-12-22 09:23:22 -05:00
README.md Add text of cdr directory into README.md for ast-db-manage 2016-09-30 18:32:19 -03:00
cdr.ini.sample alembic: Adjust sippeers, queue_members, and voicemail_messages tables. 2014-08-06 17:04:08 +00:00
config.ini.sample alembic: Adjust sippeers, queue_members, and voicemail_messages tables. 2014-08-06 17:04:08 +00:00
env.py Remove as much trailing whitespace as possible. 2017-12-22 09:23:22 -05:00
voicemail.ini.sample alembic: Adjust sippeers, queue_members, and voicemail_messages tables. 2014-08-06 17:04:08 +00:00

README.md

Asterisk Database Manager

Asterisk includes optional database integration for a variety of features. The purpose of this effort is to assist in managing the database schema for Asterisk database integration.

This is implemented as a set of repositories that contain database schema migrations, using Alembic. The existing repositories include:

  • cdr - Table used for Asterisk to store CDR records
  • config - Tables used for Asterisk realtime configuration
  • voicemail - Tables used for ODBC_STOARGE of voicemail messages

Alembic uses SQLAlchemy, which has support for many databases.

IMPORTANT NOTE: This is brand new and the initial migrations are still subject to change. Only use this for testing purposes for now.

Example Usage

First, create an ini file that contains database connection details. For help with connection string details, see the SQLAlchemy docs.

$ cp config.ini.sample config.ini
... edit config.ini and change sqlalchemy.url ...

Next, bring the database up to date with the current schema.

$ alembic -c config.ini upgrade head

In the future, as additional database migrations are added, you can run alembic again to migrate the existing tables to the latest schema.

$ alembic -c config.ini upgrade head

The migrations support both upgrading and downgrading. You could go all the way back to where you started with no tables by downgrading back to the base revision.

$ alembic -c config.ini downgrade base

base and head are special revisions. You can refer to specific revisions to upgrade or downgrade to, as well.

$ alembic -c config.ini upgrade 4da0c5f79a9c

Offline Mode

If you would like to just generate the SQL statements that would have been executed, you can use alembic's offline mode.

$ alembic -c config.ini upgrade head --sql

Adding Database Migrations

The best way to learn about how to add additional database migrations is to refer to the Alembic documentation.