user2158382 user2158382 - 5 months ago 33x
Javascript Question

Twilio: Where do the params from Twilio.Device.connect() get sent to

The Twilio JS library has a function called

which takes params. In the documentation it says these params get sent to the server, but it never specifies which server endpoint it goes to or how to set this up.

Can anybody explain?


Twilio evangelist here.

The parameters get converted into form encoded values and included in the HTTP request that is made to the URL configured for your TwiML App.

So for example, if you include parameters like this:

params = {"PhoneNumber": "+15555555555"};

they will get converted into this set of form encoded values and included in the POST request Twilio makes to your Twiml Apps Voice URL:


You can use whatever mechanism in your server side framework that exposes form values to grab those parameters and use them to generate and return TwiML. For example, in PHP:

$phoneNumber = $_REQUEST["PhoneNumber"];

Hope that helps.