Learn FreeSWITCH Part 10 Record And Speak - Omid-Mohajerani/freeswitch GitHub Wiki

In the Next Video, I want to talk about how we define IVR, so we need to learn 2 useful applications in FreeSWITCH

Record Application in FreeSWITCH

Record application is used to record voice messages

Record Application in FreeSWITCH

Example:

  <extension name="Record">
    <condition field="destination_number" expression = "^50001$">
     <!--default terminator is *. Keyword 'none' disables on-key termination /-->
     <!--following line will set # as recording session terminator /-->
     <action application="set" data="playback_terminators=#"/>
     <action application="record" data="/tmp/myrecording.wav 20 200"/>
     <action application="playback" data="/tmp/myrecording.wav" />
    </condition>
  </extension>

How to Stop Recording?

Either by hanging up, or setting the playback_terminators variable.

After recording stops, the record app sets the following read-only channel variables:

record_ms — duration of the most recently recorded file in milliseconds

record_samples — number of recorded samples

playback_terminator_used — TouchTone digit used to terminate recording

Speak Application in FreeSWITCH

Speaks a string or file of text to the channel using the defined text-to-speech engine.

 <extension name="flite">
   <condition field="destination_number" expression="^50002">
     <action application="set" data="tts_engine=flite"/>
     <action application="set" data="tts_voice=slt"/>/
     <action application="speak" data="For sales please press 1, for support please press 2"/>
   </condition>
 </extension>

Voices are 16khz, and are:

slt (female voice)

rms (male voice)

awb (male voice)

kal (male voice)

Reference: https://freeswitch.org/confluence/pages/viewpage.action?pageId=6587041 https://freeswitch.org/confluence/display/FREESWITCH/mod_dptools%3A+speak https://freeswitch.org/confluence/display/FREESWITCH/mod_flite

⚠️ **GitHub.com Fallback** ⚠️