@Override public Collection<RTPInfo> getRTPInfo() { final List<RTPInfo> list = new ArrayList<RTPInfo>(); try { final Connection c = this.sdp.getConnection(); @SuppressWarnings("unchecked") final Vector<MediaDescription> mds = this.sdp.getMediaDescriptions(false); if (mds != null) { for (final MediaDescription md : mds) { final RTPInfo rtpInfo = processMediaDescription(c, md); if (rtpInfo != null) { list.add(rtpInfo); } } } } catch (final SdpException e) { throw new RuntimeException("TODO: throw real exception", e); } return list; }
@Override public Collection<RTPInfo> getRTPInfo() { final List<RTPInfo> list = new ArrayList<RTPInfo>(); try { final Connection c = this.sdp.getConnection(); @SuppressWarnings("unchecked") final Vector<MediaDescription> mds = this.sdp.getMediaDescriptions(false); if (mds != null) { for (final MediaDescription md : mds) { final RTPInfo rtpInfo = processMediaDescription(c, md); if (rtpInfo != null) { list.add(rtpInfo); } } } } catch (final SdpException e) { throw new RuntimeException("TODO: throw real exception", e); } return list; }
private byte[] patchMedia(final String realIp, final byte[] data) throws UnknownHostException, SdpException { final String text = new String(data); final SessionDescription sdp = SdpFactory.getInstance().createSessionDescription(text); final Connection connection = sdp.getConnection(); if(Connection.IN.equals(connection.getNetworkType()) && Connection.IP4.equals(connection.getAddressType())) { final InetAddress address = InetAddress.getByName(connection.getAddress()); final String ip = address.getHostAddress(); if(!IPUtils.isRoutableAddress(ip)) { connection.setAddress(realIp); } } return sdp.toString().getBytes(); }
@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(); }
final SessionDescription sdp = SdpFactory.getInstance().createSessionDescription(text); fix(sdp.getConnection(), externalIp); fix(sdp.getConnection(), externalIp);
rtcpAddress = sourceMediaDescriptions.get(i).getConnection().getAddress(); else rtcpAddress = sourceSessionDescription.getConnection().getAddress(); rtcpAddress = destinationMediaDescriptions.get(i).getConnection().getAddress(); else rtcpAddress = destinationSessionDescription.getConnection().getAddress();
Connection otherConnection = (Connection) otherSessionDescription.getConnection(); if (otherConnection != null) { this.setConnection((Connection) otherConnection.clone());
rtcpAddress = sourceMediaDescriptions.get(i).getConnection().getAddress(); else rtcpAddress = sourceSessionDescription.getConnection().getAddress();