Package javax.sip

Examples of javax.sip.ServerTransaction


        this.sipPresenceAgent = sipPresenceAgent;
    }

    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)) {
View Full Code Here


                return;
            }

            // Always create a ServerTransaction, best as early as possible in the code
            Response response = null;
            ServerTransaction st = requestEvent.getServerTransaction();
            if (st == null) {
                st = sipProvider.getNewServerTransaction(request);
            }

            // Check if it is an initial SUBSCRIBE or a refresh / unsubscribe
            boolean isInitial = requestEvent.getDialog() == null;
            if (isInitial) {
                String toTag = UUID.randomUUID().toString();
                response = sipPresenceAgent.getConfiguration().getMessageFactory().createResponse(202, request);
                ToHeader toHeader = (ToHeader) response.getHeader(ToHeader.NAME);
                toHeader.setTag(toTag); // Application is supposed to set.

                this.dialog = st.getDialog();
                // subscribe dialogs do not terminate on bye.
                this.dialog.terminateOnBye(false);
            } else {
                response = sipPresenceAgent.getConfiguration().getMessageFactory().createResponse(200, request);
            }

            // Both 2xx response to SUBSCRIBE and NOTIFY need a Contact
            response.addHeader(sipPresenceAgent.getConfiguration().getContactHeader());

            // Expires header is mandatory in 2xx responses to SUBSCRIBE
            response.addHeader(sipPresenceAgent.getConfiguration().getExpiresHeader());
            st.sendResponse(response);
           
            LOG.debug("SipPresenceAgentListener: Sent OK Message");
            LOG.debug("SipPresenceAgentListener response: {}", response);
            sendNotification(eventHeader, isInitial, request.getContent());
View Full Code Here

        }
    }
   
    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);
View Full Code Here

  public void processRequest(RequestEvent requestEvent) {
    //Invite received
    if(requestEvent.getRequest().getMethod().equals(Request.INVITE)){
      //System.out.println("INVITE bekommen");
      try
        ServerTransaction serverTransaction = requestEvent.getServerTransaction();
        if(serverTransaction==null){
          serverTransaction = sipProvider.getNewServerTransaction(requestEvent.getRequest());
        }
        Response responseRing = messageFactory.createResponse(Response.RINGING, requestEvent.getRequest());
        responseRing.addHeader(contactHeader);
        serverTransaction.sendResponse(responseRing);
        //System.out.println("Ringing sent");
        //System.out.println("Ringing sent");
        Response responseOk = messageFactory.createResponse(Response.OK, requestEvent.getRequest());
        responseOk.addHeader(contactHeader);
        serverTransaction.sendResponse(responseOk);
        //System.out.println("OK sent");
        //System.out.println("Ok sent");
      } catch (SipException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (InvalidArgumentException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (ParseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
    if(requestEvent.getRequest().getMethod().equals(Request.ACK))
    {
      //System.out.println("ACK bekommen");
      //System.out.println("ACK bekommen");
      //System.out.println(requestEvent.getDialog());
    }
    if(requestEvent.getRequest().getMethod().equals(Request.BYE))
    {
      //System.out.println("BYE bekommen");
      //System.out.println("Bye bekommen");
      //System.out.println(requestEvent.getDialog());
     
      Response responseOk;
      try {
        responseOk = messageFactory.createResponse(Response.OK, requestEvent.getRequest());
        ServerTransaction serverTransaction = requestEvent.getServerTransaction();
        serverTransaction.sendResponse(responseOk);
       
      } catch (ParseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (SipException e) {
View Full Code Here



        public void processRequest(RequestEvent requestEvent) {
            Request request = requestEvent.getRequest();
            ServerTransaction serverTransactionId = requestEvent
                    .getServerTransaction();

            System.out.println("\n\nRequest " + request.getMethod()
                    + " received at " + sipStack.getStackName()
                    + " with server transaction id " + serverTransactionId);
View Full Code Here

                Address address = addressFactory.createAddress("Shootme <sip:"
                        + myAddress + ":" + myPort + ">");
                ContactHeader contactHeader = headerFactory
                        .createContactHeader(address);
                response.addHeader(contactHeader);
                ServerTransaction st = requestEvent.getServerTransaction();

                if (st == null) {
                    st = sipProvider.getNewServerTransaction(request);
                    logger.info("Created a new server transaction for "
                            + request.getMethod() + " serverTransaction = "
                            + st);
                }
                ((ServerTransactionExt)st).setReleaseReferences(true);
                inviteTid = st;

                dialog = st.getDialog();

                st.sendResponse(response);

            } catch (Exception ex) {
                logger.error(ex);
                fail(unexpectedException);
            }
View Full Code Here

        }

        public void processTransactionTerminated(
                TransactionTerminatedEvent transactionTerminatedEvent) {
            if (transactionTerminatedEvent.isServerTransaction()) {
                ServerTransaction serverTx = transactionTerminatedEvent
                        .getServerTransaction();

                String method = serverTx.getRequest().getMethod();

                logger.info("Server Tx : " + method + " terminated ");
                if (method.equals("INVITE")) {
                    inviteTxTerm = true;
                } else if (method.equals("CANCEL")) {
View Full Code Here



        public void processRequest(RequestEvent requestEvent) {
            Request request = requestEvent.getRequest();
            ServerTransaction serverTransactionId = requestEvent
                    .getServerTransaction();

            System.out.println("\n\nRequest " + request.getMethod()
                    + " received at " + sipStack.getStackName()
                    + " with server transaction id " + serverTransactionId);
View Full Code Here

        }

        public void processRequest(RequestEvent requestReceivedEvent) {
            Request request = requestReceivedEvent.getRequest();
            ServerTransaction serverTransactionId = requestReceivedEvent
                    .getServerTransaction();

            logger.info("\n\nRequest " + request.getMethod() + " received at "
                    + sipStack.getStackName() + " with server transaction id "
                    + serverTransactionId);
View Full Code Here

    }


    public void processRequest(RequestEvent requestReceivedEvent) {
        Request request = requestReceivedEvent.getRequest();
        ServerTransaction serverTransactionId = requestReceivedEvent
                .getServerTransaction();

        logger.info("\n\nRequest " + request.getMethod()
                + " received at " + sipStack.getStackName()
                + " with server transaction id " + serverTransactionId);
View Full Code Here

TOP

Related Classes of javax.sip.ServerTransaction

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.