diff --git a/src/main/java/org/asteriskjava/manager/event/AbstractBridgeEvent.java b/src/main/java/org/asteriskjava/manager/event/AbstractBridgeEvent.java index 58f9fcf42..9a1353405 100644 --- a/src/main/java/org/asteriskjava/manager/event/AbstractBridgeEvent.java +++ b/src/main/java/org/asteriskjava/manager/event/AbstractBridgeEvent.java @@ -15,7 +15,8 @@ public abstract class AbstractBridgeEvent extends ManagerEvent { private String bridgeName; private String bridgeTechnology; private String accountCode; - private String bridgevideosourcemode; + private String bridgeVideoSource; + private String bridgeVideoSourceMode; AbstractBridgeEvent(Object source) { super(source); @@ -77,11 +78,19 @@ public void setAccountCode(String accountCode) { this.accountCode = accountCode; } + public String getBridgeVideoSource() { + return bridgeVideoSource; + } + + public void setBridgeVideoSource(String bridgeVideoSource) { + this.bridgeVideoSource = bridgeVideoSource; + } + public String getBridgevideosourcemode() { - return bridgevideosourcemode; + return bridgeVideoSourceMode; } - public void setBridgevideosourcemode(String bridgevideosourcemode) { - this.bridgevideosourcemode = bridgevideosourcemode; + public void setBridgevideosourcemode(String bridgeVideoSourceMode) { + this.bridgeVideoSourceMode = bridgeVideoSourceMode; } } diff --git a/src/main/java/org/asteriskjava/manager/event/BridgeVideoSourceUpdateEvent.java b/src/main/java/org/asteriskjava/manager/event/BridgeVideoSourceUpdateEvent.java new file mode 100644 index 000000000..c2495f584 --- /dev/null +++ b/src/main/java/org/asteriskjava/manager/event/BridgeVideoSourceUpdateEvent.java @@ -0,0 +1,41 @@ +/* + * Copyright 2023 Hector Espert + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package org.asteriskjava.manager.event; + +/** + * Raised when the channel that is the source of video in a bridge changes. + */ +public class BridgeVideoSourceUpdateEvent extends AbstractBridgeEvent { + private String bridgePreviousVideoSource; + + public BridgeVideoSourceUpdateEvent(Object source) { + super(source); + } + + /** + * Gets the unique ID of the channel that was the video source. + * + * @return the unique ID of the channel that was the video source. + */ + public String getBridgePreviousVideoSource() { + return bridgePreviousVideoSource; + } + + public void setBridgePreviousVideoSource(String bridgePreviousVideoSource) { + this.bridgePreviousVideoSource = bridgePreviousVideoSource; + } +} diff --git a/src/test/java/org/asteriskjava/manager/event/BridgeVideoSourceUpdateEventTest.java b/src/test/java/org/asteriskjava/manager/event/BridgeVideoSourceUpdateEventTest.java new file mode 100644 index 000000000..4331041a7 --- /dev/null +++ b/src/test/java/org/asteriskjava/manager/event/BridgeVideoSourceUpdateEventTest.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Hector Espert + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package org.asteriskjava.manager.event; + +import org.junit.jupiter.api.Test; + +import java.util.HashMap; +import java.util.HashSet; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.asteriskjava.manager.util.EventAttributesHelper.setAttributes; + +class BridgeVideoSourceUpdateEventTest { + + @Test + void shouldCreateEvent() { + BridgeVideoSourceUpdateEvent bridgeVideoSourceUpdateEvent = new BridgeVideoSourceUpdateEvent(new Object()); + + HashMap attributes = new HashMap<>(); + attributes.put("bridgeuniqueid", "85f11e74-b0d9-4354-bc91-80782ee7a6a7"); + attributes.put("bridgepreviousvideosource", "e39cdee4-61a1-49b5-9656-96cef742806f"); + setAttributes(bridgeVideoSourceUpdateEvent, attributes, new HashSet<>()); + + assertThat(bridgeVideoSourceUpdateEvent.getBridgeUniqueId()) + .isEqualTo("85f11e74-b0d9-4354-bc91-80782ee7a6a7"); + assertThat(bridgeVideoSourceUpdateEvent.getBridgePreviousVideoSource()) + .isEqualTo("e39cdee4-61a1-49b5-9656-96cef742806f"); + } + +} \ No newline at end of file