Ejemplo n.º 1
0
 public SessionDescription parse(byte[] sdp) {
   try {
     return sdpParser.parse(sdp);
   } catch (IOException e) {
     logger.error(e.getMessage(), e);
   }
   return null;
 }
Ejemplo n.º 2
0
 public void terminate(SipRequest sipRequest) {
   String callId = Utils.getMessageCallId(sipRequest);
   if (!guiClosedCallIds.contains(callId)) {
     guiClosedCallIds.add(callId);
   }
   Dialog dialog = dialogManager.getDialog(callId);
   SipRequest inviteWithAuth = getInviteWithAuth(callId);
   if (dialog != null) {
     SipRequest originatingRequest;
     if (inviteWithAuth != null) {
       originatingRequest = inviteWithAuth;
     } else {
       originatingRequest = sipRequest;
     }
     ClientTransaction clientTransaction =
         transactionManager.getClientTransaction(originatingRequest);
     if (clientTransaction != null) {
       synchronized (clientTransaction) {
         DialogState dialogState = dialog.getState();
         if (dialog.EARLY.equals(dialogState)) {
           initialRequestManager.createCancel(inviteWithAuth, midDialogRequestManager, profileUri);
         } else if (dialog.CONFIRMED.equals(dialogState)) {
           // clientTransaction not yet removed
           midDialogRequestManager.generateMidDialogRequest(dialog, RFC3261.METHOD_BYE, null);
           guiClosedCallIds.remove(callId);
         }
       }
     } else {
       // clientTransaction Terminated and removed
       logger.debug("clientTransaction null");
       midDialogRequestManager.generateMidDialogRequest(dialog, RFC3261.METHOD_BYE, null);
       guiClosedCallIds.remove(callId);
     }
   } else {
     InviteClientTransaction inviteClientTransaction =
         (InviteClientTransaction) transactionManager.getClientTransaction(inviteWithAuth);
     if (inviteClientTransaction == null) {
       logger.error("cannot find invite client transaction" + " for call " + callId);
     } else {
       SipResponse sipResponse = inviteClientTransaction.getLastResponse();
       if (sipResponse != null) {
         int statusCode = sipResponse.getStatusCode();
         if (statusCode < RFC3261.CODE_200_OK) {
           initialRequestManager.createCancel(inviteWithAuth, midDialogRequestManager, profileUri);
         }
       }
     }
   }
   switch (userAgent.getMediaMode()) {
     case captureAndPlayback:
       userAgent.getMediaManager().stopSession();
       SoundManager soundManager = userAgent.getSoundManager();
       if (soundManager != null) {
         soundManager.closeLines();
       }
       break;
     case echo:
       Echo echo = userAgent.getEcho();
       if (echo != null) {
         echo.stop();
         userAgent.setEcho(null);
       }
       break;
     case file:
       MediaManager mediaManager = userAgent.getMediaManager();
       mediaManager.stopSession();
       break;
     default:
       break;
   }
 }