Reputation: 61
How can I pass parameters to my TwiML code that is generated by my page i.e. /twilio/instruction.aspx? I am using Twilio Javascript library on my /twilio/call.aspx page and using following code, I am able to get first parameter correctly on the instructions page but the remaining two are not available.
function call() {
// get the phone number to connect the call to
params = { "PhoneNumber": $("#number").val(), "clientName": $("clientName").val(), "Address": $("address").val() };
Twilio.Device.connect(params);
}
Please note that the instructions page is automatically executed by the Twilio when Twilio.Device.connect(params);
is executed on call.aspx page.
Regards,
Tahir Ahmed
Upvotes: 0
Views: 794
Reputation: 10366
Twilio evangelist here.
What you have looks pretty correct to me. In the URL you have set as your TwiML Applications Voice URL, you would just retrieve those values as Form parameters:
request.Form["PhoneNumber"]
Hope that helps.
Upvotes: 0
Reputation: 126
I had similar issue. I got it fixed by urlencoding the data manually and adding to the url.
if you have a lot of parameters to pass but also the call.apx and instruction.aspx is on the same server i would suggest you to have a dictionary and pass the key alone on the params, and you can retrieve the data when you get the key back in the instruction.aspx
Upvotes: 1