示例#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
 /**
  * Redirects the call when remotly requested. Callback function called when arriving a 3xx (call
  * redirection)
  */
 public void onCallRedirection(
     Call call,
     String reason,
     Vector contact_list,
     Message resp) { // printLog("REDIRECTION ("+reason+")");
   call.call((String) contact_list.elementAt(0));
 }