[Home]

Summary:ASTERISK-29265: chan_sip: Allow text+video media streams, again.
Reporter:Alexander Traud (traud)Labels:patch
Date Opened:2021-01-27 11:38:16.000-0600Date Closed:2021-02-04 09:55:27.000-0600
Priority:MinorRegression?
Status:Closed/CompleteComponents:Channels/chan_sip/CodecHandling
Versions:13.38.1 16.16.0 18.2.0 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) no_audio_stream_part_2.patch
Description:13 years ago, for Asterisk 1.6.0, commit [f04d5fb|https://github.com/asterisk/asterisk/commit/f04d5fb83dd36e600e1e257568ea3ca53154315e] allowed sessions without audio, for example, text+video. That change made it too easy for oneself because, in the module channel, the source code offered {{chan->tech->capabilities}} to the channel as audio formats then. {{chan->tech->capabilities}} includes only audio formats. Of course, a translation to any audio format succeeds because it includes the non-translation, the pass-through case.

However, if, for example, the channel driver is configured without any audio format, no audio format is passed (see [Git Blame|https://github.com/asterisk/asterisk/blame/652fb64a01c7a8656697d07e606620ee0ced6929/main/channel.c#L5410]). In that case, for example, with the SIP channel driver chan_sip, {{sip_request_call}} returned with
bq. Asked to get a channel of unsupported format

10 years ago, for Asterisk 10, commit [c26c190|https://github.com/asterisk/asterisk/commit/c26c190711a1bbe3b5fff1a93facae333757c56e#diff-11338cb1d71291b251965dbc23f1822c6bbd77e40859b9b096c27c4bc818e88dR5559] changed that from ANY to NULL. With Asterisk 13, it [broke even further …|https://issues.asterisk.org/jira/browse/ASTERISK-29259]

That were the 13 years of history why the check for-at-least-one-audio-format in {{chan_sip.sip_request_call(.)}} was wrong since the introduction of commit [f04d5fb|https://github.com/asterisk/asterisk/commit/f04d5fb83dd36e600e1e257568ea3ca53154315e] but nobody noticed.

At {{chan_sip->sip_request_call(.)}}, the module channel already checked there is an audio format as possible destination format -- if the caller included an audio format. The parameter {{cap}} includes the best audio format and all other format types. Consequently, {{cap}} includes
* one or no audio format
* all other format types.

*Examples*
* when a caller offers h264,h263 {{caps}} includes exactly that; no audio format but several video formats
* when a caller offers g722,ulaw {{caps}} includes {{g722}}; not more than one audio format
* when a caller offers g722,ulaw,h264,h263,t140,red {{caps} includes g722,h264,h263,t140,red; just the audio format type gets reduced to one.

*sip_cfg.caps*, previously *global_capabilities*
are the allowed formats in the \[general\] section of the configuration file sip.conf. That includes not just audio but also video and text formats.

*sip_tech.capabilities*
are the possible formats for chan_sip. That includes formats like testlaw and adpcm. However, this list contains audio formats only.

In sip.conf, a \[peer\] section might allow a complete different set than the \[general\] section, for example, the peer might allow g723,h263 and the generally g722,ulaw,h264. One might not be a superset or subset. They might even not have an intersection. Consequently, there is no way to check whether there is an intersection with the peer's formats at this stage of the call request.

*Long story short*
At the beginning of {{sip_request_call(.)}} only one check is possible: Is the offered list of formats empty? The attached patch does this and fixes a remaining question of another 13-year-old commit, [e5f3a6c|https://github.com/asterisk/asterisk/commit/e5f3a6ccdbb3ddb33e83dc20dd476d961aaf4dfd].
Comments:By: Asterisk Team (asteriskteam) 2021-01-27 11:38:17.473-0600

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

Please note that by submitting data, code, or documentation to Sangoma through JIRA, you accept the Terms of Use present at [https://www.asterisk.org/terms-of-use/|https://www.asterisk.org/terms-of-use/].

By: Friendly Automation (friendly-automation) 2021-02-04 09:55:28.711-0600

Change 15379 merged by George Joseph:
chan_sip: Set up calls without audio (text+video), again.

[https://gerrit.asterisk.org/c/asterisk/+/15379|https://gerrit.asterisk.org/c/asterisk/+/15379]

By: Friendly Automation (friendly-automation) 2021-02-04 09:56:00.117-0600

Change 15378 merged by George Joseph:
chan_sip: Set up calls without audio (text+video), again.

[https://gerrit.asterisk.org/c/asterisk/+/15378|https://gerrit.asterisk.org/c/asterisk/+/15378]

By: Friendly Automation (friendly-automation) 2021-02-04 09:56:59.383-0600

Change 15384 merged by George Joseph:
chan_sip: Set up calls without audio (text+video), again.

[https://gerrit.asterisk.org/c/asterisk/+/15384|https://gerrit.asterisk.org/c/asterisk/+/15384]