

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# Amazon Chime SDK PSTN 오디오 서비스의 텔레포니 이벤트에 대한 응답 작업 지정
<a name="use-case-2"></a>

오디오 서비스에서 SIP 미디어 애플리케이션은 AWS Lambda 함수를 호출합니다. 그러면 Lambda 함수는 actions**라는 명령어 목록을 반환할 수 있습니다. 작업은 전화 통화 레그에서 실행하려는 항목으로, 숫자 전송이나 수신, 회의 참여 등이 있습니다. PSTN 오디오 서비스에서 간접 호출하는 작업에 대한 자세한 내용은 [Amazon Chime SDK PSTN 오디오 서비스의 텔레포니 이벤트 이해](pstn-invocations.md) 단원을 참조하세요.

SIP 미디어 애플리케이션이 작업 목록을 성공적으로 실행하면 애플리케이션은 호출 이벤트 유형이 인 AWS Lambda 함수를 호출합니다`ACTION_SUCCESSFUL`. 작업이 완료되지 않으면 SIP 미디어 애플리케이션이 `ACTION_FAILED` 이벤트와 함께 AWS Lambda 함수를 호출합니다.

SIP 미디어 애플리케이션은 목록에 있는 모든 작업이 성공한 경우에만 `ACTION_SUCCESSFUL`을 반환합니다. 목록에 있는 작업 중 하나라도 실패하면 SIP 미디어 애플리케이션은 `ACTION_FAILED` 이벤트와 함께 AWS Lambda 함수를 호출하고 실패한 작업 후 목록에 있는 나머지 작업을 지웁니다. 그런 다음 SIP 미디어 애플리케이션은 AWS Lambda 함수에서 반환되는 다음 작업을 실행합니다. `ActionData` 키를 사용하여 함수를 간접 호출한 호출이 무엇인지 식별할 수 있습니다.

다음 이벤트는 `PlayAudioAndGetDigits` 작업 후의 `ACTION_SUCCESSFUL` 간접 호출 이벤트 유형에 대한 샘플 페이로드를 보여줍니다.

```
{
    "SchemaVersion": "1.0",
    "Sequence": {{3}},
    "InvocationEventType": "ACTION_SUCCESSFUL",
    "ActionData": {
        "Type": "PlayAudioAndGetDigits",
        "Parameters" : {
            "CallId": "{{call-id-1}}",
            "AudioSource": {
                "Type": "S3",
                "BucketName": "{{bucket-name}}",
                "Key": "{{failure-audio-file.wav}}"
            },
            "FailureAudioSource": {
                "Type": "S3",
                "BucketName": "{{bucket-name}}",
                "Key": "{{failure-audio-file.wav}}"
            },
            "MinNumberOfDigits": {{3}},
            "MaxNumberOfDigits": {{5}},
            "TerminatorDigits": ["{{#}}"],
            "InBetweenDigitsDurationInMilliseconds": {{5000}},
            "Repeat": 3,
            "RepeatDurationInMilliseconds": {{10000}}
        },
        "ReceivedDigits": "{{123}}"
    }
    "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 함수를 호출하여 실패를 알리고 해당 호출에서 실행할 새 작업 세트를 가져옵니다. 다음 이벤트는 `PlayAudio` 작업 후의 `ACTION_FAILED` 간접 호출 이벤트 유형에 대한 샘플 페이로드를 보여줍니다.

```
{
    "SchemaVersion": "1.0",
    "Sequence": {{4}},
    "InvocationEventType": "ACTION_FAILED",
    "ActionData": {
        "Type": "PlayAudio",
        "Parameters" : {
            "CallId": "{{call-id-1}}",
            "AudioSource": {
                "Type": "S3",
                "BucketName": "{{bucket-name}}",
                "Key": "{{audio-file.wav}}"            
            }
        },
        "ErrorType": "InvalidAudioSource",
        "ErrorMessage": "Audio Source parameter value is invalid."
    }
    "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"
            }
        ]
    }
}
}
```