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.
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
Post a Comment