Tropo is part of CiscoLearn More

Mixing Text & Voice in a Single App

Need a multimodal, multichannel application? Tropo can operate across multiple networks using the same application with relative ease. As an example, say you receive a phone call from a customer and recorded what they had to say - now you want to send a text message out to someone notifying them the recording exists. All of it can be handled in one application like the example that follows - however, note that you do need to disconnect the first session using hangup before you can launch the second:

record("We're not available right now, please leave your message at the beep.", {
   beep:true,
   recordURI:"http://example.com/phone_call.js"
    }
);

hangup();

call('+14075550100', {
  network:"SMS"});
say("Received office voice mail");
record "We're not available right now, please leave your message at the beep.", {
   :beep => true,
   :recordURI => "http://example.com/phone_call.rb"
    }

hangup

call '+14075550100', {
  :network => 'SMS'}
say "Received office voice mail."
<?php

record("We're not available right now, please leave your message at the beep.", array(
   "beep"=>"true",
   "recordURI"=>"http://example.com/phone_call.php"
    )
);

hangup();

call("+14075550100", array(
  "network" => "SMS")
);
say ("Received office voice mail.")

?>
record("We're not available right now, please leave your message at the beep.", {
   "beep":true,
   "recordURI":"http://example.com/phone_call.py"
})

hangup()

call("+14075550100", {
  "network":"SMS"})
say("Received office voice mail.")
record("We're not available right now, please leave your message at the beep.", [
   beep: true,
   recordURI: "http://example.com/phone_call.groovy"
])

hangup()

call('+14075550100', [
  network: 'SMS'])
say("Received office voice mail.")

Without hangup, the call would be ignored and the say at the end would happen on the same session. The user would essentially hear "Please leave your message at the beep", as expected, then if they stayed on the line past one of the timeout values, they would hear "Received office voice mall". The call method would be ignored all together.

There is an alternative however, if you needed to launch the outbound message or phone call before hanging up. Check out the next chapter for information on the "message" shortcut.