TclMyAst

Created by Penguin PBX Solutions
Download now

This package contains Tcl code to interface with the Asterisk manager commands via TCP/IP. Tcl is a powerful cross-platform scripting language.

Besides allowing you to create a graphical Tcl/Tk based application using this interface, you can also run the script as a standalone proxy server for the manager port. The script will connect to Asterisk and then open a port on the localhost to serve up connections to other clients. Username and password information for clients connected to the proxy is the same as that used for the proxy's login; including access control rights and system event calls. So this proxy server could be a drop-in replacement for direct connections to Asterisk — highly desirable in the case of many simultaneously connected clients.

Additionally, this code stores internal state information for all channels in various data structures. This removes the need to keep track of channel states in your own variables — just use the ones provided in tclmyast.tcl (like the 'State' array.)

In addition to simply polling the state of the internal arrays, you can register callback functions for any Asterisk Event. You can also register callbacks based on the Action ID. Some abstracted manager commands, like astGetvar, will take a -command argument to execute a callback implicitly by using the Action ID. Unique Action IDs are created if not supplied by the user and are set as the return value for each supported manager command.

This code was written and tested primarily on Linux, but it should work on Windows. GUI Tcl/Tk applications wrapped as standalone executable starkits which use this interface are in production use on Windows machines to provide visual representations of call state information.

Below is a screen capture of the reference GUI design for the TclMyAst manager interface. It's designed for learning and experimenting with the interface:
Image

Created by Penguin PBX Solutions
Download now

This package contains Tcl code to interface with the Asterisk manager commands via TCP/IP. Tcl is a powerful cross-platform scripting language.

Besides allowing you to create a graphical Tcl/Tk based application using this interface, you can also run the script as a standalone proxy server for the manager port. The script will connect to Asterisk and then open a port on the localhost to serve up connections to other clients. Username and password information for clients connected to the proxy is the same as that used for the proxy's login; including access control rights and system event calls. So this proxy server could be a drop-in replacement for direct connections to Asterisk — highly desirable in the case of many simultaneously connected clients.

Additionally, this code stores internal state information for all channels in various data structures. This removes the need to keep track of channel states in your own variables — just use the ones provided in tclmyast.tcl (like the 'State' array.)

In addition to simply polling the state of the internal arrays, you can register callback functions for any Asterisk Event. You can also register callbacks based on the Action ID. Some abstracted manager commands, like astGetvar, will take a -command argument to execute a callback implicitly by using the Action ID. Unique Action IDs are created if not supplied by the user and are set as the return value for each supported manager command.

This code was written and tested primarily on Linux, but it should work on Windows. GUI Tcl/Tk applications wrapped as standalone executable starkits which use this interface are in production use on Windows machines to provide visual representations of call state information.

Below is a screen capture of the reference GUI design for the TclMyAst manager interface. It's designed for learning and experimenting with the interface:
Image

Created by: cmaj, Last modification: Wed 09 of Apr, 2008 (22:00 UTC)
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+