Tropo is part of CiscoLearn More

Recording Audio

Want to record what the user has to say? Just use the record method.

The following example includes the recordURL parameter, which defines where the recording will be sent. By default, that's all you need to include. Tropo's recording system allows you to set multiple URLs in case your first one fails (more on that later), so the recordURL parameter is an array with a single item in these examples:

say("Welcome to the hotline!");
record("Tell us how you feel!", {
       recordURL: [{url: "http://example.com/recording.js"}]
       }
    );
say "Welcome to the hotline!"
record "Tell us how you feel!", {
    :recordURL => [{:url => "http://example.com/recording.rb"}]
    }
<?php
say("Welcome to the hotline!");
record("Tell us how you feel!", array (
       "recordURL"=>array(array("url" => "http://example.com/recording.php"))
       )
);
?>
say("Welcome to the hotline!")
record("Tell us how you feel!", {
    "recordURL":[{"url": "http://example.com/recording.py"}]
    }
)
say("Welcome to the hotline!")
record("Tell us how you feel!", [
    recordURL: [[url: "http://example.com/recording.groovy"]]
    ]
)

When the recording is completed, it will be sent as an HTTP POST to the URI you specified. The file will arrive as if it had been uploaded using an HTML form using a File form field that looks like this: <input type="file" name="filename"/>.

There a couple typical optional parameters that you might want to set. The following example sets the recording beep to play and it also defines the timeout (the amount of time Tropo will wait -- in seconds and after sending or playing the prompt -- for the user to begin a response) as 10 seconds instead of the default 30:

say("Welcome to the hotline!");
record("Tell us how you feel!", {
       beep:true,
       timeout:10,
       recordURL: [{url: "http://example.com/recording.js"}]
       }
    );
say "Welcome to the hotline!"
record "Tell us how you feel!", {
    :beep => true,
    :timeout => 10,
    :recordURL => {:url => "http://example.com/recording.rb"}
    }
<?php
say("Welcome to the hotline!");
record("Tell us how you feel!", array (
       "beep" => true,
       "timeout" => 10,
       "recordURL"=>array("url" => "http://example.com/recording.php")
       )
);
?>
say("Welcome to the hotline!")
record("Tell us how you feel!", {
    "beep":True,
    "timeout":10,
    "recordURL":{"url": "http://example.com/recording.py"}
    }
)
say("Welcome to the hotline!")
record("Tell us how you feel!", [
    beep:true,
    timeout:10,
    recordURL: [url: "http://example.com/recording.groovy"]
    ]
)

The recording file is sent to your recordURL after recording completes and will take a few moments to reach to your server.