DevSnippets

Home » FreeSWITCH » Configure Stereo Audio Recording in FreeSWITCH Dialplan

Configure Stereo Audio Recording in FreeSWITCH Dialplan

FreeSWITCH Record Calls in Stereo Format (Caller/Callee Separation) 24 views

Code

<include>
  <extension name="asterisk01">
    <condition field="destination_number" expression="^181-(\d+)$">
      <action application="answer"/>
      <action application="set" data="new_dialed_number=$1"/>
      <action application="set" data="destination_number=$1"/>
      <action application="set" data="record_stereo=true"/>
      
      <action application="record_session" data="/var/recordings/${uuid}_stereo.wav"/>
      <action application="set" data="execute_on_answer=uuid_record ${uuid} start /var/recordings/${uuid}_stereo.wav stereo"/>
      <action application="bridge" data="{api_hangup_hook=jsapi::callDuration.js}sofia/gateway/DEVELOPM-3554/$1"/>
      <action application="hangup"/>
    </condition>
  </extension>
</include>

Explanation

Summary of What This Dialplan Does
Accepts calls to numbers like 181-12345678
Extracts the number (12345678)
Enables stereo recording
Starts recording the entire call
Bridges the call to an external gateway
Logs call duration via JS hook
Ends the call

Rate this snippet

Click to rate

Have a Better Solution?

Know a more efficient way to solve this problem? Share your own code snippet and help the community!

Submit Your Version