Your SlideShare is downloading. ×
Lets have some fun with   twilio open tok
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Lets have some fun with twilio open tok

8,218
views

Published on

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
8,218
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
20
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. – Mizanur Rahman
  • 2.  Twilio: Twilio is a web-service API that lets you use your existing web languages and skills to build voice and SMS applications. It enables you to focus on building a simple, powerful, pay-as-you-go communications platform with very basic programming knowledge OpenTok: The OpenTok API is a free and flexible cloud-based API, making it easy to add video chat to your applications without having to worry about infrastructure and scale—build your app using our simple JavaScript or ActionScript libraries.
  • 3.  Appointment reminder Business lead managing IVR Phone Poll Online ordering notifications SMS Contest Speech to text service and vice versa Group video chat Private (One to one) chat session Talk show Conferences and many more……
  • 4.  Voice & SMS service with ease of use No hardware hassle Pay as you go – no up front cost Build on the Amazon cloud Options to call forwarding, recording, conferences, send & receive SMS Call all over the world Voice option for Male & Female voice
  • 5.  Very simple registration process. A sandbox credit of $30 to test out your application with real calls and SMS A well documented REST API library with examples and active community of more than 60,000 developers Can build and run your first application with few lines of codes.
  • 6.  A User calls or sends an SMS to your Twilio phone number Twilio receives the call or SMS and makes a request to your application Your app receives that information and sends XML back to Twilio Twilio executes those instructions and interacts with the user
  • 7. Primary Verbs <Say> some text <Play> an audio file <Gather> input from the caller <Record> the callers audio <Dial> another phone number <Sms> send a textSecondary Verbs <Hangup>end a call <Redirect> redirect a call <Reject> reject a call <Pause> Put delay on words.
  • 8. <Say>Hello Everyone. Welcome to PHPXperts seminar 2011</Say><Play>http://myserver.com/welcome.mp3</Play><Dial>415-867-5309</Dial><Gather action=‘handleMenu.php’ /><Record action=‘handleVoiceMessage.php’ /><Sms>Please send us payment.</Sms>
  • 9. <?xml version="1.0" encoding="utf-8" ?><Response> <Say> Your confirmation code for "PHPXperts Seminar 2011" is "1010101010" </Say> <Dial>888-777-1234</Dial></Response>
  • 10. <?xml version="1.0" encoding="utf-8" ?><Response> <Say> Please leave your feedback for "PHPXperts Seminar 2011". </Say> <Record action="http://myapplication.com/recordMessage.php" /></Response>
  • 11. <?xml version="1.0" encoding="utf-8" ?><Response> <Play>http://myapplication.com/welcome.mp3</Play> <Say> Thank for participating in "PHPXperts Seminar 2011". Press 1 to listen the topics. Press 2 to repeat. </Say> <Gather action="http://myapplication.com/handleInput.php" /></Response>
  • 12. <?phprequire "Services/Twilio.php";/* Set our AccountSid and AuthToken */$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";$token = "YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY";/* Outgoing Caller ID you have previously validated with Twilio */$CallerID = NNNNNNNNNN;/* Instantiate a new Twilio Rest Client */$client = new Services_Twilio($sid, $token);$url = "http://myapplication.com/welcome.php";$callingNumber = "888-777-6666";/* make Twilio REST request to initiate outgoing call */$call = $client->account->calls ->create($CallerID, $callingNumber, $url);
  • 13.  Let your web browser do the dialing for you Use twilio.js to perform client side programming Make calls from the browser Receive calls in the browser Make calls between two browsers
  • 14. <?phpinclude Services/Twilio/Capability.php;$accountSid = ACxxxxxxxxxxxxxxx;$authToken = xxxxxxxxxxxxxxxxx;$clientName = "PHPXperts";$token = new Services_Twilio_Capability($accountSid, $authToken);$token->allowClientOutgoing(APxxxxxxxxxxxxxxx);$token->allowClientIncoming($clientName);$activeToken = $token->generateToken();?><script type="text/javascript" src="http://static.twilio.com/libs/twiliojs/1.0/twilio.js"></script><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script><script type="text/javascript">$(document).ready(function(){ Twilio.Device.setup("<?php echo $activeToken;?>"); params = { "client" : "<?php echo $clientName;?>" }; Twilio.Device.connect(params); Twilio.Device.incoming(function (conn) { conn.accept(); });});</script>
  • 15.  Private Chats(Unlimited one-to-one chat sessions) Broadcasts (Up to 2500 viewers) Talk Shows (Have multiple hosts broadcasting) Conferences (With up to 50 people together)
  • 16.  Easy sign up process Easy to follow documentation Simple Javascript & actionscript library for client side PHP, .NET, Ruby, Java, Node.js, Pythod library for server side Already build in plugins for your need
  • 17. <?php require_once SDK/API_Config.php; require_once SDK/OpenTokSDK.php; require_once SDK/SessionPropertyConstants.php; $apiObj = new OpenTokSDK(API_Config::API_KEY, API_Config::API_SECRET); $session = $apiObj->create_session($_SERVER["REMOTE_ADDR"]); $sessionId = $session->getSessionId();?><html> <head> <title>OpenTok - PHPXpert Sample App</title> <script src="http://staging.tokbox.com/v0.91/js/TB.min.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript" charset="utf-8"> var session = TB.initSession("<?php echo $sessionId?>"); // Session ID. session.addEventListener("sessionConnected", sessionConnectedHandler); session.addEventListener("streamCreated", streamCreatedHandler); session.connect(1127, "devtoken"); // OpenTok sample API key and sample token string.
  • 18. function sessionConnectedHandler(event) { subscribeToStreams(event.streams); session.publish(); } function streamCreatedHandler(event) { subscribeToStreams(event.streams); } function subscribeToStreams(streams) { for (i = 0; i < streams.length; i++) { var stream = streams[i]; if (stream.connection.connectionId != session.connection.connectionId) { session.subscribe(stream); } } } </script> </head> <body> </body></html>
  • 19. Thanks everyone
  • 20. M. Mizanur Rahman Founder & C.T.O Informatix Technologies C.EO Eschool ProjectZCE, CSM & Moderator PHPXperts Group http://booleandreams.wordpress.com