From 836290eec9b6e62822a580aba0457254422d2eb9 Mon Sep 17 00:00:00 2001 From: JayaBharat-plivo Date: Thu, 12 Sep 2024 09:53:50 +0530 Subject: [PATCH] Added changes for single party session --- .../MaskingSession/MaskingSessionInterface.cs | 16 ++++++++++++---- src/Plivo/Resource/ResourceInterface.cs | 13 +++++++++++-- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/Plivo/Resource/MaskingSession/MaskingSessionInterface.cs b/src/Plivo/Resource/MaskingSession/MaskingSessionInterface.cs index 0eead7f5..ad72b565 100644 --- a/src/Plivo/Resource/MaskingSession/MaskingSessionInterface.cs +++ b/src/Plivo/Resource/MaskingSession/MaskingSessionInterface.cs @@ -21,7 +21,8 @@ public MaskingSessionCreateResponse Create( 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" }; @@ -56,7 +57,10 @@ public MaskingSessionCreateResponse Create( unknownCallerPlay, subaccount, geomatch, - isVoiceRequest + isVoiceRequest, + forcePinAuthentication, + createSessionWithSingleParty, + virtualNumberCooloffPeriod }); return ExecuteWithExceptionUnwrap(() => @@ -74,7 +78,8 @@ public async Task CreateAsync( 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" }; @@ -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; diff --git a/src/Plivo/Resource/ResourceInterface.cs b/src/Plivo/Resource/ResourceInterface.cs index c2c87ff9..108fecfa 100755 --- a/src/Plivo/Resource/ResourceInterface.cs +++ b/src/Plivo/Resource/ResourceInterface.cs @@ -208,10 +208,19 @@ 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"); + if(pi.Name == "firstParty" || pi.Name == "secondParty"){ + if(pi.GetValue (data) == null){ + throw new PlivoValidationException (pi.Name + "can not be null"); + } + } + else{ + if (string.IsNullOrEmpty (pi.GetValue (data))) + throw new PlivoValidationException (pi.Name + " is mandatory, can not be null or empty"); + } + } + if (pi.Name.Equals ("limit")) { if (pi.GetValue (data) > 20) { throw new PlivoValidationException ("limit:" + pi.GetValue (data) + " is out of range [0,20]");