summaryrefslogtreecommitdiff
path: root/channels/chan_pjsip.c
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2016-10-27 19:37:47 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2016-10-27 19:37:47 -0500
commit24d0907849d00fd6452818c978dbd2eac13908b9 (patch)
tree425dc97184c863d3382cc323477f5a9993da0d56 /channels/chan_pjsip.c
parent6f73da9c11201eba4c0f55d28fc71c4e878ed612 (diff)
parentaed6c219a3b21d212cea28425e0144eb52a3db70 (diff)
Merge "pjsip: Fix a few media bugs with reinvites and asymmetric payloads."
Diffstat (limited to 'channels/chan_pjsip.c')
-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 ea06d6757..b0dba1b47 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;