Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SchemaVersion mismatch error when returning CallandBridge action #125

Open
majid20222 opened this issue Feb 13, 2024 · 4 comments
Open

SchemaVersion mismatch error when returning CallandBridge action #125

majid20222 opened this issue Feb 13, 2024 · 4 comments

Comments

@majid20222
Copy link

majid20222 commented Feb 13, 2024

Describe the issue

I am integrating AWS PSTN audio service with AWS Chime meetings and want to make an Outbound Call to a phone number. I am working in amazon-chime-sdk-js on front end in angular and my backend is in dot net core 3.1. I am using the AWS Chime SDK Meetings and AWS Chime SDK Voice for meetings and calling respectively.

When I made a SIP call using

CreateSipMediaApplicationCallRequest request = new CreateSipMediaApplicationCallRequest
{
FromPhoneNumber = fromNumber,
ToPhoneNumber = toNumber,
SipMediaApplicationId = getSipMediaApplicationResponse.SipMediaApplication.SipMediaApplicationId,
SipHeaders = new Dictionary<string, string>
{
{ "X-chime-join-token" , teleMeetingJoinToken} ,
{ "X-chime-meeting-id", chimeMeetingId}
},
ArgumentsMap = new Dictionary<string, string>
{
{ "MeetingId", chimeMeetingId },
{ "RequestedDialNumber", toNumber },
{ "DialVC", "false" }
}
};

CreateSipMediaApplicationCallResponse result = await amazonChimeSDKVoiceClient.CreateSipMediaApplicationCallAsync(request);
return result;

As evident from { "DialVC", "false" }, I am using PSTN audio service for calling instead of Voice connector Uri as there are 2 approaches.

Outbound call is made , my lambda function is triggered with following series of events from SIPMediaApplication :
"InvocationEventType": "NEW_OUTBOUND_CALL", "InvocationEventType": "RINGING", "InvocationEventType": "CALL_ANSWERED",

Here is one of event as an sample:

{
"SchemaVersion": "1.0",
"Sequence": 1,
"InvocationEventType": "NEW_OUTBOUND_CALL",
"ActionData": {
"Type": "CallCreateRequest",
"Parameters": {
"Arguments": {
"DialVC": "false",
"RequestedVCArn": null,
"MeetingId": "6f8dafc1-274a-4471-93a3-b773545d3172",
"RequestorEmail": null,
"RequestedDialNumber": "+1**********"
},
"CallTimeoutSeconds": 0,
"CallerIdNumber": null,
"ParticipantTag": null,
"Endpoints": null,
"CallId": null,
"SipResponseCode": 0,
"ReceivedDigits": 0
},
"ErrorType": null,
"ErrorMessage": null
},
"CallDetails": {
"TransactionId": "ba950e5a-fa0f-4d1d-9ce7-b2ca60911b78",
"AwsAccountId": "***********",
"AwsRegion": "us-east-1",
"SipMediaApplicationId": "032c6130-9967-41de-u89v-1c3b043b1f02",
"SipRuleId": null,
"TransactionAttributes": null,
"Participants": [
{
"CallId": "7e09fb9c-9b3c-4b37-k7h4-3ccc53764218",
"ParticipantTag": "LEG-A",
"To": "+1**********",
"From": "+1**********",
"Direction": "Outbound",
"StartTimeInMilliseconds": "1706710463004",
"Status": null
}
]
},
"ErrorType": null,
"ErrorMessage": null
}

And in response to that CALL_ANSWERED event, I am returning CallAndBridge action as:

{
"SchemaVersion": "1.0",
"Actions": [
{
"Type": "CallAndBridge",
"Parameters": {
"CallTimeoutSeconds": 30,
"CallerIdNumber": "+1**********",
"Endpoints": [
{
"BridgeEndpointType": "PSTN",
"Uri": "+1**********"
}
]
}
}
]
}

And as soon as the call is answered at the receiver's end, lambda function is triggered with INVALID_LAMBDA_RESPONSE event and error message is

"ErrorType": "SchemaVersionMismatch",
"ErrorMessage": "Schema version included in invocation request does not match with schema version in the response."

After this event, call HangUp and my lambda is triggered with HANGUP event.

I have analyzed the issue at my end and realized that "SchemaVersion" in the event I received and the response I am returning is same i.e., "1.0"

I need help with this error to resolve it as SchemaVersion is same and I am unable to understand the reason of this error.

I am using Lambda function, SIPMediaApplication, and meeting all the things in the same AWS account.

Steps to Reproduce

I have just integrated the SIP calling in my project.

Current behavior

CallAndBridge action is not being completed as I get SchemaVersion mismatch error. Due to which call is not being possible and it quickly hangs up.

AWS SDK version used

"AWSSDK.ChimeSDKMeetings" Version="3.7.301.15" || "AWSSDK.ChimeSDKVoice" Version="3.7.100.3" || "AWSSDK.Core" Version="3.7.301.9"

Operating System and version

Windows 10 pro , browser: google

@schuettc
Copy link
Contributor

Is it possible that you're not sending it back in the correct JSON format? I've seen this before and that is what "SchemaVersionMismatch" typically means. If you use it with the include TypeScript, does it work?

@majid20222
Copy link
Author

Is it possible that you're not sending it back in the correct JSON format? I've seen this before and that is what "SchemaVersionMismatch" typically means. If you use it with the include TypeScript, does it work?

Please see below the response of my lambda function to SIP Media Application (SMA) for CALL_ANSWERED event:

{
statusCode: 200,
body: '{
"SchemaVersion": "1.0",
"Actions": [
{
"Type": "CallAndBridge",
"Parameters": {
"CallTimeoutSeconds": 30,
"CallerIdNumber": "+1**********",
"Endpoints": [
{
"BridgeEndpointType": "PSTN",
"Uri": "+1**********"
}
]
}
}
],
"TransactionAttributes": {
"MeetingId": "",
"RequestedDialNumber": "",
"DialVC": ""
}
}'
}

It is in JSON format, can you please highlight the possible issue in that ?

Moreover, I have looked at the following documentation for response :
https://docs.aws.amazon.com/chime-sdk/latest/dg/call-and-bridge.html

@schuettc
Copy link
Contributor

Does it work if you use the original code? If you're still unable to get it to work and sure you're sending JSON and not stringified JSON, please open a ticket.

@majid20222
Copy link
Author

Does it work if you use the original code? If you're still unable to get it to work and sure you're sending JSON and not stringified JSON, please open a ticket.

Hi Schuettc,
Appreciate your support in resolving the issue.

I was previously sending stringified JSON as evident in above response I shared.
But I have tried with sending JSON object as well but it still didn't work and throws same error : "ErrorType": "SchemaVersionMismatch".

My Workflow: SIPMeidaApplication (SMA) triggers --> lambda --> call an endpoint of dot net core project with event (from SMA) as payload, that endpoint contain logic for handling event (similar to smaHandler in the provided project) and returning response back to lambda --> lambda return the response received from endpoint back to SMA as JSON object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants