Skip to content

Commit 50040bf

Browse files
Merge pull request #288 from plivo/VT-8212
Single party session changes
2 parents 8efb708 + e338b14 commit 50040bf

File tree

10 files changed

+89
-24
lines changed

10 files changed

+89
-24
lines changed

Diff for: CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# Change Log
2+
## [5.49.0](https://github.com/plivo/plivo-dotnet/tree/v5.49.0) (2024-09-30)
3+
**Feature - Adding new param support for Number Masking session with single party **
4+
- Added `create_session_with_single_party`, `virtual_number_cooloff_period` and `force_pin_authentication` attributes in Masking Session
5+
26
## [5.48.1](https://github.com/plivo/plivo-dotnet/tree/v5.48.1) (2024-09-06)
37
**Feature - Adding more attribute on mdr object**
48
- Added `message_sent_time`, `message_updated_time` and `error-message` on get and list Message API

Diff for: README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ You can install this SDK either by referencing the .dll file or using NuGet.
1212
Use the following line to install the latest SDK using the NuGet CLI.
1313

1414
```
15-
PM> Install-Package Plivo -Version 5.48.1
15+
PM> Install-Package Plivo -Version 5.49.0
1616
```
1717

1818
You can also use the .NET CLI to install this package as follows
1919

2020
```
21-
> dotnet add package Plivo --version 5.48.1
21+
> dotnet add package Plivo --version 5.49.0
2222
```
2323

2424
## Getting started

Diff for: src/Plivo/Plivo.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFrameworks>netstandard2.0;netstandard1.3</TargetFrameworks>
4-
<ReleaseVersion>5.48.1</ReleaseVersion>
4+
<ReleaseVersion>5.49.0</ReleaseVersion>
55
<Version />
66
<Authors>Plivo SDKs Team</Authors>
77
<Owners>Plivo Inc.</Owners>

Diff for: src/Plivo/Plivo.nuspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<summary>A .NET SDK to make voice calls and send SMS using Plivo and to generate Plivo XML</summary>
55
<description>A .NET SDK to make voice calls and send SMS using Plivo and to generate Plivo XML</description>
66
<id>Plivo</id>
7-
<version>5.48.1</version>
7+
<version>5.49.0</version>
88
<title>Plivo</title>
99
<authors>Plivo SDKs Team</authors>
1010
<owners>Plivo, Inc.</owners>

Diff for: src/Plivo/Resource/MaskingSession/MaskingSession.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,29 +29,29 @@ public async Task<AsyncResponse> DeleteAsync(string Id)
2929

3030

