Choose:
Migrating from Twilio
Are you thinking of switching from Twilio to Telnyx? This document describes some key differences between the platforms as well as implementation details for standard SDK features to make your experience as smooth as possible.
How Twilio’s Voice SDK works
With Twilio, a lot of setup is required before you can get started making calls. because users are required to have their own backend in place, with Telnyx this is not needed.
TwiML is similar to Call Control that Telnyx provides - but it isn’t a requirement when using our Voice SDK.
In short, Twilio’s Voice SDK flow is as follows:
- Your browser / mobile device connects to Twilio
- Twilio connects to your pre-deployed server node application which can generate a token and receive voice webhooks
- Twilio sends you a webhook to get TwiML instructions
- Your backend server node responds with a set of TwiML instructions that you have defined for certain use cases (eg. call a number, connect to a conference)
- Twilio receives your TwiML instructions and executes them on your behalf. (eg. Dial a number contained in your TwiML instructions)
- Twilio creates a VoIP connection between your callee and your application.
Flow looks like this:
Caller > Twillio Voice SDK > Twillio Servers > customer backend (Webhook receiver) > Twillio Servers > Callee
It's much easier with the Telnyx Voice SDK
Telnyx’s Voice SDK has been designed to be as simple as possible to make/receive calls in a matter of minutes. Unlike Twilio, there is no backend setup required.
Simply, implement the Voice SDK library on the platform of your choice, and log in with your Telnyx Connection and you’re all set.
To summarize:
- Your browser / mobile device connects to Telnyx
- You send an invitation from the client
- If accepted, Telnyx creates a VoIP connection between your callee and your application.
Flow looks like this:
Caller > Telnyx WebRTC SDK > Telnyx servers > Callee
Optionally, if you would like to control the call, like you do with TwiML, you can use Call Control.
Pricing
Below is a comparison table for the United States region. (Note regional prices may vary).
Service | Telnyx Termination | Twilio Termination | Telnyx Origination | Twilio Origination |
---|---|---|---|---|
Local Calls | 0.0070/ min | 0.0130/ min | 0.0055/ min | 0.0085/ min |
Toll-Free Call | 0.0020/ min | 0.0130/ min | 0.0170/ min | 0.0220/ min |
Browser / App Calling | 0.0020/ min | 0.0040/ min | 0.0020/ min | 0.0040/ min |
SIP Interface | 0.0020/ min | 0.0040/ min | 0.0020/ min | 0.0040/ min |
Secure Media | included | included | included | included |
Sources: https://telnyx.com/pricing/call-control https://www.twilio.com/voice/pricing/us
Comparative Table (Web SDK)
Telnyx RTC | Twilio Voice SDK | |
Portal and server initial configuration |
|
|
SDK Installation |
|
|
To make calls |
|
|
Connect
Telnyx
// Initialize the client
const client = new TelnyxRTC({
/* Use a JWT to authenticate (recommended) */
login_token: login_token,
/* or use your Connection credentials */
// login: username,
// password: password,
});
// Connect and login
client.connect();
Twilio
// Download the helper library from https://www.twilio.com/docs/node/install
// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = require('twilio')(accountSid, authToken);
Make a call
Telnyx
const call = client.newCall({
// Destination is required and can be a phone number or SIP URI
destinationNumber: '18004377950',
callerNumber: '155531234567',
});
Twilio
client.calls
.create({
url: 'https://example.com',
to: '+15558675310',
from: '+15017122661'
})
.then(call => console.log(call.sid));
Answer an incoming a call
Note: in Twilio’s case, a backend server needs to be setup. We have included a Python flask example as well as the client implementation
Telnyx
client.on('telnyx.notification', (notification) => {
const call = notification.call;
if (notification.type === 'callUpdate' && call.state === 'ringing') {
call.answer();
}
});
Twilio
// Backend Server, in this case Python with flask
@app.route('/handle_calls', methods=['POST'])
def call():
p.pprint(request.form)
response = VoiceResponse()
dial = Dial(callerId=twilio_number)
if 'To' in request.form and request.form['To'] != twilio_number:
print('outbound call')
dial.number(request.form['To'])
else:
print('incoming call')
caller = request.form['Caller']
dial = Dial(callerId=caller)
dial.client(twilio_number)
return str(response.append(dial))
// Client
device.on("incoming", function (conn) {
conn.accept();
});
Migrating from Twilio
Are you thinking of switching from Twilio to Telnyx? This document describes some key differences between the platforms as well as implementation details for standard SDK features to make your experience as smooth as possible.
How Twilio’s Voice SDK works
With Twilio, a lot of setup is required before you can get started making calls. because users are required to have their own backend in place, with Telnyx this is not needed.
TwiML is similar to Call Control that Telnyx provides - but it isn’t a requirement when using our Voice SDK.
In short, Twilio’s Voice SDK flow is as follows:
- Your browser / mobile device connects to Twilio
- Twilio connects to your pre-deployed server node application which can generate a token and receive voice webhooks
- Twilio sends you a webhook to get TwiML instructions
- Your backend server node responds with a set of TwiML instructions that you have defined for certain use cases (eg. call a number, connect to a conference)
- Twilio receives your TwiML instructions and executes them on your behalf. (eg. Dial a number contained in your TwiML instructions)
- Twilio creates a VoIP connection between your callee and your application.
Flow looks like this:
Caller > Twillio Voice SDK > Twillio Servers > customer backend (Webhook receiver) > Twillio Servers > Callee
It's much easier with the Telnyx Voice SDK
Telnyx’s Voice SDK has been designed to be as simple as possible to make/receive calls in a matter of minutes. Unlike Twilio, there is no backend setup required.
Simply, implement the Voice SDK library on the platform of your choice, and log in with your Telnyx Connection and you’re all set.
To summarize:
- Your browser / mobile device connects to Telnyx
- You send an invitation from the client
- If accepted, Telnyx creates a VoIP connection between your callee and your application.
Flow looks like this:
Caller > Telnyx WebRTC SDK > Telnyx servers > Callee
Optionally, if you would like to control the call, like you do with TwiML, you can use Call Control.
Pricing
Below is a comparison table for the United States region. (Note regional prices may vary).
Service | Telnyx Termination | Twilio Termination | Telnyx Origination | Twilio Origination |
---|---|---|---|---|
Local Calls | 0.0070/ min | 0.0130/ min | 0.0055/ min | 0.0085/ min |
Toll-Free Call | 0.0020/ min | 0.0130/ min | 0.0170/ min | 0.0220/ min |
Browser / App Calling | 0.0020/ min | 0.0040/ min | 0.0020/ min | 0.0040/ min |
SIP Interface | 0.0020/ min | 0.0040/ min | 0.0020/ min | 0.0040/ min |
Secure Media | included | included | included | included |
Sources: https://telnyx.com/pricing/call-control https://www.twilio.com/voice/pricing/us
Comparative Table (Android SDK)
Telnyx RTC | Twilio Voice SDK | |
Portal and server initial configuration |
|
|
SDK Installation |
|
|
Android Minimum API Level | Android 23 (6) and higher | Android 16 (4.1) and higher |
Java Compatibility |
sourceCompatibility 1.8
targetCompatibility 1.8 |
sourceCompatibility 1.8
targetCompatibility 1.8 |
Language | Kotlin SDK Kotlin Sample app Compose Android Sample App |
Java SDK
Java Sample app |
To make calls |
|
|
Receiving calls |
|
|
Push notifications setup (CLI) |
|
|
Push notification setup on the client application |
|
|
Connect
Note: in Twilio’s case, for their mobile SDKs, they connect and authenticate per call rather than one initial connection
Telnyx
val telnyxClient = TelnyxClient(context)
telnyxClient.connect()
telnyxClient.credentialLogin(credentialConfig)
Twilio
val contact = (dialog as AlertDialog).findViewById<EditText>(R.id.contact)
params.put("to", contact.text.toString())
val connectOptions: ConnectOptions = Builder(accessToken)
.params(params)
.build()
activeCall = Voice.connect([email protected], connectOptions, callListener)
Make a call
Telnyx
telnyxClient.call.newInvite(callerName, callerNumber, destinationNumber, clientState)
Twilio
val contact = (dialog as AlertDialog).findViewById<EditText>(R.id.contact)
params.put("to", contact.text.toString())
val connectOptions: ConnectOptions = Builder(accessToken)
.params(params)
.build()
activeCall = Voice.connect([email protected], connectOptions, callListener)
Answer an incoming a call
Telnyx
mainViewModel.getSocketResponse()
?.observe(this, object : SocketObserver<ReceivedMessageBody>() {
SocketMethod.INVITE.methodName -> {
val inviteResponse = data.result as InviteResponse
telnyxClient.call.acceptCall(inviteResponse.callId, inviteResponse.callerIdNumber)
}
})
Twilio
// Receive Intent from notification:
private fun handleIncomingCallIntent(intent: Intent?) {
if (intent != null && intent.action != null) {
val action = intent.action
activeCallInvite = intent.getParcelableExtra<Parcelable>(Constants.INCOMING_CALL_INVITE)
activeCallNotificationId = intent.getIntExtra(Constants.INCOMING_CALL_NOTIFICATION_ID, 0)
when (action) {
Constants.ACTION_ACCEPT -> answer()
else -> {}
}
}
}
// answer the call
private fun answer() {
activeCallInvite.accept(this, callListener)
}
Migrating from Twilio
Are you thinking of switching from Twilio to Telnyx? This document describes some key differences between the platforms as well as implementation details for standard SDK features to make your experience as smooth as possible.
How Twilio’s Voice SDK works
With Twilio, a lot of setup is required before you can get started making calls. because users are required to have their own backend in place, with Telnyx this is not needed.
TwiML is similar to Call Control that Telnyx provides - but it isn’t a requirement when using our Voice SDK.
In short, Twilio’s Voice SDK flow is as follows:
- Your browser / mobile device connects to Twilio
- Twilio connects to your pre-deployed server node application which can generate a token and receive voice webhooks
- Twilio sends you a webhook to get TwiML instructions
- Your backend server node responds with a set of TwiML instructions that you have defined for certain use cases (eg. call a number, connect to a conference)
- Twilio receives your TwiML instructions and executes them on your behalf. (eg. Dial a number contained in your TwiML instructions)
- Twilio creates a VoIP connection between your callee and your application.
Flow looks like this:
Caller > Twillio Voice SDK > Twillio Servers > customer backend (Webhook receiver) > Twillio Servers > Callee
It's much easier with the Telnyx Voice SDK
Telnyx’s Voice SDK has been designed to be as simple as possible to make/receive calls in a matter of minutes. Unlike Twilio, there is no backend setup required.
Simply, implement the Voice SDK library on the platform of your choice, and log in with your Telnyx Connection and you’re all set.
To summarize:
- Your browser / mobile device connects to Telnyx
- You send an invitation from the client
- If accepted, Telnyx creates a VoIP connection between your callee and your application.
Flow looks like this:
Caller > Telnyx WebRTC SDK > Telnyx servers > Callee
Optionally, if you would like to control the call, like you do with TwiML, you can use Call Control.
Pricing
Below is a comparison table for the United States region. (Note regional prices may vary).
Service | Telnyx Termination | Twilio Termination | Telnyx Origination | Twilio Origination |
---|---|---|---|---|
Local Calls | 0.0070/ min | 0.0130/ min | 0.0055/ min | 0.0085/ min |
Toll-Free Call | 0.0020/ min | 0.0130/ min | 0.0170/ min | 0.0220/ min |
Browser / App Calling | 0.0020/ min | 0.0040/ min | 0.0020/ min | 0.0040/ min |
SIP Interface | 0.0020/ min | 0.0040/ min | 0.0020/ min | 0.0040/ min |
Secure Media | included | included | included | included |
Sources: https://telnyx.com/pricing/call-control https://www.twilio.com/voice/pricing/us
Comparative Table (iOS SDK)
Telnyx RTC | Twilio Voice SDK | |
Portal and server initial configuration |
|
|
SDK Installation |
|
|
To make calls |
|
|
Push notifications setup (Portal) |
|
|
Push notification setup on the client APP |
|
|
Connect
Note: in Twilio’s case, for their mobile SDKs, they connect and authenticate per call rather than one initial connection
Telnyx
let telnyxClient = TxClient()
do {
try telnyxClient.connect(txConfig: txConfigToken)
} catch let error {
print("ViewController:: connect Error \(error)")
}
Twilio
let connectOptions = ConnectOptions(accessToken: accessToken) { builder in
builder.params = [twimlParamTo: self.outgoingValue.text ?? ""]
builder.uuid = uuid
}
let call = TwilioVoiceSDK.connect(options: connectOptions, delegate: self)
Make a call
Telnyx
self.currentCall = try self.telnyxClient?.newCall(callerName: "Caller name", callerNumber: "155531234567",
// Destination is required and can be a phone number or SIP URI
destinationNumber: "18004377950",
callId: UUID.init())
Twilio
let connectOptions = ConnectOptions(accessToken: accessToken) { builder in
builder.params = [twimlParamTo: self.outgoingValue.text ?? ""]
builder.uuid = uuid
}
let call = TwilioVoiceSDK.connect(options: connectOptions, delegate: self)
Answer an incoming a call
Telnyx
extension ViewController: TxClientDelegate {
//....
func onIncomingCall(call: Call) {
// We are automatically answering any incoming call as an example, but
// maybe you want to store a reference of the call, and answer the call after a button press.
self.myCall = call.answer()
}
}
Twilio
// Listen for telephony notification (after prior setup)
extension ViewController: CXProviderDelegate {
func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) {
NSLog("provider:performAnswerCallAction:")
performAnswerVoiceCall(uuid: action.callUUID) { success in
if success {
NSLog("performAnswerVoiceCall() successful")
} else {
NSLog("performAnswerVoiceCall() failed")
}
}
action.fulfill()
}
}
// answer the call
func performAnswerVoiceCall(uuid: UUID, completionHandler: @escaping (Bool) -> Void) {
guard let callInvite = activeCallInvites[uuid.uuidString] else {
NSLog("No CallInvite matches the UUID")
return
}
let acceptOptions = AcceptOptions(callInvite: callInvite) { builder in
builder.uuid = callInvite.uuid
}
let call = callInvite.accept(options: acceptOptions, delegate: self)
}