Because Twilio has high name recognition, many organizations consider it first when investigating communications platforms as a service (CPaaS). After trying Twilio, though, they may find themselves less than completely satisfied, maybe because of high pricing or unsatisfactory support or some other factor. Fortunately, highly regarded Twilio alternatives can help ease the pain. We suggest Plivo, which earns the
If you’re not satisfied with Twilio, you don’t have to rip it out and replace it with a Twilio alternative. You can put Plivo in place for a pilot program for a single use case and see how it performs. If you’re satisfied, you can switch over, or you can use Plivo in parallel with Twilio, or as a backup alternative in case your primary provider experiences downtime.
Migrating from Twilio to Plivo is simple. The two companies’ API structures, implementation mechanisms, XML structure, SMS message processing, and voice call processing are similar. Twilio and Plivo enjoy feature parity in virtually every aspect, including
You can migrate your existing application from Twilio to Plivo by refactoring the code, or you can try Plivo High-Level Objects (PHLO), an intuitive visual workflow builder. Follow one of Plivo’s quickstart guides for your preferred language and web framework. Plivo offers server SDKs in seven languages: PHP, Node.js, .NET, Java, Python, Ruby, and Go.
Let’s take a look at the code for a Ruby application that makes an outbound call in both Twilio to Plivo. Whether you use Ruby or one of the other supported languages, you can migrate from one platform to the other by refactoring just a few lines of code.
require 'rubygems'
require 'twilio-ruby'
account_sid = ENV['<TWILIO_ACCOUNT_SID>']
auth_token = ENV['<TWILIO_AUTH_TOKEN>']
@client = Twilio::REST::Client.new(account_sid, auth_token)
call = @client.calls.create(
url: 'http://demo.twilio.com/docs/classic.mp3',
to: '+1415555222',
from: '+14155551111'
)
puts call.sid
require 'rubygems'
require 'plivo'
include Plivo
include Plivo::Exceptions
auth_id = ENV['<PLIVO_AUTH_ID>']
auth_token = ENV['<PLIVO_AUTH_TOKEN>']
api = RestClient.new(auth_id,auth_token)
begin
response = api.calls.create(
'+14155551111',
['+14155552222'],
'https://s3.amazonaws.com/static.plivo.com/answer.xml'
)
puts response
rescue PlivoRESTError => e
puts 'Exception: ' + e.message
end
You can migrate an application for receiving and handling an incoming call just as easily.
require 'sinatra'
require 'twilio-ruby'
post '/twiml' do
# Start our TwiML response
Twilio::TwiML::VoiceResponse.new do |r|
r.say(message: 'Hello, world!', voice: 'alice')
end.to_s
end
include Plivo
include Plivo::XML
include Plivo::Exceptions
class PlivoController < ApplicationController
def inbound
response = Response.new
speak_body = 'Hello, world!'
response.addSpeak(speak_body)
xml = Plivo::PlivoXML.new(response)
render xml: xml.to_xml
end
end
The same goes for an application that automatically forwards an incoming call.
require 'sinatra'
require 'twilio-ruby'
post '/twiml' do
response = Twilio::TwiML::VoiceResponse.new
response.dial(number: '415-234-5678')
response.say(message: 'Goodbye')
puts response
end.to_s
end
def forward
response = Response.new
dial = response.addDial()
dest_number = "415-234-5678"
dial.addNumber(dest_number)
xml = PlivoXML.new(response)
puts xml.to_xml
render xml: xml.to_xml
end
We don’t want to overload you with code here (especially if you use a language other than Ruby). You can get more information about how to implement voice applications in Plivo from the
One of Plivo’s key principles is to keep things simple for developers while we allow them to build complex applications. See for yourself how simple it is for a Twilio developer to pick up Plivo.
Plivo’s simple APIs work in tandem with a comprehensive global network to let you build robust voice applications with low latency and high call quality. See for yourself by signing up for a free Plivo trial account that you can experiment with, which comes with free credits.