Tropo WebAPI Development Guide Home  |  Frameset Home

  Recording Audio  |  TOC  |  Passing in Parameters  

Making a Call


Making an outgoing call requires two steps - first, you need to write the code telling Tropo who to call and what to do if/when they answer. The second step is telling Tropo to run your code.

Here's an example of a simple outbound app that places a quick call:

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

post '/index.json' do
  
  t = Tropo::Generator.new
  
  t.call(:to => "+14155550100")
  t.say(:value => "Tag, you're it!")

  t.response
  
end

var http = require('http');
var tropo_webapi = require('tropo-webapi');

var server = http.createServer(function (request, response) {
	
    var tropo = new TropoWebAPI();
    
    tropo.call("+14155550100");
    tropo.say("Tag, you're it!");
	
    response.end(TropoJSON(tropo));

}).listen(8000); 
<?php

require 'tropo.class.php';

$tropo = new Tropo();

$tropo->call("+14155550100");
$tropo->say("Tag, you're it!");

$tropo->RenderJson();
?>
from itty import *
from tropo import Tropo

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

	t = Tropo()

	t.call("+14155550100")
	t.say("Tag, you're it!")
	
	return t.RenderJson()

run_itty(server='wsgiref', host='0.0.0.0', port=8888)
{"tropo":[
      {"call":[{"to":"+14155550100"}]},
      {"say":[{"value":"Tag, you're it!"}]}
]}

You can also call multiple phone numbers or SIP addresses (or both) as an array; first to pick up, wins!

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

post '/index.json' do
  
  t = Tropo::Generator.new
  
  t.call(:to => ["+14075550100", "sip:user@252.123.45.67"])
  t.say(:value => "Tag, you're it!")

  t.response
  
end

var http = require('http');
require('tropo-webapi');

var server = http.createServer(function (request, response) {
	
    var tropo = new TropoWebAPI();
    
    tropo.call(["+14075550100", "sip:user@252.123.45.67"]);
    tropo.say("Tag, you're it!");
	
    response.end(TropoJSON(tropo));

}).listen(8000); 
<?php

require 'tropo.class.php';

$tropo = new Tropo();

$tropo->call(array("+14075550100", "sip:user@252.123.45.67"));
$tropo->say("Tag, you're it!");

$tropo->RenderJson();
?>
from itty import *
from tropo import Tropo, Session

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

	t = Tropo()

	t.call(["+14075550100", "sip:user@252.123.45.67"])
	t.say("Tag, you're it!")
	
	return t.RenderJson()

run_itty(server='wsgiref', host='0.0.0.0', port=8888)
{"tropo":[
      {"call":{
            "to":[
               "+14155550100",
               "sip:user@252.123.45.6"
            ]}
      },
      {"say":[{"value":"Tag, you're it!"}]}
]}

To then launch the code, Tropo provides you with a URL to hit, which tells Tropo to launch your application. You also get a secret API key called a “token” that ensures only you can start your code (we recommend guarding the token like you would a password, or that exclusive ability could be jeopardized). Your token is found just under the phone numbers when you view your application in the Tropo User Interface:


Then either run the link through a browser or utilize an HTTP client like curl (the http client that comes with your favorite language is absolutely fine) and set it to use GET. You can also use a POST with XML if you'd prefer - this page outlines the syntax you would use.

Note, if you're attempting to make an call to a non-U.S. destination, there are restrictions. Review this page for more information. Also, the maximum session time with Tropo is 2 hours, so the maximum time a call can be connected is also 2 hours.

Want to include parameters in the URL you use to launch your application, such as the message content?

Next Step: Passing Parameters



Additional Reading

A complete list of all the parameters for call can be found here. While you can assign a value to network for a voice call ('PSTN", "SIP" or "INUM"), it's not a required field and can be left blank. Note that SKYPE is not a valid network, as SKYPE does not allow calls to standard Skype IDs - you need a Skype-In number and that operates like a standard telephone number. SKYPE will show up as the network for an inbound call originating from Skype, however.


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

login
  Recording Audio  |  TOC  |  Passing in Parameters  

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