diff --git a/doc/CHANGES-staging/res_pjsip_session_codecs.md b/doc/CHANGES-staging/res_pjsip_session_codecs.md new file mode 100644 index 0000000000000000000000000000000000000000..847eb41b3283c2dd06cbebf77a7ca7103ac03392 --- /dev/null +++ b/doc/CHANGES-staging/res_pjsip_session_codecs.md @@ -0,0 +1,8 @@ +Subject: res_pjsip_session + +When placing an outgoing call to a PJSIP endpoint the intent +of any requested formats will now be respected. If only an audio +format is requested (such as ulaw) but the underlying endpoint +does not support the format the resulting SDP will still only +contain an audio stream, and not any additional streams such as +video. diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c index 4ce5a2427b1fbe38b3194e8e49111a3fec48553e..31b0d0c95931d70c73bdf8ebed8c607f3f706590 100644 --- a/res/res_pjsip_session.c +++ b/res/res_pjsip_session.c @@ -2727,16 +2727,6 @@ struct ast_sip_session *ast_sip_session_create_outgoing(struct ast_sip_endpoint } ast_format_cap_get_compatible(req_cap, endpoint->media.codecs, joint_cap); - if (!ast_format_cap_count(joint_cap)) { - ao2_ref(joint_cap, -1); - continue; - } - - clone_stream = ast_stream_clone(req_stream, NULL); - if (!clone_stream) { - ao2_ref(joint_cap, -1); - continue; - } if (ast_stream_get_type(req_stream) == AST_MEDIA_TYPE_AUDIO) { /* @@ -2748,6 +2738,17 @@ struct ast_sip_session *ast_sip_session_create_outgoing(struct ast_sip_endpoint endpoint->media.codecs, AST_MEDIA_TYPE_AUDIO); } + if (!ast_format_cap_count(joint_cap)) { + ao2_ref(joint_cap, -1); + continue; + } + + clone_stream = ast_stream_clone(req_stream, NULL); + if (!clone_stream) { + ao2_ref(joint_cap, -1); + continue; + } + ast_stream_set_formats(clone_stream, joint_cap); ao2_ref(joint_cap, -1);