-
Notifications
You must be signed in to change notification settings - Fork 4
/
run.sh
executable file
·61 lines (44 loc) · 1.57 KB
/
run.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
#!/bin/sh
CWD=`pwd`
ME=`basename $0`
TELEGRAM_SESSION="$CWD/telegram.session"
set -e -x
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT
# 1. Build the required applications
nix-build -A sox -o result-sox
export PATH=`readlink ./result-sox`/bin/:$PATH
sox --version
nix-build -A asterisk -o result-asterisk -K
nix-build -A asterisk-conf -o result-conf
nix-build -A python-scripts -o result-python
# nix-build -A tg2sip -o result-tg2sip
# nix-build -A tg2sip-conf -o result-tg2sip-conf
nix-build -A dongle-monitor -o result-dongle-monitor
# 2. Prepare the modem. We may need to switch it to the serial mode.
"$CWD/result-dongle-monitor/bin/dongle-monitor" &
# 3. Allocate static resources
"$CWD/result-python/bin/telegram_check.py"
"$CWD/result-python/bin/dongleman_spool.py"
"$CWD/result-python/bin/dongleman_daemon.py" --check
# mkdir /tmp/tg2sip || true
# cp -f "$CWD/result-tg2sip-conf/etc/settings.ini" /tmp/tg2sip/settings.ini
# ( cd /tmp/tg2sip && "$CWD/result-tg2sip/bin/gen_db"; )
sudo rm -rf /tmp/asterisk || true
sudo mkdir /tmp/asterisk
# 4. Run TG2SIP
# ( cd /tmp/tg2sip &&
# while true ; do
# mkdir /tmp/tg2sip || true
# cp -f "$CWD/result-tg2sip-conf/etc/settings.ini" /tmp/tg2sip/settings.ini
# "$CWD/result-tg2sip/bin/tg2sip" || true
# sleep 1
# done;
# ) &
# 5. Run the dongleman
( while true; do
"$CWD/result-python/bin/dongleman_daemon.py" || true
sleep 1
done
) &
# 6. Run Asterisk daemon synchronously, verbosely, interactively
sudo "$CWD/result-asterisk/bin/asterisk" -C "$CWD/result-conf/etc/asterisk/asterisk.conf" -c -f -vvvvvvvvv