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.”

Receiving caller input for the Amazon Chime SDK PSTN audio service

Focus mode
Receiving caller input for the Amazon Chime SDK PSTN audio service - Amazon Chime SDK

You use the ReceiveDigits action to collect inbound DTMF digits and match them against a regular expression. When the SIP media application receives digits that match the regular expression, it invokes a AWS Lambda function with an ACTION_SUCCESSFUL event. The collected digits appear in the ReceivedDigits value in the ActionData object.

For example:

{ "SchemaVersion": "1.0", "Sequence": 4, "InvocationEventType": "ACTION_SUCCESSFUL", "ActionData": { "ReceivedDigits": "", "Type": "ReceiveDigits", "Parameters": { "CallId": "call-id-1", "InputDigitsRegex": "^\d{2}#$", "InBetweenDigitsDurationInMilliseconds": 5000, "FlushDigitsDurationInMilliseconds": 10000 } }, "CallDetails": { "TransactionId": "transaction-id", "AwsAccountId": "aws-account-id", "AwsRegion": "us-east-1", "SipRuleId": "sip-rule-id", "SipApplicationId": "sip-application-id", "Participants": [ { "CallId": "call-id-1", "ParticipantTag": "LEG-A", "To": "+12065551212", "From": "+15105550101", "Direction": "Inbound", "StartTimeInMilliseconds": "159700958834234", "Status": "Connected" } ] } }

Once the caller enters digits that match your regular expression pattern, the SIP media application invokes an AWS Lambda function that returns the following type of payload:

{ "SchemaVersion": "1.0", "Sequence": 5, "InvocationEventType": "DIGITS_RECEIVED", "ActionData": { "ReceivedDigits": "11#", "Type": "ReceiveDigits", "Parameters": { "CallId": "call-id-1", "InputDigitsRegex": "^\d{2}#$", "InBetweenDigitsDurationInMilliseconds": 5000, "FlushDigitsDurationInMilliseconds": 10000 } }, "CallDetails": { "TransactionId": "transaction-id", "AwsAccountId": "aws-account-id", "AwsRegion": "us-east-1", "SipRuleId": "sip-rule-id", "SipApplicationId": "sip-application-id", "Participants": [ { "CallId": "call-id-1", "ParticipantTag": "LEG-A", "To": "+12065551212", "From": "+15105550101", "Direction": "Inbound", "StartTimeInMilliseconds": "159700958834234", "Status": "Connected" } ] } }

See a working example on GitHub: https://github.com/aws-samples/amazon-chime-sma-on-demand-recording

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