Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright 2004-2022 Asterisk-Java contributors
*
* 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;

public abstract class AbstractChannelTalkingEvent extends ManagerEvent {
private String language;
private String accountCode;
private String uniqueId;
private String linkedId;

public AbstractChannelTalkingEvent(Object source) {
super(source);
}

public String getLanguage() {
return language;
}

public void setLanguage(String language) {
this.language = language;
}

public String getAccountCode() {
return accountCode;
}

public void setAccountCode(String accountCode) {
this.accountCode = accountCode;
}

public String getUniqueId() {
return uniqueId;
}

public void setUniqueId(String uniqueId) {
this.uniqueId = uniqueId;
}

public String getLinkedId() {
return linkedId;
}

public void setLinkedId(String linkedId) {
this.linkedId = linkedId;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright 2004-2022 Asterisk-Java contributors
*
* 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;

public class ChannelTalkingStartEvent extends AbstractChannelTalkingEvent {
public ChannelTalkingStartEvent(Object source) {
super(source);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright 2004-2022 Asterisk-Java contributors
*
* 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;

public class ChannelTalkingStopEvent extends AbstractChannelTalkingEvent {
private Long duration;

public ChannelTalkingStopEvent(Object source) {
super(source);
}

public Long getDuration() {
return duration;
}

public void setDuration(Long duration) {
this.duration = duration;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright 2004-2022 Asterisk-Java contributors
*
* 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 ChannelTalkingStartEventTest {
@Test
void shouldCreateEvent() {
//given
ChannelTalkingStartEvent channelTalkingStartEvent = new ChannelTalkingStartEvent(new Object());

HashMap<String, Object> attributes = new HashMap<>();
attributes.put("language", "en");
attributes.put("accountcode", "");
attributes.put("context", "phones");
attributes.put("exten", "5");
attributes.put("priority", "4");
attributes.put("uniqueid", "1547252114.0");
attributes.put("linkedid", "1547252114.0");

//when
setAttributes(channelTalkingStartEvent, attributes, new HashSet<>());

//then
assertThat(channelTalkingStartEvent.getLanguage()).isEqualTo("en");
assertThat(channelTalkingStartEvent.getAccountCode()).isEqualTo("");
assertThat(channelTalkingStartEvent.getContext()).isEqualTo("phones");
assertThat(channelTalkingStartEvent.getExten()).isEqualTo("5");
assertThat(channelTalkingStartEvent.getPriority()).isEqualTo(4);
assertThat(channelTalkingStartEvent.getUniqueId()).isEqualTo("1547252114.0");
assertThat(channelTalkingStartEvent.getLinkedId()).isEqualTo("1547252114.0");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright 2004-2022 Asterisk-Java contributors
*
* 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 ChannelTalkingStopEventTest {
@Test
void shouldCreateEvent() {
//given
ChannelTalkingStopEvent channelTalkingStopEvent = new ChannelTalkingStopEvent(new Object());

HashMap<String, Object> attributes = new HashMap<>();
attributes.put("language", "en");
attributes.put("accountcode", "");
attributes.put("context", "phones");
attributes.put("exten", "5");
attributes.put("priority", "4");
attributes.put("uniqueid", "1547252114.0");
attributes.put("linkedid", "1547252114.0");
attributes.put("duration", "6030");

//when
setAttributes(channelTalkingStopEvent, attributes, new HashSet<>());

//then
assertThat(channelTalkingStopEvent.getLanguage()).isEqualTo("en");
assertThat(channelTalkingStopEvent.getAccountCode()).isEqualTo("");
assertThat(channelTalkingStopEvent.getContext()).isEqualTo("phones");
assertThat(channelTalkingStopEvent.getExten()).isEqualTo("5");
assertThat(channelTalkingStopEvent.getPriority()).isEqualTo(4);
assertThat(channelTalkingStopEvent.getUniqueId()).isEqualTo("1547252114.0");
assertThat(channelTalkingStopEvent.getLinkedId()).isEqualTo("1547252114.0");
assertThat(channelTalkingStopEvent.getDuration()).isEqualTo(6030);
}
}