SlideShare a Scribd company logo
PHP & TwilioMichael Peacock, October, 2011
About MeSenior/Lead Web Developer
Web Systems Developer
Telemetry Team – Smith Electric Vehicles US Corp
Author
PHP 5 Social Networking, PHP 5 E-Commerce Development, Drupal Social Networking (6 & 7), Selling online with Drupal e-Commerce, Building Websites with TYPO3
PHPNE Volunteer
Occasional technical speaker
PHP North-East, PHPNW 2010, SuperMondays, PHPNW 2011 Unconference, ConFoo 2012No. Not milk floats (anymore)Photo courtesy of kenjonbro: http://www.flickr.com/photos/kenjonbro/4037649210/in/set-72157623026469013
All Electric, Commercial Vehicles.
Smith Electric Vehicles & Telemetry	Worlds largest manufacturer of Commercial, all-electric vehiclesSmith Link – on-board vehicle telematics system, capturing over 2500 data points each second on the vehicle and broadcasting them over mobile network~400 telemetry enabled vehicles on the roadWorlds largest telemetry project outside of F1
Collection of “Infrastructure APIs”Make and receive phone calls
Send and receive text messages
Buy phone numbers
Record caller messages
Conference calls
IVR: Interactive Voice Response
DTMF: Gathering number presses
Text to speechSmith, Telemetry & TwilioField Engineers
Phone up telemetry to see if a new device they have installed in the field is broadcasting data
When in the field their access to laptop / Internet is limited
Gives instant feedback which is recorded by the system
Customers
Proof of concept: Telephone access to telematics data
Where is my truck? Geolocate
Current metrics: Battery, Current, Voltage, Temperature, Speed
Can it get to...does the truck have enough charge to reach a new destination
Basic useful information for fleet managers away from their desksApplicationsPotential use cases:Verify customers phone number
Provide a telephone based entry point to your web application
Let customers phone up to manage their account or track their order on the move
Ad

Recommended

Supermondays twilio
Supermondays twilio
Michael Peacock
 
Otra forma de hacer aplicaciones de telefonía
Otra forma de hacer aplicaciones de telefonía
Martin Perez
 
Twilio Signal 2016 Serverless Contact Center
Twilio Signal 2016 Serverless Contact Center
Twilio Inc
 
Call recording overview ring central
Call recording overview ring central
Anirban Sen Chowdhary
 
Ring central fax
Ring central fax
Anirban Sen Chowdhary
 
WooCommerce & Apple TV
WooCommerce & Apple TV
Marko Heijnen
 
Realising the true value of DevOps
Realising the true value of DevOps
tlevey
 
txt web overview
txt web overview
Narayan Srinivasan
 
Lets have some fun with twilio open tok
Lets have some fun with twilio open tok
mirahman
 
Can mule integrate with ring central
Can mule integrate with ring central
Anirban Sen Chowdhary
 
Creating Custom Solutions with FME and Python
Creating Custom Solutions with FME and Python
Safe Software
 
Automating REST/SOAP API Testing (Part 4)
Automating REST/SOAP API Testing (Part 4)
Inflectra
 
Call recording of ring central
Call recording of ring central
Anirban Sen Chowdhary
 
Kamaelia Grey
Kamaelia Grey
kamaelian
 
Insights into Chatbot Development - Implementing Cross-Platform Chatbots
Insights into Chatbot Development - Implementing Cross-Platform Chatbots
Barbara Ondrisek
 
Getting Started with Twilio
Getting Started with Twilio
Michael Kimsal
 
Real time voice call integration - Confoo 2012
Real time voice call integration - Confoo 2012
Michael Peacock
 
Tech campmemphis slides_post_session
Tech campmemphis slides_post_session
Stewart Whaley
 
Phone calls and sms from php
Phone calls and sms from php
David Stockton
 
7 Principles of API Design - Waza
7 Principles of API Design - Waza
Twilio Inc
 
Twilio - Social App Workshop - 2010-07-24
Twilio - Social App Workshop - 2010-07-24
Twilio Inc
 
Twilio Web Service API for building Voice Applications
Twilio Web Service API for building Voice Applications
Twilio Inc
 
