mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 20:04:50 +00:00
pjsip configuration: Make transport TOS values consistent with endpoints
Transport TOS values were interpreted as DSCP values without being documented as such. Endpoint TOS values (tos_audio/tos_video) behaved normally as TOS values have historically. This patch makes the transport TOS values behave as TOS values and makes all TOS values readable as string values (e.g. AF11). In addition, alembic scripts have been updated to use the proper field types for all TOS/COS values. (issue ASTERISK-23235) Reported by: George Joseph Review: https://reviewboard.asterisk.org/r/3304/ ........ Merged revisions 410028 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410029 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
61
contrib/ast-db-manage/config/versions/4c573e7135bd_fix_tos_field_types.py
Executable file
61
contrib/ast-db-manage/config/versions/4c573e7135bd_fix_tos_field_types.py
Executable file
@@ -0,0 +1,61 @@
|
||||
"""Fix tos and cos field types
|
||||
|
||||
Revision ID: 4c573e7135bd
|
||||
Revises: 21e526ad3040
|
||||
Create Date: 2014-03-05 12:16:56.618630
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '4c573e7135bd'
|
||||
down_revision = '21e526ad3040'
|
||||
|
||||
from alembic import op
|
||||
from alembic import context
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects.postgresql import ENUM
|
||||
|
||||
YESNO_NAME = 'yesno_values'
|
||||
YESNO_VALUES = ['yes', 'no']
|
||||
|
||||
def upgrade():
|
||||
op.alter_column('ps_endpoints', 'tos_audio',
|
||||
type_=sa.String(10))
|
||||
op.alter_column('ps_endpoints', 'tos_video',
|
||||
type_=sa.String(10))
|
||||
op.alter_column('ps_transports', 'tos',
|
||||
type_=sa.String(10))
|
||||
|
||||
# Can't cast YENO_VALUES to Integers, so dropping and adding is required
|
||||
op.drop_column('ps_endpoints', 'cos_audio')
|
||||
op.drop_column('ps_endpoints', 'cos_video')
|
||||
op.drop_column('ps_transports', 'cos')
|
||||
|
||||
op.add_column('ps_endpoints', sa.Column('cos_audio', sa.Integer))
|
||||
op.add_column('ps_endpoints', sa.Column('cos_video', sa.Integer))
|
||||
op.add_column('ps_transports', sa.Column('cos', sa.Integer))
|
||||
pass
|
||||
|
||||
|
||||
def downgrade():
|
||||
|
||||
yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=False)
|
||||
|
||||
# Can't cast string to YESNO_VALUES, so dropping and adding is required
|
||||
op.drop_column('ps_endpoints', 'tos_audio')
|
||||
op.drop_column('ps_endpoints', 'tos_video')
|
||||
op.drop_column('ps_transports', 'tos')
|
||||
|
||||
op.add_column('ps_endpoints', sa.Column('tos_audio', yesno_values))
|
||||
op.add_column('ps_endpoints', sa.Column('tos_video', yesno_values))
|
||||
op.add_column('ps_transports', sa.Column('tos', yesno_values))
|
||||
|
||||
# Can't cast integers to YESNO_VALUES, so dropping and adding is required
|
||||
op.drop_column('ps_endpoints', 'cos_audio')
|
||||
op.drop_column('ps_endpoints', 'cos_video')
|
||||
op.drop_column('ps_transports', 'cos')
|
||||
|
||||
op.add_column('ps_endpoints', sa.Column('cos_audio', yesno_values))
|
||||
op.add_column('ps_endpoints', sa.Column('cos_video', yesno_values))
|
||||
op.add_column('ps_transports', sa.Column('cos', yesno_values))
|
||||
pass
|
Reference in New Issue
Block a user