If you've used Linux (or FreeBSD or Mac OS X or Solaris) for longer than an hour, chances are good you've used Perl. Now, use Perl to monitor and control your Asterisk PBX.
The Perl module of choice for Asterisk is appropriately called asterisk-perl. It provides connections between the Asterisk Gateway Interface (AGI) and the venerable scripting language named after a misspelled maritime phenomenon. It also links Perl with Asterisk's Manager interface, a socket application programming interface (API) that lets you control and monitor Asterisk by sending messages to it on a TCP port—5038 to be exact.
For ad hoc interaction with the Asterisk Manager, you can telnet to that port on your Asterisk server—if the manager is enabled, that is. To ensure Asterisk Manager is indeed running and able to respond to your requests so that your Perl programs will actually do something once asterisk-perl is installed, you need to pay a visit to /etc/asterisk/manager.conf. Make it look roughly like this, being sure to include
enabled=yes and to add a section like the
[hansolo] one to define a username and password with which to access the Asterisk Manager later on:
; ; Asterisk Call Management support ; [general] enabled = yes port = 5038 bindaddr = 0.0.0.0 [hansolo] secret = falcon deny=0.0.0.0/0.0.0.0 permit=127.0.0.1/255.255.255.0 read = system,call,log,verbose,command,agent,user write = system,call,log,verbose,command,agent,user
You'll need to restart ...