Commit 824fa2960a for asterisk.org
commit 824fa2960aa03fab1986aff012aea88edea236ae
Author: Yagizalp Zaimoglu <yagizalp.zaimoglu@fertig.ai>
Date: Wed Oct 7 10:02:51 2026 +0000
chan_pjsip: Fix reversed read format path on received codec change.
When chan_pjsip_read_stream() receives a voice frame in a codec other
than the one it is sending, it switches the channel to that codec and
rebuilds both translation paths. The write path call is correct, but
the read path call passes its arguments in (core, raw) order while
ast_set_read_format_path() takes (raw, core).
If an application has set a signed linear read format, the channel then
reads the received codec untranslated, e.g. ReadFormat ulaw with
ReadTranscode (slin@8000)->(ulaw@8000). AudioSocket, for one, forwards
that ulaw as slin for the rest of the call.
Resolves: #2203
diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index c0e7611beb..403637b482 100644
--- a/channels/chan_pjsip.c
+++ b/channels/chan_pjsip.c
@@ -993,7 +993,7 @@ static struct ast_frame *chan_pjsip_read_stream(struct ast_channel *ast)
}
ast_set_write_format_path(ast, ast_channel_writeformat(ast), cur->subclass.format);
- ast_set_read_format_path(ast, ast_channel_readformat(ast), cur->subclass.format);
+ ast_set_read_format_path(ast, cur->subclass.format, ast_channel_readformat(ast));
if (ast_channel_is_bridged(ast)) {
ast_channel_set_unbridged_nolock(ast, 1);