[asterisk-bugs] [JIRA] (ASTERISK-29265) chan_sip: Allow text+video media streams, again.

Alexander Traud (JIRA) noreply at issues.asterisk.org
Wed Jan 27 11:46:00 CST 2021


     [ https://issues.asterisk.org/jira/browse/ASTERISK-29265?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Traud updated ASTERISK-29265:
---------------------------------------

    Attachment: no_audio_stream_part_2.patch

> chan_sip: Allow text+video media streams, again.
> ------------------------------------------------
>
>                 Key: ASTERISK-29265
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-29265
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Channels/chan_sip/CodecHandling
>    Affects Versions: 13.38.1, 16.16.0, 18.2.0
>            Reporter: Alexander Traud
>            Severity: Minor
>              Labels: patch
>         Attachments: no_audio_stream_part_2.patch
>
>
> 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. Since then, non-audio calls tore down Asterisk installations because that NULL is not tested:
> {{ast_format_cap_add(joint_cap, &best_audio_fmt)}} is going to crash when checking {{format->id}} in the source file {{format.cap.c}}. A great way to tear down those who are still using Asterisk 11. Later it [broke even further|https://issues.asterisk.org/jira/browse/ASTERISK-29259]. Therefore, Asterisk 13 and newer do not crash.
> 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].



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list