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

@@ -798,20 +798,55 @@
; "0" or not enabled)
;contact_user= ; On outgoing requests, force the user portion of the Contact
; header to this value (default: "")
;incoming_call_offer_pref= ; Sets the preferred codecs, and order to use between
; those received in the offer, and those set in this
; configuration's allow line. Valid values include:
;incoming_call_offer_pref= ; Based on this setting, a joint list of
; preferred codecs between those received in an
; incoming SDP offer (remote), and those specified
; in the endpoint's "allow" parameter (local)
; is created and is passed to the Asterisk core.
;
; 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 codec
;preferred_codec_only=yes ; Respond to a SIP invite with the single most preferred codec
; rather than advertising all joint codec capabilities. This
; limits the other side's codec choice to exactly what we prefer.
; default is no.
; local - Include all codecs in the local list that
; are also in the remote list preserving the local
; order. (default).
; local_first - Include only the first codec in the
; local list that is also in the remote list.
; remote - Include all codecs in the remote list that
; are also in the local list preserving remote list
; order.
; remote_first - Include only the first codec in
; the remote list that is also in the local list.
;outgoing_call_offer_pref= ; Based on this 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.
;
; local - Include all codecs in the local list that
; are also in the remote list preserving the local
; order.
; local_merge - Include all codecs in BOTH lists
; preserving the local list order. Codes in the
; remote list not in the local list will be placed
; at the end of the joint list.
; local_first - Include only the first codec in the
; local list.
; remote - Include all codecs in the remote list that
; are also in the local list preserving remote list
; order. (default)
; remote_merge - Include all codecs in BOTH lists
; preserving the remote list order. Codes in the
; local list not in the remote list will be placed
; at the end of the joint list.
; remote_first - Include only the first codec in
; the remote list.
;preferred_codec_only=no ; Respond to a SIP invite with the single most
; preferred codec rather than advertising all joint
; codec capabilities. This limits the other side's
; codec choice to exactly what we prefer.
; default is no.
; NOTE: This option is deprecated in favor
; of incoming_call_offer_pref. Setting both
; options is unsupported.
;asymmetric_rtp_codec= ; Allow the sending and receiving codec to differ and
; not be automatically matched (default: "no")
;refer_blind_progress= ; Whether to notifies all the progress details on blind