Browse Source

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

Change-Id: Iaea12033d3a142b4675cc22ed0e3270af654e7de
mr9.5.2
Richard Fuchs 4 years ago
parent
commit
1d9c71ae9b
3 changed files with 143 additions and 3 deletions
  1. +13
    -0
      daemon/call.c
  2. +6
    -3
      perl/NGCP/Rtpengine/AutoTest.pm
  3. +124
    -0
      t/auto-daemon-tests.pl

+ 13
- 0
daemon/call.c View File

@ -3106,6 +3106,19 @@ static struct call_monologue *call_get_monologue(struct call *call, const str *f
__monologue_unkernelize(ret);
__monologue_unkernelize(ret->active_dialogue);
// if we have a to-tag, confirm that this dialogue association is intact
if (totag && totag->s) {
if (str_cmp_str(&ret->active_dialogue->tag, totag)) {
__C_DBG("different to-tag than existing dialogue association");
os = g_hash_table_lookup(call->tags, totag);
if (!os)
goto new_branch;
// use existing to-tag
os->active_dialogue = ret;
ret->active_dialogue = os;
}
}
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);
};
@ -120,7 +120,7 @@ sub rtpe_req {
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);
my $regexp = "^\Q$exp_sdp_out\E\$";
@ -147,7 +147,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 snd {
@ -250,6 +250,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