Skip to content

Commit

Permalink
fix: Voice AnswerWebhook.getUuid (#564)
Browse files Browse the repository at this point in the history
* fix: AnswerWebhook.getUuid()

* docs: Update Call documentation

* chore: Update changelog

* build: Bump version
  • Loading branch information
SMadani authored Feb 5, 2025
1 parent fa39042 commit 1f9c8b3
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 23 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

# [8.16.1] -2025-02-04
# [8.16.2] - 2025-02-05
- Changed `AnswerWebhook#getUuid()` return type to String
- Updated Voice `Call` documentation

# [8.16.1] - 2025-02-04
- Removed mandatory `from` parameter for event creation in Conversation API
- Re-added URL domain validation in `VoiceClient.downloadRecordingRaw`
- Bumped JWT library version to 2.0.1
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
[![Build Status](https://github.com/Vonage/vonage-java-sdk/actions/workflows/build.yml/badge.svg)](https://github.com/Vonage/vonage-java-sdk/actions/workflows/build.yml)
![CodeQL](https://github.com/Vonage/vonage-java-sdk/actions/workflows/codeql.yml/badge.svg)
[![codecov](https://codecov.io/gh/vonage/vonage-java-sdk/branch/main/graph/badge.svg)](https://codecov.io/gh/vonage/vonage-java-sdk)
![SLOC](https://sloc.xyz/github/vonage/vonage-java-sdk/)
[![Snyk](https://snyk.io/test/github/vonage/vonage-java-sdk/badge.svg)](https://snyk.io/test/github/vonage/vonage-java-sdk)
[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/Vonage/vonage-java-sdk/badge)](https://scorecard.dev/viewer/?uri=github.com/Vonage/vonage-java-sdk)
![SLOC](https://sloc.xyz/github/vonage/vonage-java-sdk?)
[![Snyk](https://snyk.io/test/github/vonage/vonage-java-sdk/badge.svg)](https://snyk.io/test/github/vonage/vonage-java-sdk)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.1%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE.txt)
<!---[![Pulse](https://img.shields.io/github/commit-activity/m/vonage/vonage-java-sdk)](https://github.com/vonage/vonage-java-sdk/pulse)-->
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.vonage</groupId>
<artifactId>server-sdk</artifactId>
<version>8.16.1</version>
<version>8.16.2</version>

<name>Vonage Java Server SDK</name>
<description>Java client for Vonage APIs</description>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/vonage/client/HttpWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
public class HttpWrapper {
private static final String
CLIENT_NAME = "vonage-java-sdk",
CLIENT_VERSION = "8.16.1",
CLIENT_VERSION = "8.16.2",
JAVA_VERSION = System.getProperty("java.version"),
USER_AGENT = String.format("%s/%s java/%s", CLIENT_NAME, CLIENT_VERSION, JAVA_VERSION);

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/vonage/client/conversations/Member.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ public String getMemberIdInviting() {
}

/**
* TODO document this
* 'From' field for this member.
*
* @return The from field, or {@code null} if unspecified.
* @return The 'from' field, or {@code null} if unspecified.
*/
@JsonProperty("from")
public String getFrom() {
Expand Down Expand Up @@ -282,9 +282,9 @@ public Builder memberIdInviting(String memberIdInviting) {
}

/**
* (OPTIONAL) TODO document this
* (OPTIONAL) 'From' ID to associate with this request
*
* @param from The from field.
* @param from The 'from' field as a string.
*
* @return This builder.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ public MemberState getState() {
}

/**
* TODO document this.
* ID to associate with this request.
*
* @return The from, or {@code null} if unspecified.
* @return The 'from' ID as a string, or {@code null} if unspecified.
*/
@JsonProperty("from")
public String getFrom() {
Expand Down Expand Up @@ -162,9 +162,9 @@ public Builder state(MemberState state) {
}

/**
* TODO document this
* ID to associate with this request.
*
* @param from The from (??)
* @param from The 'from' ID as a string.
*
* @return This builder.
*/
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/vonage/client/voice/AnswerWebhook.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class AnswerWebhook extends JsonableBaseObject {
@JsonProperty("from_user") private String fromUser;
@JsonProperty("to") private String to;
@JsonProperty("conversation_uuid") private String conversationUuid;
@JsonProperty("uuid") private UUID uuid;
@JsonProperty("uuid") private String uuid;
@JsonProperty("region_url") private URI regionUrl;
@JsonProperty("custom_data") private Map<String, ?> customData;

Expand Down Expand Up @@ -85,9 +85,9 @@ public String getConversationUuid() {
/**
* Unique identifier for this call.
*
* @return The call ID as a UUID.
* @return The call ID as a string.
*/
public UUID getUuid() {
public String getUuid() {
return uuid;
}

Expand Down
59 changes: 55 additions & 4 deletions src/main/java/com/vonage/client/voice/Call.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,28 +103,53 @@ public Call(Endpoint[] to, Endpoint from, Collection<? extends Action> ncco) {
this(builder().to(to).from(from).ncco(ncco));
}

/**
* Endpoint of the call recipient.
*
* @return The callee endpoint wrapped in an array.
*/
@JsonProperty("to")
public Endpoint[] getTo() {
return to;
}

/**
* Endpoint from which the call will be made.
*
* @return The caller number / URI, or {@code null} if unspecified.
*/
@JsonProperty("from")
public Endpoint getFrom() {
return from;
}

/**
* URL that Vonage makes a request to when the call is answered to retrieve NCCOs.
*
* @return The publicly accessible NCCO URL, or {@code null} if unspecified.
*/
@JsonProperty("answer_url")
public String[] getAnswerUrl() {
return (answerUrl != null) ? new String[]{answerUrl} : null;
}

/**
* HTTP method used to send event information to {@code answer_url}.
*
* @return The HTTP answer method type as a string, or {@code null} if not set.
*/
@JsonProperty("answer_method")
public String getAnswerMethod() {
// Hide the answer method if the answer url isn't defined
if (answerUrl == null || answerMethod == null) return null;
return answerMethod.toString();
}

/**
* URL to send event information to.
*
* @return The event URL wrapped in a string, or {@code null} if not set.
*/
@JsonProperty("event_url")
public String[] getEventUrl() {
if (eventUrl == null) {
Expand All @@ -133,11 +158,21 @@ public String[] getEventUrl() {
return new String[]{eventUrl};
}

/**
* HTTP method used to send event information to {@code event_url}.
*
* @return The HTTP event method type as a string, or {@code null} if unspecified (the default).
*/
@JsonProperty("event_method")
public String getEventMethod() {
return eventMethod != null ? eventMethod.toString() : null;
}

/**
* Machine detection behaviour.
*
* @return The machine detection mode as an enum, or {@code null} if not set.
*/
@JsonProperty("machine_detection")
public MachineDetection getMachineDetection() {
return machineDetection;
Expand All @@ -155,22 +190,38 @@ public AdvancedMachineDetection getAdvancedMachineDetection() {
return advancedMachineDetection;
}

/**
* Call timeout i.e. when Vonage will hang up after the call is answered.
*
* @return The call length in seconds, or {@code null} if unspecified (the default).
*/
@JsonProperty("length_timer")
public Integer getLengthTimer() {
return lengthTimer;
}

/**
* The time to wait whilst ringing in seconds.
*
* @return The ringing timer in seconds, or {@code null} if unspecified (the default).
*/
@JsonProperty("ringing_timer")
public Integer getRingingTimer() {
return ringingTimer;
}

/**
* Whether the call will be made from a random number assigned to the application.
*
* @return {@code true} if a random number will be used to for the caller ID, or {@code null} if unspecified.
*/
@JsonProperty("random_from_number")
public Boolean getFromRandomNumber() {
return fromRandomNumber;
}

/**
* Gets the NCCOs to use for this call.
*
* @return The NCCO actions.
*/
Expand Down Expand Up @@ -231,14 +282,14 @@ public Builder to(Endpoint... endpoints) {
}

/**
* Connect to a Phone (PSTN) number.
* Sets the outbound caller.
*
* @param number The number to place the call from in E.164 format.
* @param caller The caller's phone number (in E.164 format) or SIP URI.
*
* @return This builder.
*/
public Builder from(String number) {
return from(new PhoneEndpoint(number));
public Builder from(String caller) {
return from(new PhoneEndpoint(caller));
}

/**
Expand Down
5 changes: 2 additions & 3 deletions src/test/java/com/vonage/client/voice/AnswerWebhookTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.junit.jupiter.api.*;
import static org.junit.jupiter.api.Assertions.*;
import java.net.URI;
import java.util.UUID;

public class AnswerWebhookTest {

Expand All @@ -28,7 +27,7 @@ public void testSerdesAllParams() {
String regionUrl = "https://api-us-3.vonage.com",
endpointType = "phone", to = "442079460000",
conversationId = "CON-55d50a94-7c84-484a-b1b7-f27633133cb4",
uuid = "f7aebf19-bd37-4d63-8f35-32352f48901b",
uuid = "f7aebf19bd374d638f3532352f48901b",
from = "447700900000", json = "{\n" +
" \"to\": \""+to+"\",\n" +
" \"from\": \""+from+"\",\n" +
Expand All @@ -43,7 +42,7 @@ public void testSerdesAllParams() {
assertEquals(to, parsed.getTo());
assertEquals(from, parsed.getFrom());
assertEquals(conversationId, parsed.getConversationUuid());
assertEquals(UUID.fromString(uuid), parsed.getUuid());
assertEquals(uuid, parsed.getUuid());
assertEquals(URI.create(regionUrl), parsed.getRegionUrl());
}

Expand Down

0 comments on commit 1f9c8b3

Please sign in to comment.