diff --git a/Vonage.Test/NumbersTests.cs b/Vonage.Test/NumbersTests.cs
index f4869de7..b90886bb 100644
--- a/Vonage.Test/NumbersTests.cs
+++ b/Vonage.Test/NumbersTests.cs
@@ -18,7 +18,7 @@ public class NumbersTests : TestBase
public NumbersTests()
{
this.credentials = this.BuildCredentials();
- this.client = this.BuildVonageClient(credentials);
+ this.client = this.BuildVonageClient(this.credentials);
}
[Fact]
@@ -91,7 +91,7 @@ public async Task FailedPurchase()
}
[Fact]
- public async Task GetAvailableNumbers()
+ public async Task GetAvailableNumbersAsync()
{
const string expectedResponse =
@"{""count"": 1234,""numbers"": [{""country"": ""GB"",""msisdn"": ""447700900000"",""type"": ""mobile-lvn"",""cost"": ""1.25"",""features"": [""VOICE"",""SMS""]}]}";
@@ -111,10 +111,10 @@ public async Task GetAvailableNumbers()
}
[Fact]
- public async Task GetAvailableNumbersAsync()
+ public async Task GetAvailableNumbersAsyncWithAdditionalData()
{
const string expectedResponse =
- @"{""count"": 1234,""numbers"": [{""country"": ""GB"",""msisdn"": ""447700900000"",""type"": ""mobile-lvn"",""cost"": ""1.25"",""features"": [""VOICE"",""SMS""]}]}";
+ @"{""count"": 1234,""numbers"": [{""country"": ""GB"",""msisdn"": ""447700900000"",""type"": ""mobile-lvn"",""cost"": ""1.25"",""features"": [""VOICE"",""SMS""], ""moHttpUrl"": ""https://example.com/webhooks/inbound-sms"", ""messagesCallbackType"": ""app"", ""messagesCallbackValue"": ""aaaaaaaa-bbbb-cccc-dddd-0123456789ab"", ""voiceCallbackType"": ""app"", ""voiceCallbackValue"": ""aaaaaaaa-bbbb-cccc-dddd-0123456789ab""}]}";
var expectedUri =
$"{this.RestUrl}/number/search?country=GB&api_key={this.ApiKey}&api_secret={this.ApiSecret}&";
var request = new NumberSearchRequest {Country = "GB"};
@@ -128,6 +128,11 @@ public async Task GetAvailableNumbersAsync()
Assert.Equal("1.25", number.Cost);
Assert.Equal("VOICE", number.Features[0]);
Assert.Equal("SMS", number.Features[1]);
+ number.MoHttpUrl.Should().Be("https://example.com/webhooks/inbound-sms");
+ number.MessagesCallbackType.Should().Be("app");
+ number.MessagesCallbackValue.Should().Be("aaaaaaaa-bbbb-cccc-dddd-0123456789ab");
+ number.VoiceCallbackType.Should().Be("app");
+ number.VoiceCallbackValue.Should().Be("aaaaaaaa-bbbb-cccc-dddd-0123456789ab");
}
[Fact]
@@ -175,6 +180,32 @@ public async Task GetOwnedNumbersAsync()
number.ApplicationId.Should().BeNull();
}
+ [Fact]
+ public async Task GetOwnedNumbersAsyncWithAdditionalData()
+ {
+ const string expectedResponse =
+ @"{""count"": 1234,""numbers"": [{""country"": ""GB"",""msisdn"": ""447700900000"",""type"": ""mobile-lvn"",""cost"": ""1.25"",""features"": [""VOICE"",""SMS""], ""moHttpUrl"": ""https://example.com/webhooks/inbound-sms"", ""messagesCallbackType"": ""app"", ""messagesCallbackValue"": ""aaaaaaaa-bbbb-cccc-dddd-0123456789ab"", ""voiceCallbackType"": ""app"", ""voiceCallbackValue"": ""aaaaaaaa-bbbb-cccc-dddd-0123456789ab""}]}";
+ var expectedUri =
+ $"{this.RestUrl}/account/numbers?country=GB&api_key={this.ApiKey}&api_secret={this.ApiSecret}&";
+ var request = new NumberSearchRequest {Country = "GB"};
+ this.Setup(expectedUri, expectedResponse);
+ var response = await this.client.NumbersClient.GetOwnedNumbersAsync(request);
+ var number = response.Numbers[0];
+ Assert.Equal(1234, response.Count);
+ Assert.Equal("GB", number.Country);
+ Assert.Equal("447700900000", number.Msisdn);
+ Assert.Equal("mobile-lvn", number.Type);
+ Assert.Equal("1.25", number.Cost);
+ Assert.Equal("VOICE", number.Features[0]);
+ Assert.Equal("SMS", number.Features[1]);
+ number.ApplicationId.Should().BeNull();
+ number.MoHttpUrl.Should().Be("https://example.com/webhooks/inbound-sms");
+ number.MessagesCallbackType.Should().Be("app");
+ number.MessagesCallbackValue.Should().Be("aaaaaaaa-bbbb-cccc-dddd-0123456789ab");
+ number.VoiceCallbackType.Should().Be("app");
+ number.VoiceCallbackValue.Should().Be("aaaaaaaa-bbbb-cccc-dddd-0123456789ab");
+ }
+
[Fact]
public async Task GetOwnedNumbersAsyncWithCredentials()
{
diff --git a/Vonage/Numbers/Number.cs b/Vonage/Numbers/Number.cs
index 4146073f..f6fa8bf2 100644
--- a/Vonage/Numbers/Number.cs
+++ b/Vonage/Numbers/Number.cs
@@ -41,4 +41,34 @@ public class Number
///
[JsonProperty("app_id")]
public string ApplicationId { get; set; }
+
+ ///
+ /// The URL of the webhook endpoint that handles inbound messages
+ ///
+ [JsonProperty("moHttpUrl")]
+ public string MoHttpUrl { get; set; }
+
+ ///
+ /// The messages webhook type: always app
+ ///
+ [JsonProperty("messagesCallbackType")]
+ public string MessagesCallbackType { get; set; }
+
+ ///
+ /// An Application ID
+ ///
+ [JsonProperty("messagesCallbackValue")]
+ public string MessagesCallbackValue { get; set; }
+
+ ///
+ /// The voice webhook type: sip, tel, or app
+ ///
+ [JsonProperty("voiceCallbackType")]
+ public string VoiceCallbackType { get; set; }
+
+ ///
+ /// A SIP URI, telephone number or Application ID
+ ///
+ [JsonProperty("voiceCallbackValue")]
+ public string VoiceCallbackValue { get; set; }
}
\ No newline at end of file