MT#55283 reverse order of "all" subscriptions

The global list of monologues is populated in reverse order from the
list of medias. Iterate the list backwards so that the resulting medias
are in ascending order.

Change-Id: Icadca7a6cecb636ca6e021c0286b44e5cd3cdc84
pull/1752/head
Richard Fuchs 2 years ago
parent 64724284c1
commit c3510b4788

@ -2764,7 +2764,7 @@ static const char *media_block_match_mult(struct call **call, GQueue *mls,
if (flags->all == ALL_ALL) { if (flags->all == ALL_ALL) {
// get and add all offer/answer mls // get and add all offer/answer mls
for (GList *l = (*call)->monologues.head; l; l = l->next) { for (GList *l = (*call)->monologues.tail; l; l = l->prev) {
struct call_monologue *ml = l->data; struct call_monologue *ml = l->data;
if (ml->tagtype != FROM_TAG && ml->tagtype != TO_TAG) if (ml->tagtype != FROM_TAG && ml->tagtype != TO_TAG)
continue; continue;

@ -755,39 +755,39 @@ s=RTPE_VERSION
t=0 0 t=0 0
m=audio PORT RTP/AVP 0 m=audio PORT RTP/AVP 0
c=IN IP4 203.0.113.1 c=IN IP4 203.0.113.1
a=label:1 a=label:0
a=rtpmap:0 PCMU/8000 a=rtpmap:0 PCMU/8000
a=sendonly a=sendonly
a=rtcp:PORT a=rtcp:PORT
m=audio PORT RTP/AVP 0 m=audio PORT RTP/AVP 0
c=IN IP4 203.0.113.1 c=IN IP4 203.0.113.1
a=label:0 a=label:1
a=rtpmap:0 PCMU/8000 a=rtpmap:0 PCMU/8000
a=sendonly a=sendonly
a=rtcp:PORT a=rtcp:PORT
SDP SDP
is $ftr, undef, 'from-tag matches'; is $ftr, undef, 'from-tag matches';
is_deeply $fts, [ft(), tt()], 'from-tags match'; is_deeply $fts, [tt(), ft()], 'from-tags match';
is_deeply $tag_medias, [ is_deeply $tag_medias, [
{ {
tag => ft(), tag => tt(),
medias => [ medias => [
{ {
index => 1, index => 1,
type => 'audio', type => 'audio',
label => '1', label => '0',
mode => 'sendrecv', mode => 'sendrecv',
}, },
], ],
}, },
{ {
tag => tt(), tag => ft(),
medias => [ medias => [
{ {
index => 1, index => 1,
type => 'audio', type => 'audio',
label => '0', label => '1',
mode => 'sendrecv', mode => 'sendrecv',
}, },
], ],
@ -863,41 +863,41 @@ s=RTPE_VERSION
t=0 0 t=0 0
m=audio PORT RTP/AVP 0 m=audio PORT RTP/AVP 0
c=IN IP4 203.0.113.1 c=IN IP4 203.0.113.1
a=label:1 a=label:0
a=rtpmap:0 PCMU/8000 a=rtpmap:0 PCMU/8000
a=sendonly a=sendonly
a=rtcp:PORT a=rtcp:PORT
m=audio PORT RTP/AVP 0 m=audio PORT RTP/AVP 0
c=IN IP4 203.0.113.1 c=IN IP4 203.0.113.1
a=label:0 a=label:1
a=rtpmap:0 PCMU/8000 a=rtpmap:0 PCMU/8000
a=sendonly a=sendonly
a=rtcp:PORT a=rtcp:PORT
SDP SDP
is $ftr, undef, 'from-tag matches'; is $ftr, undef, 'from-tag matches';
is_deeply $fts, [ft(), tt()], 'from-tags match'; is_deeply $fts, [tt(), ft()], 'from-tags match';
is_deeply $tag_medias, [ is_deeply $tag_medias, [
{ {
tag => ft(), tag => tt(),
label => 'caller', label => 'called',
medias => [ medias => [
{ {
index => 1, index => 1,
type => 'audio', type => 'audio',
label => '1', label => '0',
mode => 'sendrecv', mode => 'sendrecv',
}, },
], ],
}, },
{ {
tag => tt(), tag => ft(),
label => 'called', label => 'caller',
medias => [ medias => [
{ {
index => 1, index => 1,
type => 'audio', type => 'audio',
label => '0', label => '1',
mode => 'sendrecv', mode => 'sendrecv',
}, },
], ],
@ -976,7 +976,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)); 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)); rcv($sock_b, $port_a, rtpm(0, 4000, 7000, 0x6543, "\x00" x 160));
($ftr, $ttr, $fts, undef, undef, $port_c, undef, $port_d) = subscribe_request('"all" sub', ($ftr, $ttr, $fts, undef, undef, $port_d, undef, $port_c) = subscribe_request('"all" sub',
{ 'flags' => ['all'] }, <<SDP); { 'flags' => ['all'] }, <<SDP);
v=0 v=0
o=- SDP_VERSION IN IP4 203.0.113.1 o=- SDP_VERSION IN IP4 203.0.113.1
@ -997,7 +997,7 @@ a=rtcp:PORT
SDP SDP
is $ftr, undef, 'from-tag matches'; is $ftr, undef, 'from-tag matches';
is_deeply $fts, [ft(), tt()], 'from-tags match'; is_deeply $fts, [tt(), ft()], 'from-tags match';
subscribe_answer('"all" sub', subscribe_answer('"all" sub',
{ 'to-tag' => $ttr, flags => ['allow transcoding'] }, <<SDP); { 'to-tag' => $ttr, flags => ['allow transcoding'] }, <<SDP);
@ -1005,10 +1005,10 @@ v=0
o=- 1545997027 1 IN IP4 198.51.100.1 o=- 1545997027 1 IN IP4 198.51.100.1
s=tester s=tester
t=0 0 t=0 0
m=audio 6084 RTP/AVP 8 m=audio 6086 RTP/AVP 8
c=IN IP4 198.51.100.14 c=IN IP4 198.51.100.14
a=recvonly a=recvonly
m=audio 6086 RTP/AVP 8 m=audio 6084 RTP/AVP 8
c=IN IP4 198.51.100.14 c=IN IP4 198.51.100.14
a=recvonly a=recvonly
SDP SDP
@ -1616,7 +1616,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)); 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)); rcv($sock_b, $port_a, rtpm(0, 4000, 7000, 0x6543, "\x00" x 160));
(undef, $ttr, undef, undef, undef, $port_c, undef, $port_d) = subscribe_request('SIPREC sub pause/resume', (undef, $ttr, undef, undef, undef, $port_d, undef, $port_c) = subscribe_request('SIPREC sub pause/resume',
{ flags => ['all', 'SIPREC'] }, <<SDP); { flags => ['all', 'SIPREC'] }, <<SDP);
v=0 v=0
o=- SDP_VERSION IN IP4 203.0.113.1 o=- SDP_VERSION IN IP4 203.0.113.1
@ -1624,13 +1624,13 @@ s=RTPE_VERSION
t=0 0 t=0 0
m=audio PORT RTP/AVP 0 m=audio PORT RTP/AVP 0
c=IN IP4 203.0.113.1 c=IN IP4 203.0.113.1
a=label:1 a=label:0
a=rtpmap:0 PCMU/8000 a=rtpmap:0 PCMU/8000
a=sendonly a=sendonly
a=rtcp:PORT a=rtcp:PORT
m=audio PORT RTP/AVP 0 m=audio PORT RTP/AVP 0
c=IN IP4 203.0.113.1 c=IN IP4 203.0.113.1
a=label:0 a=label:1
a=rtpmap:0 PCMU/8000 a=rtpmap:0 PCMU/8000
a=sendonly a=sendonly
a=rtcp:PORT a=rtcp:PORT
@ -1642,14 +1642,14 @@ v=0
o=- 1545997027 1 IN IP4 198.51.100.1 o=- 1545997027 1 IN IP4 198.51.100.1
s=tester s=tester
t=0 0 t=0 0
m=audio 6122 RTP/AVP 0
c=IN IP4 198.51.100.14
a=label:1
a=recvonly
m=audio 6124 RTP/AVP 0 m=audio 6124 RTP/AVP 0
c=IN IP4 198.51.100.14 c=IN IP4 198.51.100.14
a=label:0 a=label:0
a=recvonly a=recvonly
m=audio 6122 RTP/AVP 0
c=IN IP4 198.51.100.14
a=label:1
a=recvonly
SDP SDP
snd($sock_b, $port_a, rtp(0, 2001, 4160, 0x3456, "\x00" x 160)); snd($sock_b, $port_a, rtp(0, 2001, 4160, 0x3456, "\x00" x 160));
@ -1706,7 +1706,7 @@ a=recvonly
a=rtcp:PORT a=rtcp:PORT
SDP SDP
(undef, undef, undef, $tag_medias, $media_labels, $port_c, undef, $port_d) = subscribe_request('SIPREC sub pause/resume', (undef, undef, undef, $tag_medias, $media_labels, $port_d, undef, $port_c) = subscribe_request('SIPREC sub pause/resume',
{ flags => ['all', 'SIPREC'], 'to-tag' => $ttr }, <<SDP); { flags => ['all', 'SIPREC'], 'to-tag' => $ttr }, <<SDP);
v=0 v=0
o=- SDP_VERSION IN IP4 203.0.113.1 o=- SDP_VERSION IN IP4 203.0.113.1
@ -1714,38 +1714,38 @@ s=RTPE_VERSION
t=0 0 t=0 0
m=audio PORT RTP/AVP 0 m=audio PORT RTP/AVP 0
c=IN IP4 203.0.113.1 c=IN IP4 203.0.113.1
a=label:1 a=label:0
a=rtpmap:0 PCMU/8000 a=rtpmap:0 PCMU/8000
a=inactive a=sendonly
a=rtcp:PORT a=rtcp:PORT
m=audio PORT RTP/AVP 0 m=audio PORT RTP/AVP 0
c=IN IP4 203.0.113.1 c=IN IP4 203.0.113.1
a=label:0 a=label:1
a=rtpmap:0 PCMU/8000 a=rtpmap:0 PCMU/8000
a=sendonly a=inactive
a=rtcp:PORT a=rtcp:PORT
SDP SDP
is_deeply $tag_medias, [ is_deeply $tag_medias, [
{ {
tag => ft(), tag => tt(),
medias => [ medias => [
{ {
index => 1, index => 1,
type => 'audio', type => 'audio',
label => '1', label => '0',
mode => 'sendonly', mode => 'recvonly',
}, },
], ],
}, },
{ {
tag => tt(), tag => ft(),
medias => [ medias => [
{ {
index => 1, index => 1,
type => 'audio', type => 'audio',
label => '0', label => '1',
mode => 'recvonly', mode => 'sendonly',
}, },
], ],
}, },
@ -1771,14 +1771,14 @@ v=0
o=- 1545997027 1 IN IP4 198.51.100.1 o=- 1545997027 1 IN IP4 198.51.100.1
s=tester s=tester
t=0 0 t=0 0
m=audio 6122 RTP/AVP 0
c=IN IP4 198.51.100.14
a=label:1
a=inactive
m=audio 6124 RTP/AVP 0 m=audio 6124 RTP/AVP 0
c=IN IP4 198.51.100.14 c=IN IP4 198.51.100.14
a=label:0 a=label:0
a=recvonly a=recvonly
m=audio 6122 RTP/AVP 0
c=IN IP4 198.51.100.14
a=label:1
a=inactive
SDP SDP
snd($sock_b, $port_a, rtp(0, 2001, 4320, 0x3456, "\x00" x 160)); snd($sock_b, $port_a, rtp(0, 2001, 4320, 0x3456, "\x00" x 160));
@ -1827,7 +1827,7 @@ a=sendrecv
a=rtcp:PORT a=rtcp:PORT
SDP SDP
(undef, $ttr, undef, $tag_medias, $media_labels, $port_c, undef, $port_d) = subscribe_request('SIPREC sub pause/resume', (undef, $ttr, undef, $tag_medias, $media_labels, $port_d, undef, $port_c) = subscribe_request('SIPREC sub pause/resume',
{ flags => ['all', 'SIPREC'], 'to-tag' => $ttr }, <<SDP); { flags => ['all', 'SIPREC'], 'to-tag' => $ttr }, <<SDP);
v=0 v=0
o=- SDP_VERSION IN IP4 203.0.113.1 o=- SDP_VERSION IN IP4 203.0.113.1
@ -1835,13 +1835,13 @@ s=RTPE_VERSION
t=0 0 t=0 0
m=audio PORT RTP/AVP 0 m=audio PORT RTP/AVP 0
c=IN IP4 203.0.113.1 c=IN IP4 203.0.113.1
a=label:1 a=label:0
a=rtpmap:0 PCMU/8000 a=rtpmap:0 PCMU/8000
a=sendonly a=sendonly
a=rtcp:PORT a=rtcp:PORT
m=audio PORT RTP/AVP 0 m=audio PORT RTP/AVP 0
c=IN IP4 203.0.113.1 c=IN IP4 203.0.113.1
a=label:0 a=label:1
a=rtpmap:0 PCMU/8000 a=rtpmap:0 PCMU/8000
a=sendonly a=sendonly
a=rtcp:PORT a=rtcp:PORT
@ -1849,23 +1849,23 @@ SDP
is_deeply $tag_medias, [ is_deeply $tag_medias, [
{ {
tag => ft(), tag => tt(),
medias => [ medias => [
{ {
index => 1, index => 1,
type => 'audio', type => 'audio',
label => '1', label => '0',
mode => 'sendrecv', mode => 'sendrecv',
}, },
], ],
}, },
{ {
tag => tt(), tag => ft(),
medias => [ medias => [
{ {
index => 1, index => 1,
type => 'audio', type => 'audio',
label => '0', label => '1',
mode => 'sendrecv', mode => 'sendrecv',
}, },
], ],
@ -1892,14 +1892,14 @@ v=0
o=- 1545997027 1 IN IP4 198.51.100.1 o=- 1545997027 1 IN IP4 198.51.100.1
s=tester s=tester
t=0 0 t=0 0
m=audio 6122 RTP/AVP 0
c=IN IP4 198.51.100.14
a=label:1
a=recvonly
m=audio 6124 RTP/AVP 0 m=audio 6124 RTP/AVP 0
c=IN IP4 198.51.100.14 c=IN IP4 198.51.100.14
a=label:0 a=label:0
a=recvonly a=recvonly
m=audio 6122 RTP/AVP 0
c=IN IP4 198.51.100.14
a=label:1
a=recvonly
SDP SDP
snd($sock_b, $port_a, rtp(0, 2001, 4480, 0x3456, "\x00" x 160)); snd($sock_b, $port_a, rtp(0, 2001, 4480, 0x3456, "\x00" x 160));
@ -1952,7 +1952,7 @@ a=recvonly
a=rtcp:PORT a=rtcp:PORT
SDP SDP
(undef, undef, undef, $tag_medias, $media_labels, $port_c, undef, $port_d) = subscribe_request('SIPREC sub pause/resume', (undef, undef, undef, $tag_medias, $media_labels, $port_d, undef, $port_c) = subscribe_request('SIPREC sub pause/resume',
{ flags => ['all', 'SIPREC'], 'to-tag' => $ttr }, <<SDP); { flags => ['all', 'SIPREC'], 'to-tag' => $ttr }, <<SDP);
v=0 v=0
o=- SDP_VERSION IN IP4 203.0.113.1 o=- SDP_VERSION IN IP4 203.0.113.1
@ -1960,38 +1960,38 @@ s=RTPE_VERSION
t=0 0 t=0 0
m=audio PORT RTP/AVP 0 m=audio PORT RTP/AVP 0
c=IN IP4 203.0.113.1 c=IN IP4 203.0.113.1
a=label:1 a=label:0
a=rtpmap:0 PCMU/8000 a=rtpmap:0 PCMU/8000
a=sendonly a=inactive
a=rtcp:PORT a=rtcp:PORT
m=audio PORT RTP/AVP 0 m=audio PORT RTP/AVP 0
c=IN IP4 203.0.113.1 c=IN IP4 203.0.113.1
a=label:0 a=label:1
a=rtpmap:0 PCMU/8000 a=rtpmap:0 PCMU/8000
a=inactive a=sendonly
a=rtcp:PORT a=rtcp:PORT
SDP SDP
is_deeply $tag_medias, [ is_deeply $tag_medias, [
{ {
tag => ft(), tag => tt(),
medias => [ medias => [
{ {
index => 1, index => 1,
type => 'audio', type => 'audio',
label => '1', label => '0',
mode => 'recvonly', mode => 'sendonly',
}, },
], ],
}, },
{ {
tag => tt(), tag => ft(),
medias => [ medias => [
{ {
index => 1, index => 1,
type => 'audio', type => 'audio',
label => '0', label => '1',
mode => 'sendonly', mode => 'recvonly',
}, },
], ],
}, },
@ -2017,14 +2017,14 @@ v=0
o=- 1545997027 1 IN IP4 198.51.100.1 o=- 1545997027 1 IN IP4 198.51.100.1
s=tester s=tester
t=0 0 t=0 0
m=audio 6122 RTP/AVP 0
c=IN IP4 198.51.100.14
a=label:1
a=recvonly
m=audio 6124 RTP/AVP 0 m=audio 6124 RTP/AVP 0
c=IN IP4 198.51.100.14 c=IN IP4 198.51.100.14
a=label:0 a=label:0
a=inactive a=inactive
m=audio 6122 RTP/AVP 0
c=IN IP4 198.51.100.14
a=label:1
a=recvonly
SDP SDP
snd($sock_a, $port_b, rtp(0, 4001, 7480, 0x6543, "\x00" x 160)); snd($sock_a, $port_b, rtp(0, 4001, 7480, 0x6543, "\x00" x 160));

@ -485,21 +485,21 @@ v=0
o=- SDP_VERSION IN IP4 203.0.113.1 o=- SDP_VERSION IN IP4 203.0.113.1
s=RTPE_VERSION s=RTPE_VERSION
t=0 0 t=0 0
m=audio PORT RTP/AVP 118 98 m=audio PORT RTP/AVP 96 98
c=IN IP4 203.0.113.1 c=IN IP4 203.0.113.1
a=label:1 a=label:0
a=rtpmap:118 AMR/8000 a=rtpmap:96 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=fmtp:96 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=rtpmap:98 telephone-event/8000
a=fmtp:98 0-15 a=fmtp:98 0-15
a=sendonly a=sendonly
a=rtcp:PORT a=rtcp:PORT
a=ptime:20 a=ptime:20
m=audio PORT RTP/AVP 96 98 m=audio PORT RTP/AVP 118 98
c=IN IP4 203.0.113.1 c=IN IP4 203.0.113.1
a=label:0 a=label:1
a=rtpmap:96 AMR/8000 a=rtpmap:118 AMR/8000
a=fmtp:96 mode-set=0,2,4,7;mode-change-period=2;mode-change-capability=2;mode-change-neighbor=1;max-red=0 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=rtpmap:98 telephone-event/8000
a=fmtp:98 0-15 a=fmtp:98 0-15
a=sendonly a=sendonly

Loading…
Cancel
Save