Tc 2008 11 19
Tc 2008 11 19
jeffiel
 
Look Who's Talking
Look Who's Talking
Pablo Cantero
 
Twilio Voice Applications with Amazon AWS S3 and EC2
Twilio Voice Applications with Amazon AWS S3 and EC2
Twilio Inc
 
CiviCRM API v3
CiviCRM API v3
Xavier dutoit
 
Tadhack madrid June 2014: Joris Swinnen and WebRTC Nederland "Invite my colle...
Tadhack madrid June 2014: Joris Swinnen and WebRTC Nederland "Invite my colle...
Bart Uelen
 
Twilio Presents at PariSoMa
Twilio Presents at PariSoMa
Twilio Inc
 
Twilio at the Google App Engine Meetup 2009-10
Twilio at the Google App Engine Meetup 2009-10
Twilio Inc
 
Building a Great Web API - Evan Cooke - QCON 2011
Building a Great Web API - Evan Cooke - QCON 2011
Twilio Inc
 

More Related Content

What's hot (7)

Lets have some fun with twilio open tok
Lets have some fun with twilio open tok
mirahman
 
Can mule integrate with ring central
Can mule integrate with ring central
Anirban Sen Chowdhary
 
Creating Custom Solutions with FME and Python
Creating Custom Solutions with FME and Python
Safe Software
 
Automating REST/SOAP API Testing (Part 4)
Automating REST/SOAP API Testing (Part 4)
Inflectra
 
Call recording of ring central
Call recording of ring central
Anirban Sen Chowdhary
 
Kamaelia Grey
Kamaelia Grey
kamaelian
 
Insights into Chatbot Development - Implementing Cross-Platform Chatbots
Insights into Chatbot Development - Implementing Cross-Platform Chatbots
Barbara Ondrisek
 
Lets have some fun with twilio open tok
Lets have some fun with twilio open tok
mirahman
 
Can mule integrate with ring central
Can mule integrate with ring central
Anirban Sen Chowdhary
 
Creating Custom Solutions with FME and Python
Creating Custom Solutions with FME and Python
Safe Software
 
Automating REST/SOAP API Testing (Part 4)
Automating REST/SOAP API Testing (Part 4)
Inflectra
 
Kamaelia Grey
Kamaelia Grey
kamaelian
 
Insights into Chatbot Development - Implementing Cross-Platform Chatbots
Insights into Chatbot Development - Implementing Cross-Platform Chatbots
Barbara Ondrisek
 

Similar to PHP & Twilio (20)

Getting Started with Twilio
Getting Started with Twilio
Michael Kimsal
 
Real time voice call integration - Confoo 2012
Real time voice call integration - Confoo 2012
Michael Peacock
 
Tech campmemphis slides_post_session
Tech campmemphis slides_post_session
Stewart Whaley
 
Phone calls and sms from php
Phone calls and sms from php
David Stockton
 
7 Principles of API Design - Waza
7 Principles of API Design - Waza
Twilio Inc
 
Twilio - Social App Workshop - 2010-07-24
Twilio - Social App Workshop - 2010-07-24
Twilio Inc
 
Twilio Web Service API for building Voice Applications
Twilio Web Service API for building Voice Applications
Twilio Inc
 
Tc 2008 11 19
Tc 2008 11 19
jeffiel
 
Look Who's Talking
Look Who's Talking
Pablo Cantero
 
Twilio Voice Applications with Amazon AWS S3 and EC2
Twilio Voice Applications with Amazon AWS S3 and EC2
Twilio Inc
 
CiviCRM API v3
CiviCRM API v3
Xavier dutoit
 
Tadhack madrid June 2014: Joris Swinnen and WebRTC Nederland "Invite my colle...
Tadhack madrid June 2014: Joris Swinnen and WebRTC Nederland "Invite my colle...
Bart Uelen
 
Twilio Presents at PariSoMa
Twilio Presents at PariSoMa
Twilio Inc
 
Twilio at the Google App Engine Meetup 2009-10
Twilio at the Google App Engine Meetup 2009-10
Twilio Inc
 
