All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.asteriskjava.manager.event.RtcpReceivedEvent Maven / Gradle / Ivy

There is a newer version: 3.40.1
Show newest version
/*
 *  Copyright 2004-2006 Stefan Reuter
 *
 *  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 java.net.InetAddress;

/**
 * An RTCPReceivedEvent is triggered when Asterisk receives an RTCP message.

* Available since Asterisk 1.6

* It is implemented in main/rtp.c * * @author srt * @version $Id: RtcpReceivedEvent.java 1203 2008-11-11 17:11:50Z srt $ * @since 1.0.0 */ public class RtcpReceivedEvent extends AbstractRtcpEvent { private static final long serialVersionUID = 1L; /** * Payload identifier for a sender report. */ public static final int PT_SENDER_REPORT = 200; /** * Payload identifier for a receiver report. */ public static final int PT_RECEIVER_REPORT = 201; public static final int PT_H261_FUR = 192; private InetAddress fromAddress; private Integer fromPort; private Long pt; private Long receptionReports; private Long senderSsrc; private Long packetsLost; private Long highestSequence; private Long sequenceNumberCycles; private Double lastSr; private Long rtt; public RtcpReceivedEvent(Object source) { super(source); } /** * Returns the IP address the RTCP message has been received from. * * @return the IP address the RTCP message has been received from. */ public InetAddress getFromAddress() { return fromAddress; } /** * Returns the port of the RTCP message has been received from. * * @return the port of the RTCP message has been received from. */ public Integer getFromPort() { return fromPort; } public void setFrom(String from) { // Format is "%s:%d" this.fromAddress = stringToAddress(from); this.fromPort = stringToPort(from); } /** * Indicates the format of the payload, typical values are 200 for sender reports and * 201 for receiver reports. * * @return the format of the payload. * @see #PT_SENDER_REPORT * @see #PT_RECEIVER_REPORT */ public Long getPt() { return pt; } public void setPt(String ptString) { // Format is "PT: %d(%s)" if (ptString == null || ptString.length() == 0) { this.pt = null; return; } if (ptString.indexOf('(') > 0) { this.pt = Long.parseLong(ptString.substring(0, ptString.indexOf('('))); } else { this.pt = Long.parseLong(ptString); } } public Long getReceptionReports() { return receptionReports; } public void setReceptionReports(Long receptionReports) { this.receptionReports = receptionReports; } /** * Returns the synchronization source identifier of the sender. * * @return the synchronization source identifier of the sender. */ public Long getSenderSsrc() { return senderSsrc; } public void setSenderSsrc(Long senderSsrc) { this.senderSsrc = senderSsrc; } /** * Returns the number of packets lost so far. * * @return the number of packets lost. */ public Long getPacketsLost() { return packetsLost; } public void setPacketsLost(Long packetsLost) { this.packetsLost = packetsLost; } public Long getHighestSequence() { return highestSequence; } public void setHighestSequence(Long highestSequence) { this.highestSequence = highestSequence; } public Long getSequenceNumberCycles() { return sequenceNumberCycles; } public void setSequenceNumberCycles(Long sequenceNumberCycles) { this.sequenceNumberCycles = sequenceNumberCycles; } public Double getLastSr() { return lastSr; } public void setLastSr(Double lastSr) { this.lastSr = lastSr; } /** * Returns the round trip time. * * @return the round trip time in seconds, may be null. */ public Long getRtt() { return rtt; } public void setRtt(String rttString) { this.rtt = secStringToLong(rttString); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy