Sometimes one wants to record inbound calls for posterity, quality assurance, training, or for other purposes. Let's take a look at how that is setup!
In the callflow editor, on the right hand side, select the "Call Recording" tab in toolbox:
Drag the "Start Call Recording" action onto your callflow. You should be prompted to configure the recording options:
Select the format of the subsequent audio file, your server URL to receive the file, and how long, in seconds, to record for (at a maximum).
Drag any of the normal callflow elements (like User, Device, Ring Group, etc) as normal.
The "Stop Call Recording" action is implicitly executed when the call ends and is not required.
You can optionally stop recording. For example:
If you just want to record a single incoming group,
Click on Group Features of the group you wish to record, enable Call Recording, and place the URL of the server to save the recordings to
These instructions assume a basic LAMP setup. The URL we configured in the callflow editor is "http://your.server.com/kzr". The final URL for storing the call recording will be "http://your.server.com/kzr/call_recording_CALL_ID.EXT" where CALL_ID is the actual call-id of the a-leg, and EXT is either "mp3" or "wav".
We will issue an HTTP PUT:
PUT http://your.server.com/kzr/call_recording_CALL_ID.ext HTTP/1.1
A basic setup you can use requires two pieces; an htaccess rule and a PHP script.
This file belongs in your server's DocumentRoot.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^kzr/call_recording_(.+)\.(.+)$ kzr/index.php?recording=$1.$2 [QSA,L]
</IfModule>
Create, in the kzr/ sub-folder, a file named "index.php"
<?php
/* PUT data comes in on the stdin stream */
$putdata = fopen("php://input", "r");
$r = $_REQUEST["recording"];
/* Open a file for writing */
$fp = fopen("/tmp/$r", "w");
/* Read the data 1 KB at a time and write to the file */
while ($data = fread($putdata, 1024))
fwrite($fp, $data);
/* Close the streams */
fclose($fp);
fclose($putdata);
?>
This will create a file in /tmp named with the CALL_ID.EXT.
Additional Notes:
When using NAS/Linux hosts the if the .htaccess file does not always happily the redirection correctly, in order to have the files saved you may need to specify the file name and the recording variable