Phone Communications
in Javascript
Stève SFARTZ
API Evangelist - Cisco DevNet
stsfartz@cisco.com, @SteveSfartz, github://ObjectIsadvantag
© 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
/Cisco/DevNet/SteveSfartz
• API Evangelist @CiscoDevNet
• Cisco Spark Apps & Tropo APIs
• code addict, nodejs, love story
with #golang
• France and all around Europe
• hosted @PIRL – Paris Innovation
Center & Research Lab
• twitter://@SteveSfartz
• github://ObjectIsAdvantag
“vision without
execution is
hallucination”
-- Thomas Edison
stsfartz@cisco.com
@SteveSfartz
3
 Taking your Chat bots to the next stage
 Zero to advanced Voice Machines with Tropo
T
so what’s on the menu
Taking your bots to the
next stage
© 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Taking bots to the next stage
Hosting
• Many options: IaaS, Containers, PaaS
• Concerns: Availability, Scalability,
Security, Rate Limitation
• Pricing balance: who’s willing to pay for
the bot, and how much
• Heroku PaaS Free Dynos
• AWS/Google/Microsoft free plans
• Currently testing Serverless Functions
© 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Google Functions pricing
6
© 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
The Serverless Functions opportunity
7
https://github.com/ObjectIsAdvantag/devnetexpress-bot
Remember?
a bot is nothing more
than a POST endpoint
…
with an healthcheck !
© 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
The Serverless Functions opportunity
> gcloud alpha functions deploy sparkbot
--entry-point googlefunction
--stage-bucket objectisadvantag-functions
--trigger-http
--memory 128MB
--timeout 1s
8
https://github.com/ObjectIsAdvantag/devnetexpress-bot
© 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
The Serverless Functions opportunity
• An easy way to remove the Serverless burden
9
https://github.com/ObjectIsAdvantag/devnetexpress-bot
© 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Taking bots to the next stage
• But who created the bot ?
• What is the usage policy ?
• How can I contact support, send feedback ?
• What about my data privacy ?
© 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
@CiscoDevNet /about
11
© 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Taking bots to the next stage
Is the bot down ?
© 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 13
Bot Metadata
HealthCheck
© 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Is the bot down ? a proposal
• Register the Bot in a Universal Database
• Chat services supported
• Healthcheck endpoints
• Author, Policies
• Metadata again…
• chatbot.land domain reserved
• who’s in ? twitter://@SteveSfartz
14
© 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Join the Cisco DevNet code labs
https://learninglabs.cisco.com/tracks/collab-cloud
From Zero to advanced
Voice Machines with Tropo
© 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
What is Tropo ?
Cloud APIs enabling developers to quickly
and easily embed communication capabilities
into their applications and business processes.
© 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
+
• Ask
• Call
• Conference
• Hangup
• Record
• Reject
• Say
• Transfer
18
Tropo in a nutshell
© 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
say("hello world");
19
Text to Speech
© 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public 20
Play an Audio File
say(“http://.../troporocks.mp3");
© 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Outbound Voice Call
call("+14155550100");
say("Tag, you’re it!");
2
© 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Send a Text Message
call("+14155550100",
{network:"SMS"}
);
say("Tag, you’re it!");
2
Asking a Question
var result = ask("What's your favorite
color? Choose red, blue or green.", {
choices:"red, blue, green"
});
say("You said " + result.value);
log("They said " + result.value);
2
Voicemail Application
record("Leave your message. Press
pound when finished.", {
beep:true,
timeout:10,
silenceTimeout:7,
maxTime:60,
terminator:'#',
recordFormat:"audio/mp3",
recordURI:"ftp://.../file.mp3" });
2
© 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
How to setup your own Voice Machine
• Signup at http://tropo.com
• Create a new Scripting app
• Point to an IVR script:
http://bit.ly/TROPO-IVR
• Pick a phone number
• Save the application
25
© 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Globally available
Global Outgoing Calls & Messages
Numbers in 42 countries
80 speech languages
26
© 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Account Types
• Free
• Low-volume
• Restricted use
• No production
usage
• 24x7 support
Developer
• Pre-paid
• Credit Card
• Self-service
signup
• Shared Cloud
• one minute billing
increments
Production
27
Travaux pratiques
JS-Republic
07 56 78 01 42
© 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
How to setup a custom IVR
• The IVR is composed of :
• a local phone number
• a custom script executed by the Tropo Scripting platform
dials #1
+07 56 78 01 42
« Welcome »
details via SMS
calls
Voice Machine
script
29
© 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
IVR script highlights
• Forking a new session to send a SMS
30
© 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Join the Cisco DevNet code labs
https://learninglabs.cisco.com/tracks/collab-cloud
© 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Serverless is great
• no deployment hurdles, scalability from day 1
… but
• tedious dev cycles (commit, push, test)
• painful to diagnose (read logs through)
 local emulators to the rescue
 run and debug locally
 integrate in a CI/CD tool chain
