<p>George Joseph <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/15384">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved; Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">chan_sip: Set up calls without audio (text+video), again.<br><br>The previous commit 6d980de fixed this issue in the core of Asterisk.<br>With that, each channel technology can be used without audio<br>theoretically. Practically, the channel-technology driver chan_sip<br>turned out to have an invalid check preventing that. chan_sip tested<br>whether there is at least one audio format. However, chan_sip has to<br>test whether there is at least one format. More cannot be tested while<br>requesting chan_sip because only the [general] capabilities but not the<br>[peer] caps are known yet. And the [peer] caps might not be a subset or<br>show any intersection with the [general] caps. This change here fixes<br>this.<br><br>The original commit f04d5fb, thirteen years ago, contained a software<br>bug as it passed ANY audio capability to the channel-technology driver.<br>Instead, it should have passed NO audio format. Therefore, this<br>addressed issue here was not noticed in Asterisk 1.6.x and Asterisk 1.8.<br>Then, Asterisk 10 changed that from ANY to NO, but nobody reported since<br>then.<br><br>ASTERISK-29265<br><br>Change-Id: Ic16a3bf13cd1b5c4fc4041ed74961177d96b600f<br>---<br>M channels/chan_sip.c<br>1 file changed, 2 insertions(+), 12 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/channels/chan_sip.c b/channels/chan_sip.c</span><br><span>index 6c1914f..ab682bb 100644</span><br><span>--- a/channels/chan_sip.c</span><br><span>+++ b/channels/chan_sip.c</span><br><span>@@ -30796,7 +30796,6 @@</span><br><span>   char *ext = NULL, *host;</span><br><span>     char tmp[256];</span><br><span>       struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);</span><br><span style="color: hsl(0, 100%, 40%);">-   struct ast_str *cap_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);</span><br><span>  char *dnid;</span><br><span>  char *secret = NULL;</span><br><span>         char *md5secret = NULL;</span><br><span>@@ -30812,17 +30811,8 @@</span><br><span>           AST_APP_ARG(remote_address);</span><br><span>         );</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-  /* mask request with some set of allowed formats.</span><br><span style="color: hsl(0, 100%, 40%);">-        * XXX this needs to be fixed.</span><br><span style="color: hsl(0, 100%, 40%);">-   * The original code uses AST_FORMAT_AUDIO_MASK, but it is</span><br><span style="color: hsl(0, 100%, 40%);">-       * unclear what to use here. We have global_capabilities, which is</span><br><span style="color: hsl(0, 100%, 40%);">-       * configured from sip.conf, and sip_tech.capabilities, which is</span><br><span style="color: hsl(0, 100%, 40%);">-         * hardwired to all audio formats.</span><br><span style="color: hsl(0, 100%, 40%);">-       */</span><br><span style="color: hsl(0, 100%, 40%);">-     if (!(ast_format_cap_has_type(cap, AST_MEDIA_TYPE_AUDIO))) {</span><br><span style="color: hsl(0, 100%, 40%);">-            ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format %s while capability is %s\n",</span><br><span style="color: hsl(0, 100%, 40%);">-                       ast_format_cap_get_names(cap, &codec_buf),</span><br><span style="color: hsl(0, 100%, 40%);">-                  ast_format_cap_get_names(sip_cfg.caps, &cap_buf));</span><br><span style="color: hsl(120, 100%, 40%);">+        if (ast_format_cap_empty(cap)) {</span><br><span style="color: hsl(120, 100%, 40%);">+              ast_log(LOG_NOTICE, "Asked to get a channel without offering any format\n");</span><br><span>               *cause = AST_CAUSE_BEARERCAPABILITY_NOTAVAIL;   /* Can't find codec to connect to host */</span><br><span>                return NULL;</span><br><span>         }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/15384">change 15384</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/15384"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ic16a3bf13cd1b5c4fc4041ed74961177d96b600f </div>
<div style="display:none"> Gerrit-Change-Number: 15384 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Alexander Traud <pabstraud@compuserve.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>