diff --git a/src/main/java/org/asteriskjava/manager/response/SipShowPeerResponse.java b/src/main/java/org/asteriskjava/manager/response/SipShowPeerResponse.java index 7d24d85d9..1ea7987b7 100644 --- a/src/main/java/org/asteriskjava/manager/response/SipShowPeerResponse.java +++ b/src/main/java/org/asteriskjava/manager/response/SipShowPeerResponse.java @@ -1,3 +1,18 @@ +/* + * 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.response; import java.util.Map; @@ -77,6 +92,11 @@ public class SipShowPeerResponse extends ManagerResponse { private String sipRtpEngine; private String sipComedia; private String mohsuggest; + private String namedPickupgroup; + private String sipRtcpMux; + private String description; + private String subscribecontext; + private String namedCallgroup; private Map chanVariable; @@ -614,6 +634,51 @@ public void setMohsuggest(String mohsuggest) { this.mohsuggest = mohsuggest; } + public String getNamedPickupgroup() { + return namedPickupgroup; + } + + public SipShowPeerResponse setNamedPickupgroup(String namedPickupgroup) { + this.namedPickupgroup = namedPickupgroup; + return this; + } + + public String getSipRtcpMux() { + return sipRtcpMux; + } + + public SipShowPeerResponse setSipRtcpMux(String sipRtcpMux) { + this.sipRtcpMux = sipRtcpMux; + return this; + } + + public String getDescription() { + return description; + } + + public SipShowPeerResponse setDescription(String description) { + this.description = description; + return this; + } + + public String getSubscribecontext() { + return subscribecontext; + } + + public SipShowPeerResponse setSubscribecontext(String subscribecontext) { + this.subscribecontext = subscribecontext; + return this; + } + + public String getNamedCallgroup() { + return namedCallgroup; + } + + public SipShowPeerResponse setNamedCallgroup(String namedCallgroup) { + this.namedCallgroup = namedCallgroup; + return this; + } + @Override public String toString() { StringBuilder builder = new StringBuilder(); @@ -745,6 +810,16 @@ public String toString() { builder.append(chanVariable); builder.append(", mohSuggest="); builder.append(mohsuggest); + builder.append(", namedPickupgroup="); + builder.append(namedPickupgroup); + builder.append(", sipRtcpMux="); + builder.append(sipRtcpMux); + builder.append(", description="); + builder.append(description); + builder.append(", subscribecontext="); + builder.append(subscribecontext); + builder.append(", namedCallgroup="); + builder.append(namedCallgroup); builder.append("]"); return builder.toString(); } diff --git a/src/test/java/org/asteriskjava/manager/response/SipShowPeerResponseTest.java b/src/test/java/org/asteriskjava/manager/response/SipShowPeerResponseTest.java index 9d12cedd4..d886a45f3 100644 --- a/src/test/java/org/asteriskjava/manager/response/SipShowPeerResponseTest.java +++ b/src/test/java/org/asteriskjava/manager/response/SipShowPeerResponseTest.java @@ -1,8 +1,29 @@ +/* + * 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.response; +import org.asteriskjava.manager.util.EventAttributesHelper; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; + +import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; class SipShowPeerResponseTest { @@ -13,6 +34,28 @@ void setUp() { response = new SipShowPeerResponse(); } + @Test + void shouldCreateResponse() { + //given + SipShowPeerResponse sipShowPeerResponse = new SipShowPeerResponse(); + Map attributes = new HashMap<>(); + attributes.put("named pickupgroup", ""); + attributes.put("sip-rtcp-mux", "N"); + attributes.put("description", ""); + attributes.put("subscribecontext", ""); + attributes.put("named callgroup", ""); + + //when + EventAttributesHelper.setAttributes(sipShowPeerResponse, attributes, new HashSet<>()); + + //then + assertThat(sipShowPeerResponse.getNamedPickupgroup()).isBlank(); + assertThat(sipShowPeerResponse.getSipRtcpMux()).isEqualTo("N"); + assertThat(sipShowPeerResponse.getDescription()).isBlank(); + assertThat(sipShowPeerResponse.getSubscribecontext()).isBlank(); + assertThat(sipShowPeerResponse.getNamedCallgroup()).isBlank(); + } + @Test void testSetQualifyFreq() { response.setQualifyFreq("6000 ms");