Giter Site home page Giter Site logo

iotbuttonphonecall's Introduction

IotButtonPhoneCall

Features

Use AWS IoT Enterprise Button to make a programmable phone call.

  • Single click -> make a phone call
  • Double click -> stop the phone call
  • Long press -> toggle mute mode

Setup

Gem twilio-ruby uses nokogiri which includes binary library. So if you install them in macOS env, you cannot run the app in AWS Lambda runtime (which is based on Amazon Linux).

To avoid this problem, we need to install gems in Amazon Linux Docker container.

$ IMAGE_NAME="amazon-linux-ruby-2_5_3"
$ docker build -t $IMAGE_NAME .
$ docker run -it -v `pwd`:/src -w /src $IMAGE_NAME bundle install --deployment

Claim IoT Button device by following Claiming Devices - AWS IoT 1-Click.

Then, setup resouces using CloudFormation:

S3_BUCKET="<BUCKET>"
FUNCTION_NAME="IotButtonPhoneCall"
STACK_NAME="IotButtonPhoneCall"
DSN="<IOT_BUTTON_DSN>"
TWILIO_ACCOUNT="<ACCOUNT_SID>"
TWILIO_TOKEN="<SECRET_TOKEN>"
TWILIO_TEL="<PURCHACED_PHONE>" # E.164 format
TARGET_TEL="<YOUR_PHONE>"      # E.164 format

# Package Lambda binary and upload it to S3 bucket.
aws cloudformation package \
  --template-file cloudformation-template.yml \
  --s3-bucket $S3_BUCKET \
  --s3-prefix "Lambda/$FUNCTION_NAME" \
  --output-template-file packaged-template.yml

# Deploy all resources in AWS. (Also create CloudFormation stack)
aws cloudformation deploy \
  --template-file packaged-template.yml \
  --stack-name $STACK_NAME \
  --capabilities CAPABILITY_IAM \
  --parameter-overrides "DeviceDsn=$DSN" "FunctionName=$FUNCTION_NAME" "TwilioAccount=$TWILIO_ACCOUNT" "TwilioToken=$TWILIO_TOKEN" "TwilioTel=$TWILIO_TEL" "TargetTel=$TARGET_TEL"

# Destroy all resources in AWS. (Also delete CloudFormation stack)
aws cloudformation delete-stack --stack-name $STACK_NAME

References

iotbuttonphonecall's People

Contributors

tearoom6 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.