Skip to content

Commit

Permalink
Merge pull request #58 from Bandwidth/DX-2639
Browse files Browse the repository at this point in the history
DX-2639 Add Call Queueing Support
  • Loading branch information
ajrice6713 authored Jun 20, 2022
2 parents 52967e2 + 76cabe5 commit e715986
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 12 deletions.
19 changes: 18 additions & 1 deletion Bandwidth.Standard/Voice/Models/CallState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public CallState()
/// <param name="state">state.</param>
/// <param name="identity">identity.</param>
/// <param name="stirShaken">stirShaken.</param>
/// <param name="enqueuedTime">enqueuedTime.</param>
/// <param name="startTime">startTime.</param>
/// <param name="answerTime">answerTime.</param>
/// <param name="endTime">endTime.</param>
Expand All @@ -76,6 +77,7 @@ public CallState(
string state = null,
string identity = null,
Dictionary<string, string> stirShaken = null,
DateTime? enqueuedTime = null,
DateTime? startTime = null,
DateTime? answerTime = null,
DateTime? endTime = null,
Expand All @@ -102,6 +104,7 @@ public CallState(
}

this.StirShaken = stirShaken;
this.EnqueuedTime = enqueuedTime;
this.StartTime = startTime;
if (answerTime != null)
{
Expand Down Expand Up @@ -215,6 +218,13 @@ public string Identity
[JsonProperty("stirShaken", NullValueHandling = NullValueHandling.Ignore)]
public Dictionary<string, string> StirShaken { get; set; }

/// <summary>
/// Gets or sets EnqueuedTime.
/// </summary>
[JsonConverter(typeof(IsoDateTimeConverter))]
[JsonProperty("enqueuedTime", NullValueHandling = NullValueHandling.Ignore)]
public DateTime? EnqueuedTime { get; set; }

/// <summary>
/// Gets or sets StartTime.
/// </summary>
Expand Down Expand Up @@ -474,6 +484,7 @@ public override bool Equals(object obj)
((this.State == null && other.State == null) || (this.State?.Equals(other.State) == true)) &&
((this.Identity == null && other.Identity == null) || (this.Identity?.Equals(other.Identity) == true)) &&
((this.StirShaken == null && other.StirShaken == null) || (this.StirShaken?.Equals(other.StirShaken) == true)) &&
((this.EnqueuedTime == null && other.EnqueuedTime == null) || this.EnqueuedTime?.Equals(other.EnqueuedTime) == true) &&
((this.StartTime == null && other.StartTime == null) || (this.StartTime?.Equals(other.StartTime) == true)) &&
((this.AnswerTime == null && other.AnswerTime == null) || (this.AnswerTime?.Equals(other.AnswerTime) == true)) &&
((this.EndTime == null && other.EndTime == null) || (this.EndTime?.Equals(other.EndTime) == true)) &&
Expand Down Expand Up @@ -538,6 +549,11 @@ public override int GetHashCode()
hashCode += this.StirShaken.GetHashCode();
}

if (this.EnqueuedTime != null)
{
hashCode += this.EnqueuedTime.GetHashCode();
}

if (this.StartTime != null)
{
hashCode += this.StartTime.GetHashCode();
Expand Down Expand Up @@ -592,6 +608,7 @@ protected void ToString(List<string> toStringOutput)
toStringOutput.Add($"this.State = {(this.State == null ? "null" : this.State == string.Empty ? "" : this.State)}");
toStringOutput.Add($"this.Identity = {(this.Identity == null ? "null" : this.Identity == string.Empty ? "" : this.Identity)}");
toStringOutput.Add($"StirShaken = {(this.StirShaken == null ? "null" : this.StirShaken.ToString())}");
toStringOutput.Add($"this.EnqueuedTime = {(this.EnqueuedTime == null ? "null" : this.EnqueuedTime.ToString())}");
toStringOutput.Add($"this.StartTime = {(this.StartTime == null ? "null" : this.StartTime.ToString())}");
toStringOutput.Add($"this.AnswerTime = {(this.AnswerTime == null ? "null" : this.AnswerTime.ToString())}");
toStringOutput.Add($"this.EndTime = {(this.EndTime == null ? "null" : this.EndTime.ToString())}");
Expand All @@ -601,4 +618,4 @@ protected void ToString(List<string> toStringOutput)
toStringOutput.Add($"this.LastUpdate = {(this.LastUpdate == null ? "null" : this.LastUpdate.ToString())}");
}
}
}
}
20 changes: 10 additions & 10 deletions Bandwidth.Standard/Voice/Models/CreateCallResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public CreateCallResponse()
/// <param name="callUrl">callUrl.</param>
/// <param name="answerUrl">answerUrl.</param>
/// <param name="answerMethod">answerMethod.</param>
/// <param name="startTime">startTime.</param>
/// <param name="enqueuedTime">enqueuedTime.</param>
/// <param name="callTimeout">callTimeout.</param>
/// <param name="callbackTimeout">callbackTimeout.</param>
/// <param name="answerFallbackUrl">answerFallbackUrl.</param>
Expand All @@ -82,7 +82,7 @@ public CreateCallResponse(
string callUrl,
string answerUrl,
Models.AnswerMethodEnum answerMethod,
DateTime? startTime = null,
DateTime? enqueuedTime = null,
double? callTimeout = null,
double? callbackTimeout = null,
string answerFallbackUrl = null,
Expand All @@ -101,7 +101,7 @@ public CreateCallResponse(
this.ApplicationId = applicationId;
this.To = to;
this.From = from;
this.StartTime = startTime;
this.EnqueuedTime = enqueuedTime;
this.CallUrl = callUrl;
this.CallTimeout = callTimeout;
this.CallbackTimeout = callbackTimeout;
Expand Down Expand Up @@ -186,11 +186,11 @@ public CreateCallResponse(
public string From { get; set; }

/// <summary>
/// Gets or sets StartTime.
/// Gets or sets EnqueuedTime.
/// </summary>
[JsonConverter(typeof(IsoDateTimeConverter))]
[JsonProperty("startTime", NullValueHandling = NullValueHandling.Ignore)]
public DateTime? StartTime { get; set; }
[JsonProperty("enqueuedTime", NullValueHandling = NullValueHandling.Ignore)]
public DateTime? EnqueuedTime { get; set; }

/// <summary>
/// Gets or sets CallUrl.
Expand Down Expand Up @@ -572,7 +572,7 @@ public override bool Equals(object obj)
((this.ApplicationId == null && other.ApplicationId == null) || (this.ApplicationId?.Equals(other.ApplicationId) == true)) &&
((this.To == null && other.To == null) || (this.To?.Equals(other.To) == true)) &&
((this.From == null && other.From == null) || (this.From?.Equals(other.From) == true)) &&
((this.StartTime == null && other.StartTime == null) || (this.StartTime?.Equals(other.StartTime) == true)) &&
((this.EnqueuedTime == null && other.EnqueuedTime == null) || (this.EnqueuedTime?.Equals(other.EnqueuedTime) == true)) &&
((this.CallUrl == null && other.CallUrl == null) || (this.CallUrl?.Equals(other.CallUrl) == true)) &&
((this.CallTimeout == null && other.CallTimeout == null) || (this.CallTimeout?.Equals(other.CallTimeout) == true)) &&
((this.CallbackTimeout == null && other.CallbackTimeout == null) || (this.CallbackTimeout?.Equals(other.CallbackTimeout) == true)) &&
Expand Down Expand Up @@ -620,9 +620,9 @@ public override int GetHashCode()
hashCode += this.From.GetHashCode();
}

if (this.StartTime != null)
if (this.EnqueuedTime != null)
{
hashCode += this.StartTime.GetHashCode();
hashCode += this.EnqueuedTime.GetHashCode();
}

if (this.CallUrl != null)
Expand Down Expand Up @@ -711,7 +711,7 @@ protected void ToString(List<string> toStringOutput)
toStringOutput.Add($"this.ApplicationId = {(this.ApplicationId == null ? "null" : this.ApplicationId == string.Empty ? "" : this.ApplicationId)}");
toStringOutput.Add($"this.To = {(this.To == null ? "null" : this.To == string.Empty ? "" : this.To)}");
toStringOutput.Add($"this.From = {(this.From == null ? "null" : this.From == string.Empty ? "" : this.From)}");
toStringOutput.Add($"this.StartTime = {(this.StartTime == null ? "null" : this.StartTime.ToString())}");
toStringOutput.Add($"this.EnqueuedTime = {(this.EnqueuedTime == null ? "null" : this.EnqueuedTime.ToString())}");
toStringOutput.Add($"this.CallUrl = {(this.CallUrl == null ? "null" : this.CallUrl == string.Empty ? "" : this.CallUrl)}");
toStringOutput.Add($"this.CallTimeout = {(this.CallTimeout == null ? "null" : this.CallTimeout.ToString())}");
toStringOutput.Add($"this.CallbackTimeout = {(this.CallbackTimeout == null ? "null" : this.CallbackTimeout.ToString())}");
Expand Down
1 change: 1 addition & 0 deletions Bandwidth.StandardTests/Voice/CreateCallTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public async Task CreateCallReturnsCreated()
Assert.Equal(applicationId, createCallResponse.Data.ApplicationId);
Assert.Equal(to, createCallResponse.Data.To);
Assert.Equal(from, createCallResponse.Data.From);
Assert.IsType<DateTime>(createCallResponse.Data.EnqueuedTime);
}

[Fact]
Expand Down
3 changes: 2 additions & 1 deletion Bandwidth.StandardTests/Voice/GetCallTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public async Task GetCallReturnsOk()
Assert.True(getCallStateResponse.Data.State == "initiated" || getCallStateResponse.Data.State == "disconnected");
Assert.Null(getCallStateResponse.Data.Identity);
Assert.Empty(getCallStateResponse.Data.StirShaken);
Assert.IsType<DateTime>(getCallStateResponse.Data.EnqueuedTime);
Assert.IsType<DateTime>(getCallStateResponse.Data.StartTime);
Assert.Null(getCallStateResponse.Data.AnswerTime);
Assert.True(getCallStateResponse.Data.DisconnectCause == null || getCallStateResponse.Data.DisconnectCause == "busy");
Expand All @@ -86,4 +87,4 @@ public async Task GetCallReturnsOk()
while (retries > 0);
}
}
}
}

0 comments on commit e715986

Please sign in to comment.