#!/usr/bin/perl
########################################################################
#
# $Id: xvb-ctl,v 1.20 2026/05/20 20:27:57 gosha Exp $
#
# Copyright (c) 2014 - 2026 Okunev Igor <igor[at]prv.mts-nn.ru>
#
########################################################################
my @crypt_arr;{local($_,$^W);$_=tell DATA;seek DATA,$?,$^W=scalar @crypt_arr;read DATA,my $crypt_str,"$^F$=";seek DATA,$?,$_;@crypt_arr=map{ord($_)}split //,$crypt_str;}sub xg613_x{local$_;rd613l:{if($#_>$#crypt_arr){@crypt_arr=(@crypt_arr,@crypt_arr);redo rd613l;}}my $S9AELeYUJv="";for(my $Fp9mlbTDFC=0;$Fp9mlbTDFC<=$#_;$Fp9mlbTDFC++){$S9AELeYUJv.=chr($_[$Fp9mlbTDFC]/ ord($crypt_arr[$Fp9mlbTDFC]));}$S9AELeYUJv;}use strict;use Data::Dumper;my $gZtYce7AEa=$ARGV[0];my $di3V5zlMyo87vU4afWQ96="list";if($gZtYce7AEa eq main::xg613_x(5049,4947,5616,5292,5635)){my $bJYxprQEw7qOFfRPmAs8U=0;if($di3V5zlMyo87vU4afWQ96 ne main::xg613_x(5049,4947,5616,5292)){my $pvIlPtK1kNc56uFE4LCVd=main::xg613_x(4947,5865,6032,4949,5586,5145,5980,6099,1568,2205,5928,5880,1568)."'".main::xg613_x(5049,5661,5928,4949,1568,5635,5408,6327,5831,1568,5148,5096,4753,5390,5390,4949,5508,5865,1632,5049,5661,5610,5049,5355,5865,5151)."'".main::xg613_x(1632,2550,3224,2303,4900,4949,6136,2679,5390,5733,5616,5292);my @UmRt5CFK02=`$pvIlPtK1kNc56uFE4LCVd`;foreach my $sOrM4oPeUW(@UmRt5CFK02){if($sOrM4oPeUW=~ m#SIP/[^\!]+\!xvb-phones\!#){$bJYxprQEw7qOFfRPmAs8U++;}elsif($sOrM4oPeUW=~ m#\!macro-xvb-smartdial\!#){$bJYxprQEw7qOFfRPmAs8U++;}elsif($sOrM4oPeUW=~ m#\!xvb-main\!.*show-must-go-on#){$bJYxprQEw7qOFfRPmAs8U++;}}}else{my $Bo1jQJ3VzU=time;my $pvIlPtK1kNc56uFE4LCVd=main::xg613_x(4947,5865,6032,4949,5586,5145,5980,6099,1568,2205,5928,5880,1568)."'".main::xg613_x(5049,5304,5044,5390,5390,4949,5616,1824,5439,5586,5460,5047,5145,5390,4753,5684,5151,1632,3876,5661,5049,4947,5508,2397).$Bo1jQJ3VzU.main::xg613_x(2346,5049,5044,5292,5292,5635,3328,6156,5145,5341,5460,5684,5635,1568,4949,5880,5916,5151,5610,5865,5355,5661,5610,1632,4998,5508,5151,5253,3264,5508,5355,5559,5355,5916,5865)."' >/dev/null";system $pvIlPtK1kNc56uFE4LCVd;for(0..5){$pvIlPtK1kNc56uFE4LCVd=main::xg613_x(5049,4947,6032,1568,2303,5684,5668,6384,2303).$Bo1jQJ3VzU.main::xg613_x(2346,5049,5044,5292,5292,5635);$bJYxprQEw7qOFfRPmAs8U=`$pvIlPtK1kNc56uFE4LCVd`;chomp($bJYxprQEw7qOFfRPmAs8U);if(length($bJYxprQEw7qOFfRPmAs8U)){last;}else{sleep 1;}}unlink main::xg613_x(2397,5916,5668,5488,2303).$Bo1jQJ3VzU.main::xg613_x(2346,5049,5044,5292,5292,5635);}print "$bJYxprQEw7qOFfRPmAs8U\n";}elsif($gZtYce7AEa eq main::xg613_x(5049,5661,6084,5390,5684,4949,5928,6555)){system "/opt/VirtualPBX/contrib/utils/user_counters.pl '$ARGV[3]' $ARGV[1]";}elsif($gZtYce7AEa eq main::xg613_x(5049,4947,5148,5096,4949)){system "/opt/VirtualPBX/contrib/utils/mc_view.pl '$ARGV[1]' '$ARGV[2]' '$ARGV[3]'";}elsif($gZtYce7AEa eq main::xg613_x(5049,4947,5148,5096,4949,2205,5564,5757,5929,5635)){system "/opt/VirtualPBX/contrib/utils/mc_view.pl '' 'dump'";}elsif($gZtYce7AEa eq main::xg613_x(5814,5151,5616,5439,4753,4900)){system "service xvb-perl-worker restart";system "service xvb-fagi restart";my $gZtYce7AEa=main::xg613_x(5712,5865,1664,4753,5880,1568,6448,1824,5047,5586,5252,5488,1568,4459,5047,3479,4743,5151,4947,5814,5559,4947,5610,2295,6069,5661,5814,5457,5151,5814,2346,5712,5508);my $seaCtkfsDFiJ2IVRXr8hj=`$gZtYce7AEa`;if($seaCtkfsDFiJ2IVRXr8hj){system "service xvb-gearman-worker restart";}$gZtYce7AEa=main::xg613_x(5712,5865,1664,4753,5880,1568,6448,1824,5047,5586,5252,5488,1568,4459,4067,5635,4743,4947,5202,5151,4845,6120,6018,4998,4845,5049,4947,5508,5508,4998,5508,4947,5865,5916);$seaCtkfsDFiJ2IVRXr8hj=`$gZtYce7AEa`;if($seaCtkfsDFiJ2IVRXr8hj){system "service xvb-callblast restart";}$gZtYce7AEa=main::xg613_x(5712,5865,1664,4753,5880,1568,6448,1824,5047,5586,5252,5488,1568,4459,4018,5586,4743,5151,5253,4845,5967,4947,5049,2346,5712,5508);$seaCtkfsDFiJ2IVRXr8hj=`$gZtYce7AEa`;if($seaCtkfsDFiJ2IVRXr8hj){system "service xvb-reg_uac restart";}system "service httpd restart";}elsif($gZtYce7AEa eq main::xg613_x(5814,5151,5616,5439,4753,4900,2340,5643,4753,4851,5408,4949)){system "service memcached restart";system "/opt/VirtualPBX/contrib/utils/MemCached.pl";}elsif($gZtYce7AEa eq main::xg613_x(5814,5151,5616,5439,4753,4900,2340,6612,5684)){system "/opt/VirtualPBX/contrib/utils/nodes_admin/mc_cleanup";}elsif($gZtYce7AEa eq main::xg613_x(5100,4998,5200,4949,5292)){system "/opt/VirtualPBX/contrib/utils/db_data_cli.pl $ARGV[1] del $ARGV[2]";}elsif($gZtYce7AEa eq main::xg613_x(5100,4998,5200,4753,5684,4753)or $gZtYce7AEa eq main::xg613_x(5100,4998,6136,5145,4949,5831)){system "/opt/VirtualPBX/contrib/utils/db_data_cli.pl $ARGV[1] view $ARGV[2]";}elsif($gZtYce7AEa eq main::xg613_x(5916,5916,5980,5047,4949,5390)){my $z1XcjTSh3K=$ARGV[1];if(length($z1XcjTSh3K)==0 or !-e $z1XcjTSh3K){oWUVsJLf87();}system "cat $z1XcjTSh3K | /opt/VirtualPBX/contrib/utils/tts-gen.pl $ARGV[2] $ARGV[3]";}elsif($gZtYce7AEa eq main::xg613_x(5712,5355,5720,4998,5439)){my $gZtYce7AEa="/opt/VirtualPBX/contrib/utils/db_data_cli.pl $ARGV[1] view phones";my $l3wn5uLKMmRCDAXxQeJNI=`$gZtYce7AEa`;my $VAR1;unless($l3wn5uLKMmRCDAXxQeJNI=~ s/^\x24VAR1\s+=//){print main::xg613_x(3723,5610,6032,4949,5586,5390,5044,6156,1568,4949,5928,5586,5439,5586),"\n";exit;}eval "\$VAR1 = $l3wn5uLKMmRCDAXxQeJNI";exit unless ref $VAR1 eq main::xg613_x(3672,3315,4316,3528);my $nLhoBPgdW8=$ARGV[2]||main::xg613_x(2448);my $TPsvoDijOaIChXpBGFMc2=$VAR1->{$nLhoBPgdW8}->{main::xg613_x(5610,4947,5668,4949)};if($TPsvoDijOaIChXpBGFMc2){if($VAR1->{$nLhoBPgdW8}->{main::xg613_x(5814,5151,5356,5635,4949,4851,5772,6270,4900,5635)}>time){$VAR1->{$nLhoBPgdW8}->{main::xg613_x(4182,3519,3692,4655,4067,4116,3380,4788,4165,4067)}=main::xg613_x(4182,5151,5356,5145,5635,5684,5252,6498,4949,4900);}else{$VAR1->{$nLhoBPgdW8}->{main::xg613_x(4182,3519,3692,4655,4067,4116,3380,4788,4165,4067)}=main::xg613_x(4335,5610,4264,4949,5047,5145,5980,6612,4949,5586,5252,4900);}if($VAR1->{$nLhoBPgdW8}->{main::xg613_x(4182,3519,3692,4655,4116,3577,4004,3933)}){$VAR1->{$nLhoBPgdW8}->{main::xg613_x(4182,3519,3692,4655,3332,3185,4368,3933)}=localtime($VAR1->{$nLhoBPgdW8}->{main::xg613_x(4182,3519,3692,4655,4116,3577,4004,3933)});}$gZtYce7AEa="/usr/sbin/asterisk -rx 'database get SIP/Registry ".$VAR1->{$nLhoBPgdW8}->{main::xg613_x(5610,4947,5668,4949)}."'";my $p089MtSK7OAoJ65Pm2Bln=`$gZtYce7AEa`;$p089MtSK7OAoJ65Pm2Bln=~ s{Privilege escalation protection.*}{}s;chomp $p089MtSK7OAoJ65Pm2Bln;if($p089MtSK7OAoJ65Pm2Bln=~ s/^Value://){my @AXwja82s90=split(/:/,$p089MtSK7OAoJ65Pm2Bln,5);if(scalar(@AXwja82s90)==4){$VAR1->{$nLhoBPgdW8}->{main::xg613_x(4182,3519,3692,4655,3577,3822,3640,4503)}={REG_ADDR=>$AXwja82s90[0],EXPIRE=>$AXwja82s90[1],USERNAME=>$AXwja82s90[2],CONTACT=>$AXwja82s90[3]};}else{$VAR1->{$nLhoBPgdW8}->{main::xg613_x(4182,3519,3692,4655,3577,3822,3640,4503)}={REG_ADDR=>$AXwja82s90[0].main::xg613_x(2958).$AXwja82s90[1],EXPIRE=>$AXwja82s90[2],USERNAME=>$AXwja82s90[3],CONTACT=>$AXwja82s90[4]};}}print Dumper($VAR1->{$nLhoBPgdW8});}}elsif($gZtYce7AEa eq main::xg613_x(5967,5865,5252,5586,4753,4900,5200)){my $gZtYce7AEa="sudo -u asterisk /opt/VirtualPBX/web/cgi-bin/ai 'action=user_add&phone=000&group_id=1&user_ac=".$ARGV[1]."&user_id=".$ARGV[2]."&conf_file=".$ARGV[3]."'";my $dPuU3a7WG8=`$gZtYce7AEa`;if($dPuU3a7WG8=~ /&ac=(\d+)&/){print "Created. AC: $1\n";}else{print "Error\n";}}elsif($gZtYce7AEa eq main::xg613_x(6120,6018,5096,5635,4753,5390,5200,5586,5439,5880)){my $lgS1wZbhz9=$ARGV[1];my $ykI8S9UxgV;if($lgS1wZbhz9=~ /^\d+$/){$ykI8S9UxgV=main::xg613_x(2397,5661,5824,5684,2303,4214,5460,6498,5684,5733,5044,5292,3920,3234,4312,2303,5865,5712,5661,5661,5508,2397,4998,4947,5049,5457,5967,5712,5865,2397,5100,4998,2397).$lgS1wZbhz9.main::xg613_x(2346,5253,6344);}if(-e $ykI8S9UxgV){my $gZtYce7AEa="sudo -u asterisk /opt/VirtualPBX/web/cgi-bin/ai 'action=xvbsandbox&fg=1&config_id=$lgS1wZbhz9'";my $dPuU3a7WG8=`$gZtYce7AEa`;if($dPuU3a7WG8=~ /action=sysstatus/){print "Done\n";}else{print "Error\n";}}}else{oWUVsJLf87();}sub oWUVsJLf87{print "
Valid commands:
	calls
	counters [show|clean] ac
	cache cache-key [del|set|view] [new-value]
	cache-keys
	reload-cache
	reload-tt
	reload
	dbview ac [user|peers|phones|routes|pbook|wl|bl|c2c|calls]
	dbdel ac [cdr]
	pinfo ac phone
	ttsgen BOM-file engine voice
";exit;};package main;
__DATA__
