summaryrefslogtreecommitdiff
path: root/channels/chan_pjsip.c
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2015-07-16 11:46:14 -0300
committerJoshua Colp <jcolp@digium.com>2015-07-17 14:34:59 -0300
commit2c626ceb64e11f7d18b97023f09072a992060121 (patch)
treed5aee8f1c80c3a1c2d68710f428427901b73f651 /channels/chan_pjsip.c
parent5086bdacfb921ba3edbe49a1177163f5be846549 (diff)
chan_pjsip: Don't change formats when frame of unsupported format is received.
Receipt of an RTP packet currently causes the formats on an PJSIP channel to change to the format of the RTP packet. In some off-nominal cases it's possible for this to be a format that has not been configured or negotiated. This change makes it so only formats explicitly configured on the endpoint are allowed. ASTERISK-25258 #close Change-Id: If93d641fb6418a285928839300d7854cab8c1020
Diffstat (limited to 'channels/chan_pjsip.c')
-rw-r--r--channels/chan_pjsip.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index c6a02d9c7..919b92618 100644
--- a/channels/chan_pjsip.c
+++ b/channels/chan_pjsip.c
@@ -629,6 +629,15 @@ static struct ast_frame *chan_pjsip_read(struct ast_channel *ast)
return f;
}
+ if (ast_format_cap_iscompatible_format(channel->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(channel->session->endpoint));
+
+ ast_frfree(f);
+ return &ast_null_frame;
+ }
+
if (channel->session->dsp) {
f = ast_dsp_process(ast, channel->session->dsp, f);