Asterisk record calls

Recording Calls With Asterisk

Automon for a single call

Asterisk 1.2 now comes with the new "automon" setting in features.conf that permits a user to turn on/off call recording during an active conversation.

Example by Mojo

If you have httpd with php on the * server, you can do what I did:

I set up the key combination *# in features.conf to monitor and created a few php files to interact with the results. Save the four php files at into a folder on the * web server, eg: /var/www/html/recordings/ — rename them all to .php instead of .phps, and edit config.php to point to the asterisk monitor directory (usually /var/spool/asterisk/monitor). Now make a soft link so the recorded waves appear in the web tree:

ln -s /var/spool/asterisk/monitor /var/www/html/recordings/monitor

Then direct a web browser to http://asterisk_server/recordings/ and it should be pretty self-explanatory. No recordings will appear in the list if you don't have the sox packages installed. And, of course, the w or W options must be specified in the Dial() cmd, as in Asterisk cmd Dial.

Listening on Zap channel calls

You can listen in (you hear them but they don't hear you) on conversations taking place on your Zap Channels, if you have any. See the ZapBarge command.

Monitor Calls with Astguiclient

When you know how to Monitor a call, you have to know what calls are going on in your PBX. This is much more complex than ZapBarge. For this solution I decided to write Astguiclient, a set of server and client programs that can run on a Linux or Win32 desktop.

The server side

A constantly run perl script telnets into the Manager interface of Asterisk and gets the "show channels" output every 333 milliseconds. It then queries a database to see which "phone extension/Zap channel pairs" are not in it already, and inserts them, as well as deleting channels that are no longer active. This way it can scale easily without affecting the Asterisk server at all.

A cron job perl script, running every 5 minutes, takes recorded sound files, merges them with soxmix and copies them to a universal storage location so they can be easily retrieved

The Client side

A perl/TK program pulls the current "live calls" information from the database every second using Net::MySQL and displays them in listboxes (so you can see which person is on which Zap channel). When the person whose phone you have selected is on a phone call, the recording button is enabled and you can start recording. Recording is accomplished by the program telnetting into the Asterisk Manager and sending the Monitor command for the specific channel, and stopping recording is done similarly with the StopMonitor command. You can also originate calls through this interface.

See also

Asterisk | Tips and Tricks

Created by: oej, Last modification: Thu 30 of Sep, 2010 (06:47 UTC) by valer77
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+