diff --git a/CHANGELOG.md b/CHANGELOG.md index 72df7985..cda3feb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # Change Log +## [5.49.0](https://github.com/plivo/plivo-dotnet/tree/v5.49.0) (2024-09-30) +**Feature - Adding new param support for Number Masking session with single party ** +- Added `create_session_with_single_party`, `virtual_number_cooloff_period` and `force_pin_authentication` attributes in Masking Session + ## [5.48.1](https://github.com/plivo/plivo-dotnet/tree/v5.48.1) (2024-09-06) **Feature - Adding more attribute on mdr object** - Added `message_sent_time`, `message_updated_time` and `error-message` on get and list Message API diff --git a/README.md b/README.md index a7be5855..c2a4b584 100644 --- a/README.md +++ b/README.md @@ -12,13 +12,13 @@ You can install this SDK either by referencing the .dll file or using NuGet. Use the following line to install the latest SDK using the NuGet CLI. ``` -PM> Install-Package Plivo -Version 5.48.1 +PM> Install-Package Plivo -Version 5.49.0 ``` You can also use the .NET CLI to install this package as follows ``` -> dotnet add package Plivo --version 5.48.1 +> dotnet add package Plivo --version 5.49.0 ``` ## Getting started diff --git a/src/Plivo/Plivo.csproj b/src/Plivo/Plivo.csproj index 9b9fce3c..b3f099cc 100644 --- a/src/Plivo/Plivo.csproj +++ b/src/Plivo/Plivo.csproj @@ -1,7 +1,7 @@ netstandard2.0;netstandard1.3 - 5.48.1 + 5.49.0 Plivo SDKs Team Plivo Inc. diff --git a/src/Plivo/Plivo.nuspec b/src/Plivo/Plivo.nuspec index adc59aee..57815b2f 100644 --- a/src/Plivo/Plivo.nuspec +++ b/src/Plivo/Plivo.nuspec @@ -4,7 +4,7 @@ A .NET SDK to make voice calls and send SMS using Plivo and to generate Plivo XML A .NET SDK to make voice calls and send SMS using Plivo and to generate Plivo XML Plivo - 5.48.1 + 5.49.0 Plivo Plivo SDKs Team Plivo, Inc. diff --git a/src/Plivo/Resource/MaskingSession/MaskingSession.cs b/src/Plivo/Resource/MaskingSession/MaskingSession.cs index 9c121798..924fc65f 100644 --- a/src/Plivo/Resource/MaskingSession/MaskingSession.cs +++ b/src/Plivo/Resource/MaskingSession/MaskingSession.cs @@ -29,7 +29,7 @@ public async Task DeleteAsync(string Id) #region Update - public MaskingSessionUpdateResponse Update(string sessionUuid, uint? session_expiry = null, uint? call_time_limit = null, + public MaskingSessionUpdateResponse Update(string sessionUuid, string first_party = null, string second_party = null, uint? session_expiry = null, uint? call_time_limit = null, bool? record = null, string record_file_format = null, string recording_callback_url = null, string callback_url = null, string callback_method = null, uint? ring_timeout = null, string first_party_play_url = null, string second_party_play_url = null, string recording_callback_method = null, string subaccount = null, bool? geomatch = null @@ -37,13 +37,13 @@ public MaskingSessionUpdateResponse Update(string sessionUuid, u { var updateResponse = ((MaskingSessionInterface) Interface) - .Update(Id, session_expiry, call_time_limit, record, record_file_format, recording_callback_url, callback_url, + .Update(Id, first_party, second_party, session_expiry, call_time_limit, record, record_file_format, recording_callback_url, callback_url, callback_method, ring_timeout, first_party_play_url, second_party_play_url, recording_callback_method, subaccount, geomatch); return updateResponse; } - public async Task UpdateAsync(string sessionUuid, uint? session_expiry = null, uint? call_time_limit = null, + public async Task UpdateAsync(string sessionUuid, string first_party = null, string second_party = null, uint? session_expiry = null, uint? call_time_limit = null, bool? record = null, string record_file_format = null, string recording_callback_url = null, string callback_url = null, string callback_method = null, uint? ring_timeout = null, string first_party_play_url = null, string second_party_play_url = null, string recording_callback_method = null, string subaccount = null, bool? geomatch = null @@ -51,7 +51,7 @@ public async Task UpdateAsync(string sessionUuid, uint? session_e { var updateResponse = await ((MaskingSessionInterface)Interface) - .UpdateAsync(Id, session_expiry, call_time_limit, record, record_file_format, recording_callback_url, callback_url, + .UpdateAsync(Id, first_party, second_party, session_expiry, call_time_limit, record, record_file_format, recording_callback_url, callback_url, callback_method, ring_timeout, first_party_play_url, second_party_play_url, recording_callback_method, subaccount, geomatch); diff --git a/src/Plivo/Resource/MaskingSession/MaskingSessionInterface.cs b/src/Plivo/Resource/MaskingSession/MaskingSessionInterface.cs index 0eead7f5..2be28f31 100644 --- a/src/Plivo/Resource/MaskingSession/MaskingSessionInterface.cs +++ b/src/Plivo/Resource/MaskingSession/MaskingSessionInterface.cs @@ -15,16 +15,17 @@ public MaskingSessionInterface(HttpClient client) : base(client) #region Create public MaskingSessionCreateResponse Create( - string firstParty, string secondParty, uint? sessionExpiry = null, uint? callTimeLimit = null, + string firstParty = null, string secondParty = null, uint? sessionExpiry = null, uint? callTimeLimit = null, bool? record = null, string recordFileFormat = null, string recordingCallbackUrl = null, bool? initiateCallToFirstParty = null, string callbackUrl = null, string callbackMethod = null, uint? ringTimeout = null, string firstPartyPlayUrl = null, string secondPartyPlayUrl = null, string recordingCallbackMethod = null, bool? isPinAuthenticationRequired = null, bool? generatePin = null, uint? generatePinLength = null, string firstPartyPin = null, string secondPartyPin = null, string pinPromptPlay = null, uint? pinRetry = null, uint? pinRetryWait = null, string incorrectPinPlay = null, - string unknownCallerPlay = null, string subaccount = null, bool? geomatch = null + string unknownCallerPlay = null, string subaccount = null, bool? geomatch = null, bool? forcePinAuthentication = null, + bool? createSessionWithSingleParty= null, uint? virtualNumberCooloffPeriod = 0 ) { - var mandatoryParams = new List { "firstParty", "secondParty" }; + var mandatoryParams = new List { }; bool isVoiceRequest = true; var data = CreateData( mandatoryParams, @@ -56,7 +57,10 @@ public MaskingSessionCreateResponse Create( unknownCallerPlay, subaccount, geomatch, - isVoiceRequest + isVoiceRequest, + forcePinAuthentication, + createSessionWithSingleParty, + virtualNumberCooloffPeriod }); return ExecuteWithExceptionUnwrap(() => @@ -68,16 +72,17 @@ public MaskingSessionCreateResponse Create( } public async Task CreateAsync( - string firstParty, string secondParty, uint? sessionExpiry = null, uint? callTimeLimit = null, + string firstParty = null, string secondParty = null, uint? sessionExpiry = null, uint? callTimeLimit = null, bool? record = null, string recordFileFormat = null, string recordingCallbackUrl = null, bool? initiateCallToFirstParty = null, string callbackUrl = null, string callbackMethod = null, uint? ringTimeout = null, string firstPartyPlayUrl = null, string secondPartyPlayUrl = null, string recordingCallbackMethod = null, bool? isPinAuthenticationRequired = null, bool? generatePin = null, uint? generatePinLength = null, string firstPartyPin = null, string secondPartyPin = null, string pinPromptPlay = null, uint? pinRetry = null, uint? pinRetryWait = null, string incorrectPinPlay = null, - string unknownCallerPlay = null, string subaccount = null, bool? geomatch = null + string unknownCallerPlay = null, string subaccount = null, bool? geomatch = null, bool? forcePinAuthentication = null, + bool? createSessionWithSingleParty= null, uint? virtualNumberCooloffPeriod = 0 ) { - var mandatoryParams = new List { "firstParty", "secondParty" }; + var mandatoryParams = new List { }; bool isVoiceRequest = true; var data = CreateData( mandatoryParams, @@ -109,7 +114,10 @@ public async Task CreateAsync( unknownCallerPlay, subaccount, geomatch, - isVoiceRequest + isVoiceRequest, + forcePinAuthentication, + createSessionWithSingleParty, + virtualNumberCooloffPeriod }); var result = Task.Run(async () => await Client.Update(Uri, data).ConfigureAwait(false)).Result; @@ -278,7 +286,7 @@ public async Task DeleteAsync(string sessionUuid) #region Update - public MaskingSessionUpdateResponse Update(string sessionUuid, uint? sessionExpiry = null, uint? callTimeLimit = null, + public MaskingSessionUpdateResponse Update(string sessionUuid, string firstParty = null, string secondParty = null, uint? sessionExpiry = null, uint? callTimeLimit = null, bool? record = null, string recordFileFormat = null, string recordingCallbackUrl = null, string callbackUrl = null, string callbackMethod = null, uint? ringTimeout = null, string firstPartyPlayUrl = null, string secondPartyPlayUrl = null, string recordingCallbackMethod = null, string subaccount = null, bool? geomatch = null @@ -289,7 +297,8 @@ public MaskingSessionUpdateResponse Update(string sessionUuid, u var data = CreateData( mandatoryParams, new - { + { firstParty, + secondParty, sessionExpiry, callTimeLimit, record, @@ -316,7 +325,7 @@ public MaskingSessionUpdateResponse Update(string sessionUuid, u }); } - public async Task UpdateAsync(string sessionUuid, uint? sessionExpiry = null, uint? callTimeLimit = null, + public async Task UpdateAsync(string sessionUuid, string firstParty = null, string secondParty = null, uint? sessionExpiry = null, uint? callTimeLimit = null, bool? record = null, string recordFileFormat = null, string recordingCallbackUrl = null, string callbackUrl = null, string callbackMethod = null, uint? ringTimeout = null, string firstPartyPlayUrl = null, string secondPartyPlayUrl = null, string recordingCallbackMethod = null, string subaccount = null, bool? geomatch = null @@ -327,7 +336,8 @@ public async Task UpdateAsync(string sessionUuid, uint? sessionEx var data = CreateData( mandatoryParams, new - { + { firstParty, + secondParty, sessionExpiry, callTimeLimit, record, diff --git a/src/Plivo/Resource/ResourceInterface.cs b/src/Plivo/Resource/ResourceInterface.cs index c2c87ff9..417eeb39 100755 --- a/src/Plivo/Resource/ResourceInterface.cs +++ b/src/Plivo/Resource/ResourceInterface.cs @@ -208,9 +208,12 @@ public static Dictionary CreateData (List propertyInfos, var dict = new Dictionary (); foreach (PropertyInfo pi in data.GetType ().GetProperties ()) { if (propertyInfos.Contains (pi.Name)) { - if (string.IsNullOrEmpty (pi.GetValue (data))) - throw new PlivoValidationException (pi.Name + " is mandatory, can not be null or empty"); + var propertyValue = pi.GetValue(data); + if (pi.Name != "firstParty" && pi.Name != "secondParty" && string.IsNullOrEmpty(propertyValue)) + throw new PlivoValidationException(pi.Name + " is mandatory, can not be null or empty"); } + + if (pi.Name.Equals ("limit")) { if (pi.GetValue (data) > 20) { diff --git a/src/Plivo/Version.cs b/src/Plivo/Version.cs index 61ff406c..8c735034 100644 --- a/src/Plivo/Version.cs +++ b/src/Plivo/Version.cs @@ -10,7 +10,7 @@ public class Version /// /// DotNet SDK version /// - public const string SdkVersion = "5.48.1"; + public const string SdkVersion = "5.49.0"; /// /// Plivo API version /// diff --git a/tests/Plivo.Test/Mocks/maskingSessionCreateResponse.json b/tests/Plivo.Test/Mocks/maskingSessionCreateResponse.json new file mode 100644 index 00000000..6a2bebcf --- /dev/null +++ b/tests/Plivo.Test/Mocks/maskingSessionCreateResponse.json @@ -0,0 +1,48 @@ +{ + "api_id": "e0218e45-53f5-435b-83d2-936010e40acc", + "session_uuid": "1091db69-2290-4633-9222-c9473c4815b6", + "virtual_number": "+919988776676", + "message": "Session created", + "session": { + "first_party": "916303955747", + "second_party": "916384780853", + "virtual_number": "919988776676", + "status": "active", + "initiate_call_to_first_party": false, + "session_uuid": "1091db69-2290-4633-9222-c9473c4815b6", + "callback_url": "", + "callback_method": "POST", + "created_time": "2024-09-05 06:43:26 +0000 UTC", + "modified_time": "2024-09-05 06:43:26 +0000 UTC", + "expiry_time": "2024-09-05 06:46:46 +0000 UTC", + "duration": 200, + "amount": 0, + "call_time_limit": 14400, + "ring_timeout": 45, + "first_party_play_url": "", + "second_party_play_url": "", + "record": false, + "record_file_format": "mp3", + "recording_callback_url": "", + "recording_callback_method": "POST", + "interaction": null, + "total_call_amount": 0, + "total_call_count": 0, + "total_call_billed_duration": 0, + "total_session_amount": 0, + "last_interaction_time": "", + "unknown_caller_play": "https://file-examples.com/storage/fefda3519566d3360a0efb3/2017/11/file_example_MP3_700KB.mp3", + "is_pin_authentication_required": true, + "generate_pin": false, + "generate_pin_length": 4, + "first_party_pin": "1234", + "second_party_pin": "4321", + "pin_prompt_play": "https://file-examples.com/storage/fefda3519566d3360a0efb3/2017/11/file_example_MP3_700KB.mp3", + "pin_retry": 2, + "pin_retry_wait": 7, + "incorrect_pin_play": "https://file-examples.com/storage/fefda3519566d3360a0efb3/2017/11/file_example_MP3_700KB.mp3", + "create_session_with_single_party": null, + "virtual_number_cooloff_period": 3500, + "force_pin_authentication": true + } +} \ No newline at end of file diff --git a/version.json b/version.json index 8fc43f46..60d2f66b 100644 --- a/version.json +++ b/version.json @@ -1,5 +1,5 @@ { - "version": "5.48.1", + "version": "5.49.0", "publicReleaseRefSpec": [ "^refs/heads/master$", "^refs/heads/v\\d+(?:\\.\\d+)?$"