Building a Great Web API - Evan Cooke - QCON 2011
Building a Great Web API - Evan Cooke - QCON 2011
Twilio Inc
 
Building A Great API - Evan Cooke, Cloudstock, December 2010
Building A Great API - Evan Cooke, Cloudstock, December 2010
Twilio Inc
 
How to Integrate Text and Phone Messaging with your Website
How to Integrate Text and Phone Messaging with your Website
Cindy Cullen
 
Final Twilio Under the Radar 2009 Cloud
Final Twilio Under the Radar 2009 Cloud
Dealmaker Media
 
Twilio
Twilio
Brian Levine
 
Deploying Next Gen Systems with Zero Downtime
Deploying Next Gen Systems with Zero Downtime
Twilio Inc
 
Getting Started with Twilio
Getting Started with Twilio
Michael Kimsal
 
Real time voice call integration - Confoo 2012
Real time voice call integration - Confoo 2012
Michael Peacock
 
Tech campmemphis slides_post_session
Tech campmemphis slides_post_session
Stewart Whaley
 
Phone calls and sms from php
Phone calls and sms from php
David Stockton
 
7 Principles of API Design - Waza
7 Principles of API Design - Waza
Twilio Inc
 
Twilio - Social App Workshop - 2010-07-24
Twilio - Social App Workshop - 2010-07-24
Twilio Inc
 
Twilio Web Service API for building Voice Applications
Twilio Web Service API for building Voice Applications
Twilio Inc
 
Tc 2008 11 19
Tc 2008 11 19
jeffiel
 
Twilio Voice Applications with Amazon AWS S3 and EC2
Twilio Voice Applications with Amazon AWS S3 and EC2
Twilio Inc
 
Tadhack madrid June 2014: Joris Swinnen and WebRTC Nederland "Invite my colle...
Tadhack madrid June 2014: Joris Swinnen and WebRTC Nederland "Invite my colle...
Bart Uelen
 
Twilio Presents at PariSoMa
Twilio Presents at PariSoMa
Twilio Inc
 
Twilio at the Google App Engine Meetup 2009-10
Twilio at the Google App Engine Meetup 2009-10
Twilio Inc
 
Building a Great Web API - Evan Cooke - QCON 2011
Building a Great Web API - Evan Cooke - QCON 2011
Twilio Inc
 
Building A Great API - Evan Cooke, Cloudstock, December 2010
Building A Great API - Evan Cooke, Cloudstock, December 2010
Twilio Inc
 
How to Integrate Text and Phone Messaging with your Website
How to Integrate Text and Phone Messaging with your Website
Cindy Cullen
 
Final Twilio Under the Radar 2009 Cloud
Final Twilio Under the Radar 2009 Cloud
Dealmaker Media
 
Deploying Next Gen Systems with Zero Downtime
Deploying Next Gen Systems with Zero Downtime
Twilio Inc
 
Ad

More from Michael Peacock (20)

Immutable Infrastructure with Packer Ansible and Terraform
Immutable Infrastructure with Packer Ansible and Terraform
Michael Peacock
 
Test driven APIs with Laravel
Test driven APIs with Laravel
Michael Peacock
 
Symfony Workflow Component - Introductory Lightning Talk
Symfony Workflow Component - Introductory Lightning Talk
Michael Peacock
 
Alexa, lets make a skill
Alexa, lets make a skill
Michael Peacock
 
API Development with Laravel
API Development with Laravel
Michael Peacock
 
An introduction to Laravel Passport
An introduction to Laravel Passport
Michael Peacock
 
Phinx talk
Phinx talk
Michael Peacock
 
Refactoring to symfony components
Refactoring to symfony components
Michael Peacock
 
Dance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech Talk
Michael Peacock
 
Powerful and flexible templates with Twig
Powerful and flexible templates with Twig
Michael Peacock
 
Introduction to OOP with PHP
Introduction to OOP with PHP
Michael Peacock
 
Vagrant
Vagrant
Michael Peacock
 
Phpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friends
Michael Peacock
 
Evolution of a big data project
Evolution of a big data project
Michael Peacock
 
