예제 #1
0
 // Issue 308: https://telestax.atlassian.net/browse/RESTCOMM-308
 @SuppressWarnings("unchecked")
 private static String patch(final byte[] data, final String externalIp)
     throws UnknownHostException, SdpException {
   final String text = new String(data);
   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();
 }