Capture everything happening in your asterisk server and log it to mysql. Calls, DTMF's, generic events, etc
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.


This was intended as an example of use mixing Ding and PAMI. However, it might be
useful as a tool to help you monitor/debug your asterisk installation, so I'm 
making it freely available.

See this article for more information:

AsterTrace is extendable via "listeners". Currently these listeners exist:
* dial
* event
* dtmf
* varset
* newchannel
* newstate
* newexten

So currently, AsterTrace can monitor:
* All events (event-listener)
* Call activity (CDR like) (dial-listener)
* DTMF's pressed (dtmf-listener)
* VarSet's  (varset-listener)
* Newchannel (newchannel-listener)
* Newstate (newstate-listener)
* Newexten (newexten-listener)

Each listener is autosufficient, and get called by the container (Ding) whenever an
interesting event occurs. Ding will get called by the pami helper, whenever AMI reports
an event. This event will then get dispatched to the listeners by ding.

TCP Server
AsterTrace uses the Ding TCPServerHelper to start a tcp server. This server allows you
to connect and issue commands, also you can listen for events. The events and responses to
the actions sent are serialized with json :) You can try it via telnet.

REST interface
Also, a rest interface is available, so you can make it publicly available through a webserver. This
rest interface will let you get events from ami in a json format. Ideal for COMET/Long polling.

* PHP 5.3+
* Ding 0.98+ (
* PAMI 1.27+ (
* mysql server
* log4php (optional)
* pdo-mysql

Assuming you are inside the root directory of the source (thus, having ./conf and ./src)

1.- Copy/Rename the file: conf/ to Edit it.
2.- Copy/Rename the file: conf/ to Edit it.
3.- Copy/Rename the file: conf/ to Edit it. The only
thing you need from mysql, is to have the database created (nothing else, no tables,
AsterTrace will create them on demand).
4.- Copy/Rename the file: conf/ to Edit it. You can have
your own php settings here.
5.- Copy/Rename the file: conf/ to Edit it.
6.- Copy/Rename the file: conf/ to Edit it.
7.- Run astertrace, like "php src/mg/AsterTrace/bin/astertrace.php ./conf"

Thanks to
* Joshua Elson for his help in trying and debugging in loaded asterisk servers.