Toggling conference mute with the keypad

JustinDupree -

This example, written in Ruby, provides the caller with the ability to toggle mute at any time, after joining a conference, by entering a DTMF key assigned to the terminator parameter:

say "Joining the conference. Press start to mute or unmute yourself.", {:voice => "Simon"}

while $currentCall.isActive do
   conference "4567", {
      :terminator => "*",
      :mute => false,
      :playTones => false} 
   say "Mute on", {:voice => "Simon"}
   conference "4567", { 
      :terminator => "*",
      :mute => true,
      :playTones => false}
   say "Mute off", {:voice => "Simon"}
end
  • while $currentCall.isActive do - This instructs Tropo to execute the code encapsulated from the "do" to the "end" while the variable $currentCall.isActive returns "true" or "1". Essentially, as long as the caller is on the line, this loop will continue to execute.
  • conference - This defines the properties of the conference - "mute" is set to false initially and "playTones" is also false, so when the "terminator" is chosen, the tone will not be audible to the other members of the conference. So when the caller presses "*" they will be exited from the conference. For sake of this example, the conferenceID (4567) is hardcoded, but it can be a variable.
  • say - This will play a TTS message to the caller informing them that mute will now be ON: "Mute on".
  • conference - Exactly the same conference method as the original, but now the "mute" parameter is set to "true". If/when the caller presses "*" again they will exit the conference, a "say" will play, then the "while" loop will bring the call back to the first conference where "mute" is "false".
  • say - This will play a TTS message to the caller informing them that mute will now be OFF: "Mute off". After this plays, the call loops back to the first conference.
  • end - Marks the end of the code that should be included in the "while" loop.
Have more questions? Submit a request

0 Comments

Article is closed for comments.