Dealing with Continuous Data Processing, ConFoo 2012
Dealing with Continuous Data Processing, ConFoo 2012
Michael Peacock
 
Data at Scale - Michael Peacock, Cloud Connect 2012
Data at Scale - Michael Peacock, Cloud Connect 2012
Michael Peacock
 
PHP Continuous Data Processing
PHP Continuous Data Processing
Michael Peacock
 
PHP North East Registry Pattern
PHP North East Registry Pattern
Michael Peacock
 
PHP North East - Registry Design Pattern
PHP North East - Registry Design Pattern
Michael Peacock
 
Supermondays: Jenkins CI lightning talk
Supermondays: Jenkins CI lightning talk
Michael Peacock
 
Immutable Infrastructure with Packer Ansible and Terraform
Immutable Infrastructure with Packer Ansible and Terraform
Michael Peacock
 
Test driven APIs with Laravel
Test driven APIs with Laravel
Michael Peacock
 
Symfony Workflow Component - Introductory Lightning Talk
Symfony Workflow Component - Introductory Lightning Talk
Michael Peacock
 
Alexa, lets make a skill
Alexa, lets make a skill
Michael Peacock
 
API Development with Laravel
API Development with Laravel
Michael Peacock
 
An introduction to Laravel Passport
An introduction to Laravel Passport
Michael Peacock
 
Refactoring to symfony components
Refactoring to symfony components
Michael Peacock
 
Dance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech Talk
Michael Peacock
 
Powerful and flexible templates with Twig
Powerful and flexible templates with Twig
Michael Peacock
 
Introduction to OOP with PHP
Introduction to OOP with PHP
Michael Peacock
 
Phpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friends
Michael Peacock
 
Evolution of a big data project
Evolution of a big data project
Michael Peacock
 
Dealing with Continuous Data Processing, ConFoo 2012
Dealing with Continuous Data Processing, ConFoo 2012
Michael Peacock
 
Data at Scale - Michael Peacock, Cloud Connect 2012
Data at Scale - Michael Peacock, Cloud Connect 2012
Michael Peacock
 
PHP Continuous Data Processing
PHP Continuous Data Processing
Michael Peacock
 
PHP North East Registry Pattern
PHP North East Registry Pattern
Michael Peacock
 
PHP North East - Registry Design Pattern
PHP North East - Registry Design Pattern
Michael Peacock
 
Supermondays: Jenkins CI lightning talk
Supermondays: Jenkins CI lightning talk
Michael Peacock
 
Ad

Recently uploaded (20)

Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Safe Software
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
Safe Software
 
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Alliance
 
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Impelsys Inc.
 
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
SOFTTECHHUB
 
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
Murdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementary
JorgeSemperteguiMont
 
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
AmirStern2
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Safe Software
 
FME for Good: Integrating Multiple Data Sources with APIs to Support Local Ch...
FME for Good: Integrating Multiple Data Sources with APIs to Support Local Ch...
Safe Software
 
Down the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training Roadblocks
Rustici Software
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
Edge AI and Vision Alliance
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
Edge AI and Vision Alliance
 
Artificial Intelligence in the Nonprofit Boardroom.pdf
Artificial Intelligence in the Nonprofit Boardroom.pdf
OnBoard
 
SAP Modernization Strategies for a Successful S/4HANA Journey.pdf
SAP Modernization Strategies for a Successful S/4HANA Journey.pdf
Precisely
 
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Safe Software
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
Safe Software
 
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Alliance
 
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Impelsys Inc.
 
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
SOFTTECHHUB
 
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
Murdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementary
JorgeSemperteguiMont
 
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
AmirStern2
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Safe Software
 
FME for Good: Integrating Multiple Data Sources with APIs to Support Local Ch...
FME for Good: Integrating Multiple Data Sources with APIs to Support Local Ch...
Safe Software
 
Down the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training Roadblocks
Rustici Software
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
Edge AI and Vision Alliance
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
“Why It’s Critical to Have an Integrated Development Methodology for Edge AI,...
Edge AI and Vision Alliance
 
Artificial Intelligence in the Nonprofit Boardroom.pdf
Artificial Intelligence in the Nonprofit Boardroom.pdf
OnBoard
 
SAP Modernization Strategies for a Successful S/4HANA Journey.pdf
SAP Modernization Strategies for a Successful S/4HANA Journey.pdf
Precisely
 

PHP & Twilio

  • 1. PHP & TwilioMichael Peacock, October, 2011
  • 4. Telemetry Team – Smith Electric Vehicles US Corp
  • 6. PHP 5 Social Networking, PHP 5 E-Commerce Development, Drupal Social Networking (6 & 7), Selling online with Drupal e-Commerce, Building Websites with TYPO3
  • 9. PHP North-East, PHPNW 2010, SuperMondays, PHPNW 2011 Unconference, ConFoo 2012No. Not milk floats (anymore)Photo courtesy of kenjonbro: http://www.flickr.com/photos/kenjonbro/4037649210/in/set-72157623026469013
  • 11. Smith Electric Vehicles & Telemetry Worlds largest manufacturer of Commercial, all-electric vehiclesSmith Link – on-board vehicle telematics system, capturing over 2500 data points each second on the vehicle and broadcasting them over mobile network~400 telemetry enabled vehicles on the roadWorlds largest telemetry project outside of F1
  • 12. Collection of “Infrastructure APIs”Make and receive phone calls
  • 13. Send and receive text messages
  • 19. Text to speechSmith, Telemetry & TwilioField Engineers
  • 20. Phone up telemetry to see if a new device they have installed in the field is broadcasting data
  • 21. When in the field their access to laptop / Internet is limited
  • 22. Gives instant feedback which is recorded by the system
  • 24. Proof of concept: Telephone access to telematics data
  • 25. Where is my truck? Geolocate
  • 26. Current metrics: Battery, Current, Voltage, Temperature, Speed
  • 27. Can it get to...does the truck have enough charge to reach a new destination
  • 28. Basic useful information for fleet managers away from their desksApplicationsPotential use cases:Verify customers phone number
  • 29. Provide a telephone based entry point to your web application
  • 30. Let customers phone up to manage their account or track their order on the move
  • 32. Numbers for lead sources to track conversions
  • 34. When your contact form is submitted or an order placed, automatically connect a member of your team to the customer
  • 35. Request a call back formControlled Through XMLCaller dials your number
  • 36. Twilio calls your application, which returns XML instructions
  • 37. XML instructions dictate what Twilio should say, and where to send the user depending on their responseControlled through XMLStandard header:header('Content-type: text/xml');echo '<?xml version="1.0" encoding="UTF-8"?>';<Response>
  • 39. <Say>
  • 43. <Record>API & PHP LibraryPHP Library simplifies the REST side of the API, including:
  • 46. Looking up call recordings
  • 49. Control flow is handed through XML, which can be generated using the Twiml class of the PHP Library
  • 51. Sandbox number with access code
  • 52. Until you are ready to buy your own number, you can call their sandbox number, enter a PIN and it redirects to your applicationPhone Numbers$1 per month
  • 53. Available for US, Canada and now (beta) UK
  • 54. Buy online or through the rest APIMake a call$client = newServices_Twilio(‘AC123', '123'); $call = $client->account->calls->create('FROM', 'CALL', 'http://mydomain.com/call-xml' );Call ID is generated:$call->sid;Length is recorded$call->length
  • 55. Speak<Say>Hello conference attendees</Say>$response = new Services_Twilio_Twiml();$response->say(‘Hello conference attendees');echo $ output;
  • 56. Ask for a Response<Response> <Gather action=“my-app-url/process" numDigits="1"><Say>Welcome Conference PHP North West 2011 Delegates.</Say><Say>For talks at 10 45 press 1.</Say></Gather> <Say>Sorry, I didn't get your response.</Say> <Redirect>my-app-url</Redirect></Response>
  • 57. Ask for a Response$response = new Services_Twilio_Twiml();$gather = $response->gather(array('numDigits' => 1));$gather->say("Welcome Conference PHP North West 2011 Delegates.");$gather->say("For talks at 10 45 press 1.");$response->say("Sorry, I didn't catch that");echo $response;
  • 58. Act on a Response$response = (int) $_REQUEST['Digits'];header('Content-type: text/xml');echo '<?xml version="1.0" encoding="UTF-8"?>';Switch( $response ){case 1: echo ‘<Response><Say>Track 1 details…</Say></Response>’ break;case 2:echo ‘<Response><Say>Track 2 details…</Say></Response>’ break;}exit();
  • 60. Enforcing StateEach stage of the application is accessible via a URL. Theoretically, someone could directly visit a deep link (if they know it) and see customer information.Simplest solution is to generate a unique token (with a short TTL) when caller first dials
  • 61. Token is then passed around to each <Redirect> response
  • 62. Any authentication details are associated with the token
  • 63. Tokens regularly cleaned upTwilio ConnectLets you write Twilio applications, hosted and managed on your servers (free or charged for) but that connect directly to your customers Twilioaccount, so they can manage their own Twilio usage billing
  • 64. TwimletsYou don’t have to host code on your server
  • 65. If its a basic script, with no server interaction, you can use “twimlets” http://labs.twilio.com/twimlets/
  • 67. Ring up to 10 phones at once until one answers
  • 70. Etc
  • 71. Create them using an online wizard and Twilio hosts the XMLDebugging
  • 73. Really Basic Demo Application<?php$twilio = new TwilioDemo();class TwilioDemo{ public function __construct() { header('Content-type: text/xml'); echo '<?xml version="1.0" encoding="UTF-8"?>'; $route = ( isset( $_GET['route'] ) ) ? $_GET['route'] : ''; switch( $route ) { case 'process': $this->process(); break; default: case ''; $this->menu(); break; } }Based on the URL, redirect the user
  • 74. Really Basic Demo ApplicationRead the menu, if no response selected, repeatprivate function menu() { $out = <<<EOD <Response> <Gather action="http://www./twiliodemo/twiliodemo.php?route=process" numDigits="1"> <Say>Hello PHP North West Conference attendee. At Nine Thirty we have the keynote from Ian Barber, How to Stand on the Shoulders of Giants.</Say> <Say>For talks at 10 45, press 1.</Say> <Say>For talks at 11 45, press 2</Say> <Say>Lunch is at 12 45</Say> <Say>For talks at 2 press 3.</Say> <Say>For talks at 3, press 4.</Say> <Say>For talks at 4 30, press 5.</Say> <Say>For un conference talks, press 6.</Say> </Gather> <!-- If caller didn't press any keys, prompt and try again. --> <Say>Sorry, I didn't get your response.</Say> <Redirect>http://www..co.uk/twiliodemo/twiliodemo.php?route=main</Redirect> </Response> EOD; echo $out; exit(); }
  • 75. Really Basic Demo Applicationprivate function process() { $selection = (int) $_REQUEST['Digits']; switch( $selection ) { case 1: $this->ten45(); break; case 2: $this->eleven45(); break; case 3: $this->two(); break; case 4: $this->three(); break; case 5: $this->four30(); break; case 5: $this->unconference(); break; default: $this->oi(); break; } }Process based on the user input
  • 76. Really Basic Demo ApplicationRead out the informationprivate function ten45() { echo '<Response>'; echo '<Say>Track 1: Zend Framework 2 - State Of The Art : EnricoZimuel.</Say>'; echo '<Say>Track 2: REST and HATEOAS - A Case Study : Ben Longden.</Say>'; echo '<Say>Track 3: Magic Behind the Numbers - Software Metrics In Practice : Sebastian Marek.</Say>'; echo '<Redirect>http://www.invoicecentral.co.uk/twiliodemo/twiliodemo.php?route=main</Redirect>'; echo '</Response>'; }
  • 77. ConclusionTwilio is really, really easy to use
  • 78. Build a simple application in a minute
  • 79. Build a complex application in five
  • 80. You control the responses through a new request after each user interaction
  • 81. Really cheap to useQ & AMichael PeacockWeb Systems Developer – Telemetry Team – Smith Electric Vehicles US [email protected] / Lead Developer, Author & [email protected] www.michaelpeacock.co.uk@michaelpeacockhttp://joind.in/3819 http://www.slideshare.net/michaelpeacock