This project has been abandoned
Titanium + Twilio = TiTwilio!
You can create VoIP mobile application by adding just a few lines to your JavaScript.
var TiTwilio, intent, pendingIntent;
TiTwilio = require('org.selfkleptomaniac.mod.titwilio');
if(Ti.Platform.osname === 'android'){
intent = Ti.Android.createServiceIntent({url:'service.js', twilio: TiTwilio});
pendingIntent = Ti.Android.createPendingIntent({intent: intent});
}else{
intent = null;
pendingIntent = null;
}
// login
TiTwilio.login({
url: 'http://your-auth-server.example.com', // auth server (required)
params: {key: value, post: data}, // post data (optional)
pendingIntent: pendingIntent
});
// call
TiTwilio.connect({
url: 'http://your-auth-server.example.com', // auth server (required)
params: {key: value, post: data} // post data (optional)
});
// handle incoming connection
TiTwilio.addEventListener('incomingConnection', function(e){
var intent = null;
if(Ti.Platform.osname == 'android'){
intent = e.intent;
}
TiTwilio.acceptIncomngCall({intent: intent}); // intent can be null for iOS
//TiTwilio.ignoreIncomingCall({intent: intent});
});
Connect to your authentication server and retrieve a capability token.
Object should contain at least these two values:
- string url (required)
URL of your authentication server. Used to retrieve a capability token.
- obj [params]
{key: value} pairs to be sent with your request through your TwiML app.
Create an outgoing VoIP call. Will run the "voice" URL in your TwiML app with any parameters specified in the params object.
Object should contain at least these two values:
- string url (required)
URL of your authentication server. Used to retrieve a capability token.
- obj [params]
{key: value} pairs to be sent with your request through your TwiML app.
- obj {intent: intent}
Accept an incoming call. Intent can be null for iOS.
- obj {intent: intent}
Ignore an incoming call. Intent can be null for iOS.
Ends the current connection.
Toggle speaker usage.
Fired when TiTwilio is beginning an outgoing call.
Fired when an outgoing call fails to connect.
Fired when TiTwilio is connected to an outgoing VoIP call. It is considered "connected" as soon as TwiML begins being executed, not when the recipient answers the call.
Fired after a connection terminates.
Fired when TiTwilio begins requesting a capability token from the auth server.
Fired if an auth server URL is not provided or if a capability token can not be retrieved from the auth server.
Yes, the typo is currently correct. Fired when a capability token is received. Passes an object including the capability token.
When the "login" process has completed.
TiTwilio checked the capability token and has determined it is invalid or expired.
TiTwilio checked the capability token and determined it is okay to use.
TiTwilio has begun listening for incoming connections.
TiTwilio stopped listening for incoming conncetions.
An incoming connection has been received while another is currently in progress.
Incoming connection has been received. Fired regardless of whether one is currently in progress.