Skip to content

Commit e715986

Browse files
authored
Merge pull request #58 from Bandwidth/DX-2639
DX-2639 Add Call Queueing Support
2 parents 52967e2 + 76cabe5 commit e715986

File tree

4 files changed

+31
-12
lines changed

4 files changed

+31
-12
lines changed

Bandwidth.Standard/Voice/Models/CallState.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public CallState()
5858
/// <param name="state">state.</param>
5959
/// <param name="identity">identity.</param>
6060
/// <param name="stirShaken">stirShaken.</param>
61+
/// <param name="enqueuedTime">enqueuedTime.</param>
6162
/// <param name="startTime">startTime.</param>
6263
/// <param name="answerTime">answerTime.</param>
6364
/// <param name="endTime">endTime.</param>
@@ -76,6 +77,7 @@ public CallState(
7677
string state = null,
7778
string identity = null,
7879
Dictionary<string, string> stirShaken = null,
80+
DateTime? enqueuedTime = null,
7981
DateTime? startTime = null,
8082
DateTime? answerTime = null,
8183
DateTime? endTime = null,
@@ -102,6 +104,7 @@ public CallState(
102104
}
103105

104106
this.StirShaken = stirShaken;
107+
this.EnqueuedTime = enqueuedTime;
105108
this.StartTime = startTime;
106109
if (answerTime != null)
107110
{
@@ -215,6 +218,13 @@ public string Identity
215218
[JsonProperty("stirShaken", NullValueHandling = NullValueHandling.Ignore)]
216219
public Dictionary<string, string> StirShaken { get; set; }
217220

221+
/// <summary>
222+
/// Gets or sets EnqueuedTime.
223+
/// </summary>
224+
[JsonConverter(typeof(IsoDateTimeConverter))]
225+
[JsonProperty("enqueuedTime", NullValueHandling = NullValueHandling.Ignore)]
226+
public DateTime? EnqueuedTime { get; set; }
227+
218228
/// <summary>
219229
/// Gets or sets StartTime.
220230
/// </summary>
@@ -474,6 +484,7 @@ public override bool Equals(object obj)
474484
((this.State == null && other.State == null) || (this.State?.Equals(other.State) == true)) &&
475485
((this.Identity == null && other.Identity == null) || (this.Identity?.Equals(other.Identity) == true)) &&
476486
((this.StirShaken == null && other.StirShaken == null) || (this.StirShaken?.Equals(other.StirShaken) == true)) &&
487+
((this.EnqueuedTime == null && other.EnqueuedTime == null) || this.EnqueuedTime?.Equals(other.EnqueuedTime) == true) &&
477488
((this.StartTime == null && other.StartTime == null) || (this.StartTime?.Equals(other.StartTime) == true)) &&
478489
((this.AnswerTime == null && other.AnswerTime == null) || (this.AnswerTime?.Equals(other.AnswerTime) == true)) &&
479490
((this.EndTime == null && other.EndTime == null) || (this.EndTime?.Equals(other.EndTime) == true)) &&
@@ -538,6 +549,11 @@ public override int GetHashCode()
538549
hashCode += this.StirShaken.GetHashCode();
539550
}
540551

552+
if (this.EnqueuedTime != null)
553+
{
554+
hashCode += this.EnqueuedTime.GetHashCode();
555+
}
556+
541557
if (this.StartTime != null)
542558
{
543559
hashCode += this.StartTime.GetHashCode();
@@ -592,6 +608,7 @@ protected void ToString(List<string> toStringOutput)
592608
toStringOutput.Add($"this.State = {(this.State == null ? "null" : this.State == string.Empty ? "" : this.State)}");
593609
toStringOutput.Add($"this.Identity = {(this.Identity == null ? "null" : this.Identity == string.Empty ? "" : this.Identity)}");
594610
toStringOutput.Add($"StirShaken = {(this.StirShaken == null ? "null" : this.StirShaken.ToString())}");
611+
toStringOutput.Add($"this.EnqueuedTime = {(this.EnqueuedTime == null ? "null" : this.EnqueuedTime.ToString())}");
595612
toStringOutput.Add($"this.StartTime = {(this.StartTime == null ? "null" : this.StartTime.ToString())}");
596613
toStringOutput.Add($"this.AnswerTime = {(this.AnswerTime == null ? "null" : this.AnswerTime.ToString())}");
597614
toStringOutput.Add($"this.EndTime = {(this.EndTime == null ? "null" : this.EndTime.ToString())}");
@@ -601,4 +618,4 @@ protected void ToString(List<string> toStringOutput)
601618
toStringOutput.Add($"this.LastUpdate = {(this.LastUpdate == null ? "null" : this.LastUpdate.ToString())}");
602619
}
603620
}
604-
}
621+
}