3131
#region Update
32-
public MaskingSessionUpdateResponse<MaskingSession> Update(string sessionUuid, uint? session_expiry = null, uint? call_time_limit = null,
32+
public MaskingSessionUpdateResponse<MaskingSession> Update(string sessionUuid, string first_party = null, string second_party = null, uint? session_expiry = null, uint? call_time_limit = null,
3333
bool? record = null, string record_file_format = null, string recording_callback_url = null, string callback_url = null,
3434
string callback_method = null, uint? ring_timeout = null, string first_party_play_url = null, string second_party_play_url = null,
3535
string recording_callback_method = null, string subaccount = null, bool? geomatch = null
3636
)
3737
{
3838
var updateResponse =
3939
((MaskingSessionInterface) Interface)
40-
.Update(Id, session_expiry, call_time_limit, record, record_file_format, recording_callback_url, callback_url,
40+
.Update(Id, first_party, second_party, session_expiry, call_time_limit, record, record_file_format, recording_callback_url, callback_url,
4141
callback_method, ring_timeout, first_party_play_url, second_party_play_url, recording_callback_method,
4242
subaccount, geomatch);
4343
return updateResponse;
4444
}
4545

46-
public async Task<AsyncResponse> UpdateAsync(string sessionUuid, uint? session_expiry = null, uint? call_time_limit = null,
46+
public async Task<AsyncResponse> UpdateAsync(string sessionUuid, string first_party = null, string second_party = null, uint? session_expiry = null, uint? call_time_limit = null,
4747
bool? record = null, string record_file_format = null, string recording_callback_url = null, string callback_url = null,
4848
string callback_method = null, uint? ring_timeout = null, string first_party_play_url = null, string second_party_play_url = null,
4949
string recording_callback_method = null, string subaccount = null, bool? geomatch = null
5050
)
5151
{
5252
var updateResponse = await
5353
((MaskingSessionInterface)Interface)
54-
.UpdateAsync(Id, session_expiry, call_time_limit, record, record_file_format, recording_callback_url, callback_url,
54+
.UpdateAsync(Id, first_party, second_party, session_expiry, call_time_limit, record, record_file_format, recording_callback_url, callback_url,
5555
callback_method, ring_timeout, first_party_play_url, second_party_play_url, recording_callback_method,
5656
subaccount, geomatch);
5757

Diff for: src/Plivo/Resource/MaskingSession/MaskingSessionInterface.cs

+22-12
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@ public MaskingSessionInterface(HttpClient client) : base(client)
1515

1616
#region Create
1717
public MaskingSessionCreateResponse Create(
18-
string firstParty, string secondParty, uint? sessionExpiry = null, uint? callTimeLimit = null,
18+
string firstParty = null, string secondParty = null, uint? sessionExpiry = null, uint? callTimeLimit = null,
1919
bool? record = null, string recordFileFormat = null, string recordingCallbackUrl = null, bool? initiateCallToFirstParty = null,
2020
string callbackUrl = null, string callbackMethod = null, uint? ringTimeout = null, string firstPartyPlayUrl = null,
2121
string secondPartyPlayUrl = null, string recordingCallbackMethod = null, bool? isPinAuthenticationRequired = null,
2222
bool? generatePin = null, uint? generatePinLength = null, string firstPartyPin = null, string secondPartyPin = null,
2323
string pinPromptPlay = null, uint? pinRetry = null, uint? pinRetryWait = null, string incorrectPinPlay = null,
24-
string unknownCallerPlay = null, string subaccount = null, bool? geomatch = null
24+
string unknownCallerPlay = null, string subaccount = null, bool? geomatch = null, bool? forcePinAuthentication = null,
25+
bool? createSessionWithSingleParty= null, uint? virtualNumberCooloffPeriod = 0
2526
)
2627
{
27-
var mandatoryParams = new List<string> { "firstParty", "secondParty" };
28+
var mandatoryParams = new List<string> { };
2829
bool isVoiceRequest = true;
2930
var data = CreateData(
3031
mandatoryParams,
@@ -56,7 +57,10 @@ public MaskingSessionCreateResponse Create(
5657
unknownCallerPlay,
5758
subaccount,
5859
geomatch,
59-
isVoiceRequest
60+
isVoiceRequest,
61+
forcePinAuthentication,
62+
createSessionWithSingleParty,
63+
virtualNumberCooloffPeriod
6064
});
6165

6266
return ExecuteWithExceptionUnwrap(() =>
@@ -68,16 +72,17 @@ public MaskingSessionCreateResponse Create(
6872
}
6973

7074
public async Task<AsyncResponse> CreateAsync(
71-
string firstParty, string secondParty, uint? sessionExpiry = null, uint? callTimeLimit = null,
75+
string firstParty = null, string secondParty = null, uint? sessionExpiry = null, uint? callTimeLimit = null,
7276
bool? record = null, string recordFileFormat = null, string recordingCallbackUrl = null, bool? initiateCallToFirstParty = null,
7377
string callbackUrl = null, string callbackMethod = null, uint? ringTimeout = null, string firstPartyPlayUrl = null,
7478
string secondPartyPlayUrl = null, string recordingCallbackMethod = null, bool? isPinAuthenticationRequired = null,
7579
bool? generatePin = null, uint? generatePinLength = null, string firstPartyPin = null, string secondPartyPin = null,
7680
string pinPromptPlay = null, uint? pinRetry = null, uint? pinRetryWait = null, string incorrectPinPlay = null,
77-
string unknownCallerPlay = null, string subaccount = null, bool? geomatch = null
81+
string unknownCallerPlay = null, string subaccount = null, bool? geomatch = null, bool? forcePinAuthentication = null,
82+
bool? createSessionWithSingleParty= null, uint? virtualNumberCooloffPeriod = 0
7883
)
7984
{
80-
var mandatoryParams = new List<string> { "firstParty", "secondParty" };
85+
var mandatoryParams = new List<string> { };
8186
bool isVoiceRequest = true;
8287
var data = CreateData(
8388
mandatoryParams,
@@ -109,7 +114,10 @@ public async Task<AsyncResponse> CreateAsync(
109114
unknownCallerPlay,
110115
subaccount,
111116
geomatch,
112-
isVoiceRequest
117+
isVoiceRequest,
118+
forcePinAuthentication,
119+
createSessionWithSingleParty,
120+
virtualNumberCooloffPeriod
113121
});
114122

115123
var result = Task.Run(async () => await Client.Update<AsyncResponse>(Uri, data).ConfigureAwait(false)).Result;
@@ -278,7 +286,7 @@ public async Task<AsyncResponse> DeleteAsync(string sessionUuid)
278286

279287

280288
#region Update
281-
public MaskingSessionUpdateResponse<MaskingSession> Update(string sessionUuid, uint? sessionExpiry = null, uint? callTimeLimit = null,
289+
public MaskingSessionUpdateResponse<MaskingSession> Update(string sessionUuid, string firstParty = null, string secondParty = null, uint? sessionExpiry = null, uint? callTimeLimit = null,
282290
bool? record = null, string recordFileFormat = null, string recordingCallbackUrl = null, string callbackUrl = null,
283291
string callbackMethod = null, uint? ringTimeout = null, string firstPartyPlayUrl = null, string secondPartyPlayUrl = null,
284292
string recordingCallbackMethod = null, string subaccount = null, bool? geomatch = null
@@ -289,7 +297,8 @@ public MaskingSessionUpdateResponse<MaskingSession> Update(string sessionUuid, u
289297
var data = CreateData(
290298
mandatoryParams,
291299
new
292-
{
300+
{ firstParty,
301+
secondParty,
293302
sessionExpiry,
294303
callTimeLimit,
295304
record,
@@ -316,7 +325,7 @@ public MaskingSessionUpdateResponse<MaskingSession> Update(string sessionUuid, u
316325
});
317326
}
318327

319-
public async Task<AsyncResponse> UpdateAsync(string sessionUuid, uint? sessionExpiry = null, uint? callTimeLimit = null,
328+
public async Task<AsyncResponse> UpdateAsync(string sessionUuid, string firstParty = null, string secondParty = null, uint? sessionExpiry = null, uint? callTimeLimit = null,
320329
bool? record = null, string recordFileFormat = null, string recordingCallbackUrl = null, string callbackUrl = null,
321330
string callbackMethod = null, uint? ringTimeout = null, string firstPartyPlayUrl = null, string secondPartyPlayUrl = null,
322331
string recordingCallbackMethod = null, string subaccount = null, bool? geomatch = null
@@ -327,7 +336,8 @@ public async Task<AsyncResponse> UpdateAsync(string sessionUuid, uint? sessionEx
327336
var data = CreateData(
328337
mandatoryParams,
329338
new
330-
{
339+
{ firstParty,
340+
secondParty,
331341
sessionExpiry,
332342
callTimeLimit,
333343
record,

Diff for: src/Plivo/Resource/ResourceInterface.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,12 @@ public static Dictionary<string, object> CreateData (List<string> propertyInfos,
208208
var dict = new Dictionary<string, object> ();
209209
foreach (PropertyInfo pi in data.GetType ().GetProperties ()) {
210210
if (propertyInfos.Contains (pi.Name)) {
211-
if (string.IsNullOrEmpty (pi.GetValue (data)))
212-
throw new PlivoValidationException (pi.Name + " is mandatory, can not be null or empty");
211+
var propertyValue = pi.GetValue(data);
212+
if (pi.Name != "firstParty" && pi.Name != "secondParty" && string.IsNullOrEmpty(propertyValue))
213+
throw new PlivoValidationException(pi.Name + " is mandatory, can not be null or empty");
213214
}
215+
216+
214217

215218
if (pi.Name.Equals ("limit")) {
216219
if (pi.GetValue (data) > 20) {

Diff for: src/Plivo/Version.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class Version
1010
/// <summary>
1111
/// DotNet SDK version
1212
/// </summary>
13-
public const string SdkVersion = "5.48.1";
13+
public const string SdkVersion = "5.49.0";
1414
/// <summary>
1515
/// Plivo API version
1616
/// </summary>
+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"api_id": "e0218e45-53f5-435b-83d2-936010e40acc",
3+
"session_uuid": "1091db69-2290-4633-9222-c9473c4815b6",
4+
"virtual_number": "+919988776676",
5+
"message": "Session created",
6+
"session": {
7+
"first_party": "916303955747",
8+
"second_party": "916384780853",
9+
"virtual_number": "919988776676",
10+
"status": "active",
11+
"initiate_call_to_first_party": false,
12+
"session_uuid": "1091db69-2290-4633-9222-c9473c4815b6",
13+
"callback_url": "",
14+
"callback_method": "POST",
15+
"created_time": "2024-09-05 06:43:26 +0000 UTC",
16+
"modified_time": "2024-09-05 06:43:26 +0000 UTC",
17+
"expiry_time": "2024-09-05 06:46:46 +0000 UTC",
18+
"duration": 200,
19+
"amount": 0,
20+
"call_time_limit": 14400,
21+
"ring_timeout": 45,
22+
"first_party_play_url": "",
23+
"second_party_play_url": "",
24+
"record": false,
25+
"record_file_format": "mp3",
26+
"recording_callback_url": "",
27+
"recording_callback_method": "POST",
28+
"interaction": null,
29+
"total_call_amount": 0,
30+
"total_call_count": 0,
31+
"total_call_billed_duration": 0,
32+
"total_session_amount": 0,
33+
"last_interaction_time": "",
34+
"unknown_caller_play": "https://file-examples.com/storage/fefda3519566d3360a0efb3/2017/11/file_example_MP3_700KB.mp3",
35+
"is_pin_authentication_required": true,
36+
"generate_pin": false,
37+
"generate_pin_length": 4,
38+
"first_party_pin": "1234",
39+
"second_party_pin": "4321",
40+
"pin_prompt_play": "https://file-examples.com/storage/fefda3519566d3360a0efb3/2017/11/file_example_MP3_700KB.mp3",
41+
"pin_retry": 2,
42+
"pin_retry_wait": 7,
43+
"incorrect_pin_play": "https://file-examples.com/storage/fefda3519566d3360a0efb3/2017/11/file_example_MP3_700KB.mp3",
44+
"create_session_with_single_party": null,
45+
"virtual_number_cooloff_period": 3500,
46+
"force_pin_authentication": true
47+
}
48+
}

Diff for: version.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "5.48.1",
2+
"version": "5.49.0",
33
"publicReleaseRefSpec": [
44
"^refs/heads/master$",
55
"^refs/heads/v\\d+(?:\\.\\d+)?$"

0 commit comments

Comments
 (0)