codec_negotiation: Implement outgoing_call_offer_pref

Based on this new endpoint setting, a joint list of preferred codecs
between those received from the Asterisk core (remote), and those
specified in the endpoint's "allow" parameter (local) is created and
is used to create the outgoing SDP offer.

* Add outgoing_call_offer_pref to pjsip_configuration (endpoint)

* Add "call_direction" to res_pjsip_session.

* Update pjsip_session_caps.c to make the functions more generic
  so they could be used for both incoming and outgoing.

* Update ast_sip_session_create_outgoing to create the
  pending_media_state->topology with the results of
  ast_sip_session_create_joint_call_stream().

* The endpoint "preferred_codec_only" option now automatically sets
  AST_SIP_CALL_CODEC_PREF_FIRST in incoming_call_offer_pref.

* A helper function ast_stream_get_format_count() was added to
  streams to return the current count of formats.

ASTERISK-28777

Change-Id: Id4ec0b4a906c2ae5885bf947f101c59059935437
This commit is contained in:
George Joseph
2020-03-13 13:40:46 -06:00
committed by Friendly Automation
parent 57a457c26c
commit 2ee455958e
13 changed files with 408 additions and 297 deletions

View File

@@ -0,0 +1,8 @@
Subject: res_pjsip
Subject: res_pjsip_session
Master-Only: True
Two new options, incoming_call_offer_pref and outgoing_call_offer_pref
have been added to res_pjsip endpoints that specify the preferred order
of codecs to use between those received/sent in an SDP offer and those
set in the endpoint configuration.

View File

@@ -1,53 +0,0 @@
Subject: res_pjsip
Subject: res_pjsip_session
Master-Only: True
A new option, incoming_call_offer_pref, was added to res_pjsip endpoints that
specifies the preferred order of codecs to use between those received in the
offer, and those set in the configuration.
Valid values include:
local - prefer and order by configuration (default).
local_single - prefer and order by configuration, but only choose 'top'
most codec
remote - prefer and order by incoming sdp.
remote_single - prefer and order by incoming sdp, but only choose 'top' most
most codec
Example A:
[alice]
type=endpoint
incoming_call_offer_pref=local
allow=!all,opus,alaw,ulaw
Alice's incoming sdp=g722,ulaw,alaw
RESULT: alaw,ulaw
Example B:
[alice]
type=endpoint
incoming_call_offer_pref=local_single
allow=!all,opus,alaw,ulaw
Alice's incoming sdp=g722,ulaw,alaw
RESULT: alaw
Example C:
[alice]
type=endpoint
incoming_call_offer_pref=remote
allow=!all,opus,alaw,ulaw
Alice's incoming sdp=g722,ulaw,alaw
RESULT: ulaw,alaw
Example D:
[alice]
type=endpoint
incoming_call_offer_pref=remote_single
allow=!all,opus,alaw,ulaw
Alice's incoming sdp=g722,ulaw,alaw
RESULT: ulaw