Bandwidth.Standard/Voice/Models/CreateCallResponse.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public CreateCallResponse()
6060
/// <param name="callUrl">callUrl.</param>
6161
/// <param name="answerUrl">answerUrl.</param>
6262
/// <param name="answerMethod">answerMethod.</param>
63-
/// <param name="startTime">startTime.</param>
63+
/// <param name="enqueuedTime">enqueuedTime.</param>
6464
/// <param name="callTimeout">callTimeout.</param>
6565
/// <param name="callbackTimeout">callbackTimeout.</param>
6666
/// <param name="answerFallbackUrl">answerFallbackUrl.</param>
@@ -82,7 +82,7 @@ public CreateCallResponse(
8282
string callUrl,
8383
string answerUrl,
8484
Models.AnswerMethodEnum answerMethod,
85-
DateTime? startTime = null,
85+
DateTime? enqueuedTime = null,
8686
double? callTimeout = null,
8787
double? callbackTimeout = null,
8888
string answerFallbackUrl = null,
@@ -101,7 +101,7 @@ public CreateCallResponse(
101101
this.ApplicationId = applicationId;
102102
this.To = to;
103103
this.From = from;
104-
this.StartTime = startTime;
104+
this.EnqueuedTime = enqueuedTime;
105105
this.CallUrl = callUrl;
106106
this.CallTimeout = callTimeout;
107107
this.CallbackTimeout = callbackTimeout;
@@ -186,11 +186,11 @@ public CreateCallResponse(
186186
public string From { get; set; }
187187

188188
/// <summary>
189-
/// Gets or sets StartTime.
189+
/// Gets or sets EnqueuedTime.
190190
/// </summary>
191191
[JsonConverter(typeof(IsoDateTimeConverter))]
192-
[JsonProperty("startTime", NullValueHandling = NullValueHandling.Ignore)]
193-
public DateTime? StartTime { get; set; }
192+
[JsonProperty("enqueuedTime", NullValueHandling = NullValueHandling.Ignore)]
193+
public DateTime? EnqueuedTime { get; set; }
194194

195195
/// <summary>
196196
/// Gets or sets CallUrl.
@@ -572,7 +572,7 @@ public override bool Equals(object obj)
572572
((this.ApplicationId == null && other.ApplicationId == null) || (this.ApplicationId?.Equals(other.ApplicationId) == true)) &&
573573
((this.To == null && other.To == null) || (this.To?.Equals(other.To) == true)) &&
574574
((this.From == null && other.From == null) || (this.From?.Equals(other.From) == true)) &&
575-
((this.StartTime == null && other.StartTime == null) || (this.StartTime?.Equals(other.StartTime) == true)) &&
575+
((this.EnqueuedTime == null && other.EnqueuedTime == null) || (this.EnqueuedTime?.Equals(other.EnqueuedTime) == true)) &&
576576
((this.CallUrl == null && other.CallUrl == null) || (this.CallUrl?.Equals(other.CallUrl) == true)) &&
577577
((this.CallTimeout == null && other.CallTimeout == null) || (this.CallTimeout?.Equals(other.CallTimeout) == true)) &&
578578
((this.CallbackTimeout == null && other.CallbackTimeout == null) || (this.CallbackTimeout?.Equals(other.CallbackTimeout) == true)) &&
@@ -620,9 +620,9 @@ public override int GetHashCode()
620620
hashCode += this.From.GetHashCode();
621621
}
622622

623-
if (this.StartTime != null)
623+
if (this.EnqueuedTime != null)
624624
{
625-
hashCode += this.StartTime.GetHashCode();
625+
hashCode += this.EnqueuedTime.GetHashCode();
626626
}
627627

628628
if (this.CallUrl != null)
@@ -711,7 +711,7 @@ protected void ToString(List<string> toStringOutput)
711711
toStringOutput.Add($"this.ApplicationId = {(this.ApplicationId == null ? "null" : this.ApplicationId == string.Empty ? "" : this.ApplicationId)}");
712712
toStringOutput.Add($"this.To = {(this.To == null ? "null" : this.To == string.Empty ? "" : this.To)}");
713713
toStringOutput.Add($"this.From = {(this.From == null ? "null" : this.From == string.Empty ? "" : this.From)}");
714-
toStringOutput.Add($"this.StartTime = {(this.StartTime == null ? "null" : this.StartTime.ToString())}");
714+
toStringOutput.Add($"this.EnqueuedTime = {(this.EnqueuedTime == null ? "null" : this.EnqueuedTime.ToString())}");
715715
toStringOutput.Add($"this.CallUrl = {(this.CallUrl == null ? "null" : this.CallUrl == string.Empty ? "" : this.CallUrl)}");
716716
toStringOutput.Add($"this.CallTimeout = {(this.CallTimeout == null ? "null" : this.CallTimeout.ToString())}");
717717
toStringOutput.Add($"this.CallbackTimeout = {(this.CallbackTimeout == null ? "null" : this.CallbackTimeout.ToString())}");

Bandwidth.StandardTests/Voice/CreateCallTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public async Task CreateCallReturnsCreated()
4343
Assert.Equal(applicationId, createCallResponse.Data.ApplicationId);
4444
Assert.Equal(to, createCallResponse.Data.To);
4545
Assert.Equal(from, createCallResponse.Data.From);
46+
Assert.IsType<DateTime>(createCallResponse.Data.EnqueuedTime);
4647
}
4748

4849
[Fact]

Bandwidth.StandardTests/Voice/GetCallTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public async Task GetCallReturnsOk()
6464
Assert.True(getCallStateResponse.Data.State == "initiated" || getCallStateResponse.Data.State == "disconnected");
6565
Assert.Null(getCallStateResponse.Data.Identity);
6666
Assert.Empty(getCallStateResponse.Data.StirShaken);
67+
Assert.IsType<DateTime>(getCallStateResponse.Data.EnqueuedTime);
6768
Assert.IsType<DateTime>(getCallStateResponse.Data.StartTime);
6869
Assert.Null(getCallStateResponse.Data.AnswerTime);
6970
Assert.True(getCallStateResponse.Data.DisconnectCause == null || getCallStateResponse.Data.DisconnectCause == "busy");
@@ -86,4 +87,4 @@ public async Task GetCallReturnsOk()
8687
while (retries > 0);
8788
}
8889
}
89-
}
90+
}

0 commit comments

Comments
 (0)