Grandstream unofficial TFTP provisioning server.
https://github.com/sorend/gstftpd-server.git
This project is an unofficial TFTP server for provisioning Grandstream VoIP phones. The project has been used in the free VoIP platform Gratissip, hence the name.
It consists of three parts:
Basically it is a TFTP server, however with a few extensions for the Grandstream VoIP-phones.
It is based on the fwtftpd work of Martin Kihlgren, which is GPL - and hence this is also GPL. Read more about what that means in the GplLicense. You can find Martin's work here: {{http://troja.ath.cx/~zond/fwtftpd/}}.
The project can be built using Gradle, which is already included. After downloading, run the following command:
./gradlew distZip
This produces an installation file in the folder tftpd-server/build/distribution/tftpd-server.zip. You can unpack this file in a location of your choice. After this, you have to configure the server.
In the configuration file you can define which IP and port the TFTPD server should listen on. Normally you should leave the port to 69, the standard tftp service port, however, in special cases you can here configure it to something else. Also you can define which IP to bind on. The default 0.0.0.0 IP means to bind on all IPs available on the machine.
`` xml
<bean id="tftpdServer" class="net.tanesha.tftpd.core.Server">
<property name="port" value="69" />
<property name="bindhost" value="0.0.0.0" />
<property name="vfs" ref="vfs" />
</bean>
%%CODEBLOCK1%% xml
<bean id="vfs" class="net.tanesha.tftpd.core.Vfs">
<property name="filesystems">
<list>
<ref local="firmwareServer"/>
<ref local="provisionServer"/>
<!--
http proxy server is disabled
<ref local="httpProxyServer" />
-->
<ref local="tftprootServer"/>
</list>
</property>
</bean>
%%CODEBLOCK2%%xml
<bean id="tftprootServer" class="net.tanesha.tftpd.vfs.TftpRootServer">
<property name="rootpath" value="/tftpboot" />
</bean>
%%CODEBLOCK3%% xml
<bean id="httpProxyServer" class="net.tanesha.tftpd.vfs.HTTPProxy">
<property name="pattern" value="^/?cfg[0-9a-f]{12}%%INLINECODE1%%quot;/>
<property name="target" value="http://voip/cgi-bin/tftp_request.cgi?mac=%m"/>
</bean>
%%CODEBLOCK4%% xml
<bean id="firmwareServer" class="net.tanesha.tftpd.vfs.FirmwareServer">
<property name="tftpdExternalInterface" ref="tftpdExternalInterface" />
<property name="versioningHelper" ref="versioningHelper" />
</bean>
%%CODEBLOCK5%% xml
<bean id="provisionServer" class="net.tanesha.tftpd.vfs.ProvisionServer">
<property name="tftpdExternalInterface" ref="tftpdExternalInterface" />
</bean>
%%CODEBLOCK6%% xml
<bean id="tftpdExternalInterface" class="net.tanesha.tftpd.jdbc.JdbcExternalImpl">
<property name="datasource" ref="myJdbcDatasource" />
<property name="queryByVersion">
<value>
select phone_id, version_no, firmware_path from firmware_versions where phone_id = ? and version_no = ?
</value>
</property>
<property name="queryLatestVersion">
<value>
select phone_id, version_no, firmware_path from firmware_versions where phone_id = ? and is_latest = 'T'
</value>
</property>
<property name="queryPhoneByMac">
<value>
select phone_id, version_no from phone_firmwares where mac_address = ?
</value>
</property>
<property name="querySettingsByMac">
<value>
select provision_attribute, provision_value from phone_settings where mac_address = ?
</value>
</property>
</bean>
<!-- please refer to spring documentation www.springframework.org for how to configure a datasource for your database -->
<bean id="myJdbcDatasource" class="...">
</bean>
%%CODEBLOCK7%% sql
create table firmware_versions (
phone_id varchar(50),
version_no varchar(50),
firmware_path varchar(100),
is_latest varchar(1),
primary key (phone_id, version_no)
);
create table phone_firmwares (
mac_address varchar(15) primary key,
phone_id varchar(50),
version_no varchar(50)
);
create table phone_settings (
mac_address varchar(15),
provision_attribute varchar(10),
provision_value varchar(100),
primary key (mac_address, provision_attribute)
);
``
But, you can modify the SQL to match any existing schema you may have.
The following people have contributed, a BIG THANKS from here: