javascript - Using Twilio JS client, how can I call to a number entered in the texbox? -


in order make outbound call browser, followed "https://www.twilio.com/docs/quickstart/php/client/outgoing-calls" link, , can make outbound browser call particular number(which hardcoded behind).

but if entering number in text-field, make call number, how can this? please me.

for reference have attached screen-shot.

screen make outbound call

thanks

twilio evangelist here.

the outgoing calls sample code includes client side javascript grab phone number input field in webpage , include parameter in connect() function:

function call() {     // phone number connect call     params = {"phonenumber": $("#number").val()};     twilio.device.connect(params); } 

specifically code: $("#number").val() gets value input field named number.

one server side, twilio take collection of parameters provide connect function , forward url have specified twiml application url simple form-encoded values. can use php's $_request global function grab , dynamically generate twiml response:

<?php if (isset($_request['phonenumber'])) {     $number = htmlspecialchars($_request['phonenumber']); } ?>  <response>     <dial callerid="+15555555555">        <?php echo $numberorclient ?>     </dial> </response> 

hope helps.


Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -