-
Notifications
You must be signed in to change notification settings - Fork 0
/
lib_parameters.py
171 lines (143 loc) · 6.63 KB
/
lib_parameters.py
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
#!/usr/bin/python
#lib_parameters
import sys
sys.dont_write_bytecode = True # No '*.pyc' precompiled files
import os
import socket
# This is a library for storing various (mainly constant) values, usernames,
# directory or file names, etc.
# Also: file headers, extensions, trunk names, sip settings, etc.
local_lenny_dir = 'D:\\raslenny\\'
EMPTIES = ('', [], (), {}, set(), None)
hostname_prefix = 'raslenny'
hostname_suffix = '.local'
full_hostname = hostname_prefix + hostname_suffix
default_hostnames = ('raspbx.local', full_hostname)
default_hostname = default_hostnames[0]
default_user = 'root'
default_password = 'raspberry'
tshoot_dir = 'tshoot'
init1_file = 'init1.txt'
init2_file = 'init2.txt'
adjust_file = 'doadjust.py'
ipauto_file = 'doipauto.py'
file_showtables = 'doshowtables.py'
net_script = 'changeip.py'
comm_set_hostname = 'hostnamectl set-hostname ' + full_hostname
lenny_dir = '/opt/' + hostname_prefix + '/'
comm_make_lenny_dir = 'mkdir -p ' + lenny_dir
# Folder where subfolders with custom audio dialog and background files are located.
sounds_main_dir = '/var/lib/asterisk/sounds/custom/'
local_recordings_dir = local_lenny_dir + 'recordings' + '\\'
# Call recordings location
recordings_dir = "/var/spool/asterisk/monitor/"
etc_dir = '/etc/'
asterisk_dir = '/etc/asterisk/'
path_to_ffmpeg = 'ffmpeg'
# Dialog/background audios to be sent to rpi from this dir
local_audio_folder = local_lenny_dir + 'audios' + '\\'
local_test_dir = local_lenny_dir + 'tests\\'
path_to_ffmpeg_on_pc = 'C:\Programs\\ffmpeg\\bin\\ffmpeg.exe'
dhcp_file = '/etc/dhcpcd.conf'
interface_file = '/etc/network/interfaces.d/eth0'
line_in_dhcp_file = 'denyinterfaces eth0'
exten_num = '33' # This is your initial extension number.
# Do not edit the parameters below.
# This will not work, due to the salted hash!
exten_pass = 'password' # This is the password for your initial
# extension number.
# The below must was calculated by the FreePBX, do not edit it!
exten_pass_hash = '$2a$08$iviEUwg.WoZN0VREhWEbjONRKIXj1s9lLXJi9iz6wkDfTKvfnptR.'
web_admin_name = 'webadmin'
# The pass is: 'webpass' but it is not used in the db, only its hash (below) is.
# Hash for the webadmin's pass:
web_admin_sha = '94d33e528aa5c3a4386d3b3f1f0984a177968dec'
db_user = 'db_user'
db_password = 'db_password'
localhost = 'localhost'
host = 'localhost'
asterisk_db = 'asterisk'
devices_table = 'devices'
userman_users_table = 'userman_users'
users_table = 'users'
ampusers_table = 'ampusers'
sip_table = 'sip'
file_pjsip_trans = asterisk_dir + 'pjsip.transports.conf'
file_exten_addit = asterisk_dir + 'extensions_additional.conf'
file_exten_custom = asterisk_dir + 'extensions_custom.conf'
file_sip_general_addit = asterisk_dir + 'sip_general_additional.conf'
file_net_conf = 'dhcpcd.conf'
file_pjsip_aor = 'pjsip.aor.conf',
file_pjsip_auth = 'pjsip.auth.conf',
file_pjsip_endpoint = 'pjsip.endpoint.conf',
file_pjsip_identify = 'pjsip.identify.conf',
file_sip_add = 'sip_additional.conf'
file_sip_reg = 'sip_registrations.conf'
file_make_ulaws = 'domakeulaws.py'
file_initwebuser = 'initwebuser.py'
file_initmysql = "initmysql.py"
dbs_dump_file = 'aaa_dbs_dump.txt'
report_file = 'aa_report_file.txt'
file_recordings = 'dodeldialogs.py'
file_addcustoms = 'doaddcustoms.py'
file_delcustoms = 'dodelcustoms.py'
# Config files to download for tshooting purposes
files_to_download = []
files_to_download.append(lenny_dir + dbs_dump_file)
files_to_download.append(etc_dir + file_net_conf)
files_to_download.append(etc_dir + 'amportal.conf')
files_to_download.append(file_exten_addit)
files_to_download.append(file_exten_custom)
files_to_download.append(asterisk_dir + 'pjsip.aor.conf')
files_to_download.append(asterisk_dir + 'pjsip.auth.conf')
files_to_download.append(asterisk_dir + 'pjsip.endpoint.conf')
files_to_download.append(asterisk_dir + 'pjsip.identify.conf')
files_to_download.append(asterisk_dir + 'sip_additional.conf')
files_to_download.append(asterisk_dir + 'sip_registrations.conf')
files_to_download.append(asterisk_dir + 'pjsip.transports.conf')
files_to_download.append(asterisk_dir + 'sip_general_additional.conf')
# Databases that may be needed to dump for tshooting.
dbs_to_dump = []
dbs_to_dump.append('asterisk')
# Script files that should be transferred from pc to raspberry.
files_to_put = []
files_to_put.append(local_lenny_dir + adjust_file)
files_to_put.append(local_lenny_dir + file_make_ulaws)
files_to_put.append(local_lenny_dir + 'action_ipstatic.py') # Leave it
files_to_put.append(local_lenny_dir + 'action_on_conf_files_custom_exten.py')
files_to_put.append(local_lenny_dir + 'action_on_db_custom_exten.py')
files_to_put.append(local_lenny_dir + 'action_on_net_conf_files.py')
files_to_put.append(local_lenny_dir + 'action_on_sound_files_custom_exten.py')
files_to_put.append(local_lenny_dir + 'dodeldialogs.py')
files_to_put.append(local_lenny_dir + file_addcustoms)
files_to_put.append(local_lenny_dir + file_delcustoms)
files_to_put.append(local_lenny_dir + 'doipauto.py')
files_to_put.append(local_lenny_dir + 'doshowcustoms.py')
files_to_put.append(local_lenny_dir + file_showtables)
files_to_put.append(local_lenny_dir + file_initmysql)
files_to_put.append(local_lenny_dir + file_initwebuser)
files_to_put.append(local_lenny_dir + 'lib_main.py')
files_to_put.append(local_lenny_dir + 'lib_mysql.py')
files_to_put.append(local_lenny_dir + 'lib_lan.py')
files_to_put.append(local_lenny_dir + 'lib_parameters.py')
# Prompts to provide further IP settings
prompt_dns_setts = []
prompt_dns_setts.append('----------------')
prompt_dns_setts.append('You need to provide the IP adress(es) of the DNS server(s).')
prompt_dns_setts.append('You can provide one or two custom IP address(es) of the DNS server(s).')
prompt_dns_setts.append('If you provide two IPs, they should be separated by space.')
prompt_dns_setts.append('Eg:8.8.8.8')
prompt_dns_setts.append('Or:8.8.8.8 9.9.9.9')
prompt_gw_ip = 'To configure static network settings, enter now the IP address of your Gateway/Router:'
# Prompt says, that the IP settings are being delivered.
prompt_ip_setings_ready = []
prompt_ip_setings_ready.append(
'The settings have been writen to the network configuration files. '
'RPi is rebooting...')
# These netmasks are invalid to be set for the host.
banned_netmasks = ('0.0.0.0', '255.255.255.254', '255.255.255.255')
def main():
print('This is a library for storing various (mainly constant) values,')
print('directory or file names, etc.')
if __name__ == '__main__':
main()