GXP2140 Provision using Grandstream tools

GXP2140 Setup:

I needed to setup a GXP2140 for Freepbx and spent a day looking for some concise info on how to setup…for those that do it everyday this is probably like duhh! but in an effort help others I thought I’d post this:

If option 66 is set it will overide the config file path to whatever is set on the router (dnsmasq)for DHCP.

If disabling the 66 option provide the IP of the tftp server, the default root would be the /tftpboot folder as described in the tftp server config file (below) any directory specified would be below the folder in the tftp config file.

xinetd.d for tftp:

service tftp
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot --verbose
per_source = 11
cps = 100 2
flags = IPv4
}

I could not get PJSIP in Freepbx to work correctly probably because of the NAT settings.

The configuration file is an xml file named cfgMAC.xml if that is not found a default file cfg.xml is looked for. Firmware updates would be loaded in this folder as well and autodetected… gxp2140fw.bin (example)

xml file config:

config template file:
http://www.grandstream.com/sites/default/files/Resources/config-template_1.zip

The shell script GS_Config_TXT_to_XML_v1.7.sh
http://www.grandstream.com/sites/default/files/Resources/xml_configuration_file_generator_v1.7_0.zip

The config template takes some pouring through to find everything and is very time consuming.
Once you find the major items you need I would make up a separate config file with just the options you need. I don’t understand why Grandstream does not have a simple list of what the P codes are with a description.

Once you get that file setup which will probably be a lot of trial and error, you’ll also need to setup a whatever.csv file with a comma delimited list of MAC addresses and credential info you want to configure (a MAC.csv example file is in the zip as well as an example config file)

I renamed the script to GS_config and made it executable (chmod 755) Then from the folder where everything is located(/GS in my case), ./GS_config /GS/ config.txt config.csv and out pops a cfgMAC.xml. Copy that into your tftpboot folder (or whatever your tftp server is set at) and you should be good to go. For testing the P codes I just made changes in the xml file then migrated the ones I wanted to the original text file for safety in case I wanted to gen another xml file later.