diff options
author | Mark Michelson <mmichelson@digium.com> | 2017-04-26 16:14:00 -0500 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2017-04-27 15:03:51 -0500 |
commit | d6535c0080632bce5ed555904d5198c04e040ffb (patch) | |
tree | c473dd2aa7b2061b41f9b6559490dca215f811e8 /res/res_rtp_asterisk.c | |
parent | 413de95ab247ed9b48fc48f440e5c397146e07cb (diff) |
SDP API: Add SSRC-level attributes
RFC 5576 defines how SSRC-level attributes may be added to SDP media
descriptions. In general, this is useful for grouping related SSRCes,
indicating SSRC-level format attributes, and resolving collisions in RTP
SSRC values. These attributes are used widely by browsers during WebRTC
communications, including attributes defined by documents outside of RFC
5576.
This commit introduces the addition of SSRC-level attributes into SDPs
generated by Asterisk. Since Asterisk does not tend to use multiple
SSRCs on a media stream, the initial support is minimal. Asterisk
includes an SSRC-level CNAME attribute if configured to do so. This at
least gives browsers (and possibly others) the ability to resolve SSRC
collisions at offer-answer time.
In order to facilitate this, the RTP engine API has been enhanced to be
able to retrieve the SSRC and CNAME on a given RTP instance.
res_rtp_asterisk currently does not provide meaningful CNAME values in
its RTCP SDES items, and therefore it currently will always return an
empty string as the CNAME value. A task in the near future will result
in res_rtp_asterisk generating more meaningful CNAMEs.
Change-Id: I29e7f23e7db77524f82a3b6e8531b1195ff57789
Diffstat (limited to 'res/res_rtp_asterisk.c')
-rw-r--r-- | res/res_rtp_asterisk.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c index d0d795939..85e2425cb 100644 --- a/res/res_rtp_asterisk.c +++ b/res/res_rtp_asterisk.c @@ -474,6 +474,8 @@ static void ast_rtp_stun_request(struct ast_rtp_instance *instance, struct ast_s static void ast_rtp_stop(struct ast_rtp_instance *instance); static int ast_rtp_qos_set(struct ast_rtp_instance *instance, int tos, int cos, const char* desc); static int ast_rtp_sendcng(struct ast_rtp_instance *instance, int level); +static unsigned int ast_rtp_get_ssrc(struct ast_rtp_instance *instance); +static const char *ast_rtp_get_cname(struct ast_rtp_instance *instance); #ifdef HAVE_OPENSSL_SRTP static int ast_rtp_activate(struct ast_rtp_instance *instance); @@ -1903,6 +1905,8 @@ static struct ast_rtp_engine asterisk_rtp_engine = { .dtls = &ast_rtp_dtls, .activate = ast_rtp_activate, #endif + .ssrc_get = ast_rtp_get_ssrc, + .cname_get = ast_rtp_get_cname, }; #ifdef HAVE_OPENSSL_SRTP @@ -5815,6 +5819,27 @@ static int ast_rtp_sendcng(struct ast_rtp_instance *instance, int level) return res; } +/*! \pre instance is locked */ +static unsigned int ast_rtp_get_ssrc(struct ast_rtp_instance *instance) +{ + struct ast_rtp *rtp = ast_rtp_instance_get_data(instance); + + return rtp->ssrc; +} + +/*! \pre instance is locked */ +static const char *ast_rtp_get_cname(struct ast_rtp_instance *instance) +{ + /* XXX + * + * Asterisk currently puts a zero-length CNAME value in RTCP SDES items, + * meaning our CNAME will always be an empty string. In future, should + * Asterisk actually start using meaningful CNAMEs, this function will + * need to return that instead of an empty string + */ + return ""; +} + #ifdef HAVE_OPENSSL_SRTP static void dtls_perform_setup(struct dtls_details *dtls) { |