From 0f3ce732495eef61592d412833441bbece5a7fb9 Mon Sep 17 00:00:00 2001 From: floriankirmaier Date: Fri, 5 Apr 2024 18:54:13 +0200 Subject: [PATCH] Some refactoring in the SIP module --- .../jpro/platform/sipjs/example/component/User.java | 10 +++++----- .../java/one/jpro/platform/sipjs/api/UserAgent.java | 8 ++++---- .../api/session/{Inventation.java => Invitation.java} | 5 ++--- 3 files changed, 11 insertions(+), 12 deletions(-) rename jpro-sipjs/src/main/java/one/jpro/platform/sipjs/api/session/{Inventation.java => Invitation.java} (77%) diff --git a/jpro-sipjs/example/src/main/java/one/jpro/platform/sipjs/example/component/User.java b/jpro-sipjs/example/src/main/java/one/jpro/platform/sipjs/example/component/User.java index ab681410..9b0e4c31 100644 --- a/jpro-sipjs/example/src/main/java/one/jpro/platform/sipjs/example/component/User.java +++ b/jpro-sipjs/example/src/main/java/one/jpro/platform/sipjs/example/component/User.java @@ -11,7 +11,7 @@ import one.jpro.platform.sipjs.api.options.InvitationAcceptOptions; import one.jpro.platform.sipjs.api.options.InviterOptions; import one.jpro.platform.sipjs.api.options.UserAgentOptions; -import one.jpro.platform.sipjs.api.session.Inventation; +import one.jpro.platform.sipjs.api.session.Invitation; import one.jpro.platform.sipjs.api.session.Session; import one.jpro.platform.webrtc.MediaStream; import one.jpro.platform.webrtc.VideoFrame; @@ -75,11 +75,11 @@ public void makeAcceptButton() { var button = new Button("Accept"); button.getStyleClass().add("call-button"); button.setOnAction(event -> { - ((Inventation) session.get()).accept(InvitationAcceptOptions.createVideoOnlyCall()); + ((Invitation) session.get()).accept(InvitationAcceptOptions.createVideoOnlyCall()); handleSession(webapi, session.get(), this); }); session.addListener((observable, oldValue, newValue) -> { - if (newValue instanceof Inventation) { + if (newValue instanceof Invitation) { button.setDisable(false); } else { button.setDisable(true); @@ -94,11 +94,11 @@ public void makeRejectButton() { var button = new Button("Reject"); button.getStyleClass().add("call-button"); button.setOnAction(event -> { - ((Inventation) session.get()).reject(); + ((Invitation) session.get()).reject(); session.set(null); }); session.addListener((observable, oldValue, newValue) -> { - if (newValue instanceof Inventation) { + if (newValue instanceof Invitation) { button.setDisable(false); } else { button.setDisable(true); diff --git a/jpro-sipjs/src/main/java/one/jpro/platform/sipjs/api/UserAgent.java b/jpro-sipjs/src/main/java/one/jpro/platform/sipjs/api/UserAgent.java index a1b2987e..8e195ef5 100644 --- a/jpro-sipjs/src/main/java/one/jpro/platform/sipjs/api/UserAgent.java +++ b/jpro-sipjs/src/main/java/one/jpro/platform/sipjs/api/UserAgent.java @@ -5,7 +5,7 @@ import one.jpro.platform.sipjs.SipJSUtil; import one.jpro.platform.sipjs.api.options.InviterOptions; import one.jpro.platform.sipjs.api.options.UserAgentOptions; -import one.jpro.platform.sipjs.api.session.Inventation; +import one.jpro.platform.sipjs.api.session.Invitation; import one.jpro.platform.sipjs.api.session.Inviter; import java.util.concurrent.CompletableFuture; @@ -24,7 +24,7 @@ public class UserAgent { JSVariable startPromise; UserAgentOptions options; - Consumer onInvite; + Consumer onInvite; private JSVariable onInviteJS; /** @@ -43,7 +43,7 @@ public UserAgent(UserAgentOptions options, WebAPI webapi) { // setup onInvite onInviteJS = webapi.registerJavaFunctionWithVariable(invite -> { - var inventation = new Inventation(invite, webapi); + var inventation = new Invitation(invite, webapi); onInvite.accept(inventation); }); webapi.executeScript(optionsVariable.getName() + ".delegate = { onInvite: " + onInviteJS.getName() + " };"); @@ -77,7 +77,7 @@ public CompletableFuture makeCall(String target, InviterOptions options * Sets the onInvite consumer. * @param onInvite */ - public void setOnInvite(Consumer onInvite) { + public void setOnInvite(Consumer onInvite) { this.onInvite = onInvite; } diff --git a/jpro-sipjs/src/main/java/one/jpro/platform/sipjs/api/session/Inventation.java b/jpro-sipjs/src/main/java/one/jpro/platform/sipjs/api/session/Invitation.java similarity index 77% rename from jpro-sipjs/src/main/java/one/jpro/platform/sipjs/api/session/Inventation.java rename to jpro-sipjs/src/main/java/one/jpro/platform/sipjs/api/session/Invitation.java index b7319e3b..56dfede6 100644 --- a/jpro-sipjs/src/main/java/one/jpro/platform/sipjs/api/session/Inventation.java +++ b/jpro-sipjs/src/main/java/one/jpro/platform/sipjs/api/session/Invitation.java @@ -3,13 +3,12 @@ import com.jpro.webapi.JSVariable; import com.jpro.webapi.WebAPI; import one.jpro.platform.sipjs.api.options.InvitationAcceptOptions; -import one.jpro.platform.sipjs.api.session.Session; /** * Represents an incoming call. */ -public class Inventation extends Session { - public Inventation(JSVariable session, WebAPI webapi) { +public class Invitation extends Session { + public Invitation(JSVariable session, WebAPI webapi) { super(session, webapi); }