asterisk/contrib/ast-db-manage
Matthew Jordan fd94fea599 res_pjsip: Support setting a default accountcode on endpoints
Most channel drivers let you specify a default accountcode to be set on
channels associated with a particular peer/endpoint/object. Prior to this
patch, chan_pjsip/res_pjsip did not support such a setting.

This patch adds a new setting to the res_pjsip endpoint object, 'accountcode'.
When a channel is created that is associated with an endpoint with this value
set, the channel will automatically have its accountcode property set to the
value configured for the endpoint.

Review: https://reviewboard.asterisk.org/r/3724/

ASTERISK-24000 #close
Reported by: Matt Jordan
........

Merged revisions 418756 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@418757 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-16 14:03:51 +00:00
..
cdr ast-db-manage/cdr/env.py: Don't fail if a config file can't be loaded 2014-05-28 17:44:49 +00:00
config res_pjsip: Support setting a default accountcode on endpoints 2014-07-16 14:03:51 +00:00
voicemail alembic: Add svn:ignore *.pyc to directories and svn:executable to *.py files. 2014-02-18 19:19:37 +00:00
README.md Actually *add* the database schema management utilities 2013-08-29 12:30:07 +00:00
cdr.ini.sample alembic: Add missing queue and CDR table creation scripts. 2014-03-05 18:51:37 +00:00
config.ini.sample Actually *add* the database schema management utilities 2013-08-29 12:30:07 +00:00
voicemail.ini.sample Actually *add* the database schema management utilities 2013-08-29 12:30:07 +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:

  • 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.