summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorKinsey Moore <kmoore@digium.com>2014-01-22 18:34:13 +0000
committerKinsey Moore <kmoore@digium.com>2014-01-22 18:34:13 +0000
commit0fbffdb3b29b8d4e19c105f88dd7ea6371c728af (patch)
treef6fc0a949dd9ebe2e07bf5119df8e46750fd3143 /channels
parent761d7271d4c1c4eeb97dfbbfd9bae7992023967f (diff)
chan_sip: Decline image streams on unsupported transports
This change allows chan_sip to decline individual image streams over unsupported transports in the SDP of the 200 response. Previously, an image stream offer with RTP/AVP as the transport would cause chan_sip to respond with a 488. (closes issue ASTERISK-22988) Reported by: adomjan Original patch by: adomjan ........ Merged revisions 406170 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 406171 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 406172 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406173 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 8c54f02ba..961c8552c 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -10507,6 +10507,18 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
* respond with the EC they want to use */
ast_udptl_set_error_correction_scheme(p->udptl, UDPTL_ERROR_CORRECTION_NONE);
}
+ } else if (sscanf(m, "image %30u %17s t38%n", &x, protocol, &len) == 2 && len > 0) {
+ ast_log(LOG_WARNING, "Declining image stream due to unsupported transport: %s\n", m);
+ /* produce zero-port m-line since this is guaranteed to be declined
+ * length is "m=image 0 strlen(protocol) t38" + "\r\n\0" */
+ if (!(offer->decline_m_line = ast_malloc(10 + strlen(protocol) + 7))) {
+ ast_log(LOG_WARNING, "Failed to allocate memory for SDP offer declination\n");
+ res = -1;
+ goto process_sdp_cleanup;
+ }
+ /* guaranteed to be exactly the right length */
+ sprintf(offer->decline_m_line, "m=image 0 %s t38\r\n", protocol);
+ continue;
} else {
ast_log(LOG_WARNING, "Rejecting image media offer due to invalid or unsupported syntax: %s\n", m);
res = -1;