diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1add06c7a..b236081aa 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,7 @@
# Change Log
+## [5.45.4](https://github.com/plivo/plivo-java/tree/v5.45.4)(2025-02-18)
+**Feature - Throw GeoPermissionException on synchronous geopermissions error**
+
## [5.45.3](https://github.com/plivo/plivo-java/tree/v5.45.3)(2024-10-23)
**Feature - fraudCheck param in Create, Get and List Session**
- Support for the `fraud_check` parameter in sms verify session request
diff --git a/Dockerfile b/Dockerfile
index 2879f37c5..810fe2ff9 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,6 +1,6 @@
-FROM openjdk:8-alpine
+FROM openjdk:8-buster
-RUN apk update && apk add git vim bash wget make
+RUN apt-get update && apt-get install -y git vim bash wget make
WORKDIR /usr/src/app
ENV CLASSPATH ${CLASSPATH}:/etc/jars/*
diff --git a/README.md b/README.md
index 3aeffd32b..d29d53ec7 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ The Plivo Java SDK makes it simpler to integrate communications into your Java a
### To Install Stable release
-You can use this SDK by adding it as a dependency in your dependency management tool. Alternatively, you can use the [JAR file](https://search.maven.org/remotecontent?filepath=com/plivo/plivo-java/5.45.3/plivo-java-5.45.3.jar).
+You can use this SDK by adding it as a dependency in your dependency management tool. Alternatively, you can use the [JAR file](https://search.maven.org/remotecontent?filepath=com/plivo/plivo-java/5.45.4/plivo-java-5.45.4.jar).
If you are using Maven, use the following XML to include the Plivo SDK as a dependency.
@@ -19,13 +19,13 @@ If you are using Maven, use the following XML to include the Plivo SDK as a depe
com.plivo
plivo-java
- 5.45.3
+ 5.45.4
```
If you are using Gradle, use the following line in your dependencies.
```
-compile 'com.plivo:plivo-java:5.45.3'
+compile 'com.plivo:plivo-java:5.45.4'
```
### To Install Beta release
diff --git a/pom.properties b/pom.properties
index 8ffe12a55..b3791d906 100644
--- a/pom.properties
+++ b/pom.properties
@@ -1,6 +1,6 @@
# Written manually.
-version=5.45.3
+version=5.45.4
groupId=com.plivo
artifactId=plivo-java
diff --git a/pom.xml b/pom.xml
index 4ec14a90a..114dc66f4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
4.0.0
com.plivo
plivo-java
- 5.45.3
+ 5.45.4
plivo-java
A Java SDK to make voice calls & send SMS using Plivo and to generate Plivo XML
diff --git a/src/main/java/com/plivo/api/exceptions/GeoPermissionException.java b/src/main/java/com/plivo/api/exceptions/GeoPermissionException.java
new file mode 100644
index 000000000..51c1bf159
--- /dev/null
+++ b/src/main/java/com/plivo/api/exceptions/GeoPermissionException.java
@@ -0,0 +1,8 @@
+package com.plivo.api.exceptions;
+
+public class GeoPermissionException extends PlivoRestException {
+
+ public GeoPermissionException(String message) {
+ super(message);
+ }
+}
diff --git a/src/main/java/com/plivo/api/models/base/BaseRequest.java b/src/main/java/com/plivo/api/models/base/BaseRequest.java
index c6c2b4ef3..988c3dcd6 100644
--- a/src/main/java/com/plivo/api/models/base/BaseRequest.java
+++ b/src/main/java/com/plivo/api/models/base/BaseRequest.java
@@ -11,10 +11,14 @@
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.exceptions.ResourceNotFoundException;
import com.plivo.api.exceptions.ServerException;
+import com.plivo.api.exceptions.GeoPermissionException;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.util.Arrays;
import java.util.HashMap;
+import java.util.List;
+import java.util.stream.Collectors;
import okhttp3.ResponseBody;
import retrofit2.Response;
@@ -24,6 +28,12 @@ public abstract class BaseRequest {
@JsonIgnore
protected PlivoClient plivoClient = Plivo.getClient();
+ private static final List GEO_PERMISSION_ENDPOINTS = Arrays.asList(
+ "/Call/",
+ "/Message/",
+ "/Session/"
+ );
+
public PlivoClient client() {
return this.plivoClient;
}
@@ -84,6 +94,18 @@ protected void handleResponse(Response response) throws PlivoRestException, IOEx
throw new InvalidRequestException(response.errorBody().string());
case 401:
throw new AuthenticationException(response.errorBody().string());
+ case 403:
+ try {
+ String url = response.raw().request().url().toString();
+ if ((this instanceof Creator || this instanceof VoiceCreator) &&
+ GEO_PERMISSION_ENDPOINTS.stream().anyMatch(endpoint -> url.endsWith(endpoint))) {
+ throw new GeoPermissionException(response.errorBody().string());
+ }
+ } catch (GeoPermissionException e) {
+ throw e;
+ } catch (Exception e) {
+ // nop
+ }
case 404:
throw new ResourceNotFoundException(response.errorBody().string());
case 405:
diff --git a/src/main/resources/com/plivo/api/version.txt b/src/main/resources/com/plivo/api/version.txt
index d581d07b7..a637ab285 100644
--- a/src/main/resources/com/plivo/api/version.txt
+++ b/src/main/resources/com/plivo/api/version.txt
@@ -1 +1 @@
-5.45.3
+5.45.4