Closed MarcusKohnert closed 5 months ago
Hi @MarcusKohnert,
Thanks for raising that one. I'll have a look asap
Hi @MarcusKohnert,
FYI the issue is fixed - the PR is linked. Unfortunately, this change can be considered a breaking change as I'm altering the signature of a public object. Normally, I should wait for the next major version (v7.0.0), but I was expecting that later this year. I'm considering pushing this one through anyway, given the current class is unstable. I'll let you know the outcome
Unblocked myself with the following workaround:
EventBase eventBase;
try
{
eventBase = EventBase.ParseEvent(json);
}
catch (JsonSerializationException) // workaround https://github.com/Vonage/vonage-dotnet-sdk/issues/567
{
var callStatusEvent = JsonConvert.DeserializeObject<CallStatusEvent>(json, VonageSerialization.SerializerSettings)!;
eventBase = new Answered
{
From = callStatusEvent.From,
Uuid = callStatusEvent.Uuid,
ConversationUuid = callStatusEvent.ConversationUuid,
To = callStatusEvent.To,
Direction = callStatusEvent.Direction,
Status = callStatusEvent.Status,
DetailString = callStatusEvent.DetailString,
StartTime = DateTime.Now,
TimeStamp = callStatusEvent.TimeStamp
};
}
I'm sorry you had to go down that route :sweat_smile:
Hi @MarcusKohnert,
I wanted to share some feedback. This breaking change is available in the latest version v7.0.0-alpha. Being an alpha, the package is still subject to potential problems. I do expect a final version very soon.
Describe the bug I'm using the EventBase.ParseEvent method to parse the received webhook events.
Expected behaviour: The method is able to parse an Answered event send by Vonage.
Actual behaviour:
EventBase.ParseEvent
throws an exception becausestart_time
is null and StartTime is of type DateTime (which is not nullable).StackTrace
Environment: