From 5a1d90e1fbfc4b48927aad55311f3b38efbf1f54 Mon Sep 17 00:00:00 2001 From: Tilghman Lesher Date: Tue, 15 Jul 2008 16:20:35 +0000 Subject: Additional option for videosupport (always) that disables the optimization to fail to setup video RTP if the two endpoints will not support it. This assists with call files and certain transfers to ensure that if two video phones are ever connected, they will always share a video feed. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@130951 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- CHANGES | 4 ++++ channels/chan_sip.c | 29 ++++++++++++++++++++++------- configs/sip.conf.sample | 16 +++++++++++----- 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/CHANGES b/CHANGES index d2ac513a1..870a3582c 100644 --- a/CHANGES +++ b/CHANGES @@ -127,6 +127,10 @@ SIP Changes * 'sip show peers' and 'sip show users' display their entries sorted in alphabetical order, as opposed to the order they were in, in the config file or database. + * Videosupport now supports an additional option, "always", which always sets + up video RTP ports, even on clients that don't support it. This helps with + callfiles and certain transfers to ensure that if two video phones are + connected, they will always share video feeds. IAX Changes ----------- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 580160731..35a208bf5 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -1056,11 +1056,13 @@ struct sip_auth { #define SIP_PAGE2_BUGGY_MWI (1 << 26) /*!< DP: Buggy CISCO MWI fix */ #define SIP_PAGE2_REGISTERTRYING (1 << 29) /*!< DP: Send 100 Trying on REGISTER attempts */ #define SIP_PAGE2_UDPTL_DESTINATION (1 << 30) /*!< DP: Use source IP of RTP as destination if NAT is enabled */ +#define SIP_PAGE2_VIDEOSUPPORT_ALWAYS (1 << 31) /*!< DP: Always set up video, even if endpoints don't support it */ #define SIP_PAGE2_FLAGS_TO_COPY \ (SIP_PAGE2_ALLOWSUBSCRIBE | SIP_PAGE2_ALLOWOVERLAP | SIP_PAGE2_VIDEOSUPPORT | \ SIP_PAGE2_T38SUPPORT | SIP_PAGE2_RFC2833_COMPENSATE | SIP_PAGE2_BUGGY_MWI | \ - SIP_PAGE2_TEXTSUPPORT | SIP_PAGE2_UDPTL_DESTINATION) + SIP_PAGE2_TEXTSUPPORT | SIP_PAGE2_UDPTL_DESTINATION | \ + SIP_PAGE2_VIDEOSUPPORT_ALWAYS) /*@}*/ @@ -4147,7 +4149,10 @@ static int create_addr_from_peer(struct sip_pvt *dialog, struct sip_peer *peer) ast_copy_flags(&dialog->flags[0], &peer->flags[0], SIP_FLAGS_TO_COPY); ast_copy_flags(&dialog->flags[1], &peer->flags[1], SIP_PAGE2_FLAGS_TO_COPY); dialog->capability = peer->capability; - if ((!ast_test_flag(&dialog->flags[1], SIP_PAGE2_VIDEOSUPPORT) || !(dialog->capability & AST_FORMAT_VIDEO_MASK)) && dialog->vrtp) { + if (!ast_test_flag(&dialog->flags[1], SIP_PAGE2_VIDEOSUPPORT_ALWAYS) && + (!ast_test_flag(&dialog->flags[1], SIP_PAGE2_VIDEOSUPPORT) || + !(dialog->capability & AST_FORMAT_VIDEO_MASK)) && + dialog->vrtp) { ast_rtp_destroy(dialog->vrtp); dialog->vrtp = NULL; } @@ -5509,7 +5514,9 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit We also check for vrtp. If it's not there, we are not allowed do any video anyway. */ if (i->vrtp) { - if (i->prefcodec) + if (ast_test_flag(&i->flags[1], SIP_PAGE2_VIDEOSUPPORT)) + needvideo = AST_FORMAT_VIDEO_MASK; + else if (i->prefcodec) needvideo = i->prefcodec & AST_FORMAT_VIDEO_MASK; /* Outbound call */ else needvideo = i->jointcapability & AST_FORMAT_VIDEO_MASK; /* Inbound call */ @@ -11793,7 +11800,10 @@ static enum check_auth_result check_peer_ok(struct sip_pvt *p, char *of, if (p->peercapability) p->jointcapability &= p->peercapability; p->maxcallbitrate = peer->maxcallbitrate; - if ((!ast_test_flag(&p->flags[1], SIP_PAGE2_VIDEOSUPPORT) || !(p->capability & AST_FORMAT_VIDEO_MASK)) && p->vrtp) { + if (!ast_test_flag(&p->flags[1], SIP_PAGE2_VIDEOSUPPORT_ALWAYS) && + (!ast_test_flag(&p->flags[1], SIP_PAGE2_VIDEOSUPPORT) || + !(p->capability & AST_FORMAT_VIDEO_MASK)) && + p->vrtp) { ast_rtp_destroy(p->vrtp); p->vrtp = NULL; } @@ -20008,8 +20018,13 @@ static int handle_common_options(struct ast_flags *flags, struct ast_flags *mask ast_set_flag(&mask[0], SIP_PROMISCREDIR); ast_set2_flag(&flags[0], ast_true(v->value), SIP_PROMISCREDIR); } else if (!strcasecmp(v->name, "videosupport")) { - ast_set_flag(&mask[1], SIP_PAGE2_VIDEOSUPPORT); - ast_set2_flag(&flags[1], ast_true(v->value), SIP_PAGE2_VIDEOSUPPORT); + if (!strcasecmp(v->value, "always")) { + ast_set_flag(&mask[1], SIP_PAGE2_VIDEOSUPPORT_ALWAYS); + ast_set_flag(&flags[1], SIP_PAGE2_VIDEOSUPPORT_ALWAYS); + } else { + ast_set_flag(&mask[1], SIP_PAGE2_VIDEOSUPPORT); + ast_set2_flag(&flags[1], ast_true(v->value), SIP_PAGE2_VIDEOSUPPORT); + } } else if (!strcasecmp(v->name, "textsupport")) { ast_set_flag(&mask[1], SIP_PAGE2_TEXTSUPPORT); ast_set2_flag(&flags[1], ast_true(v->value), SIP_PAGE2_TEXTSUPPORT); @@ -20936,7 +20951,7 @@ static int reload_config(enum channelreloadreason reason) /* Copy the default jb config over global_jbconf */ memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf)); - ast_clear_flag(&global_flags[1], SIP_PAGE2_VIDEOSUPPORT); + ast_clear_flag(&global_flags[1], SIP_PAGE2_VIDEOSUPPORT | SIP_PAGE2_VIDEOSUPPORT_ALWAYS); ast_clear_flag(&global_flags[1], SIP_PAGE2_TEXTSUPPORT); diff --git a/configs/sip.conf.sample b/configs/sip.conf.sample index 54f497328..9bdced5c3 100644 --- a/configs/sip.conf.sample +++ b/configs/sip.conf.sample @@ -211,11 +211,17 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls ;compactheaders = yes ; send compact sip headers. ; -;videosupport=yes ; Turn on support for SIP video. You need to turn this on - ; in the this section to get any video support at all. - ; You can turn it off on a per peer basis if the general - ; video support is enabled, but you can't enable it for - ; one peer only without enabling in the general section. +;videosupport=yes ; Turn on support for SIP video. You need to turn this + ; on in this section to get any video support at all. + ; You can turn it off on a per peer basis if the general + ; video support is enabled, but you can't enable it for + ; one peer only without enabling in the general section. + ; If you set videosupport to "always", then RTP ports will + ; always be set up for video, even on clients that don't + ; support it. This assists callfile-derived calls and + ; certain transferred calls to use always use video when + ; available. [yes|NO|always] + ;maxcallbitrate=384 ; Maximum bitrate for video calls (default 384 kb/s) ; Videosupport and maxcallbitrate is settable ; for peers and users as well -- cgit v1.2.3