summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins2 <jenkins2@gerrit.asterisk.org>2017-09-07 12:32:41 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2017-09-07 12:32:42 -0500
commit04f9357a5d58495f75076a4e92cee51755416c87 (patch)
tree6592321ef7180d86b0e6da07f69d74db568d59b5
parented2920dcc0c8a1cf5b9a82e68efc683121e9dd8c (diff)
parent11d013a9dfb096329d2705f42c660ac78c1b517e (diff)
Merge "res_pjsip_session: Preserve stream name during renegotiation." into 15
-rw-r--r--res/res_pjsip_session.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index 545113f56..b9970244e 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -588,7 +588,14 @@ static int handle_incoming_sdp(struct ast_sip_session *session, const pjmedia_sd
stream = ast_stream_topology_get_stream(session->pending_media_state->topology, i);
}
if (!stream) {
- stream = ast_stream_alloc(ast_codec_media_type2str(type), type);
+ struct ast_stream *existing_stream = NULL;
+
+ if (session->active_media_state->topology &&
+ (i < ast_stream_topology_get_count(session->active_media_state->topology))) {
+ existing_stream = ast_stream_topology_get_stream(session->active_media_state->topology, i);
+ }
+
+ stream = ast_stream_alloc(existing_stream ? ast_stream_get_name(existing_stream) : ast_codec_media_type2str(type), type);
if (!stream) {
return -1;
}
@@ -1626,6 +1633,7 @@ static int sdp_requires_deferral(struct ast_sip_session *session, const pjmedia_
char media[20];
struct ast_sip_session_sdp_handler *handler;
RAII_VAR(struct sdp_handler_list *, handler_list, NULL, ao2_cleanup);
+ struct ast_stream *existing_stream = NULL;
struct ast_stream *stream;
enum ast_media_type type;
struct ast_sip_session_media *session_media = NULL;
@@ -1634,8 +1642,13 @@ static int sdp_requires_deferral(struct ast_sip_session *session, const pjmedia_
/* We need a null-terminated version of the media string */
ast_copy_pj_str(media, &sdp->media[i]->desc.media, sizeof(media));
+ if (session->active_media_state->topology &&
+ (i < ast_stream_topology_get_count(session->active_media_state->topology))) {
+ existing_stream = ast_stream_topology_get_stream(session->active_media_state->topology, i);
+ }
+
type = ast_media_type_from_str(media);
- stream = ast_stream_alloc(ast_codec_media_type2str(type), type);
+ stream = ast_stream_alloc(existing_stream ? ast_stream_get_name(existing_stream) : ast_codec_media_type2str(type), type);
if (!stream) {
return -1;
}