1"""Add Stir Shaken Profile and Codec Preference to ps endpoint
3Revision ID: 9f3692b1654b
5Create Date: 2022-08-17 11:20:56.433088
10revision =
'9f3692b1654b'
11down_revision =
'7197536bb68d'
14import sqlalchemy
as sa
15from sqlalchemy.dialects.postgresql
import ENUM
17PJSIP_INCOMING_CALL_OFFER_PREF_NAME =
'pjsip_incoming_call_offer_pref_values'
18PJSIP_INCOMING_CALL_OFFER_PREF_VALUES = [
'local',
'local_first',
19 'remote',
'remote_first']
21PJSIP_OUTGOING_CALL_OFFER_PREF_NAME =
'pjsip_outgoing_call_offer_pref_values'
22PJSIP_OUTGOING_CALL_OFFER_PREF_VALUES = [
'local',
'local_merge',
'local_first',
23 'remote',
'remote_merge',
'remote_first']
26 context = op.get_context()
28 if context.bind.dialect.name ==
'postgresql':
29 enum_in = ENUM(*PJSIP_INCOMING_CALL_OFFER_PREF_VALUES, name=PJSIP_INCOMING_CALL_OFFER_PREF_NAME)
30 enum_out = ENUM(*PJSIP_OUTGOING_CALL_OFFER_PREF_VALUES, name=PJSIP_OUTGOING_CALL_OFFER_PREF_NAME)
32 enum_in.create(op.get_bind(), checkfirst=
False)
33 enum_out.create(op.get_bind(), checkfirst=
False)
35 op.add_column(
'ps_endpoints', sa.Column(
'incoming_call_offer_pref',
36 sa.Enum(*PJSIP_INCOMING_CALL_OFFER_PREF_VALUES, name=PJSIP_INCOMING_CALL_OFFER_PREF_NAME)))
38 op.add_column(
'ps_endpoints', sa.Column(
'outgoing_call_offer_pref',
39 sa.Enum(*PJSIP_OUTGOING_CALL_OFFER_PREF_VALUES, name=PJSIP_OUTGOING_CALL_OFFER_PREF_NAME)))
41 op.add_column(
'ps_endpoints', sa.Column(
'stir_shaken_profile', sa.String(80)))
44 context = op.get_context()
46 if context.bind.dialect.name ==
'mssql':
47 op.drop_constraint(
'ck_ps_endpoints_incoming_call_offer_pref_pjsip_incoming_call_offer_pref_values',
'ps_endpoints')
48 op.drop_constraint(
'ck_ps_endpoints_outgoing_call_offer_pref_pjsip_outgoing_call_offer_pref_values',
'ps_endpoints')
50 op.drop_column(
'ps_endpoints',
'outgoing_call_offer_pref')
51 op.drop_column(
'ps_endpoints',
'incoming_call_offer_pref')
52 op.drop_column(
'ps_endpoints',
'stir_shaken_profile')
54 enums = [PJSIP_INCOMING_CALL_OFFER_PREF_NAME, PJSIP_OUTGOING_CALL_OFFER_PREF_NAME]
56 if context.bind.dialect.name ==
'postgresql':
58 ENUM(name=e).drop(op.get_bind(), checkfirst=
False)