public void UpdateConfig() { var expectedJson = GetJsonPayload("/numbers/numberLeasesApi/request/updateNumberLeaseConfig.json"); var restRequest = MockRestResponse(expectedJson); var config = new NumberConfig { Number = "12345678901", ConfigType = NumberConfig.NumberConfigType.TRACKING, CallTrackingConfig = new CallTrackingConfig { Screen = false, Recorded = true, TransferNumbers = new List <string> { "12135551122", "12135551189" } } }; Client.NumberLeasesApi.UpdateConfig(config); Assert.AreEqual(Method.PUT, restRequest.Value.Method); var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.That(requestBodyParam.Value, Is.EqualTo(expectedJson)); Assert.That(restRequest.Value.Resource, Is.StringEnding("/numbers/leases/configs/12345678901")); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is CatalogCustomAttributeDefinition other && ((Type == null && other.Type == null) || (Type?.Equals(other.Type) == true)) && ((Name == null && other.Name == null) || (Name?.Equals(other.Name) == true)) && ((Description == null && other.Description == null) || (Description?.Equals(other.Description) == true)) && ((SourceApplication == null && other.SourceApplication == null) || (SourceApplication?.Equals(other.SourceApplication) == true)) && ((AllowedObjectTypes == null && other.AllowedObjectTypes == null) || (AllowedObjectTypes?.Equals(other.AllowedObjectTypes) == true)) && ((SellerVisibility == null && other.SellerVisibility == null) || (SellerVisibility?.Equals(other.SellerVisibility) == true)) && ((AppVisibility == null && other.AppVisibility == null) || (AppVisibility?.Equals(other.AppVisibility) == true)) && ((StringConfig == null && other.StringConfig == null) || (StringConfig?.Equals(other.StringConfig) == true)) && ((NumberConfig == null && other.NumberConfig == null) || (NumberConfig?.Equals(other.NumberConfig) == true)) && ((SelectionConfig == null && other.SelectionConfig == null) || (SelectionConfig?.Equals(other.SelectionConfig) == true)) && ((CustomAttributeUsageCount == null && other.CustomAttributeUsageCount == null) || (CustomAttributeUsageCount?.Equals(other.CustomAttributeUsageCount) == true)) && ((Key == null && other.Key == null) || (Key?.Equals(other.Key) == true))); }
public static void Main(string[] args) { var client = new CallfireClient("api_login", "api_password"); // create new IVR config var config = new NumberConfig { Number = "19206596476", ConfigType = NumberConfig.NumberConfigType.IVR, IvrInboundConfig = new IvrInboundConfig { DialplanXml = @" <dialplan name=""Root""> <menu maxDigits=""1"" timeout=""3500"" name=""Live""> <play type=""tts"" voice=""female1""> Hello this is AB Advertising, please press 1 to transfer to our sales representative, press 2 to contact clients support. </play> <keypress pressed=""1""> <!-- user pressed 1, store this data in 'selected_menu' variable --> <stash varname=""selected_menu"">sales</stash> <play type=""tts"" voice=""female1""> You will be transferred to sales representative in a moment. Please wait. </play> <transfer callerid=""${call.callerid}"" musiconhold=""blues"" mode=""ringall""> 15550004455 </transfer> </keypress> <keypress pressed=""2"" name=""kp_become_volonteer""> <!-- user pressed 2, store this data in 'selected_menu' variable --> <stash varname=""selected_menu"">support</stash> <play type=""tts"" voice=""female1""> You will be transferred to clients support. Please wait. </play> <transfer callerid=""${call.callerid}"" musiconhold=""blues"" mode=""ringall""> 15550005500 </transfer> </keypress> <!-- if pressed key is not specified in menu replay Live menu --> <keypress pressed=""default"" name=""incorrect_Selection""> <play type=""tts"" voice=""female1"">That is not a valid selection. Please try again.</play> <goto name=""replay_Live"">Live</goto> </keypress> </menu> <play type=""tts"" voice=""female1""> Thank you for calling us. Have a good day. </play> <hangup name=""Hangup""/> </dialplan> " } }; client.NumberLeasesApi.UpdateConfig(config); }
public void UpdateConfig() { var expectedJson = GetJsonPayload("/numbers/numberLeasesApi/request/updateNumberLeaseConfig.json"); var restRequest = MockRestResponse(expectedJson); var config = new NumberConfig { Number = "12345678901", ConfigType = NumberConfig.NumberConfigType.TRACKING, CallTrackingConfig = new CallTrackingConfig { Screen = false, Recorded = true, TransferNumbers = new List <string> { "12135551122", "12135551189" }, Voicemail = true, IntroSoundId = 1234, VoicemailSoundId = 1234, FailedTransferSoundId = 1234, WhisperSoundId = 1234, WeeklySchedule = new WeeklySchedule { StartTimeOfDay = new LocalTime { Hour = 1, Minute = 1, Second = 1 }, StopTimeOfDay = new LocalTime { Hour = 2, Minute = 2, Second = 2 }, DaysOfWeek = new HashSet <DayOfWeek> { DayOfWeek.FRIDAY }, TimeZone = "America/Los_Angeles" }, GoogleAnalytics = new GoogleAnalytics { Category = "Sales", GoogleAccountId = "UA-12345-26", Domain = "testDomain" } } }; Client.NumberLeasesApi.UpdateConfig(config); System.Console.WriteLine(config); Assert.AreEqual(Method.PUT, restRequest.Value.Method); var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.That(Serializer.Serialize(requestBodyParam.Value), Is.EqualTo(expectedJson)); Assert.That(restRequest.Value.Resource, Does.EndWith("/numbers/leases/configs/12345678901")); }
protected void ToString(List <string> toStringOutput) { toStringOutput.Add($"Type = {(Type == null ? "null" : Type.ToString())}"); toStringOutput.Add($"Name = {(Name == null ? "null" : Name == string.Empty ? "" : Name)}"); toStringOutput.Add($"Description = {(Description == null ? "null" : Description == string.Empty ? "" : Description)}"); toStringOutput.Add($"SourceApplication = {(SourceApplication == null ? "null" : SourceApplication.ToString())}"); toStringOutput.Add($"AllowedObjectTypes = {(AllowedObjectTypes == null ? "null" : $"[{ string.Join(", ", AllowedObjectTypes)} ]")}"); toStringOutput.Add($"SellerVisibility = {(SellerVisibility == null ? "null" : SellerVisibility.ToString())}"); toStringOutput.Add($"AppVisibility = {(AppVisibility == null ? "null" : AppVisibility.ToString())}"); toStringOutput.Add($"StringConfig = {(StringConfig == null ? "null" : StringConfig.ToString())}"); toStringOutput.Add($"NumberConfig = {(NumberConfig == null ? "null" : NumberConfig.ToString())}"); toStringOutput.Add($"SelectionConfig = {(SelectionConfig == null ? "null" : SelectionConfig.ToString())}"); toStringOutput.Add($"CustomAttributeUsageCount = {(CustomAttributeUsageCount == null ? "null" : CustomAttributeUsageCount.ToString())}"); toStringOutput.Add($"Key = {(Key == null ? "null" : Key == string.Empty ? "" : Key)}"); }
public override int GetHashCode() { int hashCode = 1892852076; if (Type != null) { hashCode += Type.GetHashCode(); } if (Name != null) { hashCode += Name.GetHashCode(); } if (Description != null) { hashCode += Description.GetHashCode(); } if (SourceApplication != null) { hashCode += SourceApplication.GetHashCode(); } if (AllowedObjectTypes != null) { hashCode += AllowedObjectTypes.GetHashCode(); } if (SellerVisibility != null) { hashCode += SellerVisibility.GetHashCode(); } if (AppVisibility != null) { hashCode += AppVisibility.GetHashCode(); } if (StringConfig != null) { hashCode += StringConfig.GetHashCode(); } if (NumberConfig != null) { hashCode += NumberConfig.GetHashCode(); } if (SelectionConfig != null) { hashCode += SelectionConfig.GetHashCode(); } if (CustomAttributeUsageCount != null) { hashCode += CustomAttributeUsageCount.GetHashCode(); } if (Key != null) { hashCode += Key.GetHashCode(); } return(hashCode); }
public NumberConfigTests() { _configRepository = Substitute.For <IConfigRepository>(); _subject = new NumberConfig(_configRepository); }
public static void Main(string[] args) { var client = new CallfireClient("api_login", "api_password"); NumberConfig config = client.NumberLeasesApi.GetConfig("12132000384", "number,configType"); }
/// <summary> /// Update number lease config /// </summary> /// <param name="config">config to update</param> /// <exception cref="BadRequestException"> in case HTTP response code is 400 - Bad request, the request was formatted improperly.</exception> /// <exception cref="UnauthorizedException"> in case HTTP response code is 401 - Unauthorized, API Key missing or invalid.</exception> /// <exception cref="AccessForbiddenException"> in case HTTP response code is 403 - Forbidden, insufficient permissions.</exception> /// <exception cref="ResourceNotFoundException"> in case HTTP response code is 404 - NOT FOUND, the resource requested does not exist.</exception> /// <exception cref="InternalServerErrorException"> in case HTTP response code is 500 - Internal Server Error.</exception> /// <exception cref="CallfireApiException"> in case HTTP response code is something different from codes listed above.</exception> /// <exception cref="CallfireClientException"> in case error has occurred in client.</exception> public void UpdateConfig(NumberConfig config) { Validate.NotBlank(config.Number, "config.number cannot be blank"); Client.Put <object>(NUMBER_CONFIGS_ITEM_PATH.ReplaceFirst(ClientConstants.PLACEHOLDER, config.Number), config); }
public static void Main(string[] args) { var client = new CallfireClient("api_login", "api_password"); // create new call tracking config var callTrackingConfig = new CallTrackingConfig { Screen = false, Recorded = true, Voicemail = true, IntroSoundId = 10004001, WhisperSoundId = 10005002, VoicemailSoundId = 10006003, FailedTransferSoundId = 10007004, TransferNumbers = new List <string> { "12135551122", "12135551189" }, WeeklySchedule = new WeeklySchedule() { StartTimeOfDay = new LocalTime { Hour = 10, Minute = 0, Second = 0 }, StopTimeOfDay = new LocalTime { Hour = 18, Minute = 0, Second = 0 }, DaysOfWeek = new HashSet <DayOfWeek> { DayOfWeek.MONDAY, DayOfWeek.TUESDAY, DayOfWeek.WEDNESDAY, DayOfWeek.THURSDAY, DayOfWeek.FRIDAY }, TimeZone = "America/New_York" }, GoogleAnalytics = new GoogleAnalytics() { Domain = "domain - name", GoogleAccountId = "UA - XXXXX - 2X", Category = "Sales" } }; // OR create IVR config IvrInboundConfig = new IvrInboundConfig { DialplanXml = @" <dialplan name=""Root""> <menu maxDigits=""1"" timeout=""3500"" name=""Live""> <play type=""tts"" voice=""female1""> Hello this is AB Advertising, please press 1 to transfer to our sales representative, press 2 to contact clients support. </play> <keypress pressed=""1""> <!-- user pressed 1, store this data in 'selected_menu' variable --> <stash varname=""selected_menu"">sales</stash> <play type=""tts"" voice=""female1""> You will be transferred to sales representative in a moment. Please wait. </play> <transfer callerid=""${call.callerid}"" musiconhold=""blues"" mode=""ringall""> 15550004455 </transfer> </keypress> <keypress pressed=""2"" name=""kp_become_volonteer""> <!-- user pressed 2, store this data in 'selected_menu' variable --> <stash varname=""selected_menu"">support</stash> <play type=""tts"" voice=""female1""> You will be transferred to clients support. Please wait. </play> <transfer callerid=""${call.callerid}"" musiconhold=""blues"" mode=""ringall""> 15550005500 </transfer> </keypress> <!-- if pressed key is not specified in menu replay Live menu --> <keypress pressed=""default"" name=""incorrect_Selection""> <play type=""tts"" voice=""female1"">That is not a valid selection. Please try again.</play> <goto name=""replay_Live"">Live</goto> </keypress> </menu> <play type=""tts"" voice=""female1""> Thank you for calling us. Have a good day. </play> <hangup name=""Hangup""/> </dialplan> " }; NumberConfig config = new NumberConfig { Number = "19206596476", // depends on what type of configuration your need assign TRACKING or IVR config ConfigType = NumberConfig.NumberConfigType.TRACKING, CallTrackingConfig = callTrackingConfig // ConfigType = NumberConfig.NumberConfigType.IVR, // CallTrackingConfig = IvrInboundConfig }; client.NumberLeasesApi.UpdateConfig(config); }