Setup Grandstream HandyTone from Command Line



  • I have been playing with Hugo to test out getting my blog running on jaredbusch.com again and I made this post today as a test. I thought I would get this cross posted as it is useful information.

    Setup Grandstream HandyTone from Command Line

    I try to make use of DHCP boot options to have telephony devices automatically reach out to their provisoining server, but it is not always possible.

    If you find yourself needing to setup a Grandstream HandyTone (or most of their phones) you do not need to log into the web interface to do it.

    Instead they have SSH enabled by default, so it is very easy. Open your preferred terminal application and ssh in as admin to the IP of the device. The defualt password is also admin.

    ssh [email protected]
    Grandstream HT802 Command Shell Copyright 2006-2018
    [email protected]'s password: 
    GS>
    

    Here is a list of the available commands for the HT802.

    GS> help
    Supported commands:
        config  -- Configure the device
        status  -- Show device status
        upgrade -- Upgrade the device
        reboot  -- Reboot the device
        reset 0  -- Factory   reset
        reset 1  -- ISP  Data reset
        reset 2  -- VOIP Data reset
        help    -- Show this help text
        exit    -- Exit this command shell
    GS>
    

    Enter configuration mode by entering config. The command help shows you the available commands in config mode.

    GS> config
    CONFIG> help
    Supported commands:
        set name value   -- Set a variable
        set ip dhcp      -- Set WAN DHCP mode
        set ip address   -- Set WAN IP address
        set netmask mask -- Set WAN network mask
        set gw address   -- Set WAN default gateway
        set mac address  -- Set WAN MAC address
        get name         -- Get a variable
        get ip           -- Get WAN IP setting
        get netmask      -- Get WAN network mask setting
        get gw           -- Get WAN default gateway setting
        unset name       -- Unset a variable
        commit           -- Commit the changes to FLASH
        security         -- Write security table or verify
        help             -- Show this help text
        exit             -- Exit this command shell
    CONFIG>
    

    As you can see, you set a variable with the set command. The name paramter is a little misleading as Gtrandstream uses P values and not readable names for all of the parameters. You can get a listing of all the P values from the Grandstream website.

    For this guide we will it up to

    • talk to a provisioning server over HTTPS
      • P212 # Firmware Upgrade and Privisioning. 0 - TFTP Upgrade, 1 - HTTP Upgrade, 2 - HTTPS Upgrade, 3 - FTP Upgrade, 4 - FTPS Upgrade.
      • P237 # Config Server Path
    • with a username
      • P1369 # HTTP/HTTPS User Name
    • and a password
      • P1361 # HTTP/HTTPS Password

    Leave off the P when you enter the commands, and you can see it echoes what you enter.

    CONFIG> set 212 2
    212 = 2
    CONFIG> set 237 pbx.domain.com:1443
    237 = pbx.domain.com:1443
    CONFIG> set 1360 123456abc
    1360 = 123456abc
    CONFIG> set 1361 hgfedcba9876543
    1361 = hgfedcba9876543
    CONFIG> commit
    Changes are commited.
    CONFIG> exit
    

    Commit the change to save it to flash, exit config mode, and then reboot.

    CONFIG> commit
    Changes are commited.
    CONFIG> exit
    GS> reboot
    

    When the device reboots, it should hit the provisioning server and pull your config file that you have set up.
    Here is what it looks for in order of hitting the webserver.

    [[email protected] ~]$ sudo tail -f /var/log/httpd/access_log | grep Grandstream
    10.2.3.45 - - [23/Apr/2020:11:33:26 -0500] "GET /cfg000b82f35db1 HTTP/1.1" 401 381 "-" "Grandstream Model HW HT802 V1.6A SW 1.0.17.5 DevId 000b82f35db1"
    10.2.3.45 - 123456abc [23/Apr/2020:11:33:26 -0500] "GET /cfg000b82f35db1 HTTP/1.1" 404 213 "-" "Grandstream Model HW HT802 V1.6A SW 1.0.17.5 DevId 000b82f35db1"
    10.2.3.45 - - [23/Apr/2020:11:33:27 -0500] "GET /cfg000b82f35db1.xml HTTP/1.1" 401 381 "-" "Grandstream Model HW HT802 V1.6A SW 1.0.17.5 DevId 000b82f35db1"
    10.2.3.45 - 123456abc [23/Apr/2020:11:33:27 -0500] "GET /cfg000b82f35db1.xml HTTP/1.1" 200 1647 "-" "Grandstream Model HW HT802 V1.6A SW 1.0.17.5 DevId 000b82f35db1"
    10.2.3.45 - - [23/Apr/2020:11:33:43 -0500] "GET /ht802fw.bin_1.0.17.5 HTTP/1.1" 401 381 "-" "Grandstream Model HW HT802 V1.6A SW 1.0.17.5 DevId 000b82f35db1"
    10.2.3.45 - 123456abc [23/Apr/2020:11:33:43 -0500] "GET /ht802fw.bin_1.0.17.5 HTTP/1.1" 206 648 "-" "Grandstream Model HW HT802 V1.6A SW 1.0.17.5 DevId 000b82f35db1"