Skip to content

Commit a3cce09

Browse files
authored
Enable PSTN Dialout in ACS Rooms (Azure#36821)
* Chnages for PSTN Dialout * Introducing ispstnDialOut property in CreateRoomOptions and updateRoomOptions * Updating tests * Update assests.json * Fixing build issues * updating Tests + adding some new tests * Updating readme.md * updating test recordings * Updating Enum version in capital letters * Modifying tests assets.json * updating Changelog * Modifying assests.json * Resolving review comments * Resolving review comments * Updating recordings * Resolving build errors * Updating test assets.json * Resolving build errors
1 parent bbad8ab commit a3cce09

File tree

18 files changed

+413
-67
lines changed

18 files changed

+413
-67
lines changed

sdk/communication/azure-communication-rooms/CHANGELOG.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
# Release History
2-
3-
## 1.1.0-beta.1 (Unreleased)
4-
2+
## 1.1.0-beta.1 (2023-10-03)
53
### Features Added
6-
7-
### Breaking Changes
8-
9-
### Bugs Fixed
10-
11-
### Other Changes
4+
- Added Support for PSTN Dial Out Capability in Azure Communication Services Rooms
125

136
## 1.0.4 (2023-09-22)
147

sdk/communication/azure-communication-rooms/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ participants.add(participant2);
8282
CreateRoomOptions roomOptions = new CreateRoomOptions()
8383
.setValidFrom(validFrom)
8484
.setValidUntil(validUntil)
85-
.setParticipants(participants);
85+
.setParticipants(participants)
86+
.setPstnDialOutEnabled(true);
8687

8788
CommunicationRoom roomResult = roomsClient.createRoom(roomOptions);
8889
```
@@ -96,7 +97,8 @@ OffsetDateTime validUntil = validFrom.plusDays(30);
9697
// Update Room options
9798
UpdateRoomOptions updateRoomOptions = new UpdateRoomOptions()
9899
.setValidFrom(validFrom)
99-
.setValidUntil(validUntil);
100+
.setValidUntil(validUntil)
101+
.setPstnDialOutEnabled(true);
100102

101103
try {
102104
CommunicationRoom roomResult = roomsClient.updateRoom("<Room Id>", updateRoomOptions);

sdk/communication/azure-communication-rooms/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "java",
44
"TagPrefix": "java/communication/azure-communication-rooms",
5-
"Tag": "java/communication/azure-communication-rooms_3c1e55016f"
5+
"Tag": "java/communication/azure-communication-rooms_0e0b02ce38"
66
}

sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/RoomsAsyncClient.java

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ Mono<CommunicationRoom> createRoom(CreateRoomOptions createRoomOptions, Context
9999
try {
100100
return this.roomsClient
101101
.createWithResponseAsync(toCreateRoomRequest(createRoomOptions.getValidFrom(),
102-
createRoomOptions.getValidUntil(), createRoomOptions.getParticipants()), context)
102+
createRoomOptions.getValidUntil(), createRoomOptions.isPstnDialOutEnabled(),
103+
createRoomOptions.getParticipants()), context)
103104
.flatMap((Response<RoomModel> response) -> {
104105
return Mono.just(getCommunicationRoomFromResponse(response.getValue()));
105106
});
@@ -125,7 +126,8 @@ Mono<Response<CommunicationRoom>> createRoomWithResponse(CreateRoomOptions creat
125126
try {
126127
return this.roomsClient
127128
.createWithResponseAsync(toCreateRoomRequest(createRoomOptions.getValidFrom(),
128-
createRoomOptions.getValidUntil(), createRoomOptions.getParticipants()), context)
129+
createRoomOptions.getValidUntil(), createRoomOptions.isPstnDialOutEnabled(),
130+
createRoomOptions.getParticipants()), context)
129131
.flatMap((Response<RoomModel> response) -> {
130132
CommunicationRoom communicationRoom = getCommunicationRoomFromResponse(response.getValue());
131133
return Mono.just(new SimpleResponse<CommunicationRoom>(response, communicationRoom));
@@ -152,8 +154,8 @@ Mono<CommunicationRoom> updateRoom(String roomId, UpdateRoomOptions updateRoomOp
152154
try {
153155
return this.roomsClient
154156
.updateWithResponseAsync(roomId,
155-
toUpdateRoomRequest(updateRoomOptions.getValidFrom(), updateRoomOptions.getValidUntil()),
156-
context)
157+
toUpdateRoomRequest(updateRoomOptions.getValidFrom(), updateRoomOptions.getValidUntil(),
158+
updateRoomOptions.isPstnDialOutEnabled()), context)
157159
.flatMap((Response<RoomModel> response) -> {
158160
return Mono.just(getCommunicationRoomFromResponse(response.getValue()));
159161
});
@@ -181,8 +183,8 @@ Mono<Response<CommunicationRoom>> updateRoomWithResponse(String roomId, UpdateRo
181183
try {
182184
return this.roomsClient
183185
.updateWithResponseAsync(roomId,
184-
toUpdateRoomRequest(updateRoomOptions.getValidFrom(), updateRoomOptions.getValidUntil()),
185-
context)
186+
toUpdateRoomRequest(updateRoomOptions.getValidFrom(), updateRoomOptions.getValidUntil(),
187+
updateRoomOptions.isPstnDialOutEnabled()), context)
186188
.flatMap((Response<RoomModel> response) -> {
187189
CommunicationRoom communicationRoom = getCommunicationRoomFromResponse(response.getValue());
188190
return Mono.just(new SimpleResponse<CommunicationRoom>(response, communicationRoom));
@@ -529,7 +531,8 @@ private CommunicationRoom getCommunicationRoomFromResponse(RoomModel room) {
529531
room.getId(),
530532
room.getValidFrom(),
531533
room.getValidUntil(),
532-
room.getCreatedAt());
534+
room.getCreatedAt(),
535+
room.isPstnDialOutEnabled());
533536
}
534537

535538
/**
@@ -538,7 +541,7 @@ private CommunicationRoom getCommunicationRoomFromResponse(RoomModel room) {
538541
* @return The create room request.
539542
*/
540543
private CreateRoomRequest toCreateRoomRequest(OffsetDateTime validFrom, OffsetDateTime validUntil,
541-
Iterable<RoomParticipant> participants) {
544+
Boolean isPstnDialOutEnabled, Iterable<RoomParticipant> participants) {
542545
CreateRoomRequest createRoomRequest = new CreateRoomRequest();
543546
if (validFrom != null) {
544547
createRoomRequest.setValidFrom(validFrom);
@@ -548,6 +551,8 @@ private CreateRoomRequest toCreateRoomRequest(OffsetDateTime validFrom, OffsetDa
548551
createRoomRequest.setValidUntil(validUntil);
549552
}
550553

554+
createRoomRequest.setPstnDialOutEnabled(isPstnDialOutEnabled);
555+
551556
Map<String, ParticipantProperties> roomParticipants = new HashMap<>();
552557

553558
if (participants != null) {
@@ -566,7 +571,7 @@ private CreateRoomRequest toCreateRoomRequest(OffsetDateTime validFrom, OffsetDa
566571
*
567572
* @return The update room request.
568573
*/
569-
private UpdateRoomRequest toUpdateRoomRequest(OffsetDateTime validFrom, OffsetDateTime validUntil) {
574+
private UpdateRoomRequest toUpdateRoomRequest(OffsetDateTime validFrom, OffsetDateTime validUntil, Boolean isPstnDialOutEnabled) {
570575
UpdateRoomRequest updateRoomRequest = new UpdateRoomRequest();
571576

572577
if (validFrom != null) {
@@ -577,6 +582,10 @@ private UpdateRoomRequest toUpdateRoomRequest(OffsetDateTime validFrom, OffsetDa
577582
updateRoomRequest.setValidUntil(validUntil);
578583
}
579584

585+
if (isPstnDialOutEnabled != null) {
586+
updateRoomRequest.setPstnDialOutEnabled(isPstnDialOutEnabled);
587+
}
588+
580589
return updateRoomRequest;
581590
}
582591

sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/RoomsClient.java

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ public final class RoomsClient {
8080
public CommunicationRoom createRoom(CreateRoomOptions createRoomOptions) {
8181
RoomModel roomModel = this.roomsClient
8282
.create(toCreateRoomRequest(createRoomOptions.getValidFrom(),
83-
createRoomOptions.getValidUntil(), createRoomOptions.getParticipants()));
83+
createRoomOptions.getValidUntil(), createRoomOptions.isPstnDialOutEnabled(),
84+
createRoomOptions.getParticipants()));
8485
return getCommunicationRoomFromResponse(roomModel);
8586
}
8687

@@ -96,7 +97,8 @@ public Response<CommunicationRoom> createRoomWithResponse(CreateRoomOptions crea
9697
context = context == null ? Context.NONE : context;
9798
Response<RoomModel> response = this.roomsClient
9899
.createWithResponse(toCreateRoomRequest(createRoomOptions.getValidFrom(),
99-
createRoomOptions.getValidUntil(), createRoomOptions.getParticipants()), context);
100+
createRoomOptions.getValidUntil(), createRoomOptions.isPstnDialOutEnabled(),
101+
createRoomOptions.getParticipants()), context);
100102
return new SimpleResponse<CommunicationRoom>(response, getCommunicationRoomFromResponse(response.getValue()));
101103
}
102104

@@ -111,7 +113,8 @@ public Response<CommunicationRoom> createRoomWithResponse(CreateRoomOptions crea
111113
public CommunicationRoom updateRoom(String roomId, UpdateRoomOptions updateRoomOptions) {
112114
RoomModel roomModel = this.roomsClient
113115
.update(roomId,
114-
toUpdateRoomRequest(updateRoomOptions.getValidFrom(), updateRoomOptions.getValidUntil()));
116+
toUpdateRoomRequest(updateRoomOptions.getValidFrom(), updateRoomOptions.getValidUntil(),
117+
updateRoomOptions.isPstnDialOutEnabled()));
115118
return getCommunicationRoomFromResponse(roomModel);
116119
}
117120

@@ -128,8 +131,8 @@ public Response<CommunicationRoom> updateRoomWithResponse(String roomId, UpdateR
128131
context = context == null ? Context.NONE : context;
129132
Response<RoomModel> response = this.roomsClient
130133
.updateWithResponse(roomId,
131-
toUpdateRoomRequest(updateRoomOptions.getValidFrom(), updateRoomOptions.getValidUntil()),
132-
context);
134+
toUpdateRoomRequest(updateRoomOptions.getValidFrom(), updateRoomOptions.getValidUntil(),
135+
updateRoomOptions.isPstnDialOutEnabled()), context);
133136
return new SimpleResponse<CommunicationRoom>(response, getCommunicationRoomFromResponse(response.getValue()));
134137
}
135138

@@ -358,7 +361,8 @@ private CommunicationRoom getCommunicationRoomFromResponse(RoomModel room) {
358361
room.getId(),
359362
room.getValidFrom(),
360363
room.getValidUntil(),
361-
room.getCreatedAt());
364+
room.getCreatedAt(),
365+
room.isPstnDialOutEnabled());
362366
}
363367

364368
/**
@@ -367,7 +371,7 @@ private CommunicationRoom getCommunicationRoomFromResponse(RoomModel room) {
367371
* @return The create room request.
368372
*/
369373
private CreateRoomRequest toCreateRoomRequest(OffsetDateTime validFrom, OffsetDateTime validUntil,
370-
Iterable<RoomParticipant> participants) {
374+
Boolean pstnDialOutEnabled, Iterable<RoomParticipant> participants) {
371375
CreateRoomRequest createRoomRequest = new CreateRoomRequest();
372376
if (validFrom != null) {
373377
createRoomRequest.setValidFrom(validFrom);
@@ -377,6 +381,10 @@ private CreateRoomRequest toCreateRoomRequest(OffsetDateTime validFrom, OffsetDa
377381
createRoomRequest.setValidUntil(validUntil);
378382
}
379383

384+
if (pstnDialOutEnabled != null) {
385+
createRoomRequest.setPstnDialOutEnabled(pstnDialOutEnabled);
386+
}
387+
380388
Map<String, ParticipantProperties> roomParticipants = new HashMap<>();
381389

382390
if (participants != null) {
@@ -395,7 +403,7 @@ private CreateRoomRequest toCreateRoomRequest(OffsetDateTime validFrom, OffsetDa
395403
*
396404
* @return The update room request.
397405
*/
398-
private UpdateRoomRequest toUpdateRoomRequest(OffsetDateTime validFrom, OffsetDateTime validUntil) {
406+
private UpdateRoomRequest toUpdateRoomRequest(OffsetDateTime validFrom, OffsetDateTime validUntil, Boolean isPstnDialOutEnabled) {
399407
UpdateRoomRequest updateRoomRequest = new UpdateRoomRequest();
400408

401409
if (validFrom != null) {
@@ -406,6 +414,10 @@ private UpdateRoomRequest toUpdateRoomRequest(OffsetDateTime validFrom, OffsetDa
406414
updateRoomRequest.setValidUntil(validUntil);
407415
}
408416

417+
if (isPstnDialOutEnabled != null) {
418+
updateRoomRequest.setPstnDialOutEnabled(isPstnDialOutEnabled);
419+
}
420+
409421
return updateRoomRequest;
410422
}
411423

sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/RoomsServiceVersion.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ public enum RoomsServiceVersion implements ServiceVersion {
1212
/**
1313
* Service version {@code 2023-06-14}
1414
*/
15-
V2023_06_14("2023-06-14");
15+
V2023_06_14("2023-06-14"),
16+
17+
/**
18+
* Service version {@code 2023-10-30-preview}
19+
*/
20+
V2023_10_30_PREVIEW("2023-10-30-preview");
1621

1722
private final String version;
1823

sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/implementation/AzureCommunicationRoomServiceImplBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ public AzureCommunicationRoomServiceImplBuilder retryPolicy(RetryPolicy retryPol
234234
@Generated
235235
public AzureCommunicationRoomServiceImpl buildClient() {
236236
HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline();
237-
String localApiVersion = (apiVersion != null) ? apiVersion : "2023-06-14";
237+
String localApiVersion = (apiVersion != null) ? apiVersion : "2023-10-30-preview";
238238
SerializerAdapter localSerializerAdapter =
239239
(serializerAdapter != null) ? serializerAdapter : JacksonAdapter.createDefaultSerializerAdapter();
240240
AzureCommunicationRoomServiceImpl client =

sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/implementation/converters/RoomModelConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public static CommunicationRoom convert(com.azure.communication.rooms.implementa
1818
return null;
1919
}
2020

21-
CommunicationRoom communicationRoom = new CommunicationRoom(room.getId(), room.getValidFrom(), room.getValidUntil(), room.getCreatedAt());
21+
CommunicationRoom communicationRoom = new CommunicationRoom(room.getId(), room.getValidFrom(), room.getValidUntil(), room.getCreatedAt(), room.isPstnDialOutEnabled());
2222

2323
return communicationRoom;
2424
}

sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/implementation/models/CreateRoomRequest.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ public final class CreateRoomRequest {
2626
@JsonProperty(value = "validUntil")
2727
private OffsetDateTime validUntil;
2828

29+
/*
30+
* Set this flag to true if, at the time of the call, dial out to a PSTN number is enabled in a particular room. By
31+
* default, this flag is set to false.
32+
*/
33+
@JsonProperty(value = "pstnDialOutEnabled")
34+
private Boolean pstnDialOutEnabled;
35+
2936
/*
3037
* (Optional) Participants to be invited to the room.
3138
*/
@@ -79,6 +86,28 @@ public CreateRoomRequest setValidUntil(OffsetDateTime validUntil) {
7986
return this;
8087
}
8188

89+
/**
90+
* Get the pstnDialOutEnabled property: Set this flag to true if, at the time of the call, dial out to a PSTN number
91+
* is enabled in a particular room. By default, this flag is set to false.
92+
*
93+
* @return the pstnDialOutEnabled value.
94+
*/
95+
public Boolean isPstnDialOutEnabled() {
96+
return this.pstnDialOutEnabled;
97+
}
98+
99+
/**
100+
* Set the pstnDialOutEnabled property: Set this flag to true if, at the time of the call, dial out to a PSTN number
101+
* is enabled in a particular room. By default, this flag is set to false.
102+
*
103+
* @param pstnDialOutEnabled the pstnDialOutEnabled value to set.
104+
* @return the CreateRoomRequest object itself.
105+
*/
106+
public CreateRoomRequest setPstnDialOutEnabled(Boolean pstnDialOutEnabled) {
107+
this.pstnDialOutEnabled = pstnDialOutEnabled;
108+
return this;
109+
}
110+
82111
/**
83112
* Get the participants property: (Optional) Participants to be invited to the room.
84113
*

sdk/communication/azure-communication-rooms/src/main/java/com/azure/communication/rooms/implementation/models/RoomModel.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ public final class RoomModel {
3838
@JsonProperty(value = "validUntil", required = true)
3939
private OffsetDateTime validUntil;
4040

41+
/*
42+
* Set this flag to true if, at the time of the call, dial out to a PSTN number is enabled in a particular room. By
43+
* default, this flag is set to false.
44+
*/
45+
@JsonProperty(value = "pstnDialOutEnabled", required = true)
46+
private boolean pstnDialOutEnabled;
47+
4148
/** Creates an instance of RoomModel class. */
4249
public RoomModel() {}
4350

@@ -126,4 +133,26 @@ public RoomModel setValidUntil(OffsetDateTime validUntil) {
126133
this.validUntil = validUntil;
127134
return this;
128135
}
136+
137+
/**
138+
* Get the pstnDialOutEnabled property: Set this flag to true if, at the time of the call, dial out to a PSTN number
139+
* is enabled in a particular room. By default, this flag is set to false.
140+
*
141+
* @return the pstnDialOutEnabled value.
142+
*/
143+
public boolean isPstnDialOutEnabled() {
144+
return this.pstnDialOutEnabled;
145+
}
146+
147+
/**
148+
* Set the pstnDialOutEnabled property: Set this flag to true if, at the time of the call, dial out to a PSTN number
149+
* is enabled in a particular room. By default, this flag is set to false.
150+
*
151+
* @param pstnDialOutEnabled the pstnDialOutEnabled value to set.
152+
* @return the RoomModel object itself.
153+
*/
154+
public RoomModel setPstnDialOutEnabled(boolean pstnDialOutEnabled) {
155+
this.pstnDialOutEnabled = pstnDialOutEnabled;
156+
return this;
157+
}
129158
}

0 commit comments

Comments
 (0)