From 07b3742ad259a92b4cefd9f149039d72c9034932 Mon Sep 17 00:00:00 2001
From: Terry Wilson <twilson@digium.com>
Date: Tue, 10 May 2011 00:22:02 +0000
Subject: [PATCH] Merged revisions 318337 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r318337 | twilson | 2011-05-09 15:23:15 -0500 (Mon, 09 May 2011) | 18 lines

  Merged revisions 318331 via svnmerge from
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2

  ........
    r318331 | twilson | 2011-05-09 15:04:41 -0500 (Mon, 09 May 2011) | 12 lines

    Don't offer video to directmedia callee unless caller offered it as well

    Make sure that when directmedia is enabled, that video is not offered to the
    callee even if it supports it. p->vrtp will not exist since the caller didn't
    offer video.

    (closes issue #19195)
    Reported by: one47
    Patches:
          sip_cant_add_video_rtp uploaded by one47 (license 23)
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@318400 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 channels/chan_sip.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index dc97c11aa4..af83c8a4de 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -11069,11 +11069,15 @@ static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int
 		doing_directmedia = (!ast_sockaddr_isnull(&p->redirip) && !(ast_format_cap_is_empty(p->redircaps))) ? TRUE : FALSE;
 		/* Check if we need video in this call */
 		if ((ast_format_cap_has_type(p->jointcaps, AST_FORMAT_TYPE_VIDEO)) && !p->novideo) {
-			if (p->vrtp) {
+			ast_format_cap_joint_copy(p->jointcaps, p->redircaps, tmpcap);
+			if (doing_directmedia && !ast_format_cap_has_type(tmpcap, AST_FORMAT_TYPE_VIDEO)) {
+				ast_debug(2, "This call needs video offers, but caller probably did not offer it!\n");
+			} else if (p->vrtp) {
 				needvideo = TRUE;
 				ast_debug(2, "This call needs video offers!\n");
-			} else
+			} else {
 				ast_debug(2, "This call needs video offers, but there's no video support enabled!\n");
+			}
 		}
 		/* Check if we need text in this call */
 		if ((ast_format_cap_has_type(p->jointcaps, AST_FORMAT_TYPE_TEXT)) && !p->notext) {
-- 
GitLab