Allow chan_sip to decline unwanted media streams

This change replaces the static array of four representable media
streams with an AST_LIST so that chan_sip can keep track of offered
media streams.  This allows chan_sip to deal with offers containing
multiple same-type streams and many other situations without rejecting
the SDP offer in its entirety, yet still generating a valid response.
This also covers cases where Asterisk can not comprehend the offer if
it is in the correct format.

Previously, chan_sip would reject SDP offers or entirely ignore
individual stream offers in an effort to be more compatible which
would often result in invalid SDP responses.

Review: https://reviewboard.asterisk.org/r/1988/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369028 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kinsey Moore
2012-06-15 17:13:20 +00:00
parent 88c9c6bef8
commit bf6ef69702
2 changed files with 155 additions and 68 deletions

View File

@@ -467,6 +467,7 @@ enum media_type {
SDP_VIDEO, /*!< RTP/AVP Video */
SDP_IMAGE, /*!< Image udptl, not TCP or RTP */
SDP_TEXT, /*!< RTP/AVP Realtime Text */
SDP_UNKNOWN, /*!< Unknown media type */
};
/*! \brief Authentication types - proxy or www authentication
@@ -968,10 +969,11 @@ struct sip_st_cfg {
};
/*! \brief Structure for remembering offered media in an INVITE, to make sure we reply
to all media streams. In theory. In practise, we try our best. */
to all media streams. */
struct offered_media {
int order_offered; /*!< Order the media was offered in. Not offered is 0 */
char codecs[128];
enum media_type type; /*!< The type of media that was offered */
char *decline_m_line; /*!< Used if the media type is unknown/unused or a media stream is declined */
AST_LIST_ENTRY(offered_media) next;
};
/*! Additional headers to send with MESSAGE method packet. */
@@ -1194,7 +1196,7 @@ struct sip_pvt {
*
* The large-scale changes would be a good idea for implementing during an SDP rewrite.
*/
struct offered_media offered_media[OFFERED_MEDIA_COUNT];
AST_LIST_HEAD_NOLOCK(, offered_media) offered_media;
struct ast_cc_config_params *cc_params;
struct sip_epa_entry *epa_entry;
int fromdomainport; /*!< Domain port to show in from field */