From 5fa83ce1cbb302bc98f6898cfae42309e5028654 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 31 Mar 2020 10:46:55 -0400 Subject: [PATCH] TT#14008 rtpengine-ctl fix to allow override of default values Change-Id: Ia5e5aafbfdfa28652c153852a664b3212544f74f --- utils/rtpengine-ctl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/utils/rtpengine-ctl b/utils/rtpengine-ctl index d4944b695..17595e7ce 100755 --- a/utils/rtpengine-ctl +++ b/utils/rtpengine-ctl @@ -7,8 +7,8 @@ use IO::Socket::INET; use Getopt::Long; use Config::Tiny; -my $ip = 'localhost'; -my $port = 9900; +my $ip; +my $port; my $conffile = '/etc/rtpengine/rtpengine.conf'; my $listen; @@ -33,13 +33,16 @@ if (-f $conffile) { } } -if ($ip && $ip =~ s/:(\d+)$//) { +if ($ip && $ip =~ s/:(\d+)$// && !$port) { $port = $1; } my $argumentstring = "@ARGV"; $argumentstring = trim($argumentstring); +$ip //= '127.0.0.1'; +$port //= 9900; + if (!$argumentstring || !$optret || $port <= 0 || $port > 65535) { showusage(); exit 1;