summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2016-10-27 16:51:33 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2016-10-27 16:51:33 -0500
commite8a3af2629ff8668b4ebd78a50bfebdbfaa66a6e (patch)
treeb35edf8f1301aa78dc546f12cfa0c805036a3562 /channels
parent66044dd606a87f804a1261ff6b0cf7b19f40164b (diff)
parente0bc17edfff27bb9dbbe931814fb5653005f3219 (diff)
Merge "pjsip: Fix a few media bugs with reinvites and asymmetric payloads." into 13
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_pjsip.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index 00e7aead2..cc4b2efa9 100644
--- a/channels/chan_pjsip.c
+++ b/channels/chan_pjsip.c
@@ -219,9 +219,7 @@ static enum ast_rtp_glue_result chan_pjsip_get_vrtp_peer(struct ast_channel *cha
/*! \brief Function called by RTP engine to get peer capabilities */
static void chan_pjsip_get_codec(struct ast_channel *chan, struct ast_format_cap *result)
{
- struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(chan);
-
- ast_format_cap_append_from_cap(result, channel->session->endpoint->media.codecs, AST_MEDIA_TYPE_UNKNOWN);
+ ast_format_cap_append_from_cap(result, ast_channel_nativeformats(chan), AST_MEDIA_TYPE_UNKNOWN);
}
/*! \brief Destructor function for \ref transport_info_data */
@@ -725,15 +723,28 @@ static struct ast_frame *chan_pjsip_read(struct ast_channel *ast)
session = channel->session;
- if (ast_format_cap_iscompatible_format(session->endpoint->media.codecs, f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
- ast_debug(1, "Oooh, got a frame with format of %s on channel '%s' when endpoint '%s' is not configured for it\n",
- ast_format_get_name(f->subclass.format), ast_channel_name(ast),
- ast_sorcery_object_get_id(session->endpoint));
+ if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
+ ast_debug(1, "Oooh, got a frame with format of %s on channel '%s' when it has not been negotiated\n",
+ ast_format_get_name(f->subclass.format), ast_channel_name(ast));
ast_frfree(f);
return &ast_null_frame;
}
+ if (!session->endpoint->asymmetric_rtp_codec &&
+ ast_format_cmp(ast_channel_rawwriteformat(ast), f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
+ /* For maximum compatibility we ensure that the write format matches that of the received media */
+ ast_debug(1, "Oooh, got a frame with format of %s on channel '%s' when we're sending '%s', switching to match\n",
+ ast_format_get_name(f->subclass.format), ast_channel_name(ast),
+ ast_format_get_name(ast_channel_rawwriteformat(ast)));
+ ast_channel_set_rawwriteformat(ast, f->subclass.format);
+ ast_set_write_format(ast, ast_channel_writeformat(ast));
+
+ if (ast_channel_is_bridged(ast)) {
+ ast_channel_set_unbridged_nolock(ast, 1);
+ }
+ }
+
if (session->dsp) {
int dsp_features;