SlideShare uma empresa Scribd logo
1 de 22
– Mizanur Rahman
   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.
   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……
   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
   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.
   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
Primary Verbs
 <Say> some text
 <Play> an audio file
 <Gather> input from the caller
 <Record> the caller's audio
 <Dial> another phone number
 <Sms> send a text
Secondary Verbs
 <Hangup>end a call
 <Redirect> redirect a call
 <Reject> reject a call
 <Pause> Put delay on words.
<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>
<?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>
<?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>
<?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>
<?php

require "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);
   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
<?php
include '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>
   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)
   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
<?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.
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>
Thanks everyone
M. Mizanur Rahman
                      Founder & C.T.O
              Informatix Technologies

                                C.EO
                      Eschool Project



ZCE, CSM & Moderator PHPXperts Group
 http://booleandreams.wordpress.com

Mais conteúdo relacionado

Semelhante a Lets have some fun with twilio open tok

A language for the Internet: Why JavaScript and Node.js is right for Internet...
A language for the Internet: Why JavaScript and Node.js is right for Internet...A language for the Internet: Why JavaScript and Node.js is right for Internet...
A language for the Internet: Why JavaScript and Node.js is right for Internet...Tom Croucher
 
GOTO Copenhagen - Radical Agility with Autonomous Teams and Microservices in ...
GOTO Copenhagen - Radical Agility with Autonomous Teams and Microservices in ...GOTO Copenhagen - Radical Agility with Autonomous Teams and Microservices in ...
GOTO Copenhagen - Radical Agility with Autonomous Teams and Microservices in ...Jan Löffler
 
Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)Mindfire Solutions
 
The Windows Runtime and the Web
The Windows Runtime and the WebThe Windows Runtime and the Web
The Windows Runtime and the WebJeremy Likness
 
[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho
[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho
[CB16] Esoteric Web Application Vulnerabilities by Andrés RianchoCODE BLUE
 
WebSockets - Realtime em Mundo Conectado
WebSockets - Realtime em Mundo ConectadoWebSockets - Realtime em Mundo Conectado
WebSockets - Realtime em Mundo ConectadoBruno Borges
 
WSF PHP 2 Webinar Sep 2008
WSF PHP 2 Webinar Sep 2008WSF PHP 2 Webinar Sep 2008
WSF PHP 2 Webinar Sep 2008WSO2
 
Php Asp Net Interoperability Rc Jao
Php Asp Net Interoperability Rc JaoPhp Asp Net Interoperability Rc Jao
Php Asp Net Interoperability Rc Jaojedt
 
Web services in java
Web services in javaWeb services in java
Web services in javamaabujji
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch
 
Pentesting web applications
Pentesting web applicationsPentesting web applications
Pentesting web applicationsSatish b
 
A language for the Internet: Why JavaScript and Node.js is right for Internet...
A language for the Internet: Why JavaScript and Node.js is right for Internet...A language for the Internet: Why JavaScript and Node.js is right for Internet...
A language for the Internet: Why JavaScript and Node.js is right for Internet...Tom Croucher
 
RoR Workshop - Web applications hacking - Ruby on Rails example
RoR Workshop - Web applications hacking - Ruby on Rails exampleRoR Workshop - Web applications hacking - Ruby on Rails example
RoR Workshop - Web applications hacking - Ruby on Rails exampleRailwaymen
 
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example Anna Klepacka
 
Node.js introduction
Node.js introductionNode.js introduction
Node.js introductionParth Joshi
 

Semelhante a Lets have some fun with twilio open tok (20)

A language for the Internet: Why JavaScript and Node.js is right for Internet...
A language for the Internet: Why JavaScript and Node.js is right for Internet...A language for the Internet: Why JavaScript and Node.js is right for Internet...
A language for the Internet: Why JavaScript and Node.js is right for Internet...
 
GOTO Copenhagen - Radical Agility with Autonomous Teams and Microservices in ...
GOTO Copenhagen - Radical Agility with Autonomous Teams and Microservices in ...GOTO Copenhagen - Radical Agility with Autonomous Teams and Microservices in ...
GOTO Copenhagen - Radical Agility with Autonomous Teams and Microservices in ...
 
WCF Fundamentals
WCF Fundamentals WCF Fundamentals
WCF Fundamentals
 
Intro to Node
Intro to NodeIntro to Node
Intro to Node
 
Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)
 
The Windows Runtime and the Web
The Windows Runtime and the WebThe Windows Runtime and the Web
The Windows Runtime and the Web
 
[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho
[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho
[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho
 
My Saminar On Php
My Saminar On PhpMy Saminar On Php
My Saminar On Php
 
WebSockets - Realtime em Mundo Conectado
WebSockets - Realtime em Mundo ConectadoWebSockets - Realtime em Mundo Conectado
WebSockets - Realtime em Mundo Conectado
 
WSF PHP 2 Webinar Sep 2008
WSF PHP 2 Webinar Sep 2008WSF PHP 2 Webinar Sep 2008
WSF PHP 2 Webinar Sep 2008
 
Php Asp Net Interoperability Rc Jao
Php Asp Net Interoperability Rc JaoPhp Asp Net Interoperability Rc Jao
Php Asp Net Interoperability Rc Jao
 
Web services in java
Web services in javaWeb services in java
Web services in java
 
OneTeam Media Server
OneTeam Media ServerOneTeam Media Server
OneTeam Media Server
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
 
Pentesting web applications
Pentesting web applicationsPentesting web applications
Pentesting web applications
 
A language for the Internet: Why JavaScript and Node.js is right for Internet...
A language for the Internet: Why JavaScript and Node.js is right for Internet...A language for the Internet: Why JavaScript and Node.js is right for Internet...
A language for the Internet: Why JavaScript and Node.js is right for Internet...
 
Web Service
Web ServiceWeb Service
Web Service
 
RoR Workshop - Web applications hacking - Ruby on Rails example
RoR Workshop - Web applications hacking - Ruby on Rails exampleRoR Workshop - Web applications hacking - Ruby on Rails example
RoR Workshop - Web applications hacking - Ruby on Rails example
 
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
 
Node.js introduction
Node.js introductionNode.js introduction
Node.js introduction
 

Último

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 

Último (20)

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 

Lets have some fun with twilio open tok

  • 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.
  • 8. Primary Verbs  <Say> some text  <Play> an audio file  <Gather> input from the caller  <Record> the caller's audio  <Dial> another phone number  <Sms> send a text Secondary Verbs  <Hangup>end a call  <Redirect> redirect a call  <Reject> reject a call  <Pause> Put delay on words.
  • 9. <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>
  • 10. <?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>
  • 11. <?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>
  • 12. <?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>
  • 13. <?php require "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);
  • 14. 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
  • 15. <?php include '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>
  • 16. 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)
  • 17. 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
  • 18. <?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.
  • 19. 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>
  • 21.
  • 22. M. Mizanur Rahman Founder & C.T.O Informatix Technologies C.EO Eschool Project ZCE, CSM & Moderator PHPXperts Group http://booleandreams.wordpress.com