Пример #1
0
 /**
  * Accepts an incoming call. Callback function called when arriving a new INVITE method (incoming
  * call)
  */
 public void onCallIncoming(
     Call call,
     NameAddress callee,
     NameAddress caller,
     String sdp,
     Message invite) { // printLog("INCOMING");
   call.ring();
   String local_session;
   if (sdp != null && sdp.length() > 0) {
     SessionDescriptor remote_sdp = new SessionDescriptor(sdp);
     SessionDescriptor local_sdp = new SessionDescriptor(call.getLocalSessionDescriptor());
     SessionDescriptor new_sdp =
         new SessionDescriptor(
             remote_sdp.getOrigin(),
             remote_sdp.getSessionName(),
             local_sdp.getConnection(),
             local_sdp.getTime());
     new_sdp.addMediaDescriptors(local_sdp.getMediaDescriptors());
     new_sdp = SdpTools.sdpMediaProduct(new_sdp, remote_sdp.getMediaDescriptors());
     new_sdp = SdpTools.sdpAttirbuteSelection(new_sdp, "rtpmap");
     local_session = new_sdp.toString();
   } else local_session = call.getLocalSessionDescriptor();
   // accept immediatly
   call.accept(local_session);
 }
Пример #2
0
 /* HSC CHANGES START */
 public static SessionDescriptor sdpAttirbuteSelection(SessionDescriptor sdp, String a_name) {
   Vector<MediaDescriptor> new_media = new Vector<MediaDescriptor>();
   for (Enumeration<MediaDescriptor> e = sdp.getMediaDescriptors().elements();
       e.hasMoreElements(); ) {
     /* HSC CHANGES END */
     MediaDescriptor md = e.nextElement();
     AttributeField attr = md.getAttribute(a_name);
     if (attr != null) {
       new_media.addElement(new MediaDescriptor(md.getMedia(), md.getConnection(), attr));
     }
   }
   SessionDescriptor new_sdp = new SessionDescriptor(sdp);
   new_sdp.removeMediaDescriptors();
   new_sdp.addMediaDescriptors(new_media);
   return new_sdp;
 }