summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2017-06-13 09:26:02 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2017-06-13 09:26:02 -0500
commit7994914c882874593eb17fdd8c910ee418f44a1b (patch)
treefc494f06178fd4e922f6afc27966533391e709a4 /channels
parent9bf726d30e4ae5a48a5b315a405de5ce5b8b6ce1 (diff)
parenta34dd63eb0a961a901c7540fb02a8c8cbbf53024 (diff)
Merge "pjsip: Extend 'asymmetric_rtp_codec' option to include us changing." into 14
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_pjsip.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index d5bf1e437..f565ea829 100644
--- a/channels/chan_pjsip.c
+++ b/channels/chan_pjsip.c
@@ -737,11 +737,24 @@ static struct ast_frame *chan_pjsip_read(struct ast_channel *ast)
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 */
+ struct ast_format_cap *caps;
+
+ /* For maximum compatibility we ensure that the formats match 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)));
+
+ caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
+ if (caps) {
+ ast_format_cap_append_from_cap(caps, ast_channel_nativeformats(ast), AST_MEDIA_TYPE_UNKNOWN);
+ ast_format_cap_remove_by_type(caps, AST_MEDIA_TYPE_AUDIO);
+ ast_format_cap_append(caps, f->subclass.format, 0);
+ ast_channel_nativeformats_set(ast, caps);
+ ao2_ref(caps, -1);
+ }
+
ast_set_write_format_path(ast, ast_channel_writeformat(ast), f->subclass.format);
+ ast_set_read_format_path(ast, ast_channel_readformat(ast), f->subclass.format);
if (ast_channel_is_bridged(ast)) {
ast_channel_set_unbridged_nolock(ast, 1);