Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Understanding the Amazon Chime SDK PSTN audio service programming model

Focus mode
Understanding the Amazon Chime SDK PSTN audio service programming model - Amazon Chime SDK

The PSTN audio service uses a request/response programming model that in turn uses AWS Lambda functions. Your AWS Lambda function is invoked automatically for incoming and outgoing calls. For example, when a new incoming call arrives, the PSTN audio service invokes your AWS Lambda function with a NEW_INCOMING_CALL event and waits for commands called Actions. For example, your application can choose actions such as playing an audio prompt, collecting digits, recording audio, or routing the call onward. These JSON formatted actions are sent back to the PSTN audio service using a callback from your AWS Lambda function.

This example shows a PlayAudio action.

{ "Type": "PlayAudio", "Parameters": { "CallId": "call-id-1", "ParticipantTag": "LEG-A", "PlaybackTerminators": ["1", "8", "#"], "Repeat": "5", "AudioSource": { "Type": "S3", "BucketName": "valid-S3-bucket-name", "Key": "wave-file.wav" } } }

This example shows a RecordAudio action.

{ "Type": "RecordAudio", "Parameters": { "CallId": "call-id-1", "DurationInSeconds": "10", "SilenceDurationInSeconds": 3, "SilenceThreshold": 100, "RecordingTerminators": [ "#" ], "RecordingDestination": { "Type": "S3", "BucketName": "valid-bucket-name", "Prefix": "valid-prefix-name" } } }

Once the PSTN audio service runs the action, it invokes your AWS Lambda function again with either a success or failure indication.

Your application can also make outbound phone calls and use your AWS Lambda function to control the call flow, caller experience, and call context. In this case, you call the CreateSipMediaApplicationCall API, and your AWS Lambda is invoked with a NEW_OUTBOUND_CALL event. Once the call is answered, you can return actions, such as playing a voice prompt and collecting user-entered digits. You can also trigger your AWS Lambda function using the UpdateSipMediaApplicationCall API to implement timers, participant muting, and waiting rooms.

PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.