Misc. Dialplan Tools record session

From FreeSWITCH Wiki

Jump to: navigation, search

record_session /tmp/test.gsm

Description

Records an entire phone call or session. The file extension will define the recorded file's format. Use the console command show file to determine possible formats.

Example: 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.

You can use an external application to resample, manipulate the recorded file like sox.

Dialplan Example

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 /usr/local/freeswitch/recordings/

<extension name="ext-666">
  <condition field="destination_number" expression="^666$">
    <action application="set" data="RECORD_TITLE=Recording ${destination_number} ${caller_id_number} ${strftime(%Y-%m-%d %H:%M)}"/>
    <action application="set" data="RECORD_COPYRIGHT=(c) 1980 Factory Records, Inc."/>
    <action application="set" data="RECORD_SOFTWARE=FreeSwitch"/>
    <action application="set" data="RECORD_ARTIST=Ian Curtis"/>
    <action application="set" data="RECORD_COMMENT=Love will tear us apart"/>
    <action application="set" data="RECORD_DATE=${strftime(%Y-%m-%d %H:%M)}"/>
    <action application="set" data="RECORD_STEREO=true"/>
    <action application="record_session" data="$${base_dir}/recordings/${strftime(%Y-%m-%d-%H-%M-%S)}_${destination_number}_${caller_id_number}.wav"/>
    <action application="set" data="ringback=${us-ring}"/>
    <action application="bridge" data="sofia/external/18007842433@sip.voip-provider.com"/>
  </condition>
</extension>

Related

Personal tools