Browse Source

TT#131651 support reverse re-invite to new to-tag

Change-Id: Iaea12033d3a142b4675cc22ed0e3270af654e7de
(cherry picked from commit d11432ec81)
pull/1346/head
Richard Fuchs 4 years ago
parent
commit
8a60d17574
3 changed files with 153 additions and 3 deletions
  1. +23
    -0
      daemon/call.c
  2. +6
    -3
      perl/NGCP/Rtpengine/AutoTest.pm
  3. +124
    -0
      t/auto-daemon-tests.pl

+ 23
- 0
daemon/call.c View File

@ -3721,6 +3721,29 @@ static int call_get_monologue_new(struct call_monologue *dialogue[2], struct cal
__monologue_unkernelize(cs->monologue);
}
// if we have a to-tag, confirm that this dialogue association is intact
if (totag && totag->s) {
for (GList *sub = ret->subscribers.head; sub; sub = sub->next) {
struct call_subscription *cs = sub->data;
if (!cs->offer_answer)
continue;
struct call_monologue *csm = cs->monologue;
if (str_cmp_str(&csm->tag, totag)) {
__C_DBG("different to-tag than existing dialogue association");
csm = call_get_monologue(call, totag);
if (!csm)
goto new_branch;
// use existing to-tag
__monologue_unkernelize(csm);
__subscribe_only_one_offer_answer(ret, csm);
__subscribe_only_one_offer_answer(csm, ret);
break;
}
break; // there should only be one
// XXX check if there's more than a one-to-one mapping here?
}
}
if (!viabranch)
goto ok_check_tag;


+ 6
- 3
perl/NGCP/Rtpengine/AutoTest.pm View File

@ -20,7 +20,7 @@ BEGIN {
require Exporter;
@ISA = qw(Exporter);
our @EXPORT = qw(autotest_start new_call offer answer ft tt snd srtp_snd rtp rcv srtp_rcv
srtp_dec escape rtpm rtpmre reverse_tags new_tt crlf sdp_split rtpe_req offer_answer
srtp_dec escape rtpm rtpmre reverse_tags new_ft new_tt crlf sdp_split rtpe_req offer_answer
autotest_init subscribe_request subscribe_answer publish);
};
@ -143,7 +143,7 @@ sub sdp_match {
sub offer_answer {
my ($cmd, $name, $req, $sdps) = @_;
my ($sdp_in, $exp_sdp_out) = sdp_split($sdps);
$req->{'from-tag'} = $ft;
$req->{'from-tag'} //= $ft;
$req->{sdp} = $sdp_in;
my $resp = rtpe_req($cmd, $name, $req);
return sdp_match($cmd, $name, $resp->{sdp}, $exp_sdp_out);
@ -153,7 +153,7 @@ sub offer {
}
sub answer {
my ($name, $req, $sdps) = @_;
$req->{'to-tag'} = $tt;
$req->{'to-tag'} //= $tt;
return offer_answer('answer', $name, $req, $sdps);
}
sub subscribe_request {
@ -270,6 +270,9 @@ sub tt { return $tt; }
sub reverse_tags {
($tt, $ft) = ($ft, $tt);
}
sub new_ft {
$ft = $tag_iter++ . "-test-fromtag" . $tag_suffix;
}
sub new_tt {
$tt = $tag_iter++ . "-test-totag" . $tag_suffix;
}


+ 124
- 0
t/auto-daemon-tests.pl View File

@ -40,6 +40,130 @@ my ($sock_a, $sock_b, $sock_c, $sock_d, $port_a, $port_b, $ssrc, $ssrc_b, $resp,
new_call;
my $ft1 = ft();
offer('re-invite re-tag w/ via-branch', { 'via-branch' => 'foo' }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio 2000 RTP/AVP 0
c=IN IP4 198.51.100.14
a=sendrecv
----------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio PORT RTP/AVP 0
c=IN IP4 203.0.113.1
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtcp:PORT
SDP
new_ft;
my $ft2 = ft();
offer('re-invite re-tag w/ via-branch', { 'via-branch' => 'bar' }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio 2100 RTP/AVP 0
c=IN IP4 198.51.100.14
a=sendrecv
----------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio PORT RTP/AVP 0
c=IN IP4 203.0.113.1
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtcp:PORT
SDP
# answer ft2
($port_a) = answer('re-invite re-tag w/ via-branch', { 'via-branch' => 'bar' }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio 2200 RTP/AVP 0
c=IN IP4 198.51.100.14
a=sendrecv
----------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio PORT RTP/AVP 0
c=IN IP4 203.0.113.1
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtcp:PORT
SDP
# delete ft1
rtpe_req('delete', 'GH 1086', { 'from-tag' => $ft1 });
# reverse re-invite to new from-tag ft3
new_ft;
my $ft3 = ft();
reverse_tags;
# tt is the new tag ft3 now
($port_b) = offer('re-invite re-tag w/ via-branch', { 'via-branch' => 'blah', 'to-tag' => tt() }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio 2200 RTP/AVP 0
c=IN IP4 198.51.100.14
a=sendrecv
----------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio PORT RTP/AVP 0
c=IN IP4 203.0.113.1
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtcp:PORT
SDP
isnt($port_a, $port_b, "new port");
# restore to original ft2
($port_b) = offer('re-invite re-tag w/ via-branch', { 'via-branch' => 'baz', 'to-tag' => $ft2 }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio 2200 RTP/AVP 0
c=IN IP4 198.51.100.14
a=sendrecv
----------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio PORT RTP/AVP 0
c=IN IP4 203.0.113.1
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtcp:PORT
SDP
is($port_a, $port_b, "new port");
new_call;
offer('unsupp codecs and dup encodings', { }, <<SDP);


Loading…
Cancel
Save