chan_sip: Allow [peer] without audio (text+video).
Two previous commits,620d9f4
and6d980de
, allow to set up a call without audio, again. That was introduced originally with commitf04d5fb
but changed and broke over time. The original commit missed one scenario: A [peer] section in sip.conf, which does not allow audio at all. In that case, chan_sip rejected the call, although even when the requester offered no audio. Now, chan_sip does not check whether there is no audio format but checks whether there is no format in general. In other words, if there is at least one format to offer, the call succeeds. However, to prevent calls with no-audio, chan_sip still rejects calls when both call parties (caller = requester of the call *and* callee = [peer] section in sip.conf) included audio. In such a case, it is expected that the call should have audio. ASTERISK-29280 Change-Id: I0fb74faf51ef22a60c10b467df6a4d1c1943b73e
This commit is contained in:
parent
28f187d6c5
commit
45e48e387c
|
@ -6555,8 +6555,21 @@ static int sip_call(struct ast_channel *ast, const char *dest, int timeout)
|
|||
ast_rtp_instance_available_formats(p->rtp, p->caps, p->prefcaps, p->jointcaps);
|
||||
p->jointnoncodeccapability = p->noncodeccapability;
|
||||
|
||||
/* If there are no audio formats left to offer, punt */
|
||||
if (!(ast_format_cap_has_type(p->jointcaps, AST_MEDIA_TYPE_AUDIO))) {
|
||||
/* If there are no formats left to offer, punt */
|
||||
if (ast_format_cap_empty(p->jointcaps)) {
|
||||
ast_log(LOG_WARNING, "No format found to offer. Cancelling call to %s\n", p->username);
|
||||
res = -1;
|
||||
/* If audio was requested (prefcaps) and the [peer] section contains
|
||||
* audio (caps) the user expects audio. In that case, if jointcaps
|
||||
* contain no audio, punt. Furthermore, this check allows the [peer]
|
||||
* section to have no audio. In that case, the user expects no audio
|
||||
* and we can pass. Finally, this check allows the requester not to
|
||||
* offer any audio. In that case, the call is expected to have no audio
|
||||
* and we can pass, as well.
|
||||
*/
|
||||
} else if ((ast_format_cap_empty(p->caps) || ast_format_cap_has_type(p->caps, AST_MEDIA_TYPE_AUDIO)) &&
|
||||
(ast_format_cap_empty(p->prefcaps) || ast_format_cap_has_type(p->prefcaps, AST_MEDIA_TYPE_AUDIO)) &&
|
||||
!ast_format_cap_has_type(p->jointcaps, AST_MEDIA_TYPE_AUDIO)) {
|
||||
ast_log(LOG_WARNING, "No audio format found to offer. Cancelling call to %s\n", p->username);
|
||||
res = -1;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue