aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authortwilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b>2009-09-30 17:52:30 +0000
committertwilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b>2009-09-30 17:52:30 +0000
commitbc354c76f41a25a047c3875db003f8fbe3b38225 (patch)
treef54b81d235c2605ab4a633cbe47be26b8eac2a6d /res
parenta1c22c9512ac2d613090efd03ae8cb5df497f25a (diff)
Merged revisions 221086 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r221086 | twilson | 2009-09-30 09:49:11 -0500 (Wed, 30 Sep 2009) | 25 lines Change the SSRC by default when our media stream changes Be default, change SSRC when doing an audio stream changes Asterisk doesn't honor marker bit when reinvited to already-bridged RTP streams,resulting in far-end stack discarding packets with "old" timestamps that areactually part of a new stream. This patch sends AST_CONTROL_SRCUPDATE whenever there is a reinvite, unless the 'constantssrc' is set to true in sip.conf. The original issue reported to Digium support detailed the following situation: ITSP <-> Asterisk 1.4.26.2 <-> SIP-based Application Server Call comes in fromITSP, Asterisk dials the app server which sends a re-invite back toAsterisk--not to negotiate to send media directly to the ITSP, but to indicatethat it's changing the stream it's sending to Asterisk. The app servergenerates a new SSRC, sequence numbers, timestamps, and sets the marker bit on the new stream. Asterisk passes through the teimstamp of the new stream, butdoes not reset the SSRC, sequence numbers, or set the marker bit. When the timestamp on the new stream is older than the timestamp on the originalstream, the ITSP (which doesn't know there has been any change) discards the newframes because it thinks they are too old. This patch addresses this by changing the SSRC on a stream update unless constantssrc=true is set in sip.conf. Review: https://reviewboard.asterisk.org/r/374/ ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@221266 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r--res/res_rtp_asterisk.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index 3abb6c686..42cce3786 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -103,6 +103,7 @@ enum strict_rtp_state {
#define FLAG_NAT_INACTIVE_NOWARN (1 << 1)
#define FLAG_NEED_MARKER_BIT (1 << 3)
#define FLAG_DTMF_COMPENSATE (1 << 4)
+#define FLAG_CONSTANT_SSRC (1 << 5)
/*! \brief RTP session description */
struct ast_rtp {
@@ -253,6 +254,7 @@ static int ast_rtp_destroy(struct ast_rtp_instance *instance);
static int ast_rtp_dtmf_begin(struct ast_rtp_instance *instance, char digit);
static int ast_rtp_dtmf_end(struct ast_rtp_instance *instance, char digit);
static void ast_rtp_new_source(struct ast_rtp_instance *instance);
+static void ast_rtp_set_constantssrc(struct ast_rtp_instance *instance);
static int ast_rtp_write(struct ast_rtp_instance *instance, struct ast_frame *frame);
static struct ast_frame *ast_rtp_read(struct ast_rtp_instance *instance, int rtcp);
static void ast_rtp_prop_set(struct ast_rtp_instance *instance, enum ast_rtp_property property, int value);
@@ -275,6 +277,7 @@ static struct ast_rtp_engine asterisk_rtp_engine = {
.dtmf_begin = ast_rtp_dtmf_begin,
.dtmf_end = ast_rtp_dtmf_end,
.new_source = ast_rtp_new_source,
+ .constant_ssrc_set = ast_rtp_set_constantssrc,
.write = ast_rtp_write,
.read = ast_rtp_read,
.prop_set = ast_rtp_prop_set,
@@ -653,6 +656,13 @@ static int ast_rtp_dtmf_end(struct ast_rtp_instance *instance, char digit)
return 0;
}
+void ast_rtp_set_constantssrc(struct ast_rtp_instance *instance)
+{
+ struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
+
+ ast_set_flag(rtp, FLAG_CONSTANT_SSRC);
+}
+
static void ast_rtp_new_source(struct ast_rtp_instance *instance)
{
struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
@@ -660,6 +670,10 @@ static void ast_rtp_new_source(struct ast_rtp_instance *instance)
/* We simply set this bit so that the next packet sent will have the marker bit turned on */
ast_set_flag(rtp, FLAG_NEED_MARKER_BIT);
+ if (!ast_test_flag(rtp, FLAG_CONSTANT_SSRC)) {
+ rtp->ssrc = ast_random();
+ }
+
return;
}