Recorder Configurations
1- Recording Script
The first step we need to take on freeswitch is to download record.lua file.
Connect to the VM where free switch is installed.
Place it in the "scripts" directory. It can be found under "/usr/local/freeswitch/scripts/" or "/usr/share/freeswitch/scripts/" depending on whether you installed recorder from source or package, respectively.
Open record.lua and change the url
url = "http://<ip-address>:9900/mixer/sip-data"
. Andurl = "http://<ip-address>:9900/mixapi"
Create a directory with the path /var/vrs/recordings/cucmRecording using mkdir command.
Enter to this cucmRecording folder and create two more directories with names “streams“ and “sessions”.
Assign all user permissions to all these directories i.e cucmRecording, streams, sessions. this could be done using chmod command with 'R' tag
CODE#chmod 777 -R "/var/vrs/"
Edit/open the recording script (record.lua) which could be located on "/usr/local/freeswitch/scripts/" or "/usr/share/freeswitch/scripts/"
Inside record.lua assign the correct paths to the
"recording_dir"
, “recording_path
" and “mixedRecordingDir
" variables.
recording_dir = "/var/vrs/recordings/cucmRecording/streams/"
recording_path = "/var/vrs/recordings/cucmRecording/streams/"
mixedRecordingDir= "/var/vrs/recordings/cucmRecording/sessions/"
session:consoleLog("info", "/var/vrs/recordings/cucmRecording/sessions/")
2 - Dialplan Configuration
Switch to the dialplan directory
/usr/local/freeswitch/conf/dialplan
Add the following lines of code in the public .xml file. Provide your CUCM ip address
<IP_ADDRESS>
make sure the ip is in quotes e.g “192.168.1.26“.
<extension name="outside_call" continue="true">
<condition>
<action application="set" data="outside_call=true"/>
<action application="log" data="INFO PP-----${sip_from_host}--------------Starting Record Dialplan --------------12124"/>
<action application="export" data="RFC2822_DATE=${strftime(%a, %d %b %Y %T %z)}"/>
</condition>
</extension>
<extension name="CUCM Recording Profile">
<action application="log" data="INFO Entering Call from CUCM"/>
<condition field="${sip_from_host}" expression="<IP_ADDRESS>">
<action application="lua" data="record.lua"/>
</condition>
</extension>
in case of multiple CUCM we need to add all the ip addresses using '|' pipe. just as shown in condition field
<extension name="CUCM Recording Profile">
<action application="log" data="INFO Entering Call from CUCM"/>
<condition field="${sip_from_host}" expression="192.168.1.26|192.168.1.27|192.168.1.28">
<action application="lua" data="record.lua"/>
</condition>
</extension>
3 - SIP Profiles
Switch to the sip_profiles directory in
/usr/local/freeswitch/conf/sip_profiles.
Edit the internal.xml and external.xml SIP profiles and enable or uncomment the Third Party Call Control option in both of them.
Change the value flag to "true" if it is set to "false" or "proxy".
<param name="enable-3pcc" value="true"/>
We also need to add one more line to the internal.xml file if it doesn't already exist.
<param name="parse-all-invite-headers" value="true"/>
Now set the rtp-ip, sip-ip, ext-rtp-ip and ext-sip-ip equals to your recorder’s machine ip in external.xml. IP must be in “ “
<param name="rtp-ip" value="<ip-address>"/>
<param name="sip-ip" value="<ip-address>"/>
<param name="ext-rtp-ip" value="<ip-address>"/>
<param name="ext-sip-ip" value="<ip-address>"/>
4- Access Control List (ACL)
Navigate to the directory "/usr/local/freeswitch/conf/autoload_configs
"
Open the file "acl.conf.xml
" and add the following line “<node type="allow" cidr="<CUCM_IP>/32"/>
” under the "<node type="allow" domain="$${domain}"/>"
line. (Replace <CUCM_IP> with the IP address of your CUCM installation). In case of multiple CUCM send invite recorder, add multiple lines each to allow each one of the CUCMs.
<node type="allow" domain="$${domain}"/>
.
.
<node type="allow" cidr="<CUCM_IP>/32"/> <!--- Add this line and replace <CUCM_IP> with the IP address of your CUCM installation -->
5-Disable STUN
Navigate to the file vars.xml in /usr/local/freeswitch/conf
open the file and comment out following lines.
<X-PRE-PROCESS cmd="stun-set" data="external_rtp_ip=stun:stun.freeswitch.org"/>
<X-PRE-PROCESS cmd="stun-set" data="external_sip_ip=stun:stun.freeswitch.org"/>
Since it is a pre process we need to restart the Recorder.
#sudo systemctl restart freeswitch
6- Utilities
After the Recorder is restarted, Install the following utilities by running the commands:
#sudo apt install -y lua-socket
#sudo apt install -y lua-dkjson