summaryrefslogtreecommitdiff
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
authorTerry Wilson <twilson@digium.com>2009-09-30 17:52:30 +0000
committerTerry Wilson <twilson@digium.com>2009-09-30 17:52:30 +0000
commit865daf4858ba8f3a592e08d37f8025d92c02810b (patch)
treef54b81d235c2605ab4a633cbe47be26b8eac2a6d /channels/chan_sip.c
parenta4ece92018d051609c26e815fd966d045a3ebec3 (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: https://origsvn.digium.com/svn/asterisk/trunk@221266 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r--channels/chan_sip.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index b8e53d915..9c0076554 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -1503,6 +1503,7 @@ struct sip_auth {
#define SIP_PAGE2_RTAUTOCLEAR (1 << 2) /*!< GP: Should we clean memory from peers after expiry? */
#define SIP_PAGE2_RPID_UPDATE (1 << 3)
/* Space for addition of other realtime flags in the future */
+#define SIP_PAGE2_CONSTANT_SSRC (1 << 7) /*!< GDP: Don't change SSRC on reinvite */
#define SIP_PAGE2_SYMMETRICRTP (1 << 8) /*!< GDP: Whether symmetric RTP is enabled or not */
#define SIP_PAGE2_STATECHANGEQUEUE (1 << 9) /*!< D: Unsent state pending change exists */
@@ -1540,7 +1541,7 @@ struct sip_auth {
SIP_PAGE2_VIDEOSUPPORT | SIP_PAGE2_T38SUPPORT | SIP_PAGE2_RFC2833_COMPENSATE | \
SIP_PAGE2_BUGGY_MWI | SIP_PAGE2_TEXTSUPPORT | SIP_PAGE2_FAX_DETECT | \
SIP_PAGE2_UDPTL_DESTINATION | SIP_PAGE2_VIDEOSUPPORT_ALWAYS | SIP_PAGE2_PREFERRED_CODEC | \
- SIP_PAGE2_RPID_IMMEDIATE | SIP_PAGE2_RPID_UPDATE | SIP_PAGE2_SYMMETRICRTP)
+ SIP_PAGE2_RPID_IMMEDIATE | SIP_PAGE2_RPID_UPDATE | SIP_PAGE2_SYMMETRICRTP | SIP_PAGE2_CONSTANT_SSRC)
/*@}*/
@@ -5192,6 +5193,9 @@ static int create_addr_from_peer(struct sip_pvt *dialog, struct sip_peer *peer)
ast_rtp_instance_set_prop(dialog->rtp, AST_RTP_PROPERTY_DTMF_COMPENSATE, ast_test_flag(&dialog->flags[1], SIP_PAGE2_RFC2833_COMPENSATE));
ast_rtp_instance_set_timeout(dialog->rtp, peer->rtptimeout);
ast_rtp_instance_set_hold_timeout(dialog->rtp, peer->rtpholdtimeout);
+ if (ast_test_flag(&dialog->flags[1], SIP_PAGE2_CONSTANT_SSRC)) {
+ ast_rtp_instance_set_constantssrc(dialog->rtp);
+ }
/* Set Frame packetization */
ast_rtp_codecs_packetization_set(ast_rtp_instance_get_codecs(dialog->rtp), dialog->rtp, &dialog->prefs);
dialog->autoframing = peer->autoframing;
@@ -5199,6 +5203,9 @@ static int create_addr_from_peer(struct sip_pvt *dialog, struct sip_peer *peer)
if (dialog->vrtp) { /* Video */
ast_rtp_instance_set_timeout(dialog->vrtp, peer->rtptimeout);
ast_rtp_instance_set_hold_timeout(dialog->vrtp, peer->rtpholdtimeout);
+ if (ast_test_flag(&dialog->flags[1], SIP_PAGE2_CONSTANT_SSRC)) {
+ ast_rtp_instance_set_constantssrc(dialog->vrtp);
+ }
}
if (dialog->trtp) { /* Realtime text */
ast_rtp_instance_set_timeout(dialog->trtp, peer->rtptimeout);
@@ -20437,6 +20444,7 @@ static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
return -1;
}
+ ast_queue_control(p->owner, AST_CONTROL_SRCUPDATE);
} else {
p->jointcapability = p->capability;
ast_debug(1, "Hm.... No sdp for the moment\n");
@@ -20487,6 +20495,14 @@ static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int
ast_debug(1, "No compatible codecs for this SIP call.\n");
return -1;
}
+ if (ast_test_flag(&p->flags[1], SIP_PAGE2_CONSTANT_SSRC)) {
+ if (p->rtp) {
+ ast_rtp_instance_set_constantssrc(p->rtp);
+ }
+ if (p->vrtp) {
+ ast_rtp_instance_set_constantssrc(p->vrtp);
+ }
+ }
} else { /* No SDP in invite, call control session */
p->jointcapability = p->capability;
ast_debug(2, "No SDP in Invite, third party call control\n");
@@ -23854,6 +23870,9 @@ static int handle_common_options(struct ast_flags *flags, struct ast_flags *mask
} else if (!strcasecmp(v->name, "t38pt_usertpsource")) {
ast_set_flag(&mask[1], SIP_PAGE2_UDPTL_DESTINATION);
ast_set2_flag(&flags[1], ast_true(v->value), SIP_PAGE2_UDPTL_DESTINATION);
+ } else if (!strcasecmp(v->name, "constantssrc")) {
+ ast_set_flag(&mask[1], SIP_PAGE2_CONSTANT_SSRC);
+ ast_set2_flag(&flags[1], ast_true(v->value), SIP_PAGE2_CONSTANT_SSRC);
} else
res = 0;
@@ -25357,6 +25376,8 @@ static int reload_config(enum channelreloadreason reason)
} else if (!strcasecmp(v->name, "disallowed_methods")) {
char *disallow = ast_strdupa(v->value);
mark_parsed_methods(&sip_cfg.disallowed_methods, disallow);
+ } else if (!strcasecmp(v->name, "constantssrc")) {
+ ast_set2_flag(&global_flags[1], ast_true(v->value), SIP_PAGE2_CONSTANT_SSRC);
}
}