public RTPInfoImpl(final Connection connection, final MediaDescription mediaDescription) { this.connection = mediaDescription.getConnection() != null ? mediaDescription.getConnection() : connection; this.mediaDescription = mediaDescription; }
public RTPInfoImpl(final Connection connection, final MediaDescription mediaDescription) { this.connection = mediaDescription.getConnection() != null ? mediaDescription.getConnection() : connection; this.mediaDescription = mediaDescription; }
@Override public String getAddress() { try { if (this.connection != null) { return this.connection.getAddress(); } return this.mediaDescription.getConnection().getAddress(); } catch (final SdpParseException e) { throw new RuntimeException("TODO: real exception pls", e); } }
@Override public String getAddress() { try { if (this.connection != null) { return this.connection.getAddress(); } return this.mediaDescription.getConnection().getAddress(); } catch (final SdpParseException e) { throw new RuntimeException("TODO: real exception pls", e); } }
/** * Convenience method for creating a new {@link RTPInfo} object. * * @param connection * the connection (the c-field) information from the SDP or null * if there were none. * @param md * the media description from the SDP * @return a new {@link RTPInfo} object if the {@link MediaDescription} was * of type "RTP/AVP", otherwise null. * @throws SdpParseException */ private RTPInfo processMediaDescription(final Connection connection, final MediaDescription md) throws SdpParseException { final Media m = md.getMedia(); if ("RTP/AVP".equalsIgnoreCase(m.getProtocol())) { final Connection c = md.getConnection() != null ? null : connection; return new RTPInfoImpl(connection, md); } return null; }
/** * Convenience method for creating a new {@link RTPInfo} object. * * @param connection * the connection (the c-field) information from the SDP or null * if there were none. * @param md * the media description from the SDP * @return a new {@link RTPInfo} object if the {@link MediaDescription} was * of type "RTP/AVP", otherwise null. * @throws SdpParseException */ private RTPInfo processMediaDescription(final Connection connection, final MediaDescription md) throws SdpParseException { final Media m = md.getMedia(); if ("RTP/AVP".equalsIgnoreCase(m.getProtocol())) { final Connection c = md.getConnection() != null ? null : connection; return new RTPInfoImpl(connection, md); } return null; }
@SuppressWarnings("unchecked") private static String patch(final byte[] data, final String externalIp) throws UnknownHostException, SdpException { final String text = new String(data); if(logger.isInfoEnabled()){ logger.info("About to patch "); logger.info("SDP :" + text); logger.info("Using externalIP: " + externalIp); } final SessionDescription sdp = SdpFactory.getInstance().createSessionDescription(text); SessionName sessionName = SdpFactory.getInstance().createSessionName("Restcomm B2BUA"); sdp.setSessionName(sessionName); // Handle the connection at the session level. fix(sdp.getConnection(), externalIp); // Handle the connections at the media description level. final Vector<MediaDescription> descriptions = sdp.getMediaDescriptions(false); for (final MediaDescription description : descriptions) { fix(description.getConnection(), externalIp); } sdp.getOrigin().setAddress(externalIp); return sdp.toString(); }
fix(description.getConnection(), externalIp); fix(description.getConnection(), externalIp);
dataPort = currMedia.getMediaPort(); rtcpPort = currMedia.getMediaPort() + 1; if (sourceMediaDescriptions.get(i).getConnection() != null) rtcpAddress = sourceMediaDescriptions.get(i).getConnection().getAddress(); else rtcpAddress = sourceSessionDescription.getConnection().getAddress(); dataPort = currMedia.getMediaPort(); rtcpPort = currMedia.getMediaPort() + 1; if (destinationMediaDescriptions.get(i).getConnection() != null) rtcpAddress = destinationMediaDescriptions.get(i).getConnection().getAddress(); else rtcpAddress = destinationSessionDescription.getConnection().getAddress();
dataPort = currMedia.getMediaPort(); rtcpPort = currMedia.getMediaPort() + 1; if (sourceMediaDescriptions.get(i).getConnection() != null) rtcpAddress = sourceMediaDescriptions.get(i).getConnection().getAddress(); else rtcpAddress = sourceSessionDescription.getConnection().getAddress();