Lessons learnt
© 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Tropo Ready!
• Tropo Ready!
• + URL to the project
• Browse the project
https://github.com/ObjectIsAdvantag/tropo-ready-vscode
© 2017 Cisco and/or its affiliates. All rights reserved. Cisco Public
Tropo Emulator in practice
https://github.com/ObjectIsAdvantag/tropo-ready-vscode
Thank you
@CiscoDevNet
@CiscoSparkDev
@SteveSfartz

Phone Communications in Javascript with Tropo Serverless

  • 1.
    Phone Communications in Javascript StèveSFARTZ API Evangelist - Cisco DevNet stsfartz@cisco.com, @SteveSfartz, github://ObjectIsadvantag
  • 2.
    © 2017 Ciscoand/or its affiliates. All rights reserved. Cisco Public /Cisco/DevNet/SteveSfartz • API Evangelist @CiscoDevNet • Cisco Spark Apps & Tropo APIs • code addict, nodejs, love story with #golang • France and all around Europe • hosted @PIRL – Paris Innovation Center & Research Lab • twitter://@SteveSfartz • github://ObjectIsAdvantag “vision without execution is hallucination” -- Thomas Edison stsfartz@cisco.com @SteveSfartz
  • 3.
    3  Taking yourChat bots to the next stage  Zero to advanced Voice Machines with Tropo T so what’s on the menu
  • 4.
    Taking your botsto the next stage
  • 5.
    © 2017 Ciscoand/or its affiliates. All rights reserved. Cisco Public Taking bots to the next stage Hosting • Many options: IaaS, Containers, PaaS • Concerns: Availability, Scalability, Security, Rate Limitation • Pricing balance: who’s willing to pay for the bot, and how much • Heroku PaaS Free Dynos • AWS/Google/Microsoft free plans • Currently testing Serverless Functions
  • 6.
    © 2017 Ciscoand/or its affiliates. All rights reserved. Cisco Public Google Functions pricing 6
  • 7.
    © 2017 Ciscoand/or its affiliates. All rights reserved. Cisco Public The Serverless Functions opportunity 7 https://github.com/ObjectIsAdvantag/devnetexpress-bot Remember? a bot is nothing more than a POST endpoint … with an healthcheck !
  • 8.
    © 2017 Ciscoand/or its affiliates. All rights reserved. Cisco Public The Serverless Functions opportunity > gcloud alpha functions deploy sparkbot --entry-point googlefunction --stage-bucket objectisadvantag-functions --trigger-http --memory 128MB --timeout 1s 8 https://github.com/ObjectIsAdvantag/devnetexpress-bot
  • 9.
    © 2017 Ciscoand/or its affiliates. All rights reserved. Cisco Public The Serverless Functions opportunity • An easy way to remove the Serverless burden 9 https://github.com/ObjectIsAdvantag/devnetexpress-bot
  • 10.
    © 2017 Ciscoand/or its affiliates. All rights reserved. Cisco Public Taking bots to the next stage • But who created the bot ? • What is the usage policy ? • How can I contact support, send feedback ? • What about my data privacy ?
  • 11.
    © 2017 Ciscoand/or its affiliates. All rights reserved. Cisco Public @CiscoDevNet /about 11
  • 12.
    © 2017 Ciscoand/or its affiliates. All rights reserved. Cisco Public Taking bots to the next stage Is the bot down ?
  • 13.
    © 2017 Ciscoand/or its affiliates. All rights reserved. Cisco Public 13 Bot Metadata HealthCheck
  • 14.
    © 2017 Ciscoand/or its affiliates. All rights reserved. Cisco Public Is the bot down ? a proposal • Register the Bot in a Universal Database • Chat services supported • Healthcheck endpoints • Author, Policies • Metadata again… • chatbot.land domain reserved • who’s in ? twitter://@SteveSfartz 14
  • 15.
    © 2017 Ciscoand/or its affiliates. All rights reserved. Cisco Public Join the Cisco DevNet code labs https://learninglabs.cisco.com/tracks/collab-cloud
  • 16.
    From Zero toadvanced Voice Machines with Tropo
  • 17.
    © 2017 Ciscoand/or its affiliates. All rights reserved. Cisco Public What is Tropo ? Cloud APIs enabling developers to quickly and easily embed communication capabilities into their applications and business processes.
  • 18.
    © 2017 Ciscoand/or its affiliates. All rights reserved. Cisco Public + • Ask • Call • Conference • Hangup • Record • Reject • Say • Transfer 18 Tropo in a nutshell
  • 19.
    © 2017 Ciscoand/or its affiliates. All rights reserved. Cisco Public say("hello world"); 19 Text to Speech
  • 20.
    © 2017 Ciscoand/or its affiliates. All rights reserved. Cisco Public 20 Play an Audio File say(“http://.../troporocks.mp3");
  • 21.
    © 2017 Ciscoand/or its affiliates. All rights reserved. Cisco Public Outbound Voice Call call("+14155550100"); say("Tag, you’re it!"); 2
  • 22.
    © 2017 Ciscoand/or its affiliates. All rights reserved. Cisco Public Send a Text Message call("+14155550100", {network:"SMS"} ); say("Tag, you’re it!"); 2
  • 23.
    Asking a Question varresult = ask("What's your favorite color? Choose red, blue or green.", { choices:"red, blue, green" }); say("You said " + result.value); log("They said " + result.value); 2
  • 24.
    Voicemail Application record("Leave yourmessage. Press pound when finished.", { beep:true, timeout:10, silenceTimeout:7, maxTime:60, terminator:'#', recordFormat:"audio/mp3", recordURI:"ftp://.../file.mp3" }); 2
  • 25.
    © 2017 Ciscoand/or its affiliates. All rights reserved. Cisco Public How to setup your own Voice Machine • Signup at http://tropo.com • Create a new Scripting app • Point to an IVR script: http://bit.ly/TROPO-IVR • Pick a phone number • Save the application 25
  • 26.
    © 2017 Ciscoand/or its affiliates. All rights reserved. Cisco Public Globally available Global Outgoing Calls & Messages Numbers in 42 countries 80 speech languages 26
  • 27.
    © 2017 Ciscoand/or its affiliates. All rights reserved. Cisco Public Account Types • Free • Low-volume • Restricted use • No production usage • 24x7 support Developer • Pre-paid • Credit Card • Self-service signup • Shared Cloud • one minute billing increments Production 27
  • 28.
  • 29.
    © 2017 Ciscoand/or its affiliates. All rights reserved. Cisco Public How to setup a custom IVR • The IVR is composed of : • a local phone number • a custom script executed by the Tropo Scripting platform dials #1 +07 56 78 01 42 « Welcome » details via SMS calls Voice Machine script 29
  • 30.
    © 2017 Ciscoand/or its affiliates. All rights reserved. Cisco Public IVR script highlights • Forking a new session to send a SMS 30
  • 31.
    © 2017 Ciscoand/or its affiliates. All rights reserved. Cisco Public Join the Cisco DevNet code labs https://learninglabs.cisco.com/tracks/collab-cloud
  • 32.
    © 2017 Ciscoand/or its affiliates. All rights reserved. Cisco Public Serverless is great • no deployment hurdles, scalability from day 1 … but • tedious dev cycles (commit, push, test) • painful to diagnose (read logs through)  local emulators to the rescue  run and debug locally  integrate in a CI/CD tool chain Lessons learnt
  • 33.
    © 2017 Ciscoand/or its affiliates. All rights reserved. Cisco Public Tropo Ready! • Tropo Ready! • + URL to the project • Browse the project https://github.com/ObjectIsAdvantag/tropo-ready-vscode
  • 34.
    © 2017 Ciscoand/or its affiliates. All rights reserved. Cisco Public Tropo Emulator in practice https://github.com/ObjectIsAdvantag/tropo-ready-vscode
  • 35.

Editor's Notes

  • #4 Bots are fun !!! Thoughts and lessons learnt building: Voice Machines Chat Bots
  • #25 You’re in control
  • #30 TODO: Add URL to the VOICE Machine
  • #33 Understand how the Tropo Scripting platform manages your files For development, host your scripts on an external URL for changes to reflect instanlty Tropo will fetch your script everytime Host on Github gist, edit your favorite IDE When going live, host your scripts on Tropo Production File Servers
  • #35 Live coding