diff --git a/daemon/call.c b/daemon/call.c index d133c25b2..83eb86ed0 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -2701,13 +2701,13 @@ static void __media_init_from_flags(struct call_media *other_media, struct call_ } } - /* moved as plain text attributes, required later by sdp_create() - * extmap - * other (unknown type) - */ - if (media) { - t_queue_clear_full(&media->sdp_attributes, sdp_attr_free); - media->sdp_attributes = *additional_attributes; + if (flags->opmode == OP_OFFER || flags->opmode == OP_ANSWER || flags->opmode == OP_PUBLISH) { + /* moved as plain text attributes, required later by sdp_create() + * extmap + * other (unknown type) + */ + t_queue_clear_full(&other_media->sdp_attributes, sdp_attr_free); + other_media->sdp_attributes = *additional_attributes; t_queue_init(additional_attributes); } diff --git a/daemon/sdp.c b/daemon/sdp.c index 8f3abfdb3..db4a9a83f 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -2149,7 +2149,16 @@ static void insert_codec_parameters(GString *s, struct call_media *cm, } void sdp_insert_media_attributes(GString *gs, union sdp_attr_print_arg a, const sdp_ng_flags *flags) { - for (__auto_type l = a.cm->sdp_attributes.head; l; l = l->next) { + // Look up the source media. We copy the source's attributes if there is only one source + // media. Otherwise we skip this step. + + if (a.cm->media_subscriptions.length != 1) + return; + + __auto_type sub = a.cm->media_subscriptions.head->data; + __auto_type sub_m = sub->media; + + for (__auto_type l = sub_m->sdp_attributes.head; l; l = l->next) { __auto_type s = l->data; if (s->type == SDP_ATTR_TYPE_EXTMAP && flags->strip_extmap && !MEDIA_ISSET(a.cm, PASSTHRU)) continue; diff --git a/t/auto-daemon-tests-pubsub.pl b/t/auto-daemon-tests-pubsub.pl index 921021377..77ce37183 100755 --- a/t/auto-daemon-tests-pubsub.pl +++ b/t/auto-daemon-tests-pubsub.pl @@ -117,6 +117,9 @@ m=audio PORT RTP/AVP 0 c=IN IP4 203.0.113.1 a=label:1 a=rtpmap:0 PCMU/8000 +a=m-dummy +a=m-foo:bar +a=m-baz:quux blah a=sendonly a=rtcp:PORT SDP @@ -153,6 +156,9 @@ m=audio PORT RTP/AVP 0 c=IN IP4 203.0.113.1 a=label:1 a=rtpmap:0 PCMU/8000 +a=m-dummy +a=m-foo:bar +a=m-baz:quux blah a=sendonly a=rtcp:PORT SDP @@ -189,6 +195,9 @@ m=audio PORT RTP/AVP 0 c=IN IP4 203.0.113.1 a=label:1 a=rtpmap:0 PCMU/8000 +a=m-dummy +a=m-foo:bar +a=m-baz:quux blah a=sendonly a=rtcp:PORT SDP @@ -226,6 +235,9 @@ m=audio PORT RTP/AVP 0 c=IN IP4 203.0.113.1 a=label:1 a=rtpmap:0 PCMU/8000 +a=m-dummy +a=m-foo:bar +a=m-baz:quux blah a=inactive a=rtcp:PORT SDP @@ -262,6 +274,9 @@ m=audio PORT RTP/AVP 0 c=IN IP4 203.0.113.1 a=label:1 a=rtpmap:0 PCMU/8000 +a=m-dummy +a=m-foo:bar +a=m-baz:quux blah a=sendonly a=rtcp:PORT SDP @@ -1158,12 +1173,18 @@ m=audio PORT RTP/AVP 0 8 c=IN IP4 203.0.113.1 a=rtpmap:0 PCMU/8000 a=rtpmap:8 PCMA/8000 +a=m-dummy +a=m-foo:bar +a=m-baz:quux blah a=sendonly a=rtcp:PORT m=audio PORT RTP/AVP 0 8 c=IN IP4 203.0.113.1 a=rtpmap:0 PCMU/8000 a=rtpmap:8 PCMA/8000 +a=b-dummy +a=b-foo:bar +a=b-baz:quux blah a=sendonly a=rtcp:PORT SDP @@ -3299,6 +3320,9 @@ a=s-baz:quux blah m=audio PORT RTP/AVP 0 c=IN IP4 203.0.113.1 a=rtpmap:0 PCMU/8000 +a=m-dummy +a=m-foo:bar +a=m-baz:quux blah a=sendonly a=rtcp:PORT SDP diff --git a/t/auto-daemon-tests.pl b/t/auto-daemon-tests.pl index 674e83bea..558322e5a 100755 --- a/t/auto-daemon-tests.pl +++ b/t/auto-daemon-tests.pl @@ -1574,6 +1574,7 @@ a=rtpmap:118 AMR/8000 a=fmtp:118 mode-set=0,2,4,7;mode-change-period=2;mode-change-capability=2;mode-change-neighbor=1;max-red=0 a=rtpmap:98 telephone-event/8000 a=fmtp:98 0-15 +a=msi:mavodi-0-15b-6c6-2-ffffffff-d3c00000-6005c95738e64-171f-ffffffffffffffff-@127.0.0.1-127.0.0.1;UAG-ELL-45-108 a=sendonly a=rtcp:PORT a=ptime:20