javax.sip.Dialog类的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(10.5k)|赞(0)|评价(0)|浏览(147)

本文整理了Java中javax.sip.Dialog类的一些代码示例,展示了Dialog类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Dialog类的具体详情如下:
包路径:javax.sip.Dialog
类名称:Dialog

Dialog介绍

暂无

代码示例

代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl

sessionCreatingDialog.delete();

代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl

/**
 * {@inheritDoc}
 */
public void addSubscription(MobicentsSipServletMessage sipServletMessageImpl) throws SipException {
  EventHeader eventHeader = null;
  if(sipServletMessageImpl instanceof SipServletResponseImpl) {
    eventHeader =  (EventHeader) ((SipServletRequestImpl)((SipServletResponseImpl)sipServletMessageImpl).getRequest()).getMessage().getHeader(EventHeader.NAME);            
  } else {
    eventHeader =  (EventHeader) sipServletMessageImpl.getMessage().getHeader(EventHeader.NAME);
  }
  if(eventHeader != null) {
    if(logger.isDebugEnabled()) {
      logger.debug("adding subscription " + eventHeader + " to sip session " + getId());
    }
    if(subscriptions == null) {
      this.subscriptions = new CopyOnWriteArraySet<String>();
    }
    subscriptions.add(eventHeader.toString());    
        
    if(logger.isDebugEnabled()) {
      logger.debug("Request from Original Transaction is " + originalMethod);
      logger.debug("Dialog is " + sessionCreatingDialog);
    }
    if(subscriptions.size() < 2 && Request.INVITE.equals(originalMethod)) {
      sessionCreatingDialog.terminateOnBye(false);
    }
  }
}

代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl

