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 9b0e4c31..106a0a4a 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 @@ -117,7 +117,7 @@ public void makeHangupButton() { session.set(null); }); session.addListener((observable, oldValue, newValue) -> { - button.setDisable(session.get() == null); + button.setDisable(session.get() == null || !session.get().stateProperty().get().equals(Session.State.Established)); }); button.setDisable(session.get() == null); getChildren().add(button); diff --git a/jpro-sipjs/src/main/java/one/jpro/platform/sipjs/api/session/Session.java b/jpro-sipjs/src/main/java/one/jpro/platform/sipjs/api/session/Session.java index 7b57a110..d0716e4f 100644 --- a/jpro-sipjs/src/main/java/one/jpro/platform/sipjs/api/session/Session.java +++ b/jpro-sipjs/src/main/java/one/jpro/platform/sipjs/api/session/Session.java @@ -89,7 +89,9 @@ public class State { } public void bye() { - webapi.executeScript(session.getName() + ".bye();"); + webapi.js().eval(session.getName() + ".bye();") + .toPromise() + .onPromiseError(e -> e.printStackTrace()); } public void endCall() {