The GTH is controlled via a TCP socket using an XML language. Here is an example of how to enable MTP-2 monitoring on a timeslot:
<new>
<mtp2_monitor ip_addr='128.250.22.3' ip_port='2453'>
<pcm_source span='2' timeslot='16'/>
</mtp2_monitor>
</new>
The API is just a text protocol over a TCP socket, so it is programming language and OS neutral. If a system can open a socket, it can control the GTH. We have used Java, C, C++, Python, Perl, BASH scripts and Erlang to control the GTH, on machines running Linux, Solaris, *BSD, MacOSX and Windows NT-2K-XP-Vista.
API Specification (PDF)
DTD for commands
DTD for responses
A bare bones example which shows how to set up audio loopback on one timeslot of a PCM, written in three different languages:
A Java package which includes an interface to the Xerces XML parser. Xerces is included in JDK 1.4, which is available from Sun. The sample code includes a tool to upgrade the software on the GTH.
XML Tool (source)
XML Tool (precompiled)
Examples in plain C to
This example includes a feature-complete wrapper, gth.erl, for the GTH API, i.e. all of the GTH's features are available through an erlang interface. Here's how you start MTP-2 monitoring with it:
41> {ok, A} = gth:start_link("172.16.2.7").
{ok,<0.188.0>}
42> {ok, ID, Socket} = gth:new_mtp2_monitor(A, "1A", 16).
{ok,"m2mo21",#Port<0.2261>}
Apart from the wrapper, there's an Erlang implementation of
The python example code package contains
The examples are built on top of a small-ish GTH API wrapper in python, so it's a useful base to build other scripts on.
The Perl example code package contains the same examples as the Python package (but written in Perl!), along with a partial GTH API wrapper written as a Perl module.