-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinstall.sh
executable file
·1176 lines (1049 loc) · 28.8 KB
/
install.sh
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
#! /bin/bash
# install.sh
# This file is part of the FreeSentral Project http://freesentral.com
#
# FreeSentral - is a Web Graphical User Interface for easy configuration of the Yate PBX software
# Copyright (C) 2008-2009 Null Team
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
readopt()
{
read -p "$1: [$2] " tmp
case "x$tmp" in
xn|xno|xN|xNO|xNo)
;;
x)
echo "$2"
;;
*)
echo "$tmp"
;;
esac
}
cmp_dates() {
year1=`date -d"${1}" +%G`
year2=`date -d"${2}" +%G`
if [ ${year1} -gt ${year2} ]; then
return 1
else
if [ ${year1} -lt ${year2} ]; then
return 0
fi
fi
# if year is the same compare the number of day in the year
dayyear1=`date -d"${1}" +%j`
dayyear2=`date -d"${2}" +%j`
if [ ${dayyear1} -lt ${dayyear2} ]; then
return 0
fi
return 1
}
showhelp()
{
cat <<EOF
$version usage:
$0
[--no_defaults]
[--config dir] [--scripts dir] [--prompts dir] [--webpage dir] [--upload_dir dir]
[--psql executable]
[--dbhost host] [--dbname name]
[--dbuser user] [--dbpass password]
[--enable_logging on/off]
[--generate_certificate yes/no]
[--timezone localtimezone]
[--quiet]
or one of the following unique parameters:
help version tarball tgz tbz rpm init_system generate_certificate
EOF
}
maketarball()
{
wd=`pwd|sed 's,^.*/,,'`
mkdir -p packing/tarballs
pushd .. > /dev/null
excl=`find "${wd}" -name '*~' -o -name '.*.swp' | sed 's/^/--exclude /'`
tar "c${1}f" "${wd}/packing/tarballs/${2}" $tarexclude $excl "${wd}"
popd > /dev/null
}
confdata()
{
cat << EOF
<?php
/* File created by $version */
/* Settings for connecting to the PostgreSQL database */
/* Host where the database server is running - use "localhost" for local */
\$db_host = "$dbhost";
/* Name of the database (a server may have many independent databases) */
\$db_database = "$dbname";
/* Database username to use when connecting */
\$db_user = "$dbuser";
/* Password for the database access */
\$db_passwd = "$dbpass";
date_default_timezone_set($timezone);
EOF
if [ "x$1" = "xweb" ]; then
cat << EOF
\$target_path = "${prompts}";
\$do_not_load = array(); //modules that are inserted here won't be loaded
\$limit = 20; //max number to display on page
\$enable_logging = "${enable_logging}"; // possible values: "on"/"off", true/false, "yes"/"no"
\$upload_path = "${upload_dir}"; // path where file for importing extensions will be uploaded
\$conf_path = "${configs}"; // path to yate's configuration files
\$default_ip = "ssl://${ip_yate}"; // ip address where yate runs
\$default_port = "5039"; // port used to connect to
\$block = array("admin_settings"=>array("cards")); // don't change this. This option is still being tested
?>
EOF
else
cat << EOF
\$conn = pg_connect("host='\$db_host' dbname='\$db_database' user='\$db_user' password='\$db_passwd'")
or die("Could not connect to the postgresql database");
\$vm_base = "$prompts$existing_prompts";
\$no_groups = false;
\$no_pbx = false;
\$uploaded_prompts = "$prompts$existing_prompts";
\$query_on = false;
\$max_resets_conn = 5;
?>
EOF
fi
}
answers_csr() {
echo --
echo SomeState
echo SomeCity
echo SomeOrganization
echo SomeOrganizationalUnit
echo localhost.localdomain
echo [email protected]
echo ""
echo ""
}
generate_certificate_now()
{
# generate SSL certificate that will be used when sending requests from web to yate(only if this installs config file for yate)
echo "Trying to generate SSL certificate"
cert_dir=$DESTDIR${configs}
mkdir -p "${cert_dir}"
crt_dir=${cert_dir}
key_dir=${cert_dir}
csr_dir=${cert_dir}
mkdir -p "${key_dir}"
mkdir -p "${crt_dir}"
key="${key_dir}/freesentral.key"
crt="${crt_dir}/freesentral.crt"
csr="${csr_dir}/freesentral.csr"
# check if a new certificate should be generated
# generate if certificate is already expired or if it will expire today
replace=1
if [ -f "${crt}" ]; then
str=`openssl x509 -in ${crt} -enddate -noout`
len=${#str}
expr_date=`date -u -d"${str:9:len}"`
now=`date -u`
cmp_dates "${now}" "${expr_date}" && replace=0
fi
if [ "${replace}" = 1 ]; then
# generate key file
openssl genrsa -des3 -passout pass:freesentral -out "${key}" 1024 2> /dev/null
echo "Generating SSL key"
answers_csr | openssl req -new -passin pass:freesentral -key "${key}" -out "${csr}" 2> /dev/null
echo "Generating SSL csr"
cp "${key}" "${key}.orig"
openssl rsa -passin pass:freesentral -in "${key}.orig" -out "${key}" 2> /dev/null
openssl x509 -req -days 1825 -in "${csr}" -signkey "${key}" -out "${crt}" 2> /dev/null
rm -f "${key}.orig"
rm -f "${csr}"
fi
}
init_system()
{
if [ X`id -u` != "X0" ]; then
echo "You need to be root for this action" >&2
exit 1
fi
## Allow for restarting in case of kernel panic
f="/etc/sysctl.conf"
if ! fgrep -q 'kernel.panic' "$f"; then
echo 'kernel.panic = 5' >> "$f"
echo '5' > /proc/sys/kernel/panic
fi
## Add the apache helper to allowed sudoers
f="/etc/sudoers"
if ! fgrep -q 'freesentral/ctl-root' "$f"; then
echo -e '## Added for FreeSentral\nDefaults !requiretty\napache env_reset,!syslog,ALL=NOPASSWD: /usr/libexec/freesentral/ctl-root' >> "$f"
fi
## Activate the auto vacuum in PostgreSQL
f="/var/lib/pgsql/data/postgresql.conf"
if ! fgrep -q 'FreeSentral' "$f"; then
cat <<EOF >> "$f"
# generated by FreeSentral - please do not delete this line
#stats_start_collector = on
#stats_row_level = on
track_counts = on
autovacuum = on
autovacuum_naptime = 300
EOF
fi
## Fix the ownership of PostgreSQL log file after live install
f="/var/log/postgres/postgresql"
if [ -f "$f" ]; then
if [ X`stat -c '%U' "$f" 2> /dev/null` != "Xpostgres" ]; then
chown -R postgres.postgres "$f"
/etc/init.d/postgresql restart
fi
fi
## Allow Apache to write to the wanpipe config directory
f="/etc/wanpipe"
if [ -d "$f" ]; then
if [ X`stat -c '%U' "$f" 2> /dev/null` != "Xapache" ]; then
chown -R apache.root "$f"
fi
fi
## Allow Apache to write to the network-scripts config directory
f="/etc/sysconfig/network-scripts"
if [ -d "$f" ]; then
if [ X`stat -c '%U' "$f" 2> /dev/null` != "Xapache" ]; then
chown -R apache.root "$f"
fi
fi
}
pkgname="freesentral"
pkglong="FreeSentral"
shortver="1.2"
version="$pkglong v$shortver"
interactive="yes"
tarexclude="--exclude CVS --exclude .cvsignore --exclude .svn --exclude .xvpics --exclude packing/tarballs --exclude config.php"
scripts=""
configs=""
prompts=""
webpage=""
dbhost="localhost"
dbname="$pkgname"
dbuser="postgres"
dbpass=""
timezone=`sed -n 's/^ZONE= *//p' /etc/sysconfig/clock 2>/dev/null`
test -z "$timezone" && timezone="Europe/London"
upload_dir="/tmp"
enable_logging="on"
case "x$1" in
x--no_defaults)
shift
;;
*)
configs="`yate-config --config 2>/dev/null`"
scripts="`yate-config --scripts 2>/dev/null`"
prompts="/var/spool/voicemail"
generate_certificate="yes"
webpage="/var/www/html"
if [ -d "$webpage" ]; then
webpage="$webpage/$pkgname"
else
webpage="/var/www"
if [ -d "$webpage" ]; then
webpage="$webpage/$pkgname"
else
webpage=""
fi
fi
;;
esac
webuser="apache"
ip_yate="127.0.0.1"
case "x`yate-config --version 2>/dev/null`" in
x2.*|x3.*|x4.*|x5.*|x6.*|x7.*|x8.*|x9.*)
;;
*)
scripts=""
configs=""
prompts=""
;;
esac
psqlcmd="`which psql`"
echo "--------------------------------------------------------"
echo "Note!!! FreeSentral requires at least PostgreSQL 8.2.0"
echo "--------------------------------------------------------"
if [ "$#" = "1" ]; then
case "x$1" in
xtarball|xtargz|xtgz)
maketarball z "$pkgname-$shortver.tar.gz"
exit
;;
xtarbz2|xtarbz|xtbz)
maketarball j "$pkgname-$shortver.tar.bz2"
exit
;;
x*.tar.gz|x*.tgz)
maketarball z "$1"
exit
;;
x*.tar.bz2|x*.tbz)
maketarball j "$1"
exit
;;
x*.tar)
maketarball "" "$1"
exit
;;
xrpm)
maketarball z "$pkgname-$shortver.tar.gz" || exit $?
rpmbuild -tb "packing/tarballs/$pkgname-$shortver.tar.gz"
exit
;;
xhelp)
showhelp
exit
;;
xversion)
echo "$pkglong $shortver"
exit
;;
xgenerate_certificate)
generate_certificate_now
exit
;;
xinit_system)
init_system
exit
;;
esac
fi
while [ "$#" != "0" ]; do
cmd="$1"
shift
case "x$cmd" in
x--help|x-h)
showhelp
exit
;;
x--version|x-V)
echo "$pkglong $shortver"
exit
;;
x--quiet|x-q)
interactive="no"
;;
x--config|x-c)
configs="$1"
shift
;;
x--scripts|x-s)
scripts="$1"
shift
;;
x--prompts|x-p)
prompts="$1"
shift
;;
x--webpage|x-w)
webpage="$1"
shift
;;
x--webuser)
webuser="$1"
shift
;;
x--psql)
psqlcmd="$1"
shift
;;
x--dbhost)
dbhost="$1"
shift
;;
x--dbname)
dbname="$1"
shift
;;
x--dbuser)
dbuser="$1"
shift
;;
x--dbpass)
dbpass="$1"
shift
;;
x--upload_dir)
upload_dir="$1"
shift
;;
x--timezone)
timezone="$1"
shift
;;
x--enable_logging)
enable_logging="$1"
shift
;;
x--generate_certificate)
generate_certificate="$1"
shift
;;
*)
echo "Unexpected parameter: $cmd" >&2
showhelp >&2
exit
;;
esac
done
httpd=("apache2" "httpd")
found=0
for name in ${httpd[@]}
do
cmd_res=`which $name 2> /dev/null`
if [ "x$cmd_res" != "x" ]; then
found=1
break
fi
done
if [ "$found" -eq 0 ]; then
echo "Could not detect installed apache/httpd on this computer."
pass=`readopt "Do you want to continue yes/no?" "no"`
if [ "x$pass" != "xyes" ]; then
exit
fi
fi
files_mod_php=("mod_php5.so" "mod_php.so" "libphp5.so")
found=0
for name in ${files_mod_php[@]}
do
cmd_res=`find /|grep $name`
if [ "x$cmd_res" != "x" ]; then
found=1
break
fi
done
if [ "$found" -eq 0 ]; then
echo "Could not detect apache's php extension."
pass=`readopt "Do you want to continue yes/no?" "no"`
if [ "x$pass" != "xyes" ]; then
exit
fi
fi
echo "Installer for $version"
if [ "x$interactive" != "xno" ]; then
echo "At the following prompts you can enter the word 'no' to disable defaults"
configs=`readopt "Install Yate config file in" "$configs"`
scripts=`readopt "Install Yate scripts in" "$scripts"`
prompts=`readopt "Install IVR prompts in" "$prompts"`
webpage=`readopt "Install Web pages in" "$webpage"`
if [ "x$prompts" = "x" ]; then
existing_prompts=`readopt "Path where IVR prompts are found(necesarry for config,scripts and web pages)" "$prompts"`
fi
ip_yate=`readopt "Ip address for yate server" "$ip_yate"`
webuser=`readopt "Web user " "$webuser"`
dbhost=`readopt "Database host" "$dbhost"`
if [ -n "$dbhost" ]; then
dbname=`readopt "Database name" "$dbname"`
dbuser=`readopt "Database user" "$dbuser"`
dbpass=`readopt "Database password" "$dbpass"`
psqlcmd=`readopt "PostgreSQL command" "$psqlcmd"`
else
dbname=""
dbuser=""
dbpass=""
psqlcmd=""
fi
fi
if [ "x$webpage$dbhost" = "x" ]; then
echo "Nothing to do!"
exit
fi
if [ -n "$psqlcmd" ]; then
if "$psqlcmd" --version 2> /dev/null | grep -q ' [89\.]'; then
/bin/true
else
echo "Invalid or too old PostgreSQL client: $psqlcmd" >&2
psqlcmd=""
fi
fi
case x"$timezone"x in
x\"*\"x)
;;
*)
timezone="\"$timezone\""
;;
esac
echo "Install options"
cat <<EOF
Config file in '$configs'
Scripts dir in '$scripts'
IVR prompts in '$prompts'
Web pages in '$webpage'
Web user '$webuser'
Database:
Host '$dbhost'
Name '$dbname'
User '$dbuser'
Password '$dbpass'
PosgreSQL tool '$psqlcmd'
EOF
case "x$DESTDIR" in
x)
;;
x/)
DESTDIR=""
;;
x*/)
;;
*)
DESTDIR="$DESTDIR/"
;;
esac
if [ "x$DESTDIR" != "x" ]; then
echo "Destination directory: '$DESTDIR'"
fi
if [ "x$interactive" != "xno" ]; then
if [ -z `readopt "Proceed with installation?" "yes"` ]; then
echo "Aborting..."
exit
fi
fi
if [ -n "$configs" ]; then
echo "Installing Yate configuration files"
# yate.conf
fe="$DESTDIR$configs/yate.conf";
e="
[localsym]
; pwlib does not clean up properly on Linux so we must disable global symbols
; unfortunately preventing all pwlib plugins from loading
h323chan.yate=yes
"
if [ -e "$fe" ]; then
if [ -z `readopt "Overwrite existing yate.conf ?" "yes"` ]; then
echo "Please edit file $fe like follows:"
echo "$e"
fe=""
fi
fi
if [ -n "$fe" ]; then
echo "Creating yate configuration file"
mkdir -p "$DESTDIR$configs"
echo "; File created by $version
$e" > "$fe"
fi
# regexroute.conf
fe="$DESTDIR$configs/regexroute.conf";
e="
[priorities]
; Route here before register.php which is at priority 100
route=95
[default]
\${address}^127\\.0\\.0\\.=goto localhost
\${username}.=goto localhost
[localhost]
; The following are for testing purposes
^99991001\$=tone/dial
^99991002\$=tone/busy
^99991003\$=tone/ring
^99991004\$=tone/specdial
^99991005\$=tone/congestion
^99991006\$=tone/outoforder
^99991007\$=tone/milliwatt
^99991008\$=tone/info
"
if [ -e "$fe" ]; then
if [ -z `readopt "Overwrite existing regexroute.conf ?" "yes"` ]; then
echo "Please edit file $fe like follows:"
echo "$e"
fe=""
fi
fi
if [ -n "$fe" ]; then
echo "Creating regexroute configuration file"
mkdir -p "$DESTDIR$configs"
echo "; File created by $version
$e" > "$fe"
fi
# extmodule.conf
fe="$DESTDIR$configs/extmodule.conf";
e="
[scripts]
register.php=param
ctc-global.php=
banbrutes.php=
"
if [ -e "$fe" ]; then
if [ -z `readopt "Overwrite existing extmodule.conf ?" "yes"` ]; then
echo "Please edit file $fe like follows:"
echo "$e"
fe=""
fi
fi
if [ -n "$fe" ]; then
echo "Creating extmodule configuration file"
mkdir -p "$DESTDIR$configs"
echo "; File created by $version
$e" > "$fe"
fi
# moh.conf
fe="$DESTDIR$configs/moh.conf";
e="
[mohs]
default=while true; do madplay -q --no-tty-control -m -R 8000 -o raw:- -z $prompts$existing_prompts/moh/*.mp3; done
madplay=while true; do madplay -q --no-tty-control -m -R 8000 -o raw:- -z \${mohlist}; done
"
if [ -e "$fe" ]; then
if [ -z `readopt "Overwrite existing moh.conf ?" "yes"` ]; then
echo "Please edit file $fe like follows:"
echo "$e"
fe=""
fi
fi
if [ -n "$fe" ]; then
echo "Creating moh configuration file"
mkdir -p "$DESTDIR$configs"
echo "; File created by $version
$e" > "$fe"
fi
# pgsqldb.conf
fe="$DESTDIR$configs/pgsqldb.conf";
e="
[freesentral]
host=$dbhost
database=$dbname
user=$dbuser
password=$dbpass
"
if [ -e "$fe" ]; then
if [ -z `readopt "Overwrite existing pgsqldb.conf ?" "yes"` ]; then
echo "Please edit file $fe like follows:"
echo "$e"
fe=""
fi
fi
if [ -n "$fe" ]; then
echo "Creating pgsqldb configuration file"
mkdir -p "$DESTDIR$configs"
echo "; File created by $version
$e" > "$fe"
fi
# queues.conf
fe="$DESTDIR$configs/queues.conf";
e="
[general]
; General settings of the queues module
; account: string: Name of the database account used in queries
account=freesentral
; priority: int: Priority of message handlers
priority=20
; rescan: int: Period of polling for available operators, in seconds
;rescan=5
; mintime: int: Minimum time between queries, in milliseconds
;mintime=500
[queries]
; SQL queries that get data about the queue and operators
; queue: string: Query to pick queue parameters, returns zero or one row
; Relevant substitutions:
; \${queue}: string: Name of the queue as obtained from routing
; Relevant returned params:
; mintime: int: Minimum time between queries, in milliseconds
; length: int: Maximum queue length, will declare congestion if grows larger
; maxout: int: Maximum number of simultaneous outgoing calls to operators
; greeting: string: Resource to be played initially as greeting
; onhold: string: Resource to be played while waiting in queue
; maxcall: int: How much to call the operator, in milliseconds
; prompt: string: Resource to play to the operator when it answers
; notify: string: Target ID for notification messages about queue activity
; detail: bool: Notify when details change, including call position in queue
; single: bool: Make just a single delivery attempt for each queued call
queue=SELECT mintime, length, maxout, greeting, 'moh/madplay' as onhold, maxcall, prompt, detail FROM groups WHERE groups.group_id='\${queue}'
; avail: string: Query to fetch operators to which calls can be distributed
; Relevant substitutions:
; \${queue}: string: Name of this queue
; \${required}: int: Number of operators required to handle incoming calls
; \${current}: int: Number of calls to operators currently running
; \${waiting}: int: Total number of calls waiting in this queue (assigned or not)
; Mandatory returned params:
; location: string: Resource where the operator is located
; username: string: User name of the operator
; Relevant returned params:
; maxcall: int: How much to call the operator, in milliseconds
; prompt: string: Resource to play to the operator when it answers
avail=SELECT extensions.location, extensions.extension as username FROM extensions, group_members WHERE extensions.extension_id=group_members.extension_id AND group_members.group_id='\${queue}' AND extensions.location IS NOT NULL AND coalesce(extensions.inuse_count,0)=0 ORDER BY extensions.inuse_last LIMIT \${required}
[channels]
; Resources that will be used to handle incoming and outgoing calls
; incoming: string: Target that will handle incoming calls while queued
incoming=external/nodata/queue_in.php
; outgoing: string: Target that will be called to make calls to operators
outgoing=external/nodata/queue_out.php
"
if [ -e "$fe" ]; then
if [ -z `readopt "Overwrite existing queues.conf ?" "yes"` ]; then
echo "Please edit file $fe like follows:"
echo "$e"
fe=""
fi
fi
if [ -n "$fe" ]; then
echo "Creating queues configuration file"
mkdir -p "$DESTDIR$configs"
echo "; File created by $version
$e" > "$fe"
fi
# pbxassist.conf
fe="$DESTDIR$configs/pbxassist.conf";
e="
[general]
; Common settings
; enabled: bool: Enable the module and install message handlers
enabled=yes
; priority: int: Priority to install message handlers into engine
;priority=15
; default: bool: Assist channels by default, module must be enabled first
;default=yes
; incoming: bool: Assist incoming calls, needs that default is enabled
;incoming=yes
; filter: regexp: Expression matching assisted channel IDs, default all
;filter=
; dtmfpass: bool: Enter DTMF pass-through mode by default
;dtmfpass=no
; minlen: int: Minimum length of command sequences
;minlen=2
; maxlen: int: Maximum length of command sequences
;maxlen=20
; timeout: int: Inter-digit timeout in milliseconds
;timeout=30000
; retake: string: Exact sequence to exit DTMF pass-through mode
retake=###
[transfer]
; blind transfer: make call on behalf of peer, hangup this
; key: *1nnnnn*
trigger=\*1\([0-9]\+\)\*$
target=\1
[fortransfer]
; put the peer on hold and dial another number
; key: *2nnnnn*
trigger=\*2\([0-9]\+\)\*$
target=\1
onhangup=yes
[dotransfer]
; transfer held to active (2nd) call
; key: *4
trigger=\*4$
[onhold]
; toggle call on/off hold
; key: *0
trigger=\*0$
[returnhold]
; always return to the held peer
; key: *7
trigger=\*7$
[conference]
; put us and peer in an ad-hoc conference or return to conference
; key: *3
trigger=\*3$
[returnconf]
; always return to conference
; key: *6
trigger=\*6$
[returntone]
; always return to a dialtone, hang up peer
; key: *9
trigger=\*9$
;operation=dialtone
[secondcall]
; hangup the peer and dial another number
; key: *8nnnnn*
trigger=\*8\([0-9]\+\)\*$
target=\1
[seconddial]
; execute a dial while at dialtone
; key: nnnn*
trigger=^\([0-9]\+\)\*$
pbxstates=dial
target=\1
operation=secondcall
[flush]
; no operation, flush the buffer
; key: #
trigger=#$
operation=
pbxgreedy=yes
pbxprompt=tone/info
[flush-dial]
; flush the buffer, return to dialtone
; key: #
trigger=#$
pbxstates=dial
pbxgreedy=yes
pbxprompt=tone/info
message=call.execute
callto=tone/dial
[passthrough]
; enter DTMF pass-through mode
; key: **
trigger=\*\*
pbxprompt=tone/probe/1
; Example: enter conference named conf/dyn-N with key sequence #N# where N=0..9
;[conference]
;trigger=#\([0-9]\)#$
;message=call.conference
;room=conf/dyn-\1
[silence]
; silence the dialtone, keep collecting tones
; key: n
trigger=^[0-9]$
pbxstates=dial
pastekeys=\0
pbxgreedy=yes
message=call.execute
callto=tone/noise
[collect]
; keep collecting tones
; key: nnnn
trigger=^[0-9]\+$
pbxstates=dial
pastekeys=\0
pbxgreedy=yes
operation=
[transparent]
; send a tone as-is to the remote
; key: n
trigger=^[0-9]$
;[blessing]
; allow the remote user to use the PBX functionality - dangerous!
; key: *9
;trigger=^\*9$
;operation=setstate
;pbxguest=no
;id=${peerid}
"
if [ -e "$fe" ]; then
if [ -z `readopt "Overwrite existing pbxassist.conf ?" "yes"` ]; then
echo "Please edit file $fe like follows:"
echo "$e"
fe=""
fi
fi
if [ -n "$fe" ]; then
echo "Creating pbxassist configuration file"
mkdir -p "$DESTDIR$configs"
echo "; File created by $version
$e" > "$fe"
fi
# openssl.conf
fe="$DESTDIR$configs/openssl.conf";
e="
; This file keeps the configuration of the openssl module
; Each section, except for 'general' configures a server context
[general]
;[server_context]
; This section configures a SSL server context
; enable: boolean: Enable or disable the context
; Defaults to yes
;enable=yes
; domains: string: Comma separated list of domains the context will be used for
; A subdomain wildcard can be specified for a given domain, e.g.
; *.null.ro will match any null.ro subdomains (including the 'null.ro' domain)
;domains=
; certificate: string: The name of the file containing the certificate for the context
; This parameter is required
;certificate=
; key: string: Optional certificate key file name
;key=
[freesentral_context]
enable=yes
certificate=freesentral.crt
key=freesentral.key
"
if [ -e "$fe" ]; then
if [ -z `readopt "Overwrite existing openssl.conf ?" "yes"` ]; then
echo "Please edit file $fe like follows:"
echo "$e"
fe=""
fi
fi
if [ -n "$fe" ]; then
echo "Creating openssl configuration file"
mkdir -p "$DESTDIR$configs"
echo "; File created by $version
$e" > "$fe"
fi
# rmanager.conf
fe="$DESTDIR$configs/rmanager.conf";
e="
[general]
; Each section creates a connection listener in the Remote Manager.
; An empty (all defaults) general section is assumed only in server mode if the
; configuration file is missing.
; port: int: TCP Port to listen on, 0 to disable the listener
;port=5038
; addr: ipaddress: IP address to bind to
;addr=127.0.0.1
; header: string: Header string to display on connect
;header=YATE ${version}-${release} (http://YATE.null.ro) ready.
; password: string: Password required to authenticate as admin, default empty!
;password=
; userpass: string: Password to authenticate as observer user, default empty!
;userpass=