[Asterisk-code-review] chan_sip: Set up calls without audio (text+video), again. (asterisk[master])

George Joseph asteriskteam at digium.com
Thu Feb 4 09:54:48 CST 2021


George Joseph has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/15384 )

Change subject: chan_sip: Set up calls without audio (text+video), again.
......................................................................

chan_sip: Set up calls without audio (text+video), again.

The previous commit 6d980de fixed this issue in the core of Asterisk.
With that, each channel technology can be used without audio
theoretically. Practically, the channel-technology driver chan_sip
turned out to have an invalid check preventing that. chan_sip tested
whether there is at least one audio format. However, chan_sip has to
test whether there is at least one format. More cannot be tested while
requesting chan_sip because only the [general] capabilities but not the
[peer] caps are known yet. And the [peer] caps might not be a subset or
show any intersection with the [general] caps. This change here fixes
this.

The original commit f04d5fb, thirteen years ago, contained a software
bug as it passed ANY audio capability to the channel-technology driver.
Instead, it should have passed NO audio format. Therefore, this
addressed issue here was not noticed in Asterisk 1.6.x and Asterisk 1.8.
Then, Asterisk 10 changed that from ANY to NO, but nobody reported since
then.

ASTERISK-29265

Change-Id: Ic16a3bf13cd1b5c4fc4041ed74961177d96b600f
---
M channels/chan_sip.c
1 file changed, 2 insertions(+), 12 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved; Approved for Submit



diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 6c1914f..ab682bb 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -30796,7 +30796,6 @@
 	char *ext = NULL, *host;
 	char tmp[256];
 	struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
-	struct ast_str *cap_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
 	char *dnid;
 	char *secret = NULL;
 	char *md5secret = NULL;
@@ -30812,17 +30811,8 @@
 		AST_APP_ARG(remote_address);
 	);
 
-	/* mask request with some set of allowed formats.
-	 * XXX this needs to be fixed.
-	 * The original code uses AST_FORMAT_AUDIO_MASK, but it is
-	 * unclear what to use here. We have global_capabilities, which is
-	 * configured from sip.conf, and sip_tech.capabilities, which is
-	 * hardwired to all audio formats.
-	 */
-	if (!(ast_format_cap_has_type(cap, AST_MEDIA_TYPE_AUDIO))) {
-		ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format %s while capability is %s\n",
-			ast_format_cap_get_names(cap, &codec_buf),
-			ast_format_cap_get_names(sip_cfg.caps, &cap_buf));
+	if (ast_format_cap_empty(cap)) {
+		ast_log(LOG_NOTICE, "Asked to get a channel without offering any format\n");
 		*cause = AST_CAUSE_BEARERCAPABILITY_NOTAVAIL;	/* Can't find codec to connect to host */
 		return NULL;
 	}

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/15384
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Ic16a3bf13cd1b5c4fc4041ed74961177d96b600f
Gerrit-Change-Number: 15384
Gerrit-PatchSet: 2
Gerrit-Owner: Alexander Traud <pabstraud at compuserve.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210204/b8ccb49b/attachment.html>


More information about the asterisk-code-review mailing list