Package javax.sip.message

Examples of javax.sip.message.Response

  • 2xx: Success -- the action was successfully received, understood, and accepted.
  • 3xx: Redirection -- further action needs to be taken in order to complete the request; 3xx responses give information about the user's new location, or about alternative services that might be able to satisfy the call.
  • 4xx: Client Error -- the request contains bad syntax or cannot be fulfilled at this server; 4xx responses are definite failure responses from a particular server. The client SHOULD NOT retry the same request without modification. However, the same request to a different server might be successful.
  • 5xx: Server Error -- the server failed to fulfill an apparently valid request; 5xx responses are failure responses given when a server itself has erred.
  • 6xx: Global Failure -- the request cannot be fulfilled at any server; 6xx responses indicate that a server has definitive information about a particular user, not just the particular instance indicated in the Request-URI. SIP status codes are extensible. The response codes are consistent with, and extend, HTTP/1.1 response codes. Not all HTTP/1.1 response codes are appropriate, and only those that are appropriate are given here. Other HTTP/1.1 response codes SHOULD NOT be used. Also, SIP defines a new class, 6xx.

    SIP applications are not required to understand the meaning of all registered response codes, though such understanding is obviously desirable. However, applications must understand the class of any status code, as indicated by the first digit and outlined above. Applications treat any unrecognized status code as being equivalent to the x00 status code of that class, with the exception that an unrecognized status code must not be cached. For example, if a client receives an unrecognized status code of 431, it can safely assume that there was something wrong with its request and treat the Response as if it had received a BAD_REQUEST(400) status code. In such cases, user agents should present to the user the message body returned with the Response, since that message body is likely to include human-readable information which will explain the unusual status.

    This specification supports the response codes defined in RFC3261 and also the response code extensions for the event notification framework and PUBLISH, documented in RFC3265 and RFC3909, these are highlighted in italic. Class status codes (x00, i.e. 100) are are highlighted in bold.

    Class Code
    PROVISIONAL (1xx)
  • TRYING - 100
  • RINGING - 180
  • CALL_IS_BEING_FORWARDED - 181
  • QUEUED - 182
  • SESSION_PROGRESS - 183
  • SUCCESS (2xx)
  • OK - 200
  • ACCEPTED - 202 (Extension RFC3265)
  • REDIRECTION (3xx)
  • MULTIPLE_CHOICES - 300
  • MOVED_PERMANENTLY - 301
  • MOVED_TEMPORARILY - 302
  • USE_PROXY - 305
  • ALTERNATIVE_SERVICE - 380
  • CLIENT_ERROR (4xx)
  • BAD_REQUEST - 400
  • UNAUTHORIZED - 401
  • PAYMENT_REQUIRED - 402
  • FORBIDDEN - 403
  • NOT_FOUND - 404
  • METHOD_NOT_ALLOWED - 405
  • NOT_ACCEPTABLE - 406
  • PROXY_AUTHENTICATION_REQUIRED - 407
  • REQUEST_TIMEOUT - 408
  • GONE - 410
  • CONDITIONAL_REQUEST_FAILED - 412 (Extension RFC3909)
  • REQUEST_ENTITY_TOO_LARGE - 413
  • REQUEST_URI_TOO_LONG - 414
  • UNSUPPORTED_MEDIA_TYPE - 415
  • UNSUPPORTED_URI_SCHEME - 416
  • BAD_EXTENSION - 420
  • EXTENSION_REQUIRED - 421
  • INTERVAL_TOO_BRIEF - 423
  • TEMPORARILY_UNAVAILABLE - 480
  • CALL_OR_TRANSACTION_DOES_NOT_EXIST - 481
  • LOOP_DETECTED - 482
  • TOO_MANY_HOPS - 483
  • ADDRESS_INCOMPLETE - 484
  • AMBIGUOUS - 485
  • BUSY_HERE - 486
  • REQUEST_TERMINATED - 487
  • NOT_ACCEPTABLE_HERE - 488
  • BAD EVENT - 489 (Extension RFC3265)
  • REQUEST_PENDING - 491
  • UNDECIPHERABLE - 493
  • SERVER_ERROR (5xx)
  • SERVER_INTERNAL_ERROR - 500
  • NOT_IMPLEMENTED - 501
  • BAD_GATEWAY - 502
  • SERVICE_UNAVAILABLE - 503
  • SERVER_TIMEOUT - 504
  • VERSION_NOT_SUPPORTED - 505
  • MESSAGE_TOO_LARGE - 513
  • GLOBAL_ERROR (6xx)
  • BUSY_EVERYWHERE - 600
  • DECLINE - 603
  • DOES_NOT_EXIST_ANYWHERE - 604
  • SESSION_NOT_ACCEPTABLE - 606
  • @author BEA Systems, NIST @version 1.2


  •         public void processResponse(ResponseEvent responseReceivedEvent) {
              logger.info("Got a response");

                Response response = (Response) responseReceivedEvent.getResponse();
                Transaction tid = responseReceivedEvent.getClientTransaction();

                logger.info("Response received with client transaction id " + tid
                        + ":\n" + response.getStatusCode());
                if (tid != null) {
            logger.info("Dialog = " + responseReceivedEvent.getDialog());
            logger.info("Dialog State is "
                + responseReceivedEvent.getDialog().getState());
          }
                SipProvider provider = (SipProvider) responseReceivedEvent.getSource();

                try {
                    if (response.getStatusCode() == Response.OK
                            && ((CSeqHeader) response.getHeader(CSeqHeader.NAME))
                                    .getMethod().equals(Request.INVITE)) {

                        Dialog dialog = responseReceivedEvent.getDialog();
                        CSeqHeader cseq = (CSeqHeader) response.getHeader(CSeqHeader.NAME);
                        Request ackRequest = dialog.createAck(cseq.getSeqNumber());
                        logger.info("Ack request to send = " + ackRequest);
                        logger.info("Sending ACK");
                        dialog.sendAck(ackRequest);
                    }
    View Full Code Here


                    ServerTransaction serverTransaction) {
                SipProvider sipProvider = (SipProvider) requestEvent.getSource();
                Request request = requestEvent.getRequest();
                logger.info("Got an INVITE  " + request);
                try {
                    Response response = protocolObjects.messageFactory.createResponse(180, request);
                    ToHeader toHeader = (ToHeader) response.getHeader(ToHeader.NAME);
                    toHeader.setTag("4321");
                    Address address = protocolObjects.addressFactory.createAddress("Shootme <sip:"
                            + myAddress + ":" + myPort + ">");
                    ContactHeader contactHeader = protocolObjects.headerFactory
                            .createContactHeader(address);
                    response.addHeader(contactHeader);
                    ServerTransaction st = requestEvent.getServerTransaction();

                    if (st == null) {
                        st = sipProvider.getNewServerTransaction(request);
                        logger.info("Server transaction created!" + request);

                        logger.info("Dialog = " + st.getDialog());
                    }

                    byte[] content = request.getRawContent();
                    if (content != null) {
                        logger.info(" content = " + new String(content));
                        ContentTypeHeader contentTypeHeader = protocolObjects.headerFactory
                                .createContentTypeHeader("application", "sdp");
                        logger.info("response = " + response);
                        response.setContent(content, contentTypeHeader);
                    }
                    dialog = st.getDialog();
                    if (dialog != null) {
                        logger.info("Dialog " + dialog);
                        logger.info("Dialog state " + dialog.getState());
                    }
                    st.sendResponse(response);
                    response = protocolObjects.messageFactory.createResponse(200, request);
                    toHeader = (ToHeader) response.getHeader(ToHeader.NAME);
                    toHeader.setTag("4321");
                    // Application is supposed to set.
                    response.addHeader(contactHeader);
                    st.sendResponse(response);
                    reSendSt = st;
                    reSendResponse = response;
                    logger.info("TxState after sendResponse = " + st.getState());
                    this.inviteTid = st;
    View Full Code Here

            }


            public void processResponse(ResponseEvent responseReceivedEvent) {
                logger.info("Got a response");
                Response response = (Response) responseReceivedEvent.getResponse();
                Transaction tid = responseReceivedEvent.getClientTransaction();

                logger.info("Response received with client transaction id "
                        + tid + ":\n" + response);
                try {
                    if (response.getStatusCode() == Response.OK
                            && ((CSeqHeader) response.getHeader(CSeqHeader.NAME))
                                    .getMethod().equals(Request.INVITE)) {
                        Dialog dialog = tid.getDialog();
                        CSeqHeader cseq = (CSeqHeader) response.getHeader(CSeqHeader.NAME);
                        Request ackRequest = dialog.createAck(cseq.getSeqNumber());
                        dialog.sendAck(ackRequest);
                    }
                    if ( tid != null ) {
                        Dialog dialog = tid.getDialog();
    View Full Code Here

                        ReInviteBusyTest.assertSame("Dialog mismatch ", st.getDialog(), this.dialog);
                        finalResponse = Response.BUSY_HERE;
                    }
                    logger.info("shootme: got an Invite sending " + finalResponse);

                    Response response = protocolObjects.messageFactory.createResponse(finalResponse,
                            request);
                    ToHeader toHeader = (ToHeader) response.getHeader(ToHeader.NAME);
                    toHeader.setTag("4321");
                    Address address = protocolObjects.addressFactory.createAddress("Shootme <sip:"
                            + myAddress + ":" + myPort + ">");
                    ContactHeader contactHeader = protocolObjects.headerFactory
                            .createContactHeader(address);
                    response.addHeader(contactHeader);

                    // Thread.sleep(5000);
                    logger.info("got a server tranasaction " + st);
                    byte[] content = request.getRawContent();
                    if (content != null) {
                        ContentTypeHeader contentTypeHeader = protocolObjects.headerFactory
                                .createContentTypeHeader("application", "sdp");
                        response.setContent(content, contentTypeHeader);
                    }
                    dialog = st.getDialog();
                    if (dialog != null) {
                        logger.info("Dialog " + dialog);
                        logger.info("Dialog state " + dialog.getState());
                    }
                    st.sendResponse(response);
                    response = protocolObjects.messageFactory.createResponse(finalResponse, request);
                    toHeader = (ToHeader) response.getHeader(ToHeader.NAME);
                    toHeader.setTag("4321");
                    // Application is supposed to set.
                    response.addHeader(contactHeader);
                    st.sendResponse(response);
                    logger.info("TxState after sendResponse = " + st.getState());
                    this.inviteTid = st;
                } catch (Exception ex) {
                    String s = "unexpected exception";
    View Full Code Here

                SipProvider sipProvider = (SipProvider) requestEvent.getSource();
                Request request = requestEvent.getRequest();
                try {
                    logger.info("shootme:  got a bye sending OK.");
                    Response response = protocolObjects.messageFactory.createResponse(200, request);
                    if (serverTransactionId != null) {
                        serverTransactionId.sendResponse(response);
                        logger.info("Dialog State is " + serverTransactionId.getDialog().getState());
                    } else {
                        logger.info("null server tx.");
    View Full Code Here

                }
            }

            public void processResponse(ResponseEvent responseReceivedEvent) {
                logger.info("Got a response");
                Response response = (Response) responseReceivedEvent.getResponse();
                Transaction tid = responseReceivedEvent.getClientTransaction();

                logger.info("Response received with client transaction id " + tid + ":\n" + response);
                try {
                    if (response.getStatusCode() == Response.OK
                            && ((CSeqHeader) response.getHeader(CSeqHeader.NAME)).getMethod().equals(
                                    Request.INVITE)) {
                        this.okRecieved = true;
                        ReInviteBusyTest.assertNotNull("INVITE 200 response should match a transaction",
                                tid);
                        Dialog dialog = tid.getDialog();
                        CSeqHeader cseq = (CSeqHeader) response.getHeader(CSeqHeader.NAME);
                        Request request = dialog.createAck(cseq.getSeqNumber());
                        dialog.sendAck(request);
                    }
                    if (tid != null) {
                        Dialog dialog = tid.getDialog();
                        logger.info("Dalog State = " + dialog.getState());
                        String toTag = ((ResponseExt)response).getToHeader().getTag();
                        // Note that TRYING is an optional response.
                        if(DialogState.CONFIRMED.equals(dialog.getState()) && toTag == null && response.getStatusCode() == Response.TRYING) {
                            this.isToTagInTryingReInvitePresent  = false;
                            logger.info("to tag for trying in re INVITE is present " + toTag);
                        }
                    }
                } catch (Exception ex) {
    View Full Code Here

                ServerTransaction firstServerTransaction = (ServerTransaction) firstTransaction;

                try
                {
                    // send 487 Request Terminated reply to canceled request
                    Response response = messageFactory.createResponse(
                            Response.REQUEST_TERMINATED, firstServerTransaction
                                    .getRequest());
                    firstServerTransaction.sendResponse(response);
                }
                catch (InvalidArgumentException e)
                {
                    // inapplicable - it only happens if the Response was created
                    // by Dialog.createReliableProvisionalResponse(int) and the
                    // application calls ServerTransaction.sendResponse() to send it
                    JipletLogger
                            .error("Cancel response sending failed  - invalid send method used.");
                }

                // find the response context
                TransactionsMapping transactionsMapping = jdialog
                        .getTransactionsMapping();
                Vector clientTransactions = transactionsMapping
                        .getClientTransactions(firstServerTransaction);
                if (clientTransactions == null || clientTransactions.isEmpty())
                {
                    // RFC states to send the CANCEL statelessly in this case
                    forwardRequestStatelessly(sipProvider, clonedRequest,
                            originalRequest, serverTransaction);
                    return;
                }

                try
                {
                    // send OK to CANCEL
                    Response response = messageFactory.createResponse(Response.OK,
                            originalRequest);
                    serverTransaction.sendResponse(response);
                }
                catch (InvalidArgumentException e)
                {
    View Full Code Here

                    {
                        // nothing to do
                        return;
                    }

                    Response response = jiplet.getMessageFactory().createResponse(
                            statusCode, firstServerTransaction.getRequest());
                    if (reason != null)
                    {
                        response.setReasonPhrase(reason);
                    }
                    firstServerTransaction.sendResponse(response);
                }
            }
            catch (Exception e)
    View Full Code Here

                /*
                 * If the target set remains empty after applying all of the above,
                 * the proxy MUST return an error response, which SHOULD be the 480
                 * (Temporarily Unavailable) response.
                 */
                Response response = jiplet.getMessageFactory().createResponse(
                        Response.TEMPORARILY_UNAVAILABLE, msg);
                if (serverTransaction != null)
                    serverTransaction.sendResponse(response);
                else
                    provider.sendResponse(response);
    View Full Code Here

                // necessarily the whole thing.
                transactionsMapping.removeMapping(clientTransaction);
                if (!transactionsMapping.hasMapping(st))
                {
                    // No more mappings left in the transaction table.
                    Response response = jiplet.getMessageFactory().createResponse(
                            Response.REQUEST_TIMEOUT, request);
                   
                    try
                    {
                        st.sendResponse(response);
                    }
                    catch (InvalidArgumentException e)
                    {
                        // inapplicable - it only happens if the Response was created
                        // by Dialog.createReliableProvisionalResponse(int) and the
                        // application calls ServerTransaction.sendResponse() to send it
                        JipletLogger
                                .error("Timeout response sending failed  - invalid send method used. Failed response = \n"
                                       + response.toString());
                    }

                }
            }
        }
    View Full Code Here

    TOP

    Related Classes of javax.sip.message.Response

    Copyright © 2018 www.massapicom. 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.