本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
您可以使用 ReceiveDigits
動作來收集傳入 DTMF 數字,並將其與規則表達式比對。當 SIP 媒體應用程式收到符合規則表達式的數字時,它會呼叫具有 ACTION_SUCCESSFUL
事件的 AWS Lambda 函數。收集的數字會出現在 ActionData
物件中的ReceivedDigits
值中。
例如:
{
"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"
}
]
}
}
呼叫者輸入符合您一般表達式模式的數字後,SIP 媒體應用程式會叫用 AWS Lambda 函數,傳回下列類型的承載:
{
"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"
}
]
}
}
請參閱 GitHub 上的工作範例:https://https://github.com/aws-samples/amazon-chime-sma-on-demand-recording