diff --git a/daemon/call.c b/daemon/call.c index d0599f7ce..7b4d666e3 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -3025,12 +3025,12 @@ int monologue_offer_answer(struct call_monologue *monologues[2], sdp_streams_q * assert(sp->index > 0); /** - * for an offer, a sequence in which the medias are gotten by index, matters. + * for an offer, a sequence in which tsender_media->media_subscriptions.headhe medias are gotten by index, matters. * This affects later the sequencing of medias, e.g. for subscribe requests. */ /* handling of media sessions level manipulations (media sessions remove) */ - if (flags->sdp_media_remove[sp->type_id]) { + if (is_offer && flags->sdp_media_remove[sp->type_id]) { sender_media = monologue_add_zero_media(sender_ml, sp, &num_ports_other, flags); medias_offset++; @@ -3041,27 +3041,34 @@ int monologue_offer_answer(struct call_monologue *monologues[2], sdp_streams_q * continue; } - /* OP_OFFER, receiver's side, get by index */ - receiver_media = NULL; - if (is_offer) - receiver_media = __get_media(receiver_ml, sp, flags, (medias_offset ? (sp->index - medias_offset) : 0)); - - /* OP_OFFER/OP_ANSWER, sender's side, get by index */ + /* sender's side, get by index */ sender_media = __get_media(sender_ml, sp, flags, 0); sender_media->media_sdp_id = sp->media_sdp_id; - /* OP_ANSWER, receiver's side, only media subscriptions lookup */ - if (!is_offer) - { - if (sender_media->media_subscriptions.head) { - __auto_type sender_media_it = sender_media->media_subscriptions.head; - struct media_subscription *ms = sender_media_it->data; - receiver_media = ms->media; + /* receiver's side, try media subscriptions lookup, fall back to index-based lookup */ + receiver_media = NULL; + for (auto_iter(l, sender_media->media_subscriptions.head); l && !receiver_media; l = l->next) { + __auto_type ms = l->data; + __auto_type r_media = ms->media; + if (r_media->monologue != receiver_ml) + continue; + if (r_media) { + // check type, it must match + if (str_cmp_str(&r_media->type, &sender_media->type)) + continue; } - else { - ilog(LOG_WARNING, "No matching media (index: %d) for answer using subscription, just use an index.", sp->index); - receiver_media = __get_media(receiver_ml, sp, flags, 0); + if (r_media) { + // check a=mid, it must match if present + if (sender_media->media_id.len && r_media->media_id.len + && str_cmp_str(&sender_media->media_id, &r_media->media_id)) + continue; } + // found it + receiver_media = r_media; + } + if (!receiver_media) { + ilog(LOG_WARNING, "No matching media (index: %d) for answer using subscription, just use an index.", sp->index); + receiver_media = __get_media(receiver_ml, sp, flags, sp->index - medias_offset); } receiver_media->media_sdp_id = sp->media_sdp_id; diff --git a/t/auto-daemon-tests-pubsub.pl b/t/auto-daemon-tests-pubsub.pl index e0db2349c..58a86a774 100755 --- a/t/auto-daemon-tests-pubsub.pl +++ b/t/auto-daemon-tests-pubsub.pl @@ -115,7 +115,7 @@ a=s-foo:bar a=s-baz:quux blah m=audio PORT RTP/AVP 0 c=IN IP4 203.0.113.1 -a=label:1 +a=label:0 a=rtpmap:0 PCMU/8000 a=m-dummy a=m-foo:bar @@ -154,7 +154,7 @@ a=s-foo:bar a=s-baz:quux blah m=audio PORT RTP/AVP 0 c=IN IP4 203.0.113.1 -a=label:1 +a=label:0 a=rtpmap:0 PCMU/8000 a=m-dummy a=m-foo:bar @@ -193,7 +193,7 @@ a=s-foo:bar a=s-baz:quux blah m=audio PORT RTP/AVP 0 c=IN IP4 203.0.113.1 -a=label:1 +a=label:0 a=rtpmap:0 PCMU/8000 a=m-dummy a=m-foo:bar @@ -233,7 +233,7 @@ a=s-foo:bar a=s-baz:quux blah m=audio PORT RTP/AVP 0 c=IN IP4 203.0.113.1 -a=label:1 +a=label:0 a=rtpmap:0 PCMU/8000 a=m-dummy a=m-foo:bar @@ -272,7 +272,7 @@ a=s-foo:bar a=s-baz:quux blah m=audio PORT RTP/AVP 0 c=IN IP4 203.0.113.1 -a=label:1 +a=label:0 a=rtpmap:0 PCMU/8000 a=m-dummy a=m-foo:bar @@ -882,10 +882,10 @@ a=rtcp:PORT SDP is $ftr, undef, 'from-tag matches'; -is_deeply $fts, [tt(), ft()], 'from-tags match'; +is_deeply $fts, [ft(), tt()], 'from-tags match'; is_deeply $tag_medias, [ { - tag => tt(), + tag => ft(), medias => [ { index => 1, @@ -896,7 +896,7 @@ is_deeply $tag_medias, [ ], }, { - tag => ft(), + tag => tt(), medias => [ { index => 1, @@ -911,13 +911,13 @@ is_deeply $media_labels, { '1' => { index => 1, type => 'audio', - tag => ft(), + tag => tt(), mode => 'sendrecv', }, '0' => { index => 1, type => 'audio', - tag => tt(), + tag => ft(), mode => 'sendrecv', }, }, 'media-labels match'; @@ -990,11 +990,11 @@ a=rtcp:PORT SDP is $ftr, undef, 'from-tag matches'; -is_deeply $fts, [tt(), ft()], 'from-tags match'; +is_deeply $fts, [ft(), tt()], 'from-tags match'; is_deeply $tag_medias, [ { - tag => tt(), - label => 'called', + tag => ft(), + label => 'caller', medias => [ { index => 1, @@ -1005,8 +1005,8 @@ is_deeply $tag_medias, [ ], }, { - tag => ft(), - label => 'caller', + tag => tt(), + label => 'called', medias => [ { index => 1, @@ -1021,15 +1021,15 @@ is_deeply $media_labels, { '1' => { index => 1, type => 'audio', - tag => ft(), - label => 'caller', + tag => tt(), + label => 'called', mode => 'sendrecv', }, '0' => { index => 1, type => 'audio', - tag => tt(), - label => 'called', + tag => ft(), + label => 'caller', mode => 'sendrecv', }, }, 'media-labels match'; @@ -1090,7 +1090,7 @@ rcv($sock_a, $port_b, rtpm(0, 2000, 4000, 0x3456, "\x00" x 160)); snd($sock_a, $port_b, rtp(0, 4000, 7000, 0x6543, "\x00" x 160)); rcv($sock_b, $port_a, rtpm(0, 4000, 7000, 0x6543, "\x00" x 160)); -($ftr, $ttr, $fts, undef, undef, $port_d, undef, $port_c) = subscribe_request('"all" sub', +($ftr, $ttr, $fts, undef, undef, $port_c, undef, $port_d) = subscribe_request('"all" sub', { 'flags' => ['all'] }, < $ttr, flags => ['allow transcoding'] }, < ['all', 'SIPREC'] }, < ['all', 'SIPREC'], 'to-tag' => $ttr }, < tt(), + tag => ft(), medias => [ { index => 1, type => 'audio', label => '0', - mode => 'recvonly', + mode => 'sendonly', }, ], }, { - tag => ft(), + tag => tt(), medias => [ { index => 1, type => 'audio', label => '1', - mode => 'sendonly', + mode => 'recvonly', }, ], }, ], 'SIPREC sub pause/resume - tag-medias match'; is_deeply $media_labels, { - '1' => { + '0' => { index => 1, type => 'audio', tag => ft(), mode => 'sendonly', }, - '0' => { + '1' => { index => 1, type => 'audio', tag => tt(), @@ -1915,14 +1915,14 @@ v=0 o=- 1545997027 1 IN IP4 198.51.100.1 s=tester t=0 0 -m=audio 6124 RTP/AVP 0 +m=audio 6122 RTP/AVP 0 c=IN IP4 198.51.100.14 a=label:0 -a=recvonly -m=audio 6122 RTP/AVP 0 +a=inactive +m=audio 6124 RTP/AVP 0 c=IN IP4 198.51.100.14 a=label:1 -a=inactive +a=recvonly SDP snd($sock_b, $port_a, rtp(0, 2001, 4320, 0x3456, "\x00" x 160)); @@ -1971,7 +1971,7 @@ a=sendrecv a=rtcp:PORT SDP -(undef, $ttr, undef, $tag_medias, $media_labels, $port_d, undef, $port_c) = subscribe_request('SIPREC sub pause/resume', +(undef, $ttr, undef, $tag_medias, $media_labels, $port_c, undef, $port_d) = subscribe_request('SIPREC sub pause/resume', { flags => ['all', 'SIPREC'], 'to-tag' => $ttr }, < tt(), + tag => ft(), medias => [ { index => 1, @@ -2004,7 +2004,7 @@ is_deeply $tag_medias, [ ], }, { - tag => ft(), + tag => tt(), medias => [ { index => 1, @@ -2016,13 +2016,13 @@ is_deeply $tag_medias, [ }, ], 'SIPREC sub pause/resume - tag-medias match'; is_deeply $media_labels, { - '1' => { + '0' => { index => 1, type => 'audio', tag => ft(), mode => 'sendrecv', }, - '0' => { + '1' => { index => 1, type => 'audio', tag => tt(), @@ -2036,11 +2036,11 @@ v=0 o=- 1545997027 1 IN IP4 198.51.100.1 s=tester t=0 0 -m=audio 6124 RTP/AVP 0 +m=audio 6122 RTP/AVP 0 c=IN IP4 198.51.100.14 a=label:0 a=recvonly -m=audio 6122 RTP/AVP 0 +m=audio 6124 RTP/AVP 0 c=IN IP4 198.51.100.14 a=label:1 a=recvonly @@ -2106,48 +2106,48 @@ m=audio PORT RTP/AVP 0 c=IN IP4 203.0.113.1 a=label:0 a=rtpmap:0 PCMU/8000 -a=inactive +a=sendonly a=rtcp:PORT m=audio PORT RTP/AVP 0 c=IN IP4 203.0.113.1 a=label:1 a=rtpmap:0 PCMU/8000 -a=sendonly +a=inactive a=rtcp:PORT SDP is_deeply $tag_medias, [ { - tag => tt(), + tag => ft(), medias => [ { index => 1, type => 'audio', label => '0', - mode => 'sendonly', + mode => 'recvonly', }, ], }, { - tag => ft(), + tag => tt(), medias => [ { index => 1, type => 'audio', label => '1', - mode => 'recvonly', + mode => 'sendonly', }, ], }, ], 'tag-medias match'; is_deeply $media_labels, { - '1' => { + '0' => { index => 1, type => 'audio', tag => ft(), mode => 'recvonly', }, - '0' => { + '1' => { index => 1, type => 'audio', tag => tt(), @@ -2161,14 +2161,14 @@ v=0 o=- 1545997027 1 IN IP4 198.51.100.1 s=tester t=0 0 -m=audio 6124 RTP/AVP 0 +m=audio 6122 RTP/AVP 0 c=IN IP4 198.51.100.14 a=label:0 -a=inactive -m=audio 6122 RTP/AVP 0 +a=recvonly +m=audio 6124 RTP/AVP 0 c=IN IP4 198.51.100.14 a=label:1 -a=recvonly +a=inactive SDP snd($sock_a, $port_b, rtp(0, 4001, 7480, 0x6543, "\x00" x 160)); diff --git a/t/auto-daemon-tests-redis-json.pl b/t/auto-daemon-tests-redis-json.pl index 3ca2de6e6..9f437142b 100755 --- a/t/auto-daemon-tests-redis-json.pl +++ b/t/auto-daemon-tests-redis-json.pl @@ -137,13 +137,13 @@ $json_exp = { '2', '3' ], - 'maps-0' => [ + 'maps-1' => [ '0' ], - 'maps-1' => [ + 'maps-0' => [ '1' ], - 'media-0' => { + 'media-1' => { 'desired_family' => 'IP4', 'format_str' => '0 8', 'index' => '1', @@ -154,7 +154,7 @@ $json_exp = { 'tag' => '1', 'type' => 'audio' }, - 'media-1' => { + 'media-0' => { 'desired_family' => 'IP4', 'format_str' => '0 8', 'index' => '1', @@ -165,10 +165,10 @@ $json_exp = { 'tag' => '0', 'type' => 'audio' }, - 'medias-0' => [ + 'medias-1' => [ '1' ], - 'medias-1' => [ + 'medias-0' => [ '0' ], 'payload_types-0' => [ @@ -234,7 +234,7 @@ $json_exp = { 'component' => '1', 'endpoint' => '', 'last_packet' => qr/^\d+$/, - 'media' => '0', + 'media' => '1', 'ps_flags' => '65536', 'rtcp_sibling' => '1', 'sfd' => '0', @@ -247,7 +247,7 @@ $json_exp = { 'component' => '2', 'endpoint' => '', 'last_packet' => qr/^\d+$/, - 'media' => '0', + 'media' => '1', 'ps_flags' => '131072', 'rtcp_sibling' => '4294967295', 'sfd' => '1', @@ -260,7 +260,7 @@ $json_exp = { 'component' => '1', 'endpoint' => '198.51.100.1:3000', 'last_packet' => qr/^\d+$/, - 'media' => '1', + 'media' => '0', 'ps_flags' => '68222976', 'rtcp_sibling' => '3', 'sfd' => '2', @@ -273,7 +273,7 @@ $json_exp = { 'component' => '2', 'endpoint' => '198.51.100.1:3001', 'last_packet' => qr/^\d+$/, - 'media' => '1', + 'media' => '0', 'ps_flags' => '68288513', 'rtcp_sibling' => '4294967295', 'sfd' => '3', @@ -293,11 +293,11 @@ $json_exp = { 'stream_sfds-3' => [ '3' ], - 'streams-0' => [ + 'streams-1' => [ '0', '1' ], - 'streams-1' => [ + 'streams-0' => [ '2', '3' ], @@ -397,13 +397,13 @@ $json_exp = { '2', '3' ], - 'maps-0' => [ + 'maps-1' => [ '0' ], - 'maps-1' => [ + 'maps-0' => [ '1' ], - 'media-0' => { + 'media-1' => { 'desired_family' => 'IP4', 'format_str' => '8', 'index' => '1', @@ -414,7 +414,7 @@ $json_exp = { 'tag' => '1', 'type' => 'audio' }, - 'media-1' => { + 'media-0' => { 'desired_family' => 'IP4', 'format_str' => '8', 'index' => '1', @@ -425,10 +425,10 @@ $json_exp = { 'tag' => '0', 'type' => 'audio' }, - 'medias-0' => [ + 'medias-1' => [ '1' ], - 'medias-1' => [ + 'medias-0' => [ '0' ], 'payload_types-0' => [ @@ -492,7 +492,7 @@ $json_exp = { 'component' => '1', 'endpoint' => '198.51.100.4:3000', 'last_packet' => qr/^\d+$/, - 'media' => '0', + 'media' => '1', 'ps_flags' => '1114112', 'rtcp_sibling' => '1', 'sfd' => '0', @@ -505,7 +505,7 @@ $json_exp = { 'component' => '2', 'endpoint' => '198.51.100.4:3001', 'last_packet' => qr/^\d+$/, - 'media' => '0', + 'media' => '1', 'ps_flags' => '1179649', 'rtcp_sibling' => '4294967295', 'sfd' => '1', @@ -518,7 +518,7 @@ $json_exp = { 'component' => '1', 'endpoint' => '198.51.100.1:3000', 'last_packet' => qr/^\d+$/, - 'media' => '1', + 'media' => '0', 'ps_flags' => '1114112', 'rtcp_sibling' => '3', 'sfd' => '2', @@ -531,7 +531,7 @@ $json_exp = { 'component' => '2', 'endpoint' => '198.51.100.1:3001', 'last_packet' => qr/^\d+$/, - 'media' => '1', + 'media' => '0', 'ps_flags' => '1179649', 'rtcp_sibling' => '4294967295', 'sfd' => '3', @@ -551,11 +551,11 @@ $json_exp = { 'stream_sfds-3' => [ '3' ], - 'streams-0' => [ + 'streams-1' => [ '0', '1' ], - 'streams-1' => [ + 'streams-0' => [ '2', '3' ], @@ -662,13 +662,13 @@ $json_exp = { '2', '3' ], - 'maps-0' => [ + 'maps-1' => [ '0' ], - 'maps-1' => [ + 'maps-0' => [ '1' ], - 'media-0' => { + 'media-1' => { 'desired_family' => 'IP4', 'format_str' => '0 8', 'index' => '1', @@ -679,7 +679,7 @@ $json_exp = { 'tag' => '1', 'type' => 'audio' }, - 'media-1' => { + 'media-0' => { 'desired_family' => 'IP4', 'format_str' => '0 8', 'index' => '1', @@ -690,10 +690,10 @@ $json_exp = { 'tag' => '0', 'type' => 'audio' }, - 'medias-0' => [ + 'medias-1' => [ '1' ], - 'medias-1' => [ + 'medias-0' => [ '0' ], 'payload_types-0' => [ @@ -759,7 +759,7 @@ $json_exp = { 'component' => '1', 'endpoint' => '', 'last_packet' => qr/^\d+$/, - 'media' => '0', + 'media' => '1', 'ps_flags' => '65536', 'rtcp_sibling' => '1', 'sfd' => '0', @@ -772,7 +772,7 @@ $json_exp = { 'component' => '2', 'endpoint' => '', 'last_packet' => qr/^\d+$/, - 'media' => '0', + 'media' => '1', 'ps_flags' => '131072', 'rtcp_sibling' => '4294967295', 'sfd' => '1', @@ -785,7 +785,7 @@ $json_exp = { 'component' => '1', 'endpoint' => '198.51.100.14:6088', 'last_packet' => qr/^\d+$/, - 'media' => '1', + 'media' => '0', 'ps_flags' => '68222976', 'rtcp_sibling' => '3', 'sfd' => '2', @@ -798,7 +798,7 @@ $json_exp = { 'component' => '2', 'endpoint' => '198.51.100.14:6089', 'last_packet' => qr/^\d+$/, - 'media' => '1', + 'media' => '0', 'ps_flags' => '68288513', 'rtcp_sibling' => '4294967295', 'sfd' => '3', @@ -818,11 +818,11 @@ $json_exp = { 'stream_sfds-3' => [ '3' ], - 'streams-0' => [ + 'streams-1' => [ '0', '1' ], - 'streams-1' => [ + 'streams-0' => [ '2', '3' ], @@ -923,13 +923,13 @@ $json_exp = { '2', '3' ], - 'maps-0' => [ + 'maps-1' => [ '0' ], - 'maps-1' => [ + 'maps-0' => [ '1' ], - 'media-0' => { + 'media-1' => { 'desired_family' => 'IP4', 'format_str' => '0 8', 'index' => '1', @@ -940,7 +940,7 @@ $json_exp = { 'tag' => '1', 'type' => 'audio' }, - 'media-1' => { + 'media-0' => { 'desired_family' => 'IP4', 'format_str' => '0 8', 'index' => '1', @@ -951,10 +951,10 @@ $json_exp = { 'tag' => '0', 'type' => 'audio' }, - 'medias-0' => [ + 'medias-1' => [ '1' ], - 'medias-1' => [ + 'medias-0' => [ '0' ], 'payload_types-0' => [ @@ -1020,7 +1020,7 @@ $json_exp = { 'component' => '1', 'endpoint' => '198.51.100.14:6090', 'last_packet' => qr/^\d+$/, - 'media' => '0', + 'media' => '1', 'ps_flags' => '1114112', 'rtcp_sibling' => '1', 'sfd' => '0', @@ -1033,7 +1033,7 @@ $json_exp = { 'component' => '2', 'endpoint' => '198.51.100.14:6091', 'last_packet' => qr/^\d+$/, - 'media' => '0', + 'media' => '1', 'ps_flags' => '1179649', 'rtcp_sibling' => '4294967295', 'sfd' => '1', @@ -1046,7 +1046,7 @@ $json_exp = { 'component' => '1', 'endpoint' => '198.51.100.14:6088', 'last_packet' => qr/^\d+$/, - 'media' => '1', + 'media' => '0', 'ps_flags' => '1114112', 'rtcp_sibling' => '3', 'sfd' => '2', @@ -1059,7 +1059,7 @@ $json_exp = { 'component' => '2', 'endpoint' => '198.51.100.14:6089', 'last_packet' => qr/^\d+$/, - 'media' => '1', + 'media' => '0', 'ps_flags' => '1179649', 'rtcp_sibling' => '4294967295', 'sfd' => '3', @@ -1079,11 +1079,11 @@ $json_exp = { 'stream_sfds-3' => [ '3' ], - 'streams-0' => [ + 'streams-1' => [ '0', '1' ], - 'streams-1' => [ + 'streams-0' => [ '2', '3' ], @@ -1210,10 +1210,10 @@ $json_exp = { '6', '7' ], - 'maps-0' => [ + 'maps-1' => [ '0' ], - 'maps-1' => [ + 'maps-0' => [ '1' ], 'maps-2' => [ @@ -1222,7 +1222,7 @@ $json_exp = { 'maps-3' => [ '3' ], - 'media-0' => { + 'media-1' => { 'desired_family' => 'IP4', 'format_str' => '0 8', 'index' => '1', @@ -1233,7 +1233,7 @@ $json_exp = { 'tag' => '1', 'type' => 'audio' }, - 'media-1' => { + 'media-0' => { 'desired_family' => 'IP4', 'format_str' => '0 8', 'index' => '1', @@ -1266,10 +1266,10 @@ $json_exp = { 'tag' => '2', 'type' => 'audio' }, - 'medias-0' => [ + 'medias-1' => [ '1' ], - 'medias-1' => [ + 'medias-0' => [ '0' ], 'medias-2' => [ @@ -1392,7 +1392,7 @@ $json_exp = { 'component' => '1', 'endpoint' => '198.51.100.14:6090', 'last_packet' => qr/^\d+$/, - 'media' => '0', + 'media' => '1', 'ps_flags' => '1114112', 'rtcp_sibling' => '1', 'sfd' => '0', @@ -1405,7 +1405,7 @@ $json_exp = { 'component' => '2', 'endpoint' => '198.51.100.14:6091', 'last_packet' => qr/^\d+$/, - 'media' => '0', + 'media' => '1', 'ps_flags' => '68288513', 'rtcp_sibling' => '4294967295', 'sfd' => '1', @@ -1418,7 +1418,7 @@ $json_exp = { 'component' => '1', 'endpoint' => '198.51.100.14:6088', 'last_packet' => qr/^\d+$/, - 'media' => '1', + 'media' => '0', 'ps_flags' => '1114112', 'rtcp_sibling' => '3', 'sfd' => '2', @@ -1431,7 +1431,7 @@ $json_exp = { 'component' => '2', 'endpoint' => '198.51.100.14:6089', 'last_packet' => qr/^\d+$/, - 'media' => '1', + 'media' => '0', 'ps_flags' => '68288513', 'rtcp_sibling' => '4294967295', 'sfd' => '3', @@ -1515,11 +1515,11 @@ $json_exp = { 'stream_sfds-7' => [ '7' ], - 'streams-0' => [ + 'streams-1' => [ '0', '1' ], - 'streams-1' => [ + 'streams-0' => [ '2', '3' ], @@ -1538,7 +1538,7 @@ $json_exp = { '0/1/0/0' ], 'media-subscriptions-2' => [ - '1/0/0/0' + '0/0/0/0' ], 'tag-0' => { 'block_dtmf' => '0', @@ -1590,8 +1590,8 @@ a=rtcp:PORT SDP -$json_exp->{'media-0'}{media_flags} = '2293772'; -$json_exp->{'media-1'}{media_flags} = '65548'; +$json_exp->{'media-1'}{media_flags} = '2293772'; +$json_exp->{'media-0'}{media_flags} = '65548'; $json_exp->{'media-2'}{format_str} = '8'; $json_exp->{'media-2'}{media_flags} = '2162692'; $json_exp->{'media-3'}{format_str} = '8'; diff --git a/t/auto-daemon-tests-redis.pl b/t/auto-daemon-tests-redis.pl index b95392c40..b8e4c96d0 100755 --- a/t/auto-daemon-tests-redis.pl +++ b/t/auto-daemon-tests-redis.pl @@ -136,13 +136,13 @@ $json_exp = { '2', '3' ], - 'maps-0' => [ + 'maps-1' => [ '0' ], - 'maps-1' => [ + 'maps-0' => [ '1' ], - 'media-0' => { + 'media-1' => { 'desired_family' => 'IP4', 'format_str' => '0 8', 'index' => '1', @@ -153,7 +153,7 @@ $json_exp = { 'tag' => '1', 'type' => 'audio' }, - 'media-1' => { + 'media-0' => { 'desired_family' => 'IP4', 'format_str' => '0 8', 'index' => '1', @@ -164,10 +164,10 @@ $json_exp = { 'tag' => '0', 'type' => 'audio' }, - 'medias-0' => [ + 'medias-1' => [ '1' ], - 'medias-1' => [ + 'medias-0' => [ '0' ], 'payload_types-0' => [ @@ -233,7 +233,7 @@ $json_exp = { 'component' => '1', 'endpoint' => '', 'last_packet' => qr/^\d+$/, - 'media' => '0', + 'media' => '1', 'ps_flags' => '65536', 'rtcp_sibling' => '1', 'sfd' => '0', @@ -246,7 +246,7 @@ $json_exp = { 'component' => '2', 'endpoint' => '', 'last_packet' => qr/^\d+$/, - 'media' => '0', + 'media' => '1', 'ps_flags' => '131072', 'rtcp_sibling' => '4294967295', 'sfd' => '1', @@ -259,7 +259,7 @@ $json_exp = { 'component' => '1', 'endpoint' => '198.51.100.1:3000', 'last_packet' => qr/^\d+$/, - 'media' => '1', + 'media' => '0', 'ps_flags' => '68222976', 'rtcp_sibling' => '3', 'sfd' => '2', @@ -272,7 +272,7 @@ $json_exp = { 'component' => '2', 'endpoint' => '198.51.100.1:3001', 'last_packet' => qr/^\d+$/, - 'media' => '1', + 'media' => '0', 'ps_flags' => '68288513', 'rtcp_sibling' => '4294967295', 'sfd' => '3', @@ -292,11 +292,11 @@ $json_exp = { 'stream_sfds-3' => [ '3' ], - 'streams-0' => [ + 'streams-1' => [ '0', '1' ], - 'streams-1' => [ + 'streams-0' => [ '2', '3' ], @@ -398,13 +398,13 @@ $json_exp = { '2', '3' ], - 'maps-0' => [ + 'maps-1' => [ '0' ], - 'maps-1' => [ + 'maps-0' => [ '1' ], - 'media-0' => { + 'media-1' => { 'desired_family' => 'IP4', 'format_str' => '8', 'index' => '1', @@ -415,7 +415,7 @@ $json_exp = { 'tag' => '1', 'type' => 'audio' }, - 'media-1' => { + 'media-0' => { 'desired_family' => 'IP4', 'format_str' => '8', 'index' => '1', @@ -426,10 +426,10 @@ $json_exp = { 'tag' => '0', 'type' => 'audio' }, - 'medias-0' => [ + 'medias-1' => [ '1' ], - 'medias-1' => [ + 'medias-0' => [ '0' ], 'payload_types-0' => [ @@ -493,7 +493,7 @@ $json_exp = { 'component' => '1', 'endpoint' => '198.51.100.4:3000', 'last_packet' => qr/^\d+$/, - 'media' => '0', + 'media' => '1', 'ps_flags' => '1114112', 'rtcp_sibling' => '1', 'sfd' => '0', @@ -506,7 +506,7 @@ $json_exp = { 'component' => '2', 'endpoint' => '198.51.100.4:3001', 'last_packet' => qr/^\d+$/, - 'media' => '0', + 'media' => '1', 'ps_flags' => '1179649', 'rtcp_sibling' => '4294967295', 'sfd' => '1', @@ -519,7 +519,7 @@ $json_exp = { 'component' => '1', 'endpoint' => '198.51.100.1:3000', 'last_packet' => qr/^\d+$/, - 'media' => '1', + 'media' => '0', 'ps_flags' => '1114112', 'rtcp_sibling' => '3', 'sfd' => '2', @@ -532,7 +532,7 @@ $json_exp = { 'component' => '2', 'endpoint' => '198.51.100.1:3001', 'last_packet' => qr/^\d+$/, - 'media' => '1', + 'media' => '0', 'ps_flags' => '1179649', 'rtcp_sibling' => '4294967295', 'sfd' => '3', @@ -552,11 +552,11 @@ $json_exp = { 'stream_sfds-3' => [ '3' ], - 'streams-0' => [ + 'streams-1' => [ '0', '1' ], - 'streams-1' => [ + 'streams-0' => [ '2', '3' ], @@ -663,13 +663,13 @@ $json_exp = { '2', '3' ], - 'maps-0' => [ + 'maps-1' => [ '0' ], - 'maps-1' => [ + 'maps-0' => [ '1' ], - 'media-0' => { + 'media-1' => { 'desired_family' => 'IP4', 'format_str' => '8', 'index' => '1', @@ -680,7 +680,7 @@ $json_exp = { 'tag' => '1', 'type' => 'audio' }, - 'media-1' => { + 'media-0' => { 'desired_family' => 'IP4', 'format_str' => '8', 'index' => '1', @@ -691,10 +691,10 @@ $json_exp = { 'tag' => '0', 'type' => 'audio' }, - 'medias-0' => [ + 'medias-1' => [ '1' ], - 'medias-1' => [ + 'medias-0' => [ '0' ], 'payload_types-0' => [ @@ -758,7 +758,7 @@ $json_exp = { 'component' => '1', 'endpoint' => '198.51.100.4:3000', 'last_packet' => qr/^\d+$/, - 'media' => '0', + 'media' => '1', 'ps_flags' => '1114112', 'rtcp_sibling' => '1', 'sfd' => '0', @@ -771,7 +771,7 @@ $json_exp = { 'component' => '2', 'endpoint' => '198.51.100.4:3001', 'last_packet' => qr/^\d+$/, - 'media' => '0', + 'media' => '1', 'ps_flags' => '1179649', 'rtcp_sibling' => '4294967295', 'sfd' => '1', @@ -784,7 +784,7 @@ $json_exp = { 'component' => '1', 'endpoint' => '198.51.100.1:3000', 'last_packet' => qr/^\d+$/, - 'media' => '1', + 'media' => '0', 'ps_flags' => '1114112', 'rtcp_sibling' => '3', 'sfd' => '2', @@ -797,7 +797,7 @@ $json_exp = { 'component' => '2', 'endpoint' => '198.51.100.1:3001', 'last_packet' => qr/^\d+$/, - 'media' => '1', + 'media' => '0', 'ps_flags' => '1179649', 'rtcp_sibling' => '4294967295', 'sfd' => '3', @@ -817,11 +817,11 @@ $json_exp = { 'stream_sfds-3' => [ '3' ], - 'streams-0' => [ + 'streams-1' => [ '0', '1' ], - 'streams-1' => [ + 'streams-0' => [ '2', '3' ], @@ -928,13 +928,13 @@ $json_exp = { '2', '3' ], - 'maps-0' => [ + 'maps-1' => [ '0' ], - 'maps-1' => [ + 'maps-0' => [ '1' ], - 'media-0' => { + 'media-1' => { 'desired_family' => 'IP4', 'format_str' => '0 8', 'index' => '1', @@ -945,7 +945,7 @@ $json_exp = { 'tag' => '1', 'type' => 'audio' }, - 'media-1' => { + 'media-0' => { 'desired_family' => 'IP4', 'format_str' => '0 8', 'index' => '1', @@ -956,10 +956,10 @@ $json_exp = { 'tag' => '0', 'type' => 'audio' }, - 'medias-0' => [ + 'medias-1' => [ '1' ], - 'medias-1' => [ + 'medias-0' => [ '0' ], 'payload_types-0' => [ @@ -1025,7 +1025,7 @@ $json_exp = { 'component' => '1', 'endpoint' => '', 'last_packet' => qr/^\d+$/, - 'media' => '0', + 'media' => '1', 'ps_flags' => '65536', 'rtcp_sibling' => '1', 'sfd' => '0', @@ -1038,7 +1038,7 @@ $json_exp = { 'component' => '2', 'endpoint' => '', 'last_packet' => qr/^\d+$/, - 'media' => '0', + 'media' => '1', 'ps_flags' => '131072', 'rtcp_sibling' => '4294967295', 'sfd' => '1', @@ -1051,7 +1051,7 @@ $json_exp = { 'component' => '1', 'endpoint' => '198.51.100.14:6088', 'last_packet' => qr/^\d+$/, - 'media' => '1', + 'media' => '0', 'ps_flags' => '68222976', 'rtcp_sibling' => '3', 'sfd' => '2', @@ -1064,7 +1064,7 @@ $json_exp = { 'component' => '2', 'endpoint' => '198.51.100.14:6089', 'last_packet' => qr/^\d+$/, - 'media' => '1', + 'media' => '0', 'ps_flags' => '68288513', 'rtcp_sibling' => '4294967295', 'sfd' => '3', @@ -1084,11 +1084,11 @@ $json_exp = { 'stream_sfds-3' => [ '3' ], - 'streams-0' => [ + 'streams-1' => [ '0', '1' ], - 'streams-1' => [ + 'streams-0' => [ '2', '3' ], @@ -1189,13 +1189,13 @@ $json_exp = { '2', '3' ], - 'maps-0' => [ + 'maps-1' => [ '0' ], - 'maps-1' => [ + 'maps-0' => [ '1' ], - 'media-0' => { + 'media-1' => { 'desired_family' => 'IP4', 'format_str' => '0 8', 'index' => '1', @@ -1206,7 +1206,7 @@ $json_exp = { 'tag' => '1', 'type' => 'audio' }, - 'media-1' => { + 'media-0' => { 'desired_family' => 'IP4', 'format_str' => '0 8', 'index' => '1', @@ -1217,10 +1217,10 @@ $json_exp = { 'tag' => '0', 'type' => 'audio' }, - 'medias-0' => [ + 'medias-1' => [ '1' ], - 'medias-1' => [ + 'medias-0' => [ '0' ], 'payload_types-0' => [ @@ -1286,7 +1286,7 @@ $json_exp = { 'component' => '1', 'endpoint' => '198.51.100.14:6090', 'last_packet' => qr/^\d+$/, - 'media' => '0', + 'media' => '1', 'ps_flags' => '1114112', 'rtcp_sibling' => '1', 'sfd' => '0', @@ -1299,7 +1299,7 @@ $json_exp = { 'component' => '2', 'endpoint' => '198.51.100.14:6091', 'last_packet' => qr/^\d+$/, - 'media' => '0', + 'media' => '1', 'ps_flags' => '1179649', 'rtcp_sibling' => '4294967295', 'sfd' => '1', @@ -1312,7 +1312,7 @@ $json_exp = { 'component' => '1', 'endpoint' => '198.51.100.14:6088', 'last_packet' => qr/^\d+$/, - 'media' => '1', + 'media' => '0', 'ps_flags' => '1114112', 'rtcp_sibling' => '3', 'sfd' => '2', @@ -1325,7 +1325,7 @@ $json_exp = { 'component' => '2', 'endpoint' => '198.51.100.14:6089', 'last_packet' => qr/^\d+$/, - 'media' => '1', + 'media' => '0', 'ps_flags' => '1179649', 'rtcp_sibling' => '4294967295', 'sfd' => '3', @@ -1345,11 +1345,11 @@ $json_exp = { 'stream_sfds-3' => [ '3' ], - 'streams-0' => [ + 'streams-1' => [ '0', '1' ], - 'streams-1' => [ + 'streams-0' => [ '2', '3' ], @@ -1476,10 +1476,10 @@ $json_exp = { '6', '7' ], - 'maps-0' => [ + 'maps-1' => [ '0' ], - 'maps-1' => [ + 'maps-0' => [ '1' ], 'maps-2' => [ @@ -1488,7 +1488,7 @@ $json_exp = { 'maps-3' => [ '3' ], - 'media-0' => { + 'media-1' => { 'desired_family' => 'IP4', 'format_str' => '0 8', 'index' => '1', @@ -1499,7 +1499,7 @@ $json_exp = { 'tag' => '1', 'type' => 'audio' }, - 'media-1' => { + 'media-0' => { 'desired_family' => 'IP4', 'format_str' => '0 8', 'index' => '1', @@ -1532,10 +1532,10 @@ $json_exp = { 'tag' => '2', 'type' => 'audio' }, - 'medias-0' => [ + 'medias-1' => [ '1' ], - 'medias-1' => [ + 'medias-0' => [ '0' ], 'medias-2' => [ @@ -1658,7 +1658,7 @@ $json_exp = { 'component' => '1', 'endpoint' => '198.51.100.14:6090', 'last_packet' => qr/^\d+$/, - 'media' => '0', + 'media' => '1', 'ps_flags' => '1114112', 'rtcp_sibling' => '1', 'sfd' => '0', @@ -1671,7 +1671,7 @@ $json_exp = { 'component' => '2', 'endpoint' => '198.51.100.14:6091', 'last_packet' => qr/^\d+$/, - 'media' => '0', + 'media' => '1', 'ps_flags' => '68288513', 'rtcp_sibling' => '4294967295', 'sfd' => '1', @@ -1684,7 +1684,7 @@ $json_exp = { 'component' => '1', 'endpoint' => '198.51.100.14:6088', 'last_packet' => qr/^\d+$/, - 'media' => '1', + 'media' => '0', 'ps_flags' => '1114112', 'rtcp_sibling' => '3', 'sfd' => '2', @@ -1697,7 +1697,7 @@ $json_exp = { 'component' => '2', 'endpoint' => '198.51.100.14:6089', 'last_packet' => qr/^\d+$/, - 'media' => '1', + 'media' => '0', 'ps_flags' => '68288513', 'rtcp_sibling' => '4294967295', 'sfd' => '3', @@ -1781,11 +1781,11 @@ $json_exp = { 'stream_sfds-7' => [ '7' ], - 'streams-0' => [ + 'streams-1' => [ '0', '1' ], - 'streams-1' => [ + 'streams-0' => [ '2', '3' ], @@ -1804,7 +1804,7 @@ $json_exp = { '0/1/0/0' ], 'media-subscriptions-2' => [ - '1/0/0/0' + '0/0/0/0' ], 'tag-0' => { 'block_dtmf' => '0', @@ -1856,8 +1856,8 @@ a=rtcp:PORT SDP -$json_exp->{'media-0'}{media_flags} = '2293772'; -$json_exp->{'media-1'}{media_flags} = '65548'; +$json_exp->{'media-1'}{media_flags} = '2293772'; +$json_exp->{'media-0'}{media_flags} = '65548'; $json_exp->{'media-2'}{format_str} = '8'; $json_exp->{'media-2'}{media_flags} = '2162692'; $json_exp->{'media-3'}{format_str} = '8'; @@ -1899,7 +1899,6 @@ SDP - new_call; $json_exp = { diff --git a/t/auto-daemon-tests.pl b/t/auto-daemon-tests.pl index 005ace76e..7fc8dc6ae 100755 --- a/t/auto-daemon-tests.pl +++ b/t/auto-daemon-tests.pl @@ -4884,33 +4884,33 @@ SDP subscribe_request('AMR asymmetric', {flags => [qw/SIPREC all/]}, <