[Asterisk-code-review] pjsip: Add Alembic for PUBLISH support. (asterisk[13])
Anonymous Coward
asteriskteam at digium.com
Fri Apr 7 14:50:03 CDT 2017
Anonymous Coward #1000019 has submitted this change and it was merged. ( https://gerrit.asterisk.org/5421 )
Change subject: pjsip: Add Alembic for PUBLISH support.
......................................................................
pjsip: Add Alembic for PUBLISH support.
This change adds database tables for the PUBLISH support so it
can be configured using realtime. A minor fix to the
res_pjsip_publish_asterisk module was done so that it read the
sorcery configuration from the correct section. Finally the
sample configuration files have been updated.
ASTERISK-26928
Change-Id: I81991ae5c75af98d247f7eacd1c0b0a763675952
---
M configs/samples/extconfig.conf.sample
M configs/samples/sorcery.conf.sample
A contrib/ast-db-manage/config/versions/2da192dbbc65_add_publish_tables.py
M res/res_pjsip_publish_asterisk.c
4 files changed, 86 insertions(+), 1 deletion(-)
Approvals:
Kevin Harwell: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Anonymous Coward #1000019: Verified
diff --git a/configs/samples/extconfig.conf.sample b/configs/samples/extconfig.conf.sample
index 8fb6cac..0f347a6 100644
--- a/configs/samples/extconfig.conf.sample
+++ b/configs/samples/extconfig.conf.sample
@@ -84,6 +84,9 @@
;ps_aors => odbc,asterisk
;ps_domain_aliases => odbc,asterisk
;ps_endpoint_id_ips => odbc,asterisk
+;ps_outbound_publishes => odbc,asterisk
+;ps_inbound_publications = odbc,asterisk
+;ps_asterisk_publications = odbc,asterisk
;voicemail => odbc,asterisk
;extensions => odbc,asterisk
;meetme => mysql,general
diff --git a/configs/samples/sorcery.conf.sample b/configs/samples/sorcery.conf.sample
index 7e95883..1e7d72a 100644
--- a/configs/samples/sorcery.conf.sample
+++ b/configs/samples/sorcery.conf.sample
@@ -67,3 +67,12 @@
;[res_pjsip_endpoint_identifier_ip]
;identify=realtime,ps_endpoint_id_ips
+
+;[res_pjsip_outbound_publish]
+;outbound-publish=realtime,ps_outbound_publishes
+
+;[res_pjsip_pubsub]
+;inbound-publication=realtime,ps_inbound_publications
+
+;[res_pjsip_publish_asterisk]
+;asterisk-publication=realtime,ps_asterisk_publications
diff --git a/contrib/ast-db-manage/config/versions/2da192dbbc65_add_publish_tables.py b/contrib/ast-db-manage/config/versions/2da192dbbc65_add_publish_tables.py
new file mode 100644
index 0000000..affdc29
--- /dev/null
+++ b/contrib/ast-db-manage/config/versions/2da192dbbc65_add_publish_tables.py
@@ -0,0 +1,73 @@
+"""add publish tables
+
+Revision ID: 2da192dbbc65
+Revises: 8fce4c573e15
+Create Date: 2017-04-05 10:16:52.504699
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '2da192dbbc65'
+down_revision = '8fce4c573e15'
+
+from alembic import op
+import sqlalchemy as sa
+from sqlalchemy.dialects.postgresql import ENUM
+
+YESNO_NAME = 'yesno_values'
+YESNO_VALUES = ['yes', 'no']
+
+def upgrade():
+ ############################# Enums ##############################
+
+ # yesno_values have already been created, so use postgres enum object
+ # type to get around "already created" issue - works okay with mysql
+ yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=False)
+
+ op.create_table(
+ 'ps_outbound_publishes',
+ sa.Column('id', sa.String(40), nullable=False, unique=True),
+ sa.Column('expiration', sa.Integer),
+ sa.Column('outbound_auth', sa.String(40)),
+ sa.Column('outbound_proxy', sa.String(256)),
+ sa.Column('server_uri', sa.String(256)),
+ sa.Column('from_uri', sa.String(256)),
+ sa.Column('to_uri', sa.String(256)),
+ sa.Column('event', sa.String(40)),
+ sa.Column('max_auth_attempts', sa.Integer),
+ sa.Column('transport', sa.String(40)),
+ sa.Column('multi_user', yesno_values),
+ sa.Column('@body', sa.String(40)),
+ sa.Column('@context', sa.String(256)),
+ sa.Column('@exten', sa.String(256)),
+ )
+
+ op.create_index('ps_outbound_publishes_id', 'ps_outbound_publishes', ['id'])
+
+ op.create_table(
+ 'ps_inbound_publications',
+ sa.Column('id', sa.String(40), nullable=False, unique=True),
+ sa.Column('endpoint', sa.String(40)),
+ sa.Column('event_asterisk-devicestate', sa.String(40)),
+ sa.Column('event_asterisk-mwi', sa.String(40)),
+ )
+
+ op.create_index('ps_inbound_publications_id', 'ps_inbound_publications', ['id'])
+
+ op.create_table(
+ 'ps_asterisk_publications',
+ sa.Column('id', sa.String(40), nullable=False, unique=True),
+ sa.Column('devicestate_publish', sa.String(40)),
+ sa.Column('mailboxstate_publish', sa.String(40)),
+ sa.Column('device_state', yesno_values),
+ sa.Column('device_state_filter', sa.String(256)),
+ sa.Column('mailbox_state', yesno_values),
+ sa.Column('mailbox_state_filter', sa.String(256)),
+ )
+
+ op.create_index('ps_asterisk_publications_id', 'ps_asterisk_publications', ['id'])
+
+def downgrade():
+ op.drop_table('ps_outbound_publishes')
+ op.drop_table('ps_inbound_publications')
+ op.drop_table('ps_asterisk_publications')
diff --git a/res/res_pjsip_publish_asterisk.c b/res/res_pjsip_publish_asterisk.c
index b32408a..7e87762 100644
--- a/res/res_pjsip_publish_asterisk.c
+++ b/res/res_pjsip_publish_asterisk.c
@@ -863,7 +863,7 @@
return AST_MODULE_LOAD_DECLINE;
}
- ast_sorcery_apply_config(ast_sip_get_sorcery(), "asterisk-publication");
+ ast_sorcery_apply_config(ast_sip_get_sorcery(), "res_pjsip_publish_asterisk");
ast_sorcery_apply_default(ast_sip_get_sorcery(), "asterisk-publication", "config", "pjsip.conf,criteria=type=asterisk-publication");
if (ast_sorcery_object_register(ast_sip_get_sorcery(), "asterisk-publication", asterisk_publication_config_alloc, NULL, NULL)) {
--
To view, visit https://gerrit.asterisk.org/5421
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I81991ae5c75af98d247f7eacd1c0b0a763675952
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
More information about the asterisk-code-review
mailing list