yagitoshiro / TiTwilio

TiTwilio
24 stars 8 forks source link

auth server example #2

Open WDPX opened 10 years ago

WDPX commented 10 years ago

Hi, Do you think you could include an example of your auth server php? I just don´t get this to work. Of course, leave your appID, auth thoken etc. blank. It´s just so I - and maybe others as well - can understand what needs to happen on the other side. That would be great!

By now, I tried something like this:

<?php

include ("Services/Twilio/Capability.php"); include ("Services/Twilio.php");

// Twilio REST API version $version = "2010-04-01";

$accountSid = "++++++++++++++++++++"; $authToken = "++++++++++++++++++++";

// The app outgoing connections will use: $appSid = "++++++++++++++++++++";

// The client name for incoming connections: if (isset($_GET["client"])) { $clientName = "client:ICallU".$_GET["ID"]; } else { $clientName = "ICallU".$_GET["ID"]; }

$capability = new Services_Twilio_Capability($accountSid, $authToken); $client = new Services_Twilio($accountSid, $authToken, $version);

// This allows incoming connections as $clientName: $capability->allowClientIncoming('ICallU'.$_GET["ID"]);

// This allows outgoing connections to $appSid with the "From" // parameter being the value of $clientName $capability->allowClientOutgoing($appSid, array(), $clientName);

// This returns a token to use with Twilio based on // the account and capabilities defined above $token = $capability->generateToken(); echo $token;

if (!isset($_GET["client"])) { try { // Initiate a new outbound call $call = $client->account->calls->create( '++++my-registered-twilio-number++++', // The number of the phone initiating the call 'client:'.$clientName, // The number of the phone receiving call 'http://www.icallu-app.com/icallu/incoming.php' // The URL Twilio will request when the call is answered ); echo '

Started call: ' . $call->sid.'

'; } catch (Exception $e) { echo '

Error: ' . $e->getMessage().'

'; } } ?>

But I guess, I need to use the file that is connected to my twilio-app (at twilio.com) which is another one. That one would create the Twilio-needed XML, not the above code. Or is it a mixture of both?

I would really appreciate your help. Thanks a lot!

Frank

yagitoshiro commented 9 years ago

Frank,

I have an example written in Ruby + Sinatra:

https://github.com/yagitoshiro/TwilioDemo/blob/master/server/index.rb

WDPX commented 9 years ago

Hi,

sorry to bother you, again, with your Twilio-Module you build an put on GitHub. Now, Apple requires 64-Bit-capable Modules. And I can´t get this to work, even though I found a notice from appcelerator how to do this. But this rather explains a lot in Excode that I simply do not understand.

Do you think, you can upload a 64-bit-capable version of this module to GitHub in the near future?

Thanx a lot for your time

Frank

Am 01.10.2014 um 09:02 schrieb yagi_ notifications@github.com:

Frank,

I have an example written in Ruby + Sinatra:

https://github.com/yagitoshiro/TwilioDemo/blob/master/server/index.rb https://github.com/yagitoshiro/TwilioDemo/blob/master/server/index.rb — Reply to this email directly or view it on GitHub https://github.com/yagitoshiro/TiTwilio/issues/2#issuecomment-57426335.

smartygo commented 9 years ago

Frank,

have you already tried to rebuild the module with the new Titanium SDK ver3.5.0?

Maybe you can check this blog post. http://www.appcelerator.com/blog/2015/01/titanium-sdk-3-5-0-ga-now-available-with-64-bit-ios-support/

WDPX commented 9 years ago

I´ll give it a try.

Am 15.02.2015 um 06:27 schrieb smartygo notifications@github.com:

Frank,

have you already tried to rebuild the module with the new Titanium SDK ver3.5.0?

Maybe you can check this blog post. http://www.appcelerator.com/blog/2015/01/titanium-sdk-3-5-0-ga-now-available-with-64-bit-ios-support/ http://www.appcelerator.com/blog/2015/01/titanium-sdk-3-5-0-ga-now-available-with-64-bit-ios-support/ — Reply to this email directly or view it on GitHub https://github.com/yagitoshiro/TiTwilio/issues/2#issuecomment-74404807.