From 3dc7d1b3edeb276d9f4b0cbfc5b4ac8cd13c6c3d Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Thu, 6 Dec 2018 08:15:57 -0500 Subject: [PATCH] TT#45472 support updating media ID strings Change-Id: I8c8f42419d81fb3e08ecbbf09999d2be4f2ac93f --- daemon/call.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/daemon/call.c b/daemon/call.c index 27fa75d0f..c7714f581 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -1703,6 +1703,24 @@ static void __update_media_id(struct call_media *media, struct call_media *other g_hash_table_insert(other_ml->media_ids, &other_media->media_id, other_media); } + else { + // RFC 5888 allows changing the media ID in a re-invite + // (section 9.1), so handle this here. + if (sp->media_id.s) { + if (str_cmp_str(&other_media->media_id, &sp->media_id)) { + // mismatch - update + g_hash_table_remove(other_ml->media_ids, &other_media->media_id); + call_str_cpy(call, &other_media->media_id, &sp->media_id); + g_hash_table_insert(other_ml->media_ids, &other_media->media_id, + other_media); + } + } + else { + // we already have a media ID, but re-invite offer did not specify + // one. we keep what we already have. + ; + } + } if (!media->media_id.s) { // outgoing side: we copy from the other side if (other_media->media_id.s) @@ -1716,6 +1734,11 @@ static void __update_media_id(struct call_media *media, struct call_media *other if (media->media_id.s) g_hash_table_insert(ml->media_ids, &media->media_id, media); } + else { + // we already have a media ID. keep what we have and ignore what's + // happening on the other side. + ; + } } else if (flags->opmode == OP_ANSWER) { // in normal cases, if the answer contains a media ID, it must match