Examples of SIPRequest


Examples of gov.nist.javax.sip.message.SIPRequest

            if (response != null) {
                if (response.getStatusCode() != 100)
                    throw new SipException(
                            "Cannot set dialog after response has been sent");
            }
            SIPRequest sipRequest = (SIPRequest) transaction.getRequest();
            String dialogId = sipRequest.getDialogId(true);
            dialog = sipStack.getDialog(dialogId);
            if (dialog == null) {
                dialog = sipStack.createDialog((SIPTransaction) transaction);
                // create and register the dialog and add the inital route set.
                dialog.addTransaction(sipTransaction);
                dialog.addRoute(sipRequest);
                sipTransaction.setDialog(dialog, null);

            } else {
                sipTransaction.setDialog(dialog, sipRequest.getDialogId(true));
            }
            if (sipRequest.getMethod().equals(Request.INVITE) && this.isDialogErrorsAutomaticallyHandled()) {
                sipStack.putInMergeTable(st, sipRequest);
            }
        } else {

            SIPClientTransaction sipClientTx = (SIPClientTransaction) transaction;

            SIPResponse response = sipClientTx.getLastResponse();

            if (response == null) {
                // A response has not yet been received, then set this up as the
                // default dialog.
                SIPRequest request = (SIPRequest) sipClientTx.getRequest();

                String dialogId = request.getDialogId(false);
                dialog = sipStack.getDialog(dialogId);
                if (dialog != null) {
                    throw new SipException("Dialog already exists!");
                } else {
                    dialog = sipStack.createDialog(sipTransaction);
View Full Code Here

Examples of gov.nist.javax.sip.message.SIPRequest

     * @param transaction is the first transaction.
     */
    public SIPDialog(SIPTransaction transaction) {
        this(transaction.getSipProvider());
      
        SIPRequest sipRequest = (SIPRequest) transaction.getRequest();
        this.callIdHeader = sipRequest.getCallId();
        this.earlyDialogId = sipRequest.getDialogId(false);
        if (transaction == null)
            throw new NullPointerException("Null tx");
        this.sipStack = transaction.sipStack;

        // this.defaultRouter = new DefaultRouter((SipStack) sipStack,
View Full Code Here

Examples of gov.nist.javax.sip.message.SIPRequest

     * @throws SipException if implementation cannot send the ACK Request for any other reason
     *
     */
    private void sendAck(Request request, boolean throwIOExceptionAsSipException)
            throws SipException {
        SIPRequest ackRequest = (SIPRequest) request;
        if (sipStack.isLoggingEnabled())
            sipStack.getStackLogger().logDebug("sendAck" + this);

        if (!ackRequest.getMethod().equals(Request.ACK))
            throw new SipException("Bad request method -- should be ACK");
        if (this.getState() == null || this.getState().getValue() == EARLY_STATE) {
            if (sipStack.isLoggingEnabled()) {
                sipStack.getStackLogger().logError(
                        "Bad Dialog State for " + this + " dialogID = " + this.getDialogId());
            }
            throw new SipException("Bad dialog state " + this.getState());
        }

        if (!this.getCallId().getCallId().equals(((SIPRequest) request).getCallId().getCallId())) {
            if (sipStack.isLoggingEnabled()) {
                sipStack.getStackLogger().logError("CallID " + this.getCallId());
                sipStack.getStackLogger().logError(
                        "RequestCallID = " + ackRequest.getCallId().getCallId());
                sipStack.getStackLogger().logError("dialog =  " + this);
            }
            throw new SipException("Bad call ID in request");
        }
        try {
            if (sipStack.isLoggingEnabled()) {
                sipStack.getStackLogger().logDebug(
                        "setting from tag For outgoing ACK= " + this.getLocalTag());
                sipStack.getStackLogger().logDebug(
                        "setting To tag for outgoing ACK = " + this.getRemoteTag());
                sipStack.getStackLogger().logDebug("ack = " + ackRequest);
            }
            if (this.getLocalTag() != null)
                ackRequest.getFrom().setTag(this.getLocalTag());
            if (this.getRemoteTag() != null)
                ackRequest.getTo().setTag(this.getRemoteTag());
        } catch (ParseException ex) {
            throw new SipException(ex.getMessage());
        }

        Hop hop = sipStack.getNextHop(ackRequest);
View Full Code Here

Examples of net.sourceforge.peers.sip.transport.SipRequest

     * @throws SipUriSyntaxException
     */
    public SipRequest getGenericRequest(String requestUri, String method,
            String profileUri) throws SipUriSyntaxException {
        //8.1.1
        SipRequest request = new SipRequest(method, new SipURI(requestUri));
        SipHeaders headers = request.getSipHeaders();
        //String hostAddress = utils.getMyAddress().getHostAddress();
       
        //Via
       
        //TODO no Via should be added directly by UAC, Via is normally added by Transaction layer
View Full Code Here

Examples of org.cipango.client.SipRequest

    return _bob;
  }
 
  public SipRequest createRequest(String method, String to) throws Exception
  {
    SipRequest request = _alice.createRequest(method, to);
   
    Map<String,List<String>> methodList = createMethodList();   
    request.getSession().setHeaders(methodList)
    request.getSession().addHeaders(request);
   
    return request;
  }
View Full Code Here

Examples of org.cipango.client.SipRequest

    return l;
  }
 
  public void testMessage() throws Exception
  {
    SipRequest request = createRequest("MESSAGE", "sip:bob@cipango.org");
    request.send();
   
    SipResponse response = request.waitResponse();
    assertEquals(SipServletResponse.SC_OK, response.getStatus());
  }
View Full Code Here

Examples of org.cipango.client.SipRequest

    assertEquals(SipServletResponse.SC_OK, response.getStatus());
  }
 
  public void testCall() throws Exception
  {
    SipRequest request = createRequest("INVITE", "sip:uas@cipango.org");
    request.send();
   
    SipResponse response = request.waitResponse();
    assertEquals(SipServletResponse.SC_RINGING, response.getStatus());
    response = request.waitResponse();
    assertEquals(SipServletResponse.SC_OK, response.getStatus());
    response.createAck().send();
    Thread.sleep(100);
   
    request = request.getSession().waitRequest();
    request.createResponse(SipServletResponse.SC_OK).send();
  }
View Full Code Here

Examples of org.cipango.client.SipRequest

    request.createResponse(SipServletResponse.SC_OK).send();
  }
 
  public void testProxy() throws Throwable
  {
    SipRequest request = createRequest("INVITE", "sip:bob@cipango.org");
    SipSession sessionBob = getBob().createUasSession();
    sessionBob.setHeaders(createMethodList());
    request.setRequestURI(getBob().getContact().getURI());
   
    UaRunnable bob = new UasScript.RingingOkBye(sessionBob);
    new Thread(bob).start();
    UacScript.ringingOkBye(request);
    bob.assertDone();
View Full Code Here

Examples of org.cipango.server.SipRequest

    public void startRequest(Buffer method, Buffer uri, Buffer version) throws IOException
    {
      try
      {
        URI ruri = URIFactory.parseURI(uri.toString());
        SipRequest request = new SipRequest();
        request.setMethod(method.toString());
        request.setRequestURI(ruri);
        _message = request;
      }
      catch (Exception e)
      {
        throw new IOException("Parsing error: " + e.getMessage());
View Full Code Here

Examples of org.cipango.server.SipRequest

        assertTrue("Failed on SipTorture test " + testFiles[i] + ":\n" + message,
            new ConnectorManager().preValidateMessage(message));
        if (message instanceof SipRequest)
        {
          SipRequest request = (SipRequest) message;
          if (request.getMaxForwards() < 0 && request.getMaxForwards() != -1)
            fail("Failed on SipTorture test " + testFiles[i] + ":\n" + message);
        }
      }
      catch (Exception e)
      {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.