res_pjsip: Add new AOR option "qualify_2xx_only"

Added a new option "qualify_2xx_only" to the res_pjsip AOR qualify
feature to mark a contact as available only if an OPTIONS request
returns a 2XX response. If the option is not specified or is false,
any response to the OPTIONS request marks the contact as available.

UserNote: The pjsip.conf AOR section now has a "qualify_2xx_only"
option that can be set so that only 2XX responses to OPTIONS requests
used to qualify a contact will mark the contact as available.
This commit is contained in:
Kent
2024-12-03 08:24:44 -06:00
parent 10adfa920a
commit 0b30f546ba
7 changed files with 73 additions and 1 deletions

View File

@@ -0,0 +1,34 @@
"""add qualify 2xx only option
Revision ID: 44bd6dd914fa
Revises: 4f91fc18c979
Create Date: 2024-12-02 21:08:41.130023
"""
# revision identifiers, used by Alembic.
revision = '44bd6dd914fa'
down_revision = '4f91fc18c979'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects.postgresql import ENUM
AST_BOOL_NAME = 'ast_bool_values'
AST_BOOL_VALUES = [ '0', '1',
'off', 'on',
'false', 'true',
'no', 'yes' ]
def upgrade():
ast_bool_values = ENUM(*AST_BOOL_VALUES, name=AST_BOOL_NAME, create_type=False)
op.add_column('ps_aors', sa.Column('qualify_2xx_only', ast_bool_values))
op.add_column('ps_contacts', sa.Column('qualify_2xx_only', ast_bool_values))
def downgrade():
if op.get_context().bind.dialect.name == 'mssql':
op.drop_constraint('ck_ps_aors_qualify_2xx_only_ast_bool_values', 'ps_aors')
op.drop_constraint('ck_ps_contacts_qualify_2xx_only_ast_bool_values', 'ps_contacts')
op.drop_column('ps_aors', 'qualify_2xx_only')
op.drop_column('ps_contacts', 'qualify_2xx_only')