spaconf

spaconf is a tool which can be used with an analog phone adapter (ATA) such as the Sipura SPA 3000 and Linksys PAP2. These devices are normally configured via a web interface, but this tool allows you to read the configuration from the device and store it in a text file, or take a text file and copy the configuration to the device.

Why would you want to use this?

  • you can back up your configuration to a computer
  • you can more easily swap configurations with other users
  • you can compare configurations easily (using diff)
  • you can use this tool to update your configuration programmatically (for different times of day, etc.)
  • you can store your configuration in a source control system
  • you prefer editing text files to using web interfaces

spaconf is written in python and should run anywhere python runs (Unix, Windows, Mac, etc.).

It requires Python 2.3 or newer.

Home page:
http://www.opensky.ca/~jdhildeb/software/spaconf/
Download:

spaconf is available as source code in .tar.gz format (requires python to run) and as a Windows standalone executable (choose the .zip file).

All downloads are available from:
http://www.opensky.ca/~jdhildeb/software/spaconf/downloads/
Sample config file:
http://www.opensky.ca/~jdhildeb/software/spaconf/spa3000.txt

usage: spaconf.py [-nq] <src> [<dest>]

spaconf.py can read the active configuration from a Sipura SPA or Linksys PAP2 analog telephone adapter (ATA) and store it in a text file, or can take an existing text file and write that configuration to the ATA. Configuration options are stored as key-value pairs.

One of <src> or <dest> should be a local file path, and the other should be a URL to your ATA with the username and password embedded. If <src> or <dest> is a hyphen (-), standard input or output is used. <src> can also be a key-value pair (i.e., key = value).

Options:

-n, --noboot Do not reboot the ATA after configuring it.
-q, --quiet Do not print informational messages.

Examples:

Write ATA config to standard output:
spaconf.py http://admin:mypassword@myata/

System Message: WARNING/2 (README.txt, line 61)

Definition list ends without a blank line; unexpected unindent.

or spaconf.py http://admin:mypassword@myata/ -

Copy ATA config into a config file:
spaconf.py http://admin:mypassword@myata/ ata.config
Or use an explicit IP if necessary:
spaconf.py http://admin:mypassword@192.168.0.5/ ata.config
Copy a config file to the ATA device (no reboot afterward):
spaconf.py --noboot ata.config http://admin:mypassword@192.168.0.5/
Copy config options from standard input to the ATA device:
spaconf.py - http://admin:mypassword@myata/
Set a single option (key/value pair):
spaconf.py key = value http://admin:mypassword@myata/

System Message: WARNING/2 (README.txt, line 77)

Definition list ends without a blank line; unexpected unindent.

or spaconf.py key value http://admin:mypassword@myata/

Notes:

When reading a config from an ATA, this script unfortunately cannot retrieve the passwords. They appear as stars ("****"). It is however safe to write such a configuration back to the device; such passwords will be ignored, and the passwords in the device will be left unchanged. If you edit a config file to contain a (non-star) password, however, it will be changed.

System Message: WARNING/2 (README.txt, line 80); backlink

Inline strong start-string without end-string.

System Message: WARNING/2 (README.txt, line 80); backlink

Inline strong start-string without end-string.

It is not necessary that a config file contain key-value pairs for every option supported by the ATA. Any options not present will not be changed.

Lines beginning with # in a config file are taken as comments and ignored. Lines beginning with ! are printed to standard out when the config file is restored to an ATA.

Single and double quotes are permitted around option values (single quotes are used in generated files) but may be omitted. When using a key-value pair in the command, it is good practice to use single quotes around the value to keep the shell from munging it.

This program has been tested with the Sipura SPA 3000 (firmware versions 2.0.13g and 3.1.3), and with the Linksys PAP2 (firmware 3.1.9 and 5.1.5). Your mileage may vary.

Changelog:
2008-01-02

Release 0.3.

Huge thanks to Jerry Kindall for patches which:
  • add better support for Linksys PAP2 devices
  • fixed bug where spaconf couldn't handle values containing "="
  • allow stdin/stdout to be used for config files
  • allow the reboot to be suppressed
  • more verbose output (and --quiet option)
  • script returns an error code (0 is success)
  • allow you to set a single configuration value from command line

Sorry, no windows executable for this version yet.

2006-04-11

Release 0.2.

Added alternate URLs for compatibility with Linksys PAP devices.

2005-12-29
Initial release (0.1).
Feedback:
Please send me comments, bug reports, etc. jason@opensky.ca (better yet, please send patches!)