.next();
MobicentsSipSessionKey sessionKey = mobicentsSipSession.getKey();                
if(sessionKey.getCallId().trim().equals(dialog.getCallId().getCallId())) {
  if(logger.isDebugEnabled()) {
    logger.debug("found session with the same Call Id " + sessionKey + ", to Tag " + sessionKey.getToTag());
    logger.debug("dialog localParty = " + dialog.getLocalParty().getURI() + ", localTag " + dialog.getLocalTag());
    logger.debug("dialog remoteParty = " + dialog.getRemoteParty().getURI() + ", remoteTag " + dialog.getRemoteTag());
  if(sessionKey.getFromTag().equals(dialog.getLocalTag()) && sessionKey.getToTag().equals(dialog.getRemoteTag())) {
    if(mobicentsSipSession.getProxy() == null) {
      return mobicentsSipSession;	
  } else if (sessionKey.getFromTag().equals(dialog.getRemoteTag()) && sessionKey.getToTag().equals(dialog.getLocalTag())){
    if(mobicentsSipSession.getProxy() == null) {
      return mobicentsSipSession;

代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl

public void processDialogTerminated(final DialogTerminatedEvent dialogTerminatedEvent) {
  final Dialog dialog = dialogTerminatedEvent.getDialog();		
  if(logger.isDebugEnabled()) {
    logger.debug("Dialog Terminated => dialog Id : " + dialogTerminatedEvent.getDialog().getDialogId());
    final TransactionApplicationData dialogAppData = (TransactionApplicationData) dialog.getApplicationData();
    public void run() {			
      try {

代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl

public void run() {			
    try {
      boolean appDataFound = false;
      TransactionApplicationData txAppData = null; 
      if(dialogAppData != null) {						
        if(dialogAppData.getSipServletMessage() == null) {
          Transaction transaction = dialogAppData.getTransaction();
          if(transaction != null && transaction.getApplicationData() != null) {
            txAppData = (TransactionApplicationData) transaction.getApplicationData();
            txAppData.cleanUp();
          }
        } else {
          MobicentsSipSessionKey sipSessionKey = dialogAppData.getSipSessionKey();
          tryToInvalidateSession(sipSessionKey, false);				
        }
        dialogAppData.cleanUp();
        // since the stack doesn't nullify the app data, we need to do it to let go of the refs					
        dialog.setApplicationData(null);
      }        
      if(!appDataFound && logger.isDebugEnabled()) {
        logger.debug("no application data for this dialog " + dialog.getDialogId());
      }
    } catch (Exception e) {
      logger.error("Problem handling dialog termination", e);
    }
  }
});

代码示例来源:origin: org.mobicents.examples/call-controller2-sbbs

/**
 * Voice Mail will hang up on caller sending a BYE Request.
 * 
 */
private void sendByeRequest() {
  log.info("########## VOICE MAIL SBB: sendByRequest ##########");
  try {
    SipProvider sipProvider = getSipFactoryProvider();
    Dialog dialog = this.getDialog();
    if(dialog == null)
    {
      return;
    }
    Request request = dialog.createRequest(Request.BYE);
    ClientTransaction ct = sipProvider.getNewClientTransaction(request);
    dialog.sendRequest(ct);
    releaseState();
  } catch (TransactionUnavailableException e) {
    log.severe(e.getMessage(), e);
  } catch (SipException e) {
    log.severe(e.getMessage(), e);
  }
}

代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl

logger.info("Sending the ACK through the dialog " + clonedRequest);
  dialog.sendAck(clonedRequest);
} else {
  Request dialogRequest=
    dialog.createRequest(clonedRequest.getMethod());
  Object content=clonedRequest.getContent();
  if (content!=null) {
  dialog.setApplicationData(appData);
  if(logger.isInfoEnabled()) {
    logger.info("Sending the request through the dialog " + clonedRequest);
  dialog.sendRequest(clientTransaction);

代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl

cleanDialogInformation(true);
if(!DialogState.TERMINATED.equals(sessionCreatingDialog.getState())) {
  sessionCreatingDialog.delete();

代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl

sessionCreatingDialog);
  if(sessionCreatingDialog != null) {
    logger.debug("dialog state " + sessionCreatingDialog.getState() + " for that dialog "+ sessionCreatingDialog);
if(sessionCreatingDialog != null && DialogState.TERMINATED.equals(sessionCreatingDialog.getState()) && !method.equalsIgnoreCase(Request.BYE)) {
    (!DialogState.TERMINATED.equals(sessionCreatingDialog.getState()) || 
        (DialogState.TERMINATED.equals(sessionCreatingDialog.getState()) && method.equalsIgnoreCase(Request.BYE)))) {
    final Request methodRequest = this.sessionCreatingDialog.createRequest(method);
      if(sessionCreatingDialog != null && sessionCreatingDialog.getRemoteTarget() != null) {
        SipUri sipUri = (SipUri) sessionCreatingDialog.getRemoteTarget().getURI().clone();
        sipUri.clearUriParms();
        if(logger.isDebugEnabled()) {
        if(sessionCreatingDialog != null && sessionCreatingDialog.getRemoteTarget() != null) {
          SipUri sipUri = (SipUri) sessionCreatingDialog.getRemoteTarget().getURI().clone();
          sipUri.clearUriParms();
          if(logger.isDebugEnabled()) {
    String errorMessage = "Couldn't create the subsequent request " + method + " for this session " + key + ", isValid " + isValid() + ", session state " + state + " , sessionCreatingDialog = " + sessionCreatingDialog;
    if(sessionCreatingDialog != null) {
      errorMessage += " , dialog state " + sessionCreatingDialog.getState();

代码示例来源:origin: org.mobicents.examples/converged-demo-callcontrol-sbb

/**
 * 
 * @param callId
 * @return
 */
private Session getSession(Dialog dialog) {
  final String callId = dialog.getCallId().getCallId();
  SessionAssociation sa = (SessionAssociation) cache.get(callId);
  Session session = sa.getSession(callId);
  return session;
}

代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl

dialog.setApplicationData(this.transactionApplicationData);
Thread.currentThread().setContextClassLoader(cl);
if (dialog == null || dialog.getState() == null
    || (dialog.getState() == DialogState.EARLY && !Request.PRACK.equals(requestMethod) && !Request.UPDATE.equals(requestMethod)) 
    || Request.CANCEL.equals(requestMethod)) {
  if(logger.isDebugEnabled()) {
    logger.debug("Sending the in dialog request " + request);
  dialog.sendRequest((ClientTransaction) getTransaction());

代码示例来源:origin: org.jitsi/jain-sip-ri-ossonly

challengedTransaction.getDialog().getState() != DialogState.CONFIRMED)  {
  reoriginatedRequest = (Request) challengedRequest.clone();
} else {
      challengedTransaction.getDialog().createRequest(challengedRequest.getMethod());
  Iterator<String> headerNames = challengedRequest.getHeaderNames();
  while (headerNames.hasNext()) {

代码示例来源:origin: org.mobicents.examples/restcomm-slee-example-sip11-b2b-sbb

public void on2xxResponse(ResponseEvent event, ActivityContextInterface aci) {
  final CSeqHeader cseq = (CSeqHeader) event.getResponse().getHeader(
      CSeqHeader.NAME);
  if (cseq.getMethod().equals(Request.INVITE)) {
    // lets ack it ourselves to avoid UAS retransmissions due to
    // forwarding of this response and further UAC Ack
    // note that the app does not handles UAC ACKs
    try {
      final Request ack = event.getDialog().createAck(
          cseq.getSeqNumber());
      event.getDialog().sendAck(ack);
    } catch (Exception e) {
      tracer.severe("Unable to ack INVITE's 200 ok from UAS", e);
    }
  } else if (cseq.getMethod().equals(Request.BYE)
      || cseq.getMethod().equals(Request.CANCEL)) {
    // not forwarded to the other dialog
    return;
  }
  processResponse(event, aci);
}

代码示例来源:origin: org.mobicents.examples/converged-demo-callcontrol-sbb

public void sendCallerAck(ResponseEvent event) {
  try {
    Dialog dialog = sipUtils.getDialog(event);
    Request ackRequest = sipUtils.buildAck(dialog, null);
    dialog.sendAck(ackRequest);
  } catch (SipException e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl

if(dialog != null && DialogState.CONFIRMED.equals(dialog.getState())) {
  return RoutingState.SUBSEQUENT;
if(dialog != null && !DialogState.EARLY.equals(dialog.getState())) {
  return RoutingState.SUBSEQUENT;

代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl

} else if(joinReplacesDialog != null && ((TransactionApplicationData)joinReplacesDialog.getApplicationData()) != null && !Request.INVITE.equals(((TransactionApplicationData)joinReplacesDialog.getApplicationData()).getMethod())) {
} else if(joinReplacesDialog != null && DialogState.TERMINATED.equals(joinReplacesDialog.getState())) {

代码示例来源:origin: org.mobicents.servlet.sip.containers/sip-servlets-tomcat-jboss4

@Override
public void setSessionCreatingDialog(Dialog dialog) {
  super.setSessionCreatingDialog(dialog);
  if(dialog != null && dialog.getDialogId() != null) {
    sessionMetadataDirty();
    metaModifiedMap_.put(DIALOG_ID, dialog.getDialogId() );
  }
}

代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl

logger.debug("dialog to create the ack Request " + dialog);
Request ackRequest = dialog.createAck(cSeqHeader.getSeqNumber());

代码示例来源:origin: org.mobicents.examples/converged-demo-callcontrol-sbb

throws SipException {
Request request;
request = dialog.createRequest(requestType);
  SbbLocalObject mySelf = sbbContext.getSbbLocalObject();
  acIntf.attach(mySelf);
  dialog.sendRequest(ct);
} catch (Exception e) { // This catches no less than 10 distinct

代码示例来源:origin: org.mobicents.examples/converged-demo-callcontrol-sbb

public void handleOK(String callerCallId, ResponseEvent event) {
  // Check that the dialog of the event is the same as in the session
  // If not this is the result of a fork, we don't handle this
  try {
    Dialog eventDialog = sipUtils.getDialog(event);
    Dialog currentDialog = getDialog(eventDialog.getCallId()
        .getCallId());
    if (!eventDialog.equals(currentDialog)) {
      log.warn("Received 200 response from forked dialog");
      return; // We don't currently handle this. Should send ACK
      // and BYE
    }
  } catch (SipException e) {
    // TODO Handle this
  }
  sendCalleeAck(event);
  sendCallerAck(event);
  setState(new SessionEstablishedState(), callerCallId);
}

相关文章