using twilio php library in mobile devices (ios and android)? -
i'm working on simple application using twlio php library make out going calls.
everything seems working should in web browser. however, when test simple php page in mobile device (iphone example), nothing works! page loaded cannot make outgoing calls!
this code:
<?php include 'services/twilio/capability.php'; // put twilio api credentials here $accountsid = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; $authtoken = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; // put twilio application sid here $appsid = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; $capability = new services_twilio_capability($accountsid, $authtoken); $capability->allowclientoutgoing($appsid); $capability->allowclientincoming('jenny'); $token = $capability->generatetoken(); ?> <!doctype html> <html> <head> <title>hello client monkey 4</title> <script type="text/javascript" src="//static.twilio.com/libs/twiliojs/1.2/twilio.min.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"> </script> <script type="text/javascript"> twilio.device.setup("<?php echo $token; ?>"); twilio.device.ready(function (device) { $("#log").text("ready"); }); twilio.device.error(function (error) { $("#log").text("error: " + error.message); }); twilio.device.connect(function (conn) { $("#log").text("successfully established call"); }); twilio.device.disconnect(function (conn) { $("#log").text("call ended"); }); twilio.device.incoming(function (conn) { $("#log").text("incoming connection " + conn.parameters.from); // accept incoming connection , start two-way audio conn.accept(); }); function call() { // phone number connect call params = {"phonenumber": $("#number").val()}; twilio.device.connect(params); } function hangup() { twilio.device.disconnectall(); } </script> </head> <body> <button class="call" onclick="call();"> call </button> <button class="hangup" onclick="hangup();"> hangup </button> <input type="text" id="number" name="number" value="phone number/> <div id="log">loading pigeons...</div> </body> </html>
could please advise on issue? missing something?
twilio developer evangelist here.
sadly ios not support either webrtc or flash, both of technologies twilio client uses make phone calls web browser. so, twilio client javascript not work on iphone. recent versions of chrome on android support webrtc, should able use twilio client on devices.
Comments
Post a Comment