From cb104327b940edfb9b2151f2daa371bd816ed3e1 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 20 Jun 2025 08:23:48 -0400 Subject: [PATCH] MT#55283 add tester rtpe_raw_req Change-Id: Id59d23e9e3b8dc9021003a2fb8f10ce275b28229 (cherry picked from commit 18f10775482bb40bf25c3bda686b2d6ac81a01ed) --- perl/NGCP/Rtpengine/AutoTest.pm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/perl/NGCP/Rtpengine/AutoTest.pm b/perl/NGCP/Rtpengine/AutoTest.pm index 09fa5d77a..7ed36a50e 100644 --- a/perl/NGCP/Rtpengine/AutoTest.pm +++ b/perl/NGCP/Rtpengine/AutoTest.pm @@ -22,7 +22,7 @@ BEGIN { @ISA = qw(Exporter); our @EXPORT = qw(autotest_start new_call offer answer ft tt cid snd srtp_snd rtp rcv srtp_rcv rcv_no rcv_maybe 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 use_json); + autotest_init subscribe_request subscribe_answer publish use_json rtpe_raw_req); }; @@ -114,16 +114,21 @@ sub sdp_split { my ($s) = @_; return split(/--------*\n/, $s); } -sub rtpe_req { - my ($cmd, $name, $req) = @_; - $req->{command} = $cmd; - $req->{'call-id'} = $cid; +sub rtpe_raw_req { + my ($req) = @_; my $resp; eval { alarm(3); $resp = $c->req($req); alarm(0); }; + return $resp || $@; +} +sub rtpe_req { + my ($cmd, $name, $req) = @_; + $req->{command} = $cmd; + $req->{'call-id'} //= $cid; + my $resp = rtpe_raw_req($req); terminate("'$cmd' request failed ($@)") if $@; is $resp->{result}, 'ok', "$name - '$cmd' status"; return $resp;