1. Home
  2. Knowledge Base
  3. Smart PBX
  4. How to Setup Call recording on your Aasani Platform

home_app_our_app_pricing2

 

How to Setup Call recording on your Aasani Platform

The Aasani platform does not allow direct recording to the system.To ensure continued security to our users, we expect users to host all call recording outside of the Aasani Hosted Platform.

To set this up you will need a server running PHP and a webserver of your choice.

Setting up the HTaccess file:

</p>
<div class="line number1 index0 alt2"><code class="java plain">&lt;IfModule mod_rewrite.c&gt;</code></div>
<div class="line number2 index1 alt1"><code class="java plain">RewriteEngine On</code></div>
<div class="line number3 index2 alt2"><code class="java plain">RewriteBase /</code></div>
<div class="line number4 index3 alt1"><code class="java plain">RewriteRule ^kzr/call_recording_(.+)\.(.+)$  kzr/index.php?recording=$</code><code class="java value">1</code><code class="java plain">.$</code><code class="java value">2</code> <code class="java plain">[QSA,L]</code></div>
<div class="line number5 index4 alt2"><code class="java plain">&lt;/IfModule&gt;</code></div>
<p>

The PHP File:

</div>
<div class="line number1 index0 alt2"><code class="java plain">&lt;?php</code></div>
<div class="line number2 index1 alt1"><code class="java comments">/* PUT data comes in on the stdin stream */</code></div>
<div class="line number3 index2 alt2"><code class="java spaces">  </code><code class="java plain">$putdata = fopen(</code><code class="java string">"php://input"</code><code class="java plain">, </code><code class="java string">"r"</code><code class="java plain">);</code></div>
<div class="line number4 index3 alt1"></div>
<div class="line number5 index4 alt2"><code class="java spaces">  </code><code class="java plain">$r = $_REQUEST[</code><code class="java string">"recording"</code><code class="java plain">];</code></div>
<div class="line number6 index5 alt1"><code class="java spaces">  </code><code class="java comments">/* Open a file for writing */</code></div>
<div class="line number7 index6 alt2"><code class="java spaces">  </code><code class="java plain">$fp = fopen(</code><code class="java string">"/tmp/$r"</code><code class="java plain">, </code><code class="java string">"w"</code><code class="java plain">);</code></div>
<div class="line number8 index7 alt1"><code class="java spaces">  </code><code class="java comments">/* Read the data 1 KB at a time and write to the file */</code></div>
<div class="line number9 index8 alt2"><code class="java spaces">  </code><code class="java keyword">while</code> <code class="java plain">($data = fread($putdata, </code><code class="java value">1024</code><code class="java plain">))</code></div>
<div class="line number10 index9 alt1"><code class="java spaces">    </code><code class="java plain">fwrite($fp, $data);</code></div>
<div class="line number11 index10 alt2"></div>
<div class="line number12 index11 alt1"><code class="java spaces">  </code><code class="java comments">/* Close the streams */</code></div>
<div class="line number13 index12 alt2"><code class="java spaces">  </code><code class="java plain">fclose($fp);</code></div>
<div class="line number14 index13 alt1"><code class="java spaces">  </code><code class="java plain">fclose($putdata);</code></div>
<div class="line number15 index14 alt2"><code class="java plain">?&gt;</code></div>
<p>

 

Now you can setup your call recording URL on your aasani platform, based on the above configuration we will be recording to: http://www.ourdomain.com/kzr/ and you will now start to see all call recordings going to that location.

 

Note: If there continuous problems with the data stream to your server, recording might be lost.

Was this article helpful?

Related Articles