

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 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**  
*描述* – `ParticipantTag` 中其中一個已連線參與者的描述 `CallDetails`  
*允許的值* – `LEG-A`或 `LEG-B`  
*必要* – 否  
*預設值* - 如果您指定 ，則叫`ParticipantTag`用`callLeg`忽略的預設值 `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-call-notifications](https://github.com/aws-samples/amazon-chime-sma-outbound-call-notifications)
+ [https://github.com/aws-samples/amazon-chime-sma-on-demand-recording](https://github.com/aws-samples/amazon-chime-sma-on-demand-recording)
+ [https://github.com/aws-samples/amazon-chime-sma-update-call](https://github.com/aws-samples/amazon-chime-sma-update-call)