summaryrefslogtreecommitdiff
path: root/res/res_pjsip_sdp_rtp.c
diff options
context:
space:
mode:
authorAaron An <anjb@ti-net.com.cn>2016-08-30 11:26:03 +0800
committerJoshua Colp <jcolp@digium.com>2016-09-09 05:36:19 -0500
commit2a50c2910144e1b4095d171b1386fd5ebb0c5b5a (patch)
treebcc7712ca9397f1ae82f5e30905f21b247acde74 /res/res_pjsip_sdp_rtp.c
parentd3c4b901d476a41b3f7df063aeba3852df4e26b7 (diff)
res/res_pjsip: Add preferred_codec_only config to pjsip endpoint.
This patch add config to pjsip by endpoint. ;preferred_codec_only=yes ; Respond to a SIP invite with the single most preferred codec ; rather than advertising all joint codec capabilities. This ; limits the other side's codec choice to exactly what we prefer. ASTERISK-26317 #close Reported by: AaronAn Tested by: AaronAn Change-Id: Iad04dc55055403bbf5ec050997aee2dadc4f0762
Diffstat (limited to 'res/res_pjsip_sdp_rtp.c')
-rw-r--r--res/res_pjsip_sdp_rtp.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index 6610ef126..68d5fdb56 100644
--- a/res/res_pjsip_sdp_rtp.c
+++ b/res/res_pjsip_sdp_rtp.c
@@ -360,8 +360,13 @@ static int set_caps(struct ast_sip_session *session,
ast_format_cap_append_from_cap(caps, ast_channel_nativeformats(session->channel),
AST_MEDIA_TYPE_UNKNOWN);
ast_format_cap_remove_by_type(caps, media_type);
- ast_format_cap_append_from_cap(caps, joint, media_type);
-
+ if (session->endpoint->preferred_codec_only){
+ struct ast_format *preferred_fmt = ast_format_cap_get_format(joint, 0);
+ ast_format_cap_append(caps, preferred_fmt, 0);
+ ao2_ref(preferred_fmt, -1);
+ } else {
+ ast_format_cap_append_from_cap(caps, joint, media_type);
+ }
/*
* Apply the new formats to the channel, potentially changing
* raw read/write formats and translation path while doing so.