TT#81700 generate_test_tt2.pl: fixes

* add soundfile id to scenarios_ids.yml
* zero Content-Length
* add app.local port fix
* don't try to find subscriber_ids on some headers
  like CSeq or Content-Length

Change-Id: Ia10817a025c22c17cdfd93edcc7128e7cdb06029
mr9.2
Victor Seva 6 years ago
parent e0662e6cdb
commit 4f6e639ef9

@ -65,7 +65,7 @@ if(!$del) {
sub manage_soundfiles
{
my ($data, $id) = @_;
my ($data, $st) = @_;
foreach my $sf (sort keys %{$data->{sounds}})
{
@ -76,8 +76,8 @@ sub manage_soundfiles
$sf_data->{handle} = $sf;
$sf_data->{filename} = basename($filename, '.wav');
if(-f $filepath) {
$api->upload_soundfile($sf_data, $filepath);
print "$filename at [$filepath] uploaded\n";
$ids->{soundsets}->{$st}->{$sf}->{id} = $api->upload_soundfile($sf_data, $filepath);
print "$filename at [$filepath] uploaded[$sf]\n";
} else {
die("$filename at [$filepath] not found");
}
@ -100,7 +100,7 @@ sub do_create
} else {
$data->{soundsets}->{$st}->{id} = $api->create_soundset($st_data);
print "soundset [$st]: created [$data->{soundsets}->{$st}->{id}]\n";
manage_soundfiles($data->{soundsets}->{$st});
manage_soundfiles($data->{soundsets}->{$st}, $st);
}
$ids->{soundsets}->{$st}->{id} = $data->{soundsets}->{$st}->{id};
}

@ -112,6 +112,12 @@ sub subst_uuids
sub subst_ids
{
my $line = shift;
my @skip_headers = qw(Content-Length CSeq);
foreach my $header (@{skip_headers}) {
if ($line =~ /^\Q${header}\E: /i) {
return $line;
}
}
foreach my $id (sort keys %{$ids}) {
if($line =~ s/(=|: )\Q${id}\E([^\d]?)/${1}[% $ids->{$id} %]${2}/g) {
return $line;
@ -136,6 +142,8 @@ sub subst_common
$line =~ s/: Sipwise NGCP (Proxy|Application|PBX|LB).+/: Sipwise NGCP ${1}/;
} elsif($line =~ /^Content-Length:[ ]+[1-9]/i) {
$line =~ s/:[ ]+\d+/:\\s+\\d+/;
} elsif($line =~ /^Content-Length: [ ]+0/i) {
$line =~ s/: [ ]+\d+/: \\s+0/;
} elsif($line =~ /^Contact: /i) {
$line =~ s/;expires=\d+/;expires=\\d+/g;
$line =~ s/;\+sip\.instance=/;\\+sip.instance=/g;
@ -154,6 +162,8 @@ sub subst_common
$line =~ s/appearance-uri=\"([^\"]+)\"/appearance-uri=\\"${1}\\"/g;
} elsif($line =~ /^Subscription-State: /i) {
$line =~ s/expires=\d+/expires=\\d+/;
} elsif($line =~ /sip:pre_announce\@app\.local:\d+/ ) {
$line =~ s/app\.local:\d+/app.local:\\d+/;
}
if($line =~ /127\.0\.0\.1(:|;port=)508[08]/) {

@ -1013,7 +1013,7 @@ sub upload_soundfile {
if(! $res->is_success) {
die $res->as_string;
}
return;
return _get_id("/api/soundfiles/", $res->header('Location'));
}
sub delete_banneduser {

Loading…
Cancel
Save