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

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

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

Dialog介绍

暂无

代码示例

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

  1. sessionCreatingDialog.delete();

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. public void addSubscription(MobicentsSipServletMessage sipServletMessageImpl) throws SipException {
  5. EventHeader eventHeader = null;
  6. if(sipServletMessageImpl instanceof SipServletResponseImpl) {
  7. eventHeader = (EventHeader) ((SipServletRequestImpl)((SipServletResponseImpl)sipServletMessageImpl).getRequest()).getMessage().getHeader(EventHeader.NAME);
  8. } else {
  9. eventHeader = (EventHeader) sipServletMessageImpl.getMessage().getHeader(EventHeader.NAME);
  10. }
  11. if(eventHeader != null) {
  12. if(logger.isDebugEnabled()) {
  13. logger.debug("adding subscription " + eventHeader + " to sip session " + getId());
  14. }
  15. if(subscriptions == null) {
  16. this.subscriptions = new CopyOnWriteArraySet<String>();
  17. }
  18. subscriptions.add(eventHeader.toString());
  19. if(logger.isDebugEnabled()) {
  20. logger.debug("Request from Original Transaction is " + originalMethod);
  21. logger.debug("Dialog is " + sessionCreatingDialog);
  22. }
  23. if(subscriptions.size() < 2 && Request.INVITE.equals(originalMethod)) {
  24. sessionCreatingDialog.terminateOnBye(false);
  25. }
  26. }
  27. }

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

  1. .next();
  2. MobicentsSipSessionKey sessionKey = mobicentsSipSession.getKey();
  3. if(sessionKey.getCallId().trim().equals(dialog.getCallId().getCallId())) {
  4. if(logger.isDebugEnabled()) {
  5. logger.debug("found session with the same Call Id " + sessionKey + ", to Tag " + sessionKey.getToTag());
  6. logger.debug("dialog localParty = " + dialog.getLocalParty().getURI() + ", localTag " + dialog.getLocalTag());
  7. logger.debug("dialog remoteParty = " + dialog.getRemoteParty().getURI() + ", remoteTag " + dialog.getRemoteTag());
  8. if(sessionKey.getFromTag().equals(dialog.getLocalTag()) && sessionKey.getToTag().equals(dialog.getRemoteTag())) {
  9. if(mobicentsSipSession.getProxy() == null) {
  10. return mobicentsSipSession;
  11. } else if (sessionKey.getFromTag().equals(dialog.getRemoteTag()) && sessionKey.getToTag().equals(dialog.getLocalTag())){
  12. if(mobicentsSipSession.getProxy() == null) {
  13. return mobicentsSipSession;

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

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

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

  1. public void run() {
  2. try {
  3. boolean appDataFound = false;
  4. TransactionApplicationData txAppData = null;
  5. if(dialogAppData != null) {
  6. if(dialogAppData.getSipServletMessage() == null) {
  7. Transaction transaction = dialogAppData.getTransaction();
  8. if(transaction != null && transaction.getApplicationData() != null) {
  9. txAppData = (TransactionApplicationData) transaction.getApplicationData();
  10. txAppData.cleanUp();
  11. }
  12. } else {
  13. MobicentsSipSessionKey sipSessionKey = dialogAppData.getSipSessionKey();
  14. tryToInvalidateSession(sipSessionKey, false);
  15. }
  16. dialogAppData.cleanUp();
  17. // since the stack doesn't nullify the app data, we need to do it to let go of the refs
  18. dialog.setApplicationData(null);
  19. }
  20. if(!appDataFound && logger.isDebugEnabled()) {
  21. logger.debug("no application data for this dialog " + dialog.getDialogId());
  22. }
  23. } catch (Exception e) {
  24. logger.error("Problem handling dialog termination", e);
  25. }
  26. }
  27. });

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

  1. /**
  2. * Voice Mail will hang up on caller sending a BYE Request.
  3. *
  4. */
  5. private void sendByeRequest() {
  6. log.info("########## VOICE MAIL SBB: sendByRequest ##########");
  7. try {
  8. SipProvider sipProvider = getSipFactoryProvider();
  9. Dialog dialog = this.getDialog();
  10. if(dialog == null)
  11. {
  12. return;
  13. }
  14. Request request = dialog.createRequest(Request.BYE);
  15. ClientTransaction ct = sipProvider.getNewClientTransaction(request);
  16. dialog.sendRequest(ct);
  17. releaseState();
  18. } catch (TransactionUnavailableException e) {
  19. log.severe(e.getMessage(), e);
  20. } catch (SipException e) {
  21. log.severe(e.getMessage(), e);
  22. }
  23. }

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

  1. logger.info("Sending the ACK through the dialog " + clonedRequest);
  2. dialog.sendAck(clonedRequest);
  3. } else {
  4. Request dialogRequest=
  5. dialog.createRequest(clonedRequest.getMethod());
  6. Object content=clonedRequest.getContent();
  7. if (content!=null) {
  8. dialog.setApplicationData(appData);
  9. if(logger.isInfoEnabled()) {
  10. logger.info("Sending the request through the dialog " + clonedRequest);
  11. dialog.sendRequest(clientTransaction);

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

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

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

  1. sessionCreatingDialog);
  2. if(sessionCreatingDialog != null) {
  3. logger.debug("dialog state " + sessionCreatingDialog.getState() + " for that dialog "+ sessionCreatingDialog);
  4. if(sessionCreatingDialog != null && DialogState.TERMINATED.equals(sessionCreatingDialog.getState()) && !method.equalsIgnoreCase(Request.BYE)) {
  5. (!DialogState.TERMINATED.equals(sessionCreatingDialog.getState()) ||
  6. (DialogState.TERMINATED.equals(sessionCreatingDialog.getState()) && method.equalsIgnoreCase(Request.BYE)))) {
  7. final Request methodRequest = this.sessionCreatingDialog.createRequest(method);
  8. if(sessionCreatingDialog != null && sessionCreatingDialog.getRemoteTarget() != null) {
  9. SipUri sipUri = (SipUri) sessionCreatingDialog.getRemoteTarget().getURI().clone();
  10. sipUri.clearUriParms();
  11. if(logger.isDebugEnabled()) {
  12. if(sessionCreatingDialog != null && sessionCreatingDialog.getRemoteTarget() != null) {
  13. SipUri sipUri = (SipUri) sessionCreatingDialog.getRemoteTarget().getURI().clone();
  14. sipUri.clearUriParms();
  15. if(logger.isDebugEnabled()) {
  16. String errorMessage = "Couldn't create the subsequent request " + method + " for this session " + key + ", isValid " + isValid() + ", session state " + state + " , sessionCreatingDialog = " + sessionCreatingDialog;
  17. if(sessionCreatingDialog != null) {
  18. errorMessage += " , dialog state " + sessionCreatingDialog.getState();

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

  1. /**
  2. *
  3. * @param callId
  4. * @return
  5. */
  6. private Session getSession(Dialog dialog) {
  7. final String callId = dialog.getCallId().getCallId();
  8. SessionAssociation sa = (SessionAssociation) cache.get(callId);
  9. Session session = sa.getSession(callId);
  10. return session;
  11. }

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

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

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

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

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

  1. public void on2xxResponse(ResponseEvent event, ActivityContextInterface aci) {
  2. final CSeqHeader cseq = (CSeqHeader) event.getResponse().getHeader(
  3. CSeqHeader.NAME);
  4. if (cseq.getMethod().equals(Request.INVITE)) {
  5. // lets ack it ourselves to avoid UAS retransmissions due to
  6. // forwarding of this response and further UAC Ack
  7. // note that the app does not handles UAC ACKs
  8. try {
  9. final Request ack = event.getDialog().createAck(
  10. cseq.getSeqNumber());
  11. event.getDialog().sendAck(ack);
  12. } catch (Exception e) {
  13. tracer.severe("Unable to ack INVITE's 200 ok from UAS", e);
  14. }
  15. } else if (cseq.getMethod().equals(Request.BYE)
  16. || cseq.getMethod().equals(Request.CANCEL)) {
  17. // not forwarded to the other dialog
  18. return;
  19. }
  20. processResponse(event, aci);
  21. }

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

  1. public void sendCallerAck(ResponseEvent event) {
  2. try {
  3. Dialog dialog = sipUtils.getDialog(event);
  4. Request ackRequest = sipUtils.buildAck(dialog, null);
  5. dialog.sendAck(ackRequest);
  6. } catch (SipException e) {
  7. e.printStackTrace();
  8. }
  9. }

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

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

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

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

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

  1. @Override
  2. public void setSessionCreatingDialog(Dialog dialog) {
  3. super.setSessionCreatingDialog(dialog);
  4. if(dialog != null && dialog.getDialogId() != null) {
  5. sessionMetadataDirty();
  6. metaModifiedMap_.put(DIALOG_ID, dialog.getDialogId() );
  7. }
  8. }

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

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

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

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

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

  1. public void handleOK(String callerCallId, ResponseEvent event) {
  2. // Check that the dialog of the event is the same as in the session
  3. // If not this is the result of a fork, we don't handle this
  4. try {
  5. Dialog eventDialog = sipUtils.getDialog(event);
  6. Dialog currentDialog = getDialog(eventDialog.getCallId()
  7. .getCallId());
  8. if (!eventDialog.equals(currentDialog)) {
  9. log.warn("Received 200 response from forked dialog");
  10. return; // We don't currently handle this. Should send ACK
  11. // and BYE
  12. }
  13. } catch (SipException e) {
  14. // TODO Handle this
  15. }
  16. sendCalleeAck(event);
  17. sendCallerAck(event);
  18. setState(new SessionEstablishedState(), callerCallId);
  19. }

相关文章