-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathinstall.pl
2418 lines (2287 loc) · 77.1 KB
/
install.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/perl
# install.pl version 2.4
#
# Copyright (C) 2010 Matt Florell <[email protected]> LICENSE: AGPLv2
#
# CHANGES
# 71004-1155 - Added FTP and REPORT connection variables
# 71012-1251 - Added PATHDONEmonitor setting
# 71121-1048 - Added -p flag to mkdir to not show errors
# 80107-2341 - Added --build_multiserver_conf flag to generate dynamic multi-server conf sections
# 80115-1426 - Added ip_relay scripts for port forwarding
# 80122-0320 - Added build_phones_conf flag to generate phones conf entries from phones table records
# 80227-1536 - Added ip_relay to keepalive list
# 80316-2208 - Added $PATHlogs/archive for backups
# 80526-1345 - Added Timeclock auto-logout option 9
# 90210-0319 - Added option to prompt for Asterisk version
# 90312-1256 - Added CLI flag for automatic configuration
# 90620-1910 - Added check before creating directories and formatting changes
# 90727-1457 - Added GSW directory creation
# 91105-1359 - Added MIX directory to /var/spool/asterisk/monitor
# 91123-0001 - Added FTP2 directory to /var/spool/asterisk/monitorDONE
# 100428-0936 - Added DB custom user/pass fields
# 101217-0520 - Added PREPROCESS directory
#
############################################
# install.pl - puts server files in the right places and creates conf file
#
# default paths.
#
# default path to astguiclient configuration file:
$PATHconf = '/etc/astguiclient.conf';
# default path to home directory:
$PATHhome = '/usr/share/astguiclient';
# default path to astguiclient logs directory:
$PATHlogs = '/var/log/astguiclient';
# default path to asterisk agi-bin directory:
$PATHagi = '/var/lib/asterisk/agi-bin';
# default path to web root directory:
#$PATHweb = '/var/www/html';
#$PATHweb = '/home/www/htdocs';
$PATHweb = '/usr/local/apache2/htdocs';
# default path to asterisk sounds directory:
$PATHsounds = '/var/lib/asterisk/sounds';
# default path to asterisk recordings directory:
$PATHmonitor = '/var/spool/asterisk/monitor';
# default path to asterisk recordings DONE directory:
$PATHDONEmonitor = '/var/spool/asterisk/monitorDONE';
# default database server variables:
$VARDB_server = 'localhost';
$VARDB_database = 'asterisk';
$VARDB_user = 'cron';
$VARDB_pass = '1234';
$VARDB_custom_user = 'custom';
$VARDB_custom_pass = 'custom1234';
$VARDB_port = '3306';
# default keepalive processes:
$VARactive_keepalives = '1234568';
# default Asterisk version:
$VARasterisk_version = '1.4';
# default recording FTP archive variables:
$VARFTP_host = '10.0.0.4';
$VARFTP_user = 'cron';
$VARFTP_pass = 'test';
$VARFTP_port = '21';
$VARFTP_dir = 'RECORDINGS';
$VARHTTP_path = 'http://10.0.0.4';
# default report FTP variables:
$VARREPORT_host = '10.0.0.4';
$VARREPORT_user = 'cron';
$VARREPORT_pass = 'test';
$VARREPORT_port = '21';
$VARREPORT_dir = 'REPORTS';
# defaults for FastAGI Server PreFork
$VARfastagi_log_min_servers = '3';
$VARfastagi_log_max_servers = '16';
$VARfastagi_log_min_spare_servers = '2';
$VARfastagi_log_max_spare_servers = '8';
$VARfastagi_log_max_requests = '1000';
$VARfastagi_log_checkfordead = '30';
$VARfastagi_log_checkforwait = '60';
############################################
$CLIhome=0;
$CLIlogs=0;
$CLIagi=0;
$CLIweb=0;
$CLIsounds=0;
$CLImonitor=0;
$CLIserver_ip=0;
$CLIDB_server=0;
$CLIDB_database=0;
$CLIDB_user=0;
$CLIDB_pass=0;
$CLIDB_custom_user=0;
$CLIDB_custom_pass=0;
$CLIDB_port=0;
$CLIVARactive_keepalives=0;
$CLIVARasterisk_version=0;
$CLIFTP_host=0;
$CLIFTP_user=0;
$CLIFTP_pass=0;
$CLIFTP_port=0;
$CLIFTP_dir=0;
$CLIHTTP_path=0;
$CLIREPORT_host=0;
$CLIREPORT_user=0;
$CLIREPORT_pass=0;
$CLIREPORT_port=0;
$CLIREPORT_dir=0;
$CLIVARfastagi_log_min_servers=0;
$CLIVARfastagi_log_max_servers=0;
$CLIVARfastagi_log_min_spare_servers=0;
$CLIVARfastagi_log_max_spare_servers=0;
$CLIVARfastagi_log_max_requests=0;
$CLIVARfastagi_log_checkfordead=0;
$CLIVARfastagi_log_checkforwait=0;
$COPYhome=0;
$COPYlogs=0;
$COPYagi=0;
$COPYweb=0;
$COPYsounds=0;
$COPYmonitor=0;
$secX = time();
# constants
$DB=1; # Debug flag, set to 0 for no debug messages, lots of output
$US='_';
$MT[0]='';
### begin parsing run-time options ###
if (length($ARGV[0])>1)
{
$i=0;
while ($#ARGV >= $i)
{
$args = "$args $ARGV[$i]";
$i++;
}
if ($args =~ /--help/i)
{
print "install.pl - installs astGUIclient server files in the proper places, this\n";
print "script will look for an /etc/astguiclient.conf file for existing settings, and\n";
print "if not present will prompt for proper information then copy files.\n";
print "\n";
print "installation options:\n";
print " [--help] = this help screen\n";
print " [--test] = test (will not copy files)\n";
print " [--debug] = verbose debug messages\n";
print " [--no-prompt] = do not ask questions, just install\n";
print " [--web-only] = only copy files/directories for web server install\n";
print " [--without-web] = do not copy web files/directories\n\n";
print "configuration options:\n";
print " [--home=/path/from/root] = define home path from root at runtime\n";
print " [--logs=/path/from/root] = define logs path from root at runtime\n";
print " [--agi=/path/from/root] = define agi-bin path from root at runtime\n";
print " [--web=/path/from/root] = define webroot path from root at runtime\n";
print " [--sounds=/path/from/root] = define sounds path from root at runtime\n";
print " [--monitor=/path/from/root] = define monitor path from root at runtime\n";
print " [--DONEmonitor=/path/from/root] = define monitor DONE path from root at runtime\n";
print " [--server_ip=192.168.0.1] = define server IP address at runtime\n";
print " [--DB_server=localhost] = define database server IP address at runtime\n";
print " [--DB_database=asterisk] = define database name at runtime\n";
print " [--DB_user=cron] = define database user login at runtime\n";
print " [--DB_pass=1234] = define database user password at runtime\n";
print " [--DB_custom_user=custom] = define database custom user login at runtime\n";
print " [--DB_custom_pass=custom1234] = define database custom user password at runtime\n";
print " [--DB_port=3306] = define database connection port at runtime\n";
print " [--active_keepalives=123456] = define processes to keepalive\n";
print " X - NO KEEPALIVE PROCESSES (use only if you want none to be keepalive)\n";
print " 1 - AST_update\n";
print " 2 - AST_send_listen\n";
print " 3 - AST_VDauto_dial\n";
print " 4 - AST_VDremote_agents\n";
print " 5 - AST_VDadapt (If multi-server system, this must only be on one server)\n";
print " 6 - FastAGI_log\n";
print " 7 - AST_VDauto_dial_FILL (only for multi-server, this must only be on one server)\n";
print " 8 - ip_relay (used for blind agent monitoring)\n";
print " 9 - Timeclock auto-logout\n";
print " [--asterisk_version] = set the asterisk version you want to install for\n";
print " [--copy_sample_conf_files] = copies the sample conf files to /etc/asterisk/\n";
print " [--FTP_host=192.168.0.2] = define recording archive server IP address at runtime\n";
print " [--FTP_user=cron] = define archive server name at runtime\n";
print " [--FTP_pass=test] = define archive server user login at runtime\n";
print " [--FTP_port=21] = define archive server user password at runtime\n";
print " [--FTP_dir=RECORDINGS] = define archive server connection port at runtime\n";
print " [--HTTP_path=http://192.168.0.2] = define archive web root at runtime\n";
print " [--REPORT_host=192.168.0.2] = define report server IP address at runtime\n";
print " [--REPORT_user=cron] = define report server name at runtime\n";
print " [--REPORT_pass=test] = define report server user login at runtime\n";
print " [--REPORT_port=21] = define report server user password at runtime\n";
print " [--REPORT_dir=REPORTS] = define report server connection port at runtime\n";
print " [--fastagi_log_min_servers=3] = define FastAGI log min servers\n";
print " [--fastagi_log_max_servers=16] = define FastAGI log max servers\n";
print " [--fastagi_log_min_spare_servers=2] = define FastAGI log min spare servers\n";
print " [--fastagi_log_max_spare_servers=8] = define FastAGI log max spare servers\n";
print " [--fastagi_log_max_requests=1000] = define FastAGI log max requests\n";
print " [--fastagi_log_checkfordead=30] = define FastAGI log check-for-dead seconds\n";
print " [--fastagi_log_checkforwait=60] = define FastAGI log check-for-wait seconds\n";
print " [--build_multiserver_conf] = generates conf file examples for extensions.conf and iax.conf\n";
print " [--build_phones_conf] = generates conf file examples for extensions.conf, sip.conf and iax.conf\n";
print "\n";
exit;
}
else
{
if ($args =~ /--debug/i) # Debug flag
{$DB=1;}
if ($args =~ /--test/i) # test flag
{$TEST=1; $T=1;}
if ($args =~ /--web-only/i) # web-only flag
{$WEBONLY=1; }
if ($args =~ /--without-web/i) # without web flag
{$NOWEB=1;}
else
{$NOWEB=0;}
if ($args =~ /--no-prompt/i) # do not ask questions
{$NOPROMPT=1;}
if ($args =~ /--home=/i) # CLI defined home path
{
@CLIhomeARY = split(/--home=/,$args);
@CLIhomeARX = split(/ /,$CLIhomeARY[1]);
if (length($CLIhomeARX[0])>2)
{
$PATHhome = $CLIhomeARX[0];
$PATHhome =~ s/\/$| |\r|\n|\t//gi;
$CLIhome=1;
print " CLI defined home path: $PATHhome\n";
}
}
if ($args =~ /--logs=/i) # CLI defined logs path
{
@CLIlogsARY = split(/--logs=/,$args);
@CLIlogsARX = split(/ /,$CLIlogsARY[1]);
if (length($CLIlogsARX[0])>2)
{
$PATHlogs = $CLIlogsARX[0];
$PATHlogs =~ s/\/$| |\r|\n|\t//gi;
$CLIlogs=1;
print " CLI defined logs path: $PATHlogs\n";
}
}
if ($args =~ /--agi=/i) # CLI defined agi-bin path
{
@CLIagiARY = split(/--agi=/,$args);
@CLIagiARX = split(/ /,$CLIagiARY[1]);
if (length($CLIagiARX[0])>2)
{
$PATHagi = $CLIagiARX[0];
$PATHagi =~ s/\/$| |\r|\n|\t//gi;
$CLIagi=1;
print " CLI defined agi-bin path: $PATHagi\n";
}
}
if ($args =~ /--web=/i) # CLI defined webroot path
{
@CLIwebARY = split(/--web=/,$args);
@CLIwebARX = split(/ /,$CLIwebARY[1]);
if (length($CLIwebARX[0])>2)
{
$PATHweb = $CLIwebARX[0];
$PATHweb =~ s/\/$| |\r|\n|\t//gi;
$CLIweb=1;
print " CLI defined webroot path: $PATHweb\n";
}
}
if ($args =~ /--sounds=/i) # CLI defined sounds path
{
@CLIsoundsARY = split(/--sounds=/,$args);
@CLIsoundsARX = split(/ /,$CLIsoundsARY[1]);
if (length($CLIsoundsARX[0])>2)
{
$PATHsounds = $CLIsoundsARX[0];
$PATHsounds =~ s/\/$| |\r|\n|\t//gi;
$CLIsounds=1;
print " CLI defined sounds path: $PATHsounds\n";
}
}
if ($args =~ /--monitor=/i) # CLI defined monitor path
{
@CLImonitorARY = split(/--monitor=/,$args);
@CLImonitorARX = split(/ /,$CLImonitorARY[1]);
if (length($CLImonitorARX[0])>2)
{
$PATHmonitor = $CLImonitorARX[0];
$PATHmonitor =~ s/\/$| |\r|\n|\t//gi;
$CLImonitor=1;
print " CLI defined monitor path: $PATHmonitor\n";
}
}
if ($args =~ /--DONEmonitor=/i) # CLI defined DONEmonitor path
{
@CLIDONEmonitorARY = split(/--DONEmonitor=/,$args);
@CLIDONEmonitorARX = split(/ /,$CLIDONEmonitorARY[1]);
if (length($CLIDONEmonitorARX[0])>2)
{
$PATHDONEmonitor = $CLIDONEmonitorARX[0];
$PATHDONEmonitor =~ s/\/$| |\r|\n|\t//gi;
$CLIDONEmonitor=1;
print " CLI defined DONEmonitor: $PATHDONEmonitor\n";
}
}
if ($args =~ /--server_ip=/i) # CLI defined server IP address
{
@CLIserver_ipARY = split(/--server_ip=/,$args);
@CLIserver_ipARX = split(/ /,$CLIserver_ipARY[1]);
if (length($CLIserver_ipARX[0])>2)
{
$VARserver_ip = $CLIserver_ipARX[0];
$VARserver_ip =~ s/\/$| |\r|\n|\t//gi;
$CLIserver_ip=1;
print " CLI defined server IP: $VARserver_ip\n";
}
}
if ($args =~ /--DB_server=/i) # CLI defined Database server address
{
@CLIDB_serverARY = split(/--DB_server=/,$args);
@CLIDB_serverARX = split(/ /,$CLIDB_serverARY[1]);
if (length($CLIDB_serverARX[0])>2)
{
$VARDB_server = $CLIDB_serverARX[0];
$VARDB_server =~ s/\/$| |\r|\n|\t//gi;
$CLIDB_server=1;
print " CLI defined DB server: $VARDB_server\n";
}
}
if ($args =~ /--DB_database=/i) # CLI defined Database name
{
@CLIDB_databaseARY = split(/--DB_database=/,$args);
@CLIDB_databaseARX = split(/ /,$CLIDB_databaseARY[1]);
if (length($CLIDB_databaseARX[0])>1)
{
$VARDB_database = $CLIDB_databaseARX[0];
$VARDB_database =~ s/ |\r|\n|\t//gi;
$CLIDB_database=1;
print " CLI defined DB database: $VARDB_database\n";
}
}
if ($args =~ /--DB_user=/i) # CLI defined Database user login
{
@CLIDB_userARY = split(/--DB_user=/,$args);
@CLIDB_userARX = split(/ /,$CLIDB_userARY[1]);
if (length($CLIDB_userARX[0])>1)
{
$VARDB_user = $CLIDB_userARX[0];
$VARDB_user =~ s/ |\r|\n|\t//gi;
$CLIDB_user=1;
print " CLI defined DB user: $VARDB_user\n";
}
}
if ($args =~ /--DB_pass=/i) # CLI defined Database user password
{
@CLIDB_passARY = split(/--DB_pass=/,$args);
@CLIDB_passARX = split(/ /,$CLIDB_passARY[1]);
if (length($CLIDB_passARX[0])>1)
{
$VARDB_pass = $CLIDB_passARX[0];
$VARDB_pass =~ s/ |\r|\n|\t//gi;
$CLIDB_pass=1;
print " CLI defined DB password: $VARDB_pass\n";
}
}
if ($args =~ /--DB_custom_user=/i) # CLI defined Database custom user login
{
@CLIDB_custom_userARY = split(/--DB_custom_user=/,$args);
@CLIDB_custom_userARX = split(/ /,$CLIDB_custom_userARY[1]);
if (length($CLIDB_custom_userARX[0])>1)
{
$VARDB_custom_user = $CLIDB_custom_userARX[0];
$VARDB_custom_user =~ s/ |\r|\n|\t//gi;
$CLIDB_custom_user=1;
print " CLI defined DB custom user: $VARDB_custom_user\n";
}
}
if ($args =~ /--DB_custom_pass=/i) # CLI defined Database custom password login
{
@CLIDB_custom_passARY = split(/--DB_custom_pass=/,$args);
@CLIDB_custom_passARX = split(/ /,$CLIDB_custom_passARY[1]);
if (length($CLIDB_custom_passARX[0])>1)
{
$VARDB_custom_pass = $CLIDB_custom_passARX[0];
$VARDB_custom_pass =~ s/ |\r|\n|\t//gi;
$CLIDB_custom_pass=1;
print " CLI defined DB custom pass: $VARDB_custom_pass\n";
}
}
if ($args =~ /--DB_port=/i) # CLI defined Database connection port
{
@CLIDB_portARY = split(/--DB_port=/,$args);
@CLIDB_portARX = split(/ /,$CLIDB_portARY[1]);
if (length($CLIDB_portARX[0])>1)
{
$VARDB_port = $CLIDB_portARX[0];
$VARDB_port =~ s/ |\r|\n|\t//gi;
$CLIDB_port=1;
print " CLI defined DB port: $VARDB_port\n";
}
}
if ($args =~ /--active_keepalives=/i) # CLI defined keepalive processes
{
@CLIkeepaliveARY = split(/--active_keepalives=/,$args);
@CLIkeepaliveARX = split(/ /,$CLIkeepaliveARY[1]);
if (length($CLIkeepaliveARX[0])>1)
{
$VARactive_keepalives = $CLIkeepaliveARX[0];
$VARactive_keepalives =~ s/ |\r|\n|\t//gi;
$CLIactive_keepalives=1;
print " CLI active keepalive procs: $VARactive_keepalives\n";
}
}
if ($args =~ /--asterisk_version=/i) # CLI defined asterisk version
{
@CLIastversionARY = split(/--asterisk_version=/,$args);
@CLIastversionARX = split(/ /,$CLIastversionARY[1]);
if (length($CLIastversionARX[0])>1)
{
$VARasterisk_version = $CLIastversionARX[0];
$VARasterisk_version =~ s/ |\r|\n|\t//gi;
$CLIasterisk_version=1;
print " CLI asterisk version: $VARasterisk_version\n";
}
}
if ($args =~ /--FTP_host=/i) # CLI defined archive server address
{
@CLIFTP_hostARY = split(/--FTP_host=/,$args);
@CLIFTP_hostARX = split(/ /,$CLIFTP_hostARY[1]);
if (length($CLIFTP_hostARX[0])>2)
{
$VARFTP_host = $CLIFTP_hostARX[0];
$VARFTP_host =~ s/\/$| |\r|\n|\t//gi;
$CLIFTP_host=1;
print " CLI defined FTP host: $VARFTP_host\n";
}
}
if ($args =~ /--FTP_user=/i) # CLI defined archive FTP user
{
@CLIFTP_userARY = split(/--FTP_user=/,$args);
@CLIFTP_userARX = split(/ /,$CLIFTP_userARY[1]);
if (length($CLIFTP_userARX[0])>2)
{
$VARFTP_user = $CLIFTP_userARX[0];
$VARFTP_user =~ s/\/$| |\r|\n|\t//gi;
$CLIFTP_user=1;
print " CLI defined FTP user: $VARFTP_user\n";
}
}
if ($args =~ /--FTP_pass=/i) # CLI defined archive FTP pass
{
@CLIFTP_passARY = split(/--FTP_pass=/,$args);
@CLIFTP_passARX = split(/ /,$CLIFTP_passARY[1]);
if (length($CLIFTP_passARX[0])>2)
{
$VARFTP_pass = $CLIFTP_passARX[0];
$VARFTP_pass =~ s/\/$| |\r|\n|\t//gi;
$CLIFTP_pass=1;
print " CLI defined FTP pass: $VARFTP_pass\n";
}
}
if ($args =~ /--FTP_port=/i) # CLI defined archive FTP port
{
@CLIFTP_portARY = split(/--FTP_port=/,$args);
@CLIFTP_portARX = split(/ /,$CLIFTP_portARY[1]);
if (length($CLIFTP_portARX[0])>2)
{
$VARFTP_port = $CLIFTP_portARX[0];
$VARFTP_port =~ s/\/$| |\r|\n|\t//gi;
$CLIFTP_port=1;
print " CLI defined FTP port: $VARFTP_port\n";
}
}
if ($args =~ /--FTP_dir=/i) # CLI defined archive FTP directory
{
@CLIFTP_dirARY = split(/--FTP_dir=/,$args);
@CLIFTP_dirARX = split(/ /,$CLIFTP_dirARY[1]);
if (length($CLIFTP_dirARX[0])>2)
{
$VARFTP_dir = $CLIFTP_dirARX[0];
$VARFTP_dir =~ s/\/$| |\r|\n|\t//gi;
$CLIFTP_dir=1;
print " CLI defined FTP dir: $VARFTP_dir\n";
}
}
if ($args =~ /--HTTP_path=/i) # CLI defined archive HTTP path
{
@CLIHTTP_pathARY = split(/--HTTP_path=/,$args);
@CLIHTTP_pathARX = split(/ /,$CLIHTTP_pathARY[1]);
if (length($CLIHTTP_pathARX[0])>2)
{
$VARHTTP_path = $CLIHTTP_pathARX[0];
$VARHTTP_path =~ s/\/$| |\r|\n|\t//gi;
$CLIHTTP_path=1;
print " CLI defined HTTP path: $VARHTTP_path\n";
}
}
if ($args =~ /--REPORT_host=/i) # CLI defined archive server address
{
@CLIREPORT_hostARY = split(/--REPORT_host=/,$args);
@CLIREPORT_hostARX = split(/ /,$CLIREPORT_hostARY[1]);
if (length($CLIREPORT_hostARX[0])>2)
{
$VARREPORT_host = $CLIREPORT_hostARX[0];
$VARREPORT_host =~ s/\/$| |\r|\n|\t//gi;
$CLIREPORT_host=1;
print " CLI defined REPORT host: $VARREPORT_host\n";
}
}
if ($args =~ /--REPORT_user=/i) # CLI defined archive REPORT user
{
@CLIREPORT_userARY = split(/--REPORT_user=/,$args);
@CLIREPORT_userARX = split(/ /,$CLIREPORT_userARY[1]);
if (length($CLIREPORT_userARX[0])>2)
{
$VARREPORT_user = $CLIREPORT_userARX[0];
$VARREPORT_user =~ s/\/$| |\r|\n|\t//gi;
$CLIREPORT_user=1;
print " CLI defined REPORT user: $VARREPORT_user\n";
}
}
if ($args =~ /--REPORT_pass=/i) # CLI defined archive REPORT pass
{
@CLIREPORT_passARY = split(/--REPORT_pass=/,$args);
@CLIREPORT_passARX = split(/ /,$CLIREPORT_passARY[1]);
if (length($CLIREPORT_passARX[0])>2)
{
$VARREPORT_pass = $CLIREPORT_passARX[0];
$VARREPORT_pass =~ s/\/$| |\r|\n|\t//gi;
$CLIREPORT_pass=1;
print " CLI defined REPORT pass: $VARREPORT_pass\n";
}
}
if ($args =~ /--REPORT_port=/i) # CLI defined archive REPORT port
{
@CLIREPORT_portARY = split(/--REPORT_port=/,$args);
@CLIREPORT_portARX = split(/ /,$CLIREPORT_portARY[1]);
if (length($CLIREPORT_portARX[0])>2)
{
$VARREPORT_port = $CLIREPORT_portARX[0];
$VARREPORT_port =~ s/\/$| |\r|\n|\t//gi;
$CLIREPORT_port=1;
print " CLI defined REPORT port: $VARREPORT_port\n";
}
}
if ($args =~ /--REPORT_dir=/i) # CLI defined archive REPORT directory
{
@CLIREPORT_dirARY = split(/--REPORT_dir=/,$args);
@CLIREPORT_dirARX = split(/ /,$CLIREPORT_dirARY[1]);
if (length($CLIREPORT_dirARX[0])>2)
{
$VARREPORT_dir = $CLIREPORT_dirARX[0];
$VARREPORT_dir =~ s/\/$| |\r|\n|\t//gi;
$CLIREPORT_dir=1;
print " CLI defined REPORT dir: $VARREPORT_dir\n";
}
}
if ($args =~ /--copy_sample_conf_files/i) # CLI defined conf files
{
$CLIcopy_conf_files='y';
print " CLI copy conf files: YES\n";
}
else
{
$CLIcopy_conf_files='n';
}
if ($args =~ /--fastagi_log_min_servers=/i) # CLI defined fastagi min servers
{
@CLIDB_minserARY = split(/--fastagi_log_min_servers=/,$args);
@CLIDB_minserARX = split(/ /,$CLIDB_minserARY[1]);
if (length($CLIDB_minserARX[0])>1)
{
$VARfastagi_log_min_servers = $CLIDB_minserARX[0];
$VARfastagi_log_min_servers =~ s/ |\r|\n|\t//gi;
$CLIfastagi_log_min_servers=1;
print " CLI defined log min server: $VARfastagi_log_min_servers\n";
}
}
if ($args =~ /--fastagi_log_max_servers=/i) # CLI defined fastagi max servers
{
@CLIDB_maxserARY = split(/--fastagi_log_max_servers=/,$args);
@CLIDB_maxserARX = split(/ /,$CLIDB_maxserARY[1]);
if (length($CLIDB_maxserARX[0])>1)
{
$VARfastagi_log_max_servers = $CLIDB_maxserARX[0];
$VARfastagi_log_max_servers =~ s/ |\r|\n|\t//gi;
$CLIfastagi_log_max_servers=1;
print " CLI defined log max server: $VARfastagi_log_max_servers\n";
}
}
if ($args =~ /--fastagi_log_min_spare_servers=/i) # CLI defined fastagi min spare servers
{
@CLIDB_minspaARY = split(/--fastagi_log_min_spare_servers=/,$args);
@CLIDB_minspaARX = split(/ /,$CLIDB_minspaARY[1]);
if (length($CLIDB_minspaARX[0])>1)
{
$VARfastagi_log_min_spare_servers = $CLIDB_minspaARX[0];
$VARfastagi_log_min_spare_servers =~ s/ |\r|\n|\t//gi;
$CLIfastagi_log_min_spare_servers=1;
print " CLI defined log min spare: $VARfastagi_log_min_spare_servers\n";
}
}
if ($args =~ /--fastagi_log_max_spare_servers=/i) # CLI defined fastagi max spare servers
{
@CLIDB_maxspaARY = split(/--fastagi_log_max_spare_servers=/,$args);
@CLIDB_maxspaARX = split(/ /,$CLIDB_maxspaARY[1]);
if (length($CLIDB_maxspaARX[0])>1)
{
$VARfastagi_log_max_spare_servers = $CLIDB_maxspaARX[0];
$VARfastagi_log_max_spare_servers =~ s/ |\r|\n|\t//gi;
$CLIfastagi_log_max_spare_servers=1;
print " CLI defined log max spare: $VARfastagi_log_max_spare_servers\n";
}
}
if ($args =~ /--fastagi_log_max_requests=/i) # CLI defined fastagi max requests
{
@CLIDB_maxreqARY = split(/--fastagi_log_max_requests=/,$args);
@CLIDB_maxreqARX = split(/ /,$CLIDB_maxreqARY[1]);
if (length($CLIDB_maxreqARX[0])>1)
{
$VARfastagi_log_max_requests = $CLIDB_maxreqARX[0];
$VARfastagi_log_max_requests =~ s/ |\r|\n|\t//gi;
$CLIfastagi_log_max_requests=1;
print " CLI defined log max request:$VARfastagi_log_max_requests\n";
}
}
if ($args =~ /--fastagi_log_checkfordead=/i) # CLI defined fastagi check-for-dead seconds
{
@CLIDB_ckdeadARY = split(/--fastagi_log_checkfordead=/,$args);
@CLIDB_ckdeadARX = split(/ /,$CLIDB_ckdeadARY[1]);
if (length($CLIDB_ckdeadARX[0])>1)
{
$VARfastagi_log_checkfordead = $CLIDB_ckdeadARX[0];
$VARfastagi_log_checkfordead =~ s/ |\r|\n|\t//gi;
$CLIfastagi_log_checkfordead=1;
print " CLI defined log ckdead sec: $VARfastagi_log_checkfordead\n";
}
}
if ($args =~ /--fastagi_log_checkforwait=/i) # CLI defined fastagi check-for-wait seconds
{
@CLIDB_ckwaitARY = split(/--fastagi_log_checkforwait=/,$args);
@CLIDB_ckwaitARX = split(/ /,$CLIDB_ckwaitARY[1]);
if (length($CLIDB_ckwaitARX[0])>1)
{
$VARfastagi_log_checkforwait = $CLIDB_ckwaitARX[0];
$VARfastagi_log_checkforwait =~ s/ |\r|\n|\t//gi;
$CLIfastagi_log_checkforwait=1;
print " CLI defined log ckwait sec: $VARfastagi_log_checkforwait\n";
}
}
if ($args =~ /--build_multiserver_conf/i) # CLI defined conf files
{
$build_multiserver_conf='y';
print " CLI multiserver conf gen: YES\n";
# default path to astguiclient configuration file:
$PATHconf = '/etc/astguiclient.conf';
open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n";
@conf = <conf>;
close(conf);
$i=0;
foreach(@conf)
{
$line = $conf[$i];
$line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi;
if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) )
{$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;}
if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) )
{$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) )
{$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) )
{$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) )
{$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) )
{$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_custom_user/) && ($CLIDB_custom_user < 1) )
{$VARDB_custom_user = $line; $VARDB_custom_user =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_custom_pass/) && ($CLIDB_custom_pass < 1) )
{$VARDB_custom_pass = $line; $VARDB_custom_pass =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) )
{$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;}
$i++;
}
# Customized Variables
$server_ip = $VARserver_ip; # Asterisk server IP
if (!$VARDB_port) {$VARDB_port='3306';}
use DBI;
$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass")
or die "Couldn't connect to database: " . DBI->errstr;
### format the new server_ip dialstring for example to use with extensions.conf
$S='*';
if( $VARserver_ip =~ m/(\S+)\.(\S+)\.(\S+)\.(\S+)/ )
{
$a = leading_zero($1);
$b = leading_zero($2);
$c = leading_zero($3);
$d = leading_zero($4);
$VARremDIALstr = "$a$S$b$S$c$S$d";
}
$ext = "\nAdd the following lines to your extensions.conf file:\n";
$ext .= "TRUNKloop = IAX2/ASTloop:test\@127.0.0.1:40569\n";
$ext .= "TRUNKblind = IAX2/ASTblind:test\@127.0.0.1:41569\n";
$iax = "\nAdd the following lines to your iax.conf file:\n";
$iax .= "register => ASTloop:test\@127.0.0.1:40569\n";
$iax .= "register => ASTblind:test\@127.0.0.1:41569\n";
$Lext = "\n";
$Lext .= "; Local Server: $server_ip\n";
$Lext .= "exten => _$VARremDIALstr*.,1,Goto(default,\${EXTEN:16},1)\n";
$Lext .= "exten => _8600XXX*.,1,AGI(agi-VDADfixCXFER.agi)\n";
$Lext .= "exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi)\n";
$Lext .= "; Local blind monitoring\n";
$Lext .= "exten => _08600XXX,1,Dial(\${TRUNKblind}/6\${EXTEN:1},55,o)\n";
$Liax .= "\n";
$Liax .= "[ASTloop]\n";
$Liax .= "type=friend\n";
$Liax .= "accountcode=IAXASTloop\n";
$Liax .= "context=default\n";
$Liax .= "auth=plaintext\n";
$Liax .= "host=dynamic\n";
$Liax .= "permit=0.0.0.0/0.0.0.0\n";
$Liax .= "secret=test\n";
$Liax .= "disallow=all\n";
$Liax .= "allow=ulaw\n";
$Liax .= "qualify=yes\n";
$Liax .= "\n";
$Liax .= "[ASTblind]\n";
$Liax .= "type=friend\n";
$Liax .= "accountcode=IAXASTblind\n";
$Liax .= "context=default\n";
$Liax .= "auth=plaintext\n";
$Liax .= "host=dynamic\n";
$Liax .= "permit=0.0.0.0/0.0.0.0\n";
$Liax .= "secret=test\n";
$Liax .= "disallow=all\n";
$Liax .= "allow=ulaw\n";
$Liax .= "qualify=yes\n";
##### Get the server_id for this server's server_ip #####
$stmtA = "SELECT server_id FROM servers where server_ip='$server_ip';";
print "$stmtA\n";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$server_id = "$aryA[0]";
$i++;
}
$sthA->finish();
##### Get the server_ips and server_ids of all VICIDIAL servers on the network #####
$stmtA = "SELECT server_ip,server_id FROM servers where server_ip!='$server_ip';";
print "$stmtA\n";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$i=0;
while ($sthArows > $i)
{
@aryA = $sthA->fetchrow_array;
$server_ip[$i] = "$aryA[0]";
$server_id[$i] = "$aryA[1]";
if( $server_ip[$i] =~ m/(\S+)\.(\S+)\.(\S+)\.(\S+)/ )
{
$a = leading_zero($1);
$b = leading_zero($2);
$c = leading_zero($3);
$d = leading_zero($4);
$VARremDIALstr = "$a$S$b$S$c$S$d";
}
$ext .= "TRUNK$server_id[$i] = IAX2/$server_id:test\@$server_ip[$i]:4569\n";
$iax .= "register => $server_id:test\@$server_ip[$i]:4569\n";
$Lext .= "; Remote Server VDAD extens: $server_id[$i] $server_ip[$i]\n";
$Lext .= "exten => _$VARremDIALstr*.,1,Dial(\${TRUNK$server_id[$i]}/\${EXTEN:16},55,o)\n";
$Liax .= "\n";
$Liax .= "[$server_id[$i]]\n";
$Liax .= "type=friend\n";
$Liax .= "accountcode=IAX$server_id[$i]\n";
$Liax .= "context=default\n";
$Liax .= "auth=plaintext\n";
$Liax .= "host=dynamic\n";
$Liax .= "permit=0.0.0.0/0.0.0.0\n";
$Liax .= "secret=test\n";
$Liax .= "disallow=all\n";
$Liax .= "allow=ulaw\n";
$Liax .= "qualify=yes\n";
$i++;
}
$sthA->finish();
print "$ext$Lext\n$iax$Liax\n";
exit;
}
if ($args =~ /--build_phones_conf/i) # CLI defined conf files
{
$build_phones_conf='y';
print " CLI phones conf gen: YES\n";
# default path to astguiclient configuration file:
$PATHconf = '/etc/astguiclient.conf';
open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n";
@conf = <conf>;
close(conf);
$i=0;
foreach(@conf)
{
$line = $conf[$i];
$line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi;
if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) )
{$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;}
if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) )
{$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) )
{$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) )
{$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) )
{$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) )
{$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_custom_user/) && ($CLIDB_custom_user < 1) )
{$VARDB_custom_user = $line; $VARDB_custom_user =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_custom_pass/) && ($CLIDB_custom_pass < 1) )
{$VARDB_custom_pass = $line; $VARDB_custom_pass =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) )
{$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;}
$i++;
}
# Customized Variables
$server_ip = $VARserver_ip; # Asterisk server IP
if (!$VARDB_port) {$VARDB_port='3306';}
use DBI;
$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass")
or die "Couldn't connect to database: " . DBI->errstr;
$ext = "\nAdd the following lines to your extensions.conf file:\n";
$sip = "\nAdd the following lines to your sip.conf file:\n";
$iax = "\nAdd the following lines to your iax.conf file:\n";
$vm = "\nAdd the following lines to your voicemail.conf file:\n";
##### Get the SIP phone entries #####
$stmtA = "SELECT extension,dialplan_number,voicemail_id,pass FROM phones where server_ip='$server_ip' and protocol='SIP';";
print "$stmtA\n";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$i=0;
while ($sthArows > $i)
{
@aryA = $sthA->fetchrow_array;
$extension[$i] = "$aryA[0]";
$dialplan[$i] = "$aryA[1]";
$voicemail[$i] = "$aryA[2]";
$pass[$i] = "$aryA[3]";
$ext .= "exten => $dialplan[$i],1,Dial(SIP/$extension[$i])\n";
$ext .= "exten => $dialplan[$i],2,Voicemail,u$voicemail[$i]\n";
$sip .= "\[$extension[$i]\]\n";
$sip .= "disallow=all\n";
$sip .= "allow=ulaw\n";
$sip .= "type=friend\n";
$sip .= "username=$extension[$i]\n";
$sip .= "secret=$pass[$i]\n";
$sip .= "host=dynamic\n";
$sip .= "dtmfmode=rfc2833\n";
$sip .= "qualify=1000\n";
$sip .= "mailbox=$voicemail[$i]\n\n";
$vm .= "$voicemail[$i] => $voicemail[$i],$extension[$i] Mailbox\n";
$i++;
}
$sthA->finish();
##### Get the IAX phone entries #####
$stmtA = "SELECT extension,dialplan_number,voicemail_id,pass FROM phones where server_ip='$server_ip' and protocol='IAX2';";
print "$stmtA\n";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$i=0;
while ($sthArows > $i)
{
@aryA = $sthA->fetchrow_array;
$extension[$i] = "$aryA[0]";
$dialplan[$i] = "$aryA[1]";
$voicemail[$i] = "$aryA[2]";
$pass[$i] = "$aryA[3]";
$ext .= "exten => $dialplan[$i],1,Dial(IAX2/$extension[$i])\n";
$ext .= "exten => $dialplan[$i],2,Voicemail,u$voicemail[$i]\n";
$iax .= "\[$extension[$i]\]\n";
$iax .= "disallow=all\n";
$iax .= "allow=ulaw\n";
$iax .= "context=default\n";
$iax .= "type=friend\n";
$iax .= "accountcode=$extension[$i]\n";
$iax .= "secret=$pass[$i]\n";
$iax .= "auth=md5\n";
$iax .= "host=dynamic\n";
$iax .= "permit=0.0.0.0/0.0.0.0\n";
$iax .= "qualify=1000\n";
$iax .= "mailbox=$voicemail[$i]\n\n";
$vm .= "$voicemail[$i] => $voicemail[$i],$extension[$i] Mailbox\n";
$i++;
}
$sthA->finish();
print "$ext\n$sip\n$iax\n$vm\n";
exit;
}
}
}
else
{
# print "no command line options set\n";
$CLIcopy_conf_files='n';
}
### end parsing run-time options ###
if (-e "$PATHconf")
{
print "Previous astGUIclient configuration file found at: $PATHconf\n";
open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n";
@conf = <conf>;
close(conf);
$i=0;
foreach(@conf)
{
$line = $conf[$i];
$line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi;
if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) )
{$PATHhome = $line; $PATHhome =~ s/.*=//gi;}
if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) )
{$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;}
if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) )
{$PATHagi = $line; $PATHagi =~ s/.*=//gi;}
if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) )
{$PATHweb = $line; $PATHweb =~ s/.*=//gi;}
if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) )
{$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;}
if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) )
{$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;}
if ( ($line =~ /^PATHDONEmonitor/) && ($CLIDONEmonitor < 1) )
{$PATHDONEmonitor = $line; $PATHDONEmonitor =~ s/.*=//gi;}
if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) )
{$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) )
{$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) )
{$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) )
{$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) )
{$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_custom_user/) && ($CLIDB_custom_user < 1) )
{$VARDB_custom_user = $line; $VARDB_custom_user =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_custom_pass/) && ($CLIDB_custom_pass < 1) )
{$VARDB_custom_pass = $line; $VARDB_custom_pass =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) )
{$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;}