diff options
author | twilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-09-30 14:49:11 +0000 |
---|---|---|
committer | twilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-09-30 14:49:11 +0000 |
commit | 4f67fa12535deb67bc00f833d168270544281077 (patch) | |
tree | f65c97c3a71a2daada0530012670d648d3c34478 /main/rtp.c | |
parent | ec161909b6471d89ba0301ba2a67cac094eee718 (diff) |
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/branches/1.4@221086 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/rtp.c')
-rw-r--r-- | main/rtp.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/main/rtp.c b/main/rtp.c index c1dc445b7..770292a4f 100644 --- a/main/rtp.c +++ b/main/rtp.c @@ -174,6 +174,7 @@ struct ast_rtp { struct ast_codec_pref pref; struct ast_rtp *bridged; /*!< Who we are Packet bridged to */ int set_marker_bit:1; /*!< Whether to set the marker bit or not */ + unsigned int constantssrc:1; }; /* Forward declarations */ @@ -2054,12 +2055,19 @@ int ast_rtp_settos(struct ast_rtp *rtp, int tos) return res; } +void ast_rtp_set_constantssrc(struct ast_rtp *rtp) +{ + rtp->constantssrc = 1; +} + void ast_rtp_new_source(struct ast_rtp *rtp) { if (rtp) { rtp->set_marker_bit = 1; + if (!rtp->constantssrc) { + rtp->ssrc = ast_random(); + } } - return; } void ast_rtp_set_peer(struct ast_rtp *rtp, struct sockaddr_in *them) |