aws-samples / amazon-chime-sma-outbound-call-notifications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Outbound Notifications with SIP Media Application

This demo will build and configure several services within AWS so that you can send a meeting reminder with confirmation to a PSTN phone.

NOTE Your use of the Amazon Chime SDK for automated calling is subject to the AWS Customer agreement (including the AWS Acceptable Use Policy) and any other agreement with AWS governing your use of AWS services. It is your responsibility to comply with all applicable laws and regulations regarding the use of automated calling, including any requirements to obtain the consent of called parties.

Overview

To PSTN

Diagram

With Asterisk

AsteriskDiagram

Requirements

  • node V12+/npm installed
  • yarn installed
  • python3/pip installed
  • AWS CLI installed
  • Ability to create a Chime SIP media applications and Phone Numbers (ensure your Service Quota in us-east-1 for Phone Numbers have not been reached)
  • Deployment must be done in us-east-1 or us-west-2 to align with SIP media application resources

Deployment

Back-end Resources

  • Clone this repo: git clone https://github.com/aws-samples/amazon-chime-sma-outbound-call-notifications
  • cd amazon-chime-sma-outbound-call-notifications
  • ./deploy.sh
  • Accept prompts for CDK deployment
  • To deploy with an Asterisk endpoint for automatic call answering ./deploy.sh -o withAsterisk

Local client

  • cd client-app
  • yarn
  • yarn start

Description

This deployment will build everything required to see Amazon Chime SIP media application in action. A phone number will be provided as part of the CDK output. This is the number that the call will be made from.

Resources Created

  • outboundCall - Python Lambda that creates wav files for SMA playback and calls create_sip_media_application_call to make outbound calls
  • smaOutbound - SMA Lambda that handles processing from SMA
  • graphqlResolver - Lambda resolver for graphQL queries and mutations
  • outgoingWav Bucket - S3 bucket to store wav files for playing customized messages
  • requesterInfo DynamoDB - Table used to store numbers to call and status of those calls
  • AppSync API - Used to process DynamoDB Table and handle queries and mutations from Lambdas
  • SIP media application - Chime SMA used to make outbound calls. Associated with smaOutbound Lambda
  • (Optional) Asterisk Server on Public VPC. Used to answer calls and reply with DTMF. Please note - Asterisk can take ~5 minutes to create and configure during CDK deployment. To access Asterisk, please use Session Manager within EC2.
  • (Optional) Chime Voice Connector with Phone Number associated with Asterisk server.

Additional Resources

  • utils\createWav.py - Python script to create wav files using Polly
  • utils\CreateCsv.js - Node script to create csv file with random names to call Asterisk server
  • wav_files\* - wav files uploaded to outgoingWav bucket for use with SMA

Local Client Use

LocalClient

The local client is a React app that allows you to upload a CSV file that contains the following fields: phoneNumber,message,firstName,lastName

Once the file is uploaded, it will populate the fields:

LocalClient2

This will also upload the fields to a DynamoDB using GraphQL for later processing and updating. To initiate the notifications, press Send Calls. This will make an axios call to an API Gateway triggering the OutboundCall Lambda. This Lambda will make calls to the number requested and update the DynanamoDB using GraphQL. This will update the React app using a subscription to give immediate feedback about the state of the call. If you are using the Asterisk option for sending calls, please be patient as it can take several minutes to fully deploy and configure the Asterisk.

LocalClient3

Cleanup

To clean up this demo: yarn cdk destroy --all. Additionally, Chime SIP media applications, rules, voice connectors, and phone numbers should be manually removed in the Chime Console.

About

License:MIT No Attribution


Languages

Language:JavaScript 34.1%Language:TypeScript 27.9%Language:Python 24.5%Language:Shell 9.5%Language:CSS 3.3%Language:HTML 0.6%