Skip to content

Commit

Permalink
Some refactoring in the SIP module
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianKirmaier committed Apr 5, 2024
1 parent 29c8873 commit 0f3ce73
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -24,7 +24,7 @@ public class UserAgent {
JSVariable startPromise;
UserAgentOptions options;

Consumer<Inventation> onInvite;
Consumer<Invitation> onInvite;

private JSVariable onInviteJS;
/**
Expand All @@ -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() + " };");
Expand Down Expand Up @@ -77,7 +77,7 @@ public CompletableFuture<Inviter> makeCall(String target, InviterOptions options
* Sets the onInvite consumer.
* @param onInvite
*/
public void setOnInvite(Consumer<Inventation> onInvite) {
public void setOnInvite(Consumer<Invitation> onInvite) {
this.onInvite = onInvite;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 0f3ce73

Please sign in to comment.