1. Set up PostgreSQL-database:
    Execute the following as the PostgreSQL superuser (normally this is the
    user 'postgres'):

    $ createuser --no-superuser --no-createdb --no-createrole --pwprompt gsphonebook
    Enter password for new role:
    Enter it again:
    CREATE ROLE
    $ createdb --encoding=UTF-8 --owner gsphonebook gsphonebook
    CREATE DATABASE
    $ psql phonebook < dump.pgsql

    You might have to adjust the DSN in 'config.php' to access the PostgreSQL
    server.

2. Copy directory 'html' somewhere into your webserver tree. e.g.
    # cp -r html /var/www/gsphonebook

3. Download 'xajax' from http://sourceforge.net/project/showfiles.php?group_id=139736
    (I tested with xajax 0.5 beta 4).
    Point the variable $xajaxdir in 'config.php' to the installation (relative
    pathname).
    $xajaxdir + '/xajax_core/xajax.inc.php' should point to the respective
    file.

Now the phonebook should be usable. Read on for XML phonebook generation
and custom ringtone selection.

4. *OPTIONAL* for Grandstream XML phonebook generation:

    Set the 'Phonebook XML Server Path' in you Grandstream phone(s) to the
    gsget.php script in the installation directory:

    Enable Phonebook XML Download: 'YES, HTTP'
    Phonebook XML Server Path: 'myserver.lan/gsphonebook/gsget.php'

    For automatic phonebook updates also set 'Phonebook Download Interval' to
    some value > 0.  (This number is in minutes)

    For this feature to work the IP address or hostname has to be known to the
    phonebook application. Every user has a 'GS hostname' field that can be
    set for his phone. The application will then generate that users XML
    phonebook for this IP address.

5. *OPTIONAL* for user-selectable ring tones:

    Set the 'Firmware Server Path' entry in all Grandstream phones to the
    gsget.php script in the directory you just created:

    Upgrade Via 'HTTP'
    Firmware Server Path: 'myserver.lan/gsphonebook/gsget.php'

    Be sure that the fields 'Firmware File Prefix' and 'Firmware File Postfix'
    are empty.

    Copy your ringtones into the ringtone directory. Filename suffix has to be
    '.ring'. If you want to to hear the ring tones in your browser you can
    generate WAV-files and put them in the same directory with the same name
    but the suffix '.wav'. (See http://grandstream.com/ringtone.html for ring
    tone generation for Grandstream phones.)

    Unfortunately I don't have any free ringtones that I can distribute as
    examples so you have to do this up yourself.

    Additionally you can also put the Grandstream firmware files in the
    'firmware' subdirectory if you want to serve them through this tool.
    You can also serve config files if you set 'Config Server Path' in the
    phone to the same gsget.php-URL. They are also searched for in the
    'firmware' subdirecory.
