In this example I use isc-dhcp-server software (apt install isc-dhcp-server) on ubuntu 18.04 server
To catch the grandstream HT801 SIP and pass TFTP server ip information in the DHCP request I use option 66 In the dhcpd.conf file:
class "GRANDSTREAM HT801"{ match if option vendor-class-identifier = "HT8XX dslforum.org"; option tftp-server-name "40.40.40.40/ht801"; }
In this example I use Ubuntu 18.04 with "tftpd-hpa" software (apt install tftpd-hpa) TFTP structure:
tftpboot | --> frimware | | | --> ht810 | | | --> ht801fw.bin | --> ht801 | --> cfgcxxxxxxxxxxx.xml
The script is a simple python3 script that generates files based on template with data from a database The configuration script build-ht801-configs.py is placed in
/root/bin/
pip3 install -r requirements.txt
In this example I use postgresql database on Ubuntu 18.04
I have one table called sipfriends
Colums required in the table:
mac, gateway, tftp_server_ip, device_type, username, secret, admin_password
Colums explained:
mac - Used to validate client mac address
gateway - Point to the sip gateway
tftp_server_ip - Point to the tftp server
device_type - Specify the type/model of device
username - User telefone number
secret - User password for validating the user
admin_password - Password for remote access
crontab -e
*/5 * * * * /usr/bin/python3 /root/bin/build-ht801-configs.py