

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# ReceiveDigits
<a name="listen-to-digits"></a>

当用户输入与此操作中指定的正则表达式模式相匹配的数字时，SIP 媒体应用程序将调用该 AWS Lambda 函数。

```
{
    "Type": "ReceiveDigits",
    "Parameters": {
        "CallId": "call-id-1",
        "ParticipantTag": "LEG-A",
        "InputDigitsRegex": "^\d{2}#$",
        "InBetweenDigitsDurationInMilliseconds": 1000, 
        "FlushDigitsDurationInMilliseconds": 10000
    }
}
```

**CallId**  
*描述* — `CallId` AWS Lambda 函数调用`CallDetails`中的参与者  
*允许的值* — 有效的调用 ID  
*必填* — 否  
*默认值* – 无

**ParticipantTag**  
*描述* — `CallDetails` 中一个已连接参与者的 `ParticipantTag`  
*允许的值* — `LEG-A` 或 `LEG-B`  
*必填* — 否  
*默认值* — 已调用 `callLeg` 的 `ParticipantTag`，如指定 `CallId`，则忽略该值

**InputDigitsRegex**  
*描述* — 正则表达式模式  
*允许的值* — 有效的正则表达式模式  
*必填* — 是  
*默认值* – 无

**InBetweenDigitsDurationInMilliseconds**  
*描述* — 检查输入是否与正则表达式模式匹配前数字之间的时间间隔  
*允许的值* — 持续时间（以毫秒为单位）  
*必填* — 是  
*默认值* – 无

**FlushDigitsDurationInMilliseconds**  
*描述*-刷新收到的 DTMF 数字并将其发送到函数的时间间隔。 AWS Lambda 如果 SIP 媒体应用程序在时间间隔结束后收到新的数字，则计时器将重新启动。  
*允许的值* — `InBetweenDigitsDurationInMilliseconds`  
*必填* — 是  
*默认值* – 无

SIP 媒体应用程序在调用期间放弃 DTMF 数字，直至收到新的 `ReceiveDigits` 操作。`FlushDigitsDurationInMilliseconds` 间隔时间从 SIP 媒体应用程序收到第一个 DTMF 数字时开始。如果用户在间隔到期之前输入了正确的数字，则 SIP 媒体应用程序将调用中描述的 AWS Lambda 功能。[使用 Amazon Chime SDK PSTN 音频服务接收来电者输入](case-4.md)

如果用户输入与正则表达式模式不匹配，SIP 媒体应用程序将重复“失败”的音频文件消息，直到应用程序耗尽重复计数或用户输入有效数字。

参见以下工作示例 GitHub：
+ [https://github.com/aws-samples/amazon-chime-sma-outbound-来电通知](https://github.com/aws-samples/amazon-chime-sma-outbound-call-notifications)
+ [https://github.com/aws-samples/amazon-chime-sma-on-需求录音](https://github.com/aws-samples/amazon-chime-sma-on-demand-recording)
+ [https://github.com/aws-samples/amazon-chime-sma-update-打电话](https://github.com/aws-samples/amazon-chime-sma-update-call)