Records an entire phone call or session.
Multiple media bugs can be placed on the same channel.
Simply set the file extension to define the recorded file's format. Use the console command
show file to display available formats.
record_session /tmp/test.gsm will produce a GSM encoded voice file which is raw data and is not in any container (e.g. wav, ogg, etc.). The sampling rate can not be influenced by the filename.
record_session /tmp/test.mp3 will produce an MP3 file if mod_shout is loaded.
The following example, once added to your dialplan, will accept a call on extension 666, enable recording for the session, and bridge the call to the toll-free PSTN number through a VoIP provider. Under default FreeSWITCH installations, recordings through the extension below will be saved to
Record Calls To Extensions
To record all phone calls between extensions do the following. Make a directory under freeswitch/recordings/archive/. Then edit Local_Extension in dialplan in conf/dialplan/default.xml
Then add the following actions.
Record Calls From Extensions
Add the following in /usr/local/freeswitch/conf/dialplan/default/
Controlling When Recording Begins
Recording normally starts as soon as the bridge application is called -- often times this isn't desired. You can force the recording to start after the call is actually answered by setting the channel variable media_bug_answer_req.
Another way to record calls when the call is answered
If you happen to be using group_confirm_key/group_confirm_file as part of your bridge, you may want to delay the start of the recording until the confirm action is completed. This can be accomplished through use of bridge_pre_execute_bleg_app/bridge_pre_execute_bleg_data:
Recording a Call On Demand
If your sip client supports a record key or free function keys which allow sending DTMF you can activate server based recording during the call. Recording starts with activating the recording, so not the complete call is recorded.
There are at least two ways to do this: via DTMF or via SIP INFO.
Continue Recording on Transfer
If you want the call recording to continue after transferring, set the recording_follow_transfer variable to true.
Activating via DTMF
Recording on demand via DTMF is done via dptools' "bind_meta_app" application as shown in the default dialplan which ships with FreeSWITCH.
Here is an example dialplan:
Lastly, configure your SIP client to send "*2" as DTMF within dialog. When that SIP client is called and the call is established it can activate recording by pressing the configured key one time. Pressing it a second time it stops the recording. The other party doesn't hear the DTMFs but possibly its comfort noise generation (CNG) might stop momentarily. The above dialplan example is set to allow the SIP client to turn recording on and off when it is the recipient of a call (i.e. it is the B leg). Change the bind_meta_app settings if you want the originating leg (i.e. the A leg) also to be able to record the call:
bind_meta_app in this example is listening on both the a and b legs.
Activating via SIP INFO
Recording on demand via SIP INFO messages seems to be independent from "bind_meta_app" but obey the RECORD... channel variables. Either the caller or the called party can initiate recording by sending a SIP INFO message with the "Record: on" header. In fact, both parties may initiate recording simultaneously, so be sure to make the record-template such that two sessions will not try to simultaneously record to the same file.
Set in your SIP profile the following parameter:
Now your SIP client can send a SIP INFO message within the call to activate the recording similar to the following:
To stop recording your SIP client should send a SIP INFO message within the call similar to the following:
The way of activating this seems to be changed:
You can start or stop recording a session via SIP-INFO messages from a SIP phone. To get this working you need to set "recordings_dir" in vars.xml. In your sip-profile you have to add this:
It seems that the bind_meta_app options are not accessible to this way of session recording...
If the Sofia profile that the SIP INFO message is received by has no record-template defined, FreeSWITCH will respond with "488 Recording not enabled". Through the absence of the record-template config option, you can effectively disable SIP INFO recording on selected Sofia profiles (eg. public-facing profiles, such as "external").
This is tested with FreeSWITCH Version 1.0.head (17097:17188M) and Snom 370, 820 and 870 FW 8.2+
Post Processing Recordings in the Dialplan
These two variables allow the post–processing of recorded audio. The reason this is required is if the A leg hangs up first in a call, the dialplan stops being processed, and then you aren't able to take action on the file that was recorded. These variables take the form of:
- Stop Record Session
- mod_dptools: record
- Dialplan XML
- Channel Variables
- record_rateActivating via DTMF