twilio - Forwarding live Calls to a new Twiml from the browser -
i following tutorial on https://www.twilio.com/docs/api/rest/change-call-state#post coding in php portion allows forward current inbound call new twiml url. how inbound call sid? currently, call sid retrieving forwards browser new twiml url , hangs inbound caller. think may have wrong call sid since want forward current inbound caller new twiml url. not browser. can please give me advice on retrieving inbound call sid use in php script? thanks
twilio.device.incoming(function (conn) { callsid = conn.parameters.callsid; $("#log").text("incoming connection " + conn.parameters.from); // accept incoming connection , start two-way audio conn.accept(); });
this how getting call sid. if input call sid
<?php // php helper library twilio.com/docs/php/install require_once('twilioapi/twilio-php-master/services/twilio.php'); // loads library // account sid , auth token twilio.com/user/account $sid = ''; $token = ''; $client = new services_twilio($sid, $token); // object sid. if not have sid, // check out list resource examples on page $call = $client->account->calls->get("the call sid got js goes here"); $call->update(array( "url" => "http://twimlets.com/message?message%5b0%5d=i%20finally%20did%20it&", "method" => "post" )); echo $call->to; ?>
this code forwards browser receives call new twiml url. not inbound caller.
Comments
Post a Comment