Tropo WebAPI Development Guide Home  |  Frameset Home

  Using the Message Shortcut  |  TOC  |  Recording the Entire Call  

Recording Caller Input


While this QuickStart is similar to the Recording Audio subsection of Answering Incoming Calls, this one will go into more detail regarding optional parameters and functionality of the record method. You might want to read that page first before delving into this Quickstart.

The following example is rather comprehensive and includes several of the optional parameters. We'll describe them in order:


Now for the actual code:

require 'tropo-webapi-ruby'
require 'sinatra'

post '/record.json' do
  
  t = Tropo::Generator.new
  
  t.record({ :name => 'recording',
             :timeout => 10,
             :maxSilence => 7,
             :maxTime => 60,
             :format => "audio/mp3",
             :url => 'ftp://example.com/filename.mp3',
             :username => "tropocloud",
             :password => "password", 
             :choices => { :terminator => "#"}
             }) do
                  say :value => 'Please leave a message'
              end
  t.response
  
end
var http = require('http');
var tropo_webapi = require('tropo-webapi');

var server = http.createServer(function (request, response) {

    var tropo = new TropoWebAPI();
	
    var say = new Say("Please leave a message.");
    var choices = new Choices(null, null, "#");

    //function(attempts, bargein, beep, choices, format, maxSilence, maxTime, method, minConfidence, name, required, say, timeout, transcription, url, password, username)
    tropo.record(null, null, null, choices, "audio/mp3", 7, 60, null, null, "recording", null, say, 10, null, "ftp://example.com/filename.mp3", "password", "tropocloud");
	
    response.end(TropoJSON(tropo));

}).listen(8000); 
<?php

require('tropo.class.php');

$tropo = new Tropo();
 
$tropo->record(array(
    'name' => 'recording',
    'say' => 'Please leave a message.',
    'url' => 'ftp://example.com/filename.mp3',
    'terminator' => '#',
    'timeout' => 10,
    'maxSilence' => 7,
    'maxTime' => 60,
    'format' => 'audio/mp3',
    'username' => 'tropocloud',
    'password' => 'password'
  ));
 
$tropo->RenderJson();
?>
from itty import *
from tropo import Tropo

@post('/index.json')
def index(request):

	t = Tropo()

	t.record(name = "recording", timeout = 10, maxSilence = 7, maxTime = 60, format = "audio/mp3", choices = {"terminator": "#"} , say = "Please leave a message.", url = "ftp://example.com/filename.mp3", username = "tropocloud", password = "password")
	
	return t.RenderJson()

run_itty(server='wsgiref', host='0.0.0.0', port=8888)
{
   "tropo":[
      {
         "record":{
            "say":{
               "value":"Please leave a message"
            },
            "name":"foo",
            "timeout":10,
            "maxSilence":7,
            "maxTime":60,
            "format":"audio/mp3",
            "url":"ftp://example.com/filename.mp3",
            "username":"tropocloud",
            "password":"password",
            "choices":{
               "terminator":"#"
            }
         }
      }
   ]
}

This example will only record the user's response to the prompt; if you want to record more than that - both the prompt and the response, for example - you would use startRecording and stopRecording instead.

Next Step: Recording the Entire Call


  ANNOTATIONS: EXISTING POSTS
0 posts - click the button below to add a note to this page

login
  Using the Message Shortcut  |  TOC  |  Recording the Entire Call  

© 2012 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site