res_pjsip_session: Add ability to accept multiple sdp answers

pjproject by default currently will follow media forked during an INVITE
on outbound calls if the To tag is different on a subsequent response as
that on an earlier response.  We handle this correctly.  There have
been reported cases where the To tag is the same but we still need to
follow the media.  The pjproject patch in this commit adds the
capability to sip_inv and also adds the capability to control it at
runtime.  The original "different tag" behavior was always controllable
at runtime but we never did anything with it and left it to default to
TRUE.

So, along with the pjproject patch, this commit adds options to both the
system and endpoint objects to control the two behaviors, and a small
logic change to session_inv_on_media_update in res_pjsip_session to
control the behavior at the endpoint level.

The default behavior for "different tags" remains the same at TRUE and
the default for "same tag" is FALSE.

Change-Id: I64d071942b79adb2f0a4e13137389b19404fe3d6
ASTERISK-27936
Reported-by: Ross Beer
This commit is contained in:
George Joseph
2018-06-18 20:22:17 -06:00
parent 017b7849bc
commit 880fbff6b7
13 changed files with 505 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
"""Add early media options
Revision ID: 0be05c3a8225
Revises: d3e4284f8707
Create Date: 2018-06-18 17:26:16.737692
"""
# revision identifiers, used by Alembic.
revision = '0be05c3a8225'
down_revision = 'd3e4284f8707'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects.postgresql import ENUM
YESNO_NAME = 'yesno_values'
YESNO_VALUES = ['yes', 'no']
def upgrade():
yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=False)
op.add_column('ps_systems', sa.Column('follow_early_media_fork', yesno_values))
op.add_column('ps_systems', sa.Column('accept_multiple_sdp_answers', yesno_values))
op.add_column('ps_endpoints', sa.Column('follow_early_media_fork', yesno_values))
op.add_column('ps_endpoints', sa.Column('accept_multiple_sdp_answers', yesno_values))
def downgrade():
if op.get_context().bind.dialect.name == 'mssql':
op.drop_constraint('ck_ps_systems_follow_early_media_fork_yesno_values','ps_systems')
op.drop_constraint('ck_ps_systems_accept_multiple_sdp_answers_yesno_values','ps_systems')
op.drop_constraint('ck_ps_endpoints_follow_early_media_fork_yesno_values','ps_endpoints')
op.drop_constraint('ck_ps_endpoints_accept_multiple_sdp_answers_yesno_values','ps_endpoints')
op.drop_column('ps_systems', 'follow_early_media_fork')
op.drop_column('ps_systems', 'accept_multiple_sdp_answers')
op.drop_column('ps_endpoints', 'follow_early_media_fork')
op.drop_column('ps_endpoints', 'accept_multiple_sdp_answers')