javax.sip.message.Request.getMethod()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(228)

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

Request.getMethod介绍

暂无

代码示例

代码示例来源:origin: org.apache.camel/camel-sip

public void processRequest(RequestEvent requestEvent) {
  Request request = requestEvent.getRequest();
  ServerTransaction serverTransactionId = requestEvent.getServerTransaction();
  LOG.debug("Request: {}", request.getMethod()); 
  LOG.debug("Server Transaction Id: {}", serverTransactionId);
  if (request.getMethod().equals(Request.SUBSCRIBE)) {
    processSubscribe(requestEvent, serverTransactionId);
  } else if (request.getMethod().equals(Request.PUBLISH)) {
    processPublish(requestEvent, serverTransactionId);
  } else {
    LOG.debug("Received expected request with method: {}. No further processing done", request.getMethod());
  }
}

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

final String method = request.getMethod();
AtomicLong requestsStatsMethod = null;
if(processed) {

代码示例来源:origin: org.apache.camel/camel-sip

public void processRequest(RequestEvent requestReceivedEvent) {
  Request request = requestReceivedEvent.getRequest();
  ServerTransaction serverTransactionId = requestReceivedEvent
      .getServerTransaction();
  String viaBranch = ((ViaHeader)(request.getHeaders(ViaHeader.NAME).next())).getParameter("branch");
  LOG.debug("Request: {}", request.getMethod()); 
  LOG.debug("Server Transaction Id: {}", serverTransactionId);
  LOG.debug("Received From Branch: {}", viaBranch);
  if (request.getMethod().equals(Request.NOTIFY)) {
    processNotify(requestReceivedEvent, serverTransactionId);
  } 
}

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

public final String getMethod() {
  if(method == null) {
    method = message instanceof Request ? ((Request) message).getMethod()
      : ((CSeqHeader) message.getHeader(CSeqHeader.NAME)).getMethod();
  }
  return method;
}

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

/**
 * {@inheritDoc}
 */
public void pushPath(Address uri) {
  checkReadOnly();
  if(!Request.REGISTER.equalsIgnoreCase(((Request)message).getMethod())) {
    throw new IllegalStateException("Cannot push a Path on a non REGISTER request !");
  }
  if(uri.getURI() instanceof TelURL) {
    throw new IllegalArgumentException("Cannot push a TelUrl as a path !");
  }
  
  if (logger.isDebugEnabled())
    logger.debug("Pushing path into message of value [" + uri + "]");
  try {
    javax.sip.header.Header p = SipFactoryImpl.headerFactory
        .createHeader(PathHeader.NAME, uri.toString());
    this.message.addFirst(p);
  } catch (Exception e) {
    logger.error("Error while pushing path [" + uri + "]");
    throw new IllegalArgumentException("Error pushing path ", e);
  }
}

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

public void execute(RequestEvent event) {
    Request request = event.getRequest();
    final String calleeCallId = ((CallIdHeader) request
        .getHeader(CallIdHeader.NAME)).getCallId();
    String method = request.getMethod();
    if (Request.BYE.equals(method)) {
      handleBye(calleeCallId, request);
    }
  }
}

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

public void execute(RequestEvent event) {
  Request request = event.getRequest();
  final String calleeCallId = ((CallIdHeader) request
      .getHeader(CallIdHeader.NAME)).getCallId();
  String method = request.getMethod();
  if (Request.BYE.equals(method)) {
    handleBye(calleeCallId, request);
  }
}

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

public void execute(RequestEvent event) {
    Request request = event.getRequest();
    final String calleeCallId = ((CallIdHeader) request
        .getHeader(CallIdHeader.NAME)).getCallId();
    String method = request.getMethod();
    if (Request.BYE.equals(method)) {
      handleBye(calleeCallId, request);
    }
  }
}

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

Request request = (Request) this.message;
String method = request.getMethod();
if (method.equals(Request.REGISTER)) {
  return ModifiableRule.ContactNotSystem;

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

final long localCseq = cseq;		
final long remoteCSeq =  ((CSeqHeader) request.getHeader(CSeqHeader.NAME)).getSeqNumber();
final String method = request.getMethod();
final boolean isAck = Request.ACK.equalsIgnoreCase(method);
final boolean isPrackCancel= Request.PRACK.equalsIgnoreCase(method) || Request.CANCEL.equalsIgnoreCase(method);

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

public void execute(RequestEvent event) {
    Request request = event.getRequest();
    final String method = request.getMethod();
    if (method.equals(Request.BYE)) {
      final String callId = ((CallIdHeader) request
          .getHeader(CallIdHeader.NAME)).getCallId();
      Dialog dialog = getPeerDialog(callId);
      try {
        sipUtils.sendOk(request);
        sendRequest(dialog, Request.BYE);
      } catch (ParseException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
      } catch (SipException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
      }
      setState(new UATerminationState(), callId);
    }
  }
}

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

String A2 = request.getMethod().toUpperCase() + ":" + uri.toString();
byte mdbytes[] = messageDigest.digest(A1.getBytes());
String HA1 = toHexString(mdbytes);

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

private void onNonInviteEvent(javax.sip.RequestEvent event, 
    CallForwardingSbbActivityContextInterface localAci) {
  
  localAci.detach(this.getSbbLocalObject());
  // get proxy child SBB
  ChildRelation proxyRelation = getJainSipProxySbb();
  if (!proxyRelation.isEmpty()) {
    // we have a child so we are processing this call, 
    // attach the proxy so it can have a chance to cancel the invite
    localAci.attach((SbbLocalObject) proxyRelation.iterator().next());
    log.info("########## Processing request "+event.getRequest().getMethod()+" for user "+event.getRequest().getRequestURI());
  }
}
private LocationService locationService = new LocationService();

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

String A2 = request.getMethod().toUpperCase() + ":" + uri.toString();
String HA1 = hashedPassword;

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

private boolean controlCongestion(Request request, SipServletRequestImpl sipServletRequest, Dialog dialog, RouteHeader routeHeader, SipProvider sipProvider) {
  if(rejectSipMessages || memoryToHigh) {
    String method = request.getMethod();
    boolean goodMethod = method.equals(Request.ACK) || method.equals(Request.PRACK) || method.equals(Request.BYE) || method.equals(Request.CANCEL) || method.equals(Request.UPDATE) || method.equals(Request.INFO);
    if(logger.isDebugEnabled()) {

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

public SipServletRequest createCancel() {
  checkReadOnly();
  if (!((Request) message).getMethod().equals(Request.INVITE)) {
    throw new IllegalStateException(
        "Cannot create CANCEL for non invite " + message);
  }
  if (super.getTransaction() == null
      || super.getTransaction() instanceof ServerTransaction)
    throw new IllegalStateException("No client transaction found! " + super.getTransaction());
  if(RoutingState.FINAL_RESPONSE_SENT.equals(routingState) || lastFinalResponse != null) {
    if(lastFinalResponse != null) {
      throw new IllegalStateException("final response already sent : " + lastFinalResponse);
    } else {
      throw new IllegalStateException("final response already sent!");
    }
  }
  
  try {			
    Request cancelRequest = ((ClientTransaction) getTransaction())
        .createCancel();
    SipServletRequestImpl newRequest = (SipServletRequestImpl) sipFactoryImpl.getMobicentsSipServletMessageFactory().createSipServletRequest(
        cancelRequest, getSipSession(),
        null, getTransaction().getDialog(), false);
    newRequest.inviteTransactionToCancel = super.getTransaction();
    return newRequest;
  } catch (SipException ex) {
    throw new IllegalStateException("Could not create cancel", ex);
  }
}

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

ViaHeader viaHeader = (ViaHeader) request.getHeader(ViaHeader.NAME);
if(!request.getMethod().equals(Request.CANCEL) && viaHeader == null) {

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

private void forwardRequest(RequestEvent event, DialogActivity out)
    throws SipException {
  final Request incomingRequest = event.getRequest();
  if (tracer.isInfoEnabled()) {
    tracer.info("Forwarding request " + incomingRequest.getMethod()
        + " to dialog " + out);
  }
  // Copies the request, setting the appropriate headers for the dialog.
  Request outgoingRequest = out.createRequest(incomingRequest);
  outgoingRequest.setRequestURI(out.getRemoteParty().getURI());
  
  // Send the request on the dialog activity
  final ClientTransaction ct = out.sendRequest(outgoingRequest);
  // Record an association with the original server transaction,
  // so we can retrieve it when forwarding the response.
  out.associateServerTransaction(ct, event.getServerTransaction());
}

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

throw new IllegalStateException("the transaction state is such that it doesn't allow a PRACK to be sent now, or this response is provisional only, or a PRACK has already been generated");
if(!Request.INVITE.equals(getTransaction().getRequest().getMethod())) {
  throw new Rel100Exception(Rel100Exception.NOT_INVITE);

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

throw new SipException(" Error - AUTOMATIC_DIALOG_SUPPORT is on");
if (!SIPTransactionStack.isDialogCreated(transaction.getRequest().getMethod()))
  throw new SipException("Dialog cannot be created for this method "
      + transaction.getRequest().getMethod());

相关文章