From c3510b4788e36a0e55145e71089f74090fb036e7 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Thu, 9 Nov 2023 09:54:19 -0500 Subject: [PATCH] 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 --- daemon/call_interfaces.c | 2 +- t/auto-daemon-tests-pubsub.pl | 136 +++++++++++++++++----------------- t/auto-daemon-tests.pl | 16 ++-- 3 files changed, 77 insertions(+), 77 deletions(-) diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index aeb4ddab6..a53856737 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -2764,7 +2764,7 @@ static const char *media_block_match_mult(struct call **call, GQueue *mls, if (flags->all == ALL_ALL) { // 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; if (ml->tagtype != FROM_TAG && ml->tagtype != TO_TAG) continue; diff --git a/t/auto-daemon-tests-pubsub.pl b/t/auto-daemon-tests-pubsub.pl index db9f1162b..53904c4c8 100755 --- a/t/auto-daemon-tests-pubsub.pl +++ b/t/auto-daemon-tests-pubsub.pl @@ -755,39 +755,39 @@ s=RTPE_VERSION t=0 0 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=sendonly a=rtcp:PORT m=audio PORT RTP/AVP 0 c=IN IP4 203.0.113.1 -a=label:0 +a=label:1 a=rtpmap:0 PCMU/8000 a=sendonly a=rtcp:PORT SDP 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, [ { - tag => ft(), + tag => tt(), medias => [ { index => 1, type => 'audio', - label => '1', + label => '0', mode => 'sendrecv', }, ], }, { - tag => tt(), + tag => ft(), medias => [ { index => 1, type => 'audio', - label => '0', + label => '1', mode => 'sendrecv', }, ], @@ -863,41 +863,41 @@ s=RTPE_VERSION t=0 0 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=sendonly a=rtcp:PORT m=audio PORT RTP/AVP 0 c=IN IP4 203.0.113.1 -a=label:0 +a=label:1 a=rtpmap:0 PCMU/8000 a=sendonly a=rtcp:PORT SDP 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, [ { - tag => ft(), - label => 'caller', + tag => tt(), + label => 'called', medias => [ { index => 1, type => 'audio', - label => '1', + label => '0', mode => 'sendrecv', }, ], }, { - tag => tt(), - label => 'called', + tag => ft(), + label => 'caller', medias => [ { index => 1, type => 'audio', - label => '0', + label => '1', 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)); 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'] }, < $ttr, flags => ['allow transcoding'] }, < ['all', 'SIPREC'] }, < ['all', 'SIPREC'], 'to-tag' => $ttr }, < ft(), + tag => tt(), medias => [ { index => 1, type => 'audio', - label => '1', - mode => 'sendonly', + label => '0', + mode => 'recvonly', }, ], }, { - tag => tt(), + tag => ft(), medias => [ { index => 1, type => 'audio', - label => '0', - mode => 'recvonly', + label => '1', + mode => 'sendonly', }, ], }, @@ -1771,14 +1771,14 @@ v=0 o=- 1545997027 1 IN IP4 198.51.100.1 s=tester 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 c=IN IP4 198.51.100.14 a=label:0 a=recvonly +m=audio 6122 RTP/AVP 0 +c=IN IP4 198.51.100.14 +a=label:1 +a=inactive SDP snd($sock_b, $port_a, rtp(0, 2001, 4320, 0x3456, "\x00" x 160)); @@ -1827,7 +1827,7 @@ a=sendrecv a=rtcp:PORT 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 }, < ft(), + tag => tt(), medias => [ { index => 1, type => 'audio', - label => '1', + label => '0', mode => 'sendrecv', }, ], }, { - tag => tt(), + tag => ft(), medias => [ { index => 1, type => 'audio', - label => '0', + label => '1', mode => 'sendrecv', }, ], @@ -1892,14 +1892,14 @@ v=0 o=- 1545997027 1 IN IP4 198.51.100.1 s=tester 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 c=IN IP4 198.51.100.14 a=label:0 a=recvonly +m=audio 6122 RTP/AVP 0 +c=IN IP4 198.51.100.14 +a=label:1 +a=recvonly SDP snd($sock_b, $port_a, rtp(0, 2001, 4480, 0x3456, "\x00" x 160)); @@ -1952,7 +1952,7 @@ a=recvonly a=rtcp:PORT 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 }, < ft(), + tag => tt(), medias => [ { index => 1, type => 'audio', - label => '1', - mode => 'recvonly', + label => '0', + mode => 'sendonly', }, ], }, { - tag => tt(), + tag => ft(), medias => [ { index => 1, type => 'audio', - label => '0', - mode => 'sendonly', + label => '1', + mode => 'recvonly', }, ], }, @@ -2017,14 +2017,14 @@ v=0 o=- 1545997027 1 IN IP4 198.51.100.1 s=tester 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 c=IN IP4 198.51.100.14 a=label:0 a=inactive +m=audio 6122 RTP/AVP 0 +c=IN IP4 198.51.100.14 +a=label:1 +a=recvonly SDP snd($sock_a, $port_b, rtp(0, 4001, 7480, 0x6543, "\x00" x 160)); diff --git a/t/auto-daemon-tests.pl b/t/auto-daemon-tests.pl index 33005ed99..784b8e49a 100755 --- a/t/auto-daemon-tests.pl +++ b/t/auto-daemon-tests.pl @@ -485,21 +485,21 @@ v=0 o=- SDP_VERSION IN IP4 203.0.113.1 s=RTPE_VERSION t=0 0 -m=audio PORT RTP/AVP 118 98 +m=audio PORT RTP/AVP 96 98 c=IN IP4 203.0.113.1 -a=label:1 -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=label:0 +a=rtpmap:96 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=rtpmap:98 telephone-event/8000 a=fmtp:98 0-15 a=sendonly a=rtcp:PORT a=ptime:20 -m=audio PORT RTP/AVP 96 98 +m=audio PORT RTP/AVP 118 98 c=IN IP4 203.0.113.1 -a=label:0 -a=rtpmap:96 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=label:1 +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=sendonly