PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, November 19, 2022

[FIXED] How can I pass parameters to a Twilio number voice URL with PHP?

 November 19, 2022     php, twilio, twilio-php     No comments   

Issue

Currently, I making a call using Twilio with their REST API using the Twilio php helper library, I'm dialing the a Twilio number which have a Voice URL setup, in this case, I need to send some parameters to that URL from the REST API call which I can't for the moment, because the URL is set on the Twilio console and I need to sent some user data based on the call, but I haven't seen anything that allows me to do that, in the documentation it's not saying anything about that, it's possible to achieve that?

Thank you beforehand


Solution

Twilio developer evangelist here.

You can set parameters in the Voice URL in the Twilio dashboard using URL parameters. For example, if you set the URL to be http://example.com/voice?foo=bar then you should be able to extract bar with $_REQUEST['foo'].

Twilio also sends a number of parameters to your URL with an incoming call, including the number that was dialled (useful if you have multiple incoming numbers), the number dialled from and many more. You should be able to use the information in the request from Twilio to choose where to dial your call onto. For example, if you are expecting a call from a particular number and you know you want to forward that call onto a different number, you can setup a conditional based on the From parameter.

Let me know if that helps at all.



Answered By - philnash
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing