Package gov.nist.javax.sip

Examples of gov.nist.javax.sip.ResponseEventExt


                            timer.schedule( new SendBye(ackedDialog), 4000  );
                        }


                    } else {
                        ResponseEventExt responseEventExt  = (ResponseEventExt) responseReceivedEvent;
                        TestCase.assertTrue("forked event must set flag",responseEventExt.isForkedResponse());
                        this.canceledDialog.add(dialog);
                        SipProvider sipProvider = (SipProvider) responseReceivedEvent
                                .getSource();
                       
                        TestCase.assertSame("original ctx must match " ,
                                responseEventExt.getOriginalTransaction(),this.originalTransaction);

                        Request byeRequest = dialog.createRequest(Request.BYE);
                        ClientTransaction ct = sipProvider
                                .getNewClientTransaction(byeRequest);
                        dialog.sendRequest(ct);
View Full Code Here


        }
    }

    public synchronized void processResponse(ResponseEvent responseReceived) {
        logger.info("Got a response");
        ResponseEventExt responseReceivedEvent = (ResponseEventExt) responseReceived;
        Response response = (Response) responseReceivedEvent.getResponse();
        ClientTransaction tid = responseReceivedEvent.getClientTransaction();
        CSeqHeader cseq = (CSeqHeader) response.getHeader(CSeqHeader.NAME);

        logger.info("Response received : Status Code = "
                + response.getStatusCode() + " " + cseq);
        logger.info("Response = " + response + " class=" + response.getClass() );
       

        Dialog dialog = responseReceivedEvent.getDialog();    
        if(createDialogAfterRequest) {
            TestCase.assertNull( dialog );
            return;
        } else {
            TestCase.assertNotNull( dialog );
        }
       
        System.out.println("original Tx " + responseReceivedEvent.getOriginalTransaction());
        if ( cseq.getMethod().equals(Request.INVITE)) {
          TestCase.assertSame("Must preserve original dialog",
            this.originalDialog,responseReceivedEvent.getOriginalTransaction().getDefaultDialog());
        }

        if (tid != null)
            logger.info("transaction state is " + tid.getState());
        else
            logger.info("transaction = " + tid);

        logger.info("Dialog = " + dialog);

        logger.info("Dialog state is " + dialog.getState());

        try {
            if (response.getStatusCode() == Response.OK) {
                if (cseq.getMethod().equals(Request.INVITE)) {
                    TestCase.assertEquals( DialogState.CONFIRMED, dialog.getState() );
                    Request ackRequest = dialog.createAck(cseq
                            .getSeqNumber());
               
                    TestCase.assertNotNull( ackRequest.getHeader( MaxForwardsHeader.NAME ) );

                     dialog.sendAck(ackRequest);
                     // Proxy will fork. I will accept the first dialog.
                    this.forkedDialogs.add(dialog);
                    if ( responseReceivedEvent.getClientTransaction() != null ) {
                        this.originalTransaction = responseReceivedEvent.getClientTransaction();
                        logger.info("Sending ACK");
                        TestCase.assertTrue(
                                "Dialog state should be CONFIRMED", dialog
                                        .getState() == DialogState.CONFIRMED);

                        TestCase.assertTrue(this.ackedDialog == null ||
                                this.ackedDialog == dialog);
                        this.ackedDialog = dialog;

                        if ( callerSendsBye ) {
                            timer.schedule( new SendBye(ackedDialog), 4000  );
                        }


                    } else {
                        ResponseEventExt responseEventExt  = (ResponseEventExt) responseReceivedEvent;
                        TestCase.assertTrue("forked event must set flag",responseEventExt.isForkedResponse());
                        this.canceledDialog.add(dialog);
                        SipProvider sipProvider = (SipProvider) responseReceivedEvent
                                .getSource();
                       
                        TestCase.assertSame("original ctx must match " ,
                                responseEventExt.getOriginalTransaction(),this.originalTransaction);

                        Request byeRequest = dialog.createRequest(Request.BYE);
                        ClientTransaction ct = sipProvider
                                .getNewClientTransaction(byeRequest);
                        dialog.sendRequest(ct);
View Full Code Here

        }
    }

    public synchronized void processResponse(ResponseEvent responseReceived) {
        try {           
            ResponseEventExt responseReceivedEvent = (ResponseEventExt) responseReceived;
            Response response = (Response) responseReceivedEvent.getResponse();
            ClientTransaction tid = responseReceivedEvent.getClientTransaction();
            CSeqHeader cseq = (CSeqHeader) response.getHeader(CSeqHeader.NAME);
   
            logger.info("Response received : Status Code = "
                    + response.getStatusCode() + " " + cseq);
            logger.info("Response = " + response + " class=" + response.getClass() );           
   
            Dialog dialog = responseReceivedEvent.getDialog();    
            this.forkedDialogs.add(dialog);
            if(createDialogAfterRequest) {
                TestCase.assertNull( dialog );
                return;
            } else {
                TestCase.assertNotNull( dialog );
            }
            System.out.println("original Tx " + responseReceivedEvent.getOriginalTransaction());           
            if (tid != null)
                logger.info("transaction state is " + tid.getState());
            else
                logger.info("transaction = " + tid);
   
View Full Code Here

        }
    }

    public synchronized void processResponse(ResponseEvent responseReceived) {
        try {           
            ResponseEventExt responseReceivedEvent = (ResponseEventExt) responseReceived;
            Response response = (Response) responseReceivedEvent.getResponse();
            ClientTransaction tid = responseReceivedEvent.getClientTransaction();
            CSeqHeader cseq = (CSeqHeader) response.getHeader(CSeqHeader.NAME);
   
            logger.info("Response received : Status Code = "
                    + response.getStatusCode() + " " + cseq);
            logger.info("Response = " + response + " class=" + response.getClass() );           
   
            Dialog dialog = responseReceivedEvent.getDialog();    
            this.forkedDialogs.add(dialog);
            if(createDialogAfterRequest) {
                TestCase.assertNull( dialog );
                return;
            } else {
                TestCase.assertNotNull( dialog );
            }
            System.out.println("original Tx " + responseReceivedEvent.getOriginalTransaction());           
            if (tid != null)
                logger.info("transaction state is " + tid.getState());
            else
                logger.info("transaction = " + tid);
   
            logger.info("Dialog = " + dialog);
            logger.info("Dialog state is " + dialog.getState());

            String toTag = ((ResponseExt)response).getToHeader().getTag();
            boolean isFromFork = false;
            if(forkFirst) {
                isFromFork = toTag != null && !toTag.contains("shootme-5080");
            } else {
                isFromFork = toTag != null && !toTag.contains("shootme-5081");
            }
            logger.info("isRetransmission = " + responseReceivedEvent.isRetransmission() + " isFromForked = " + isFromFork + " isForked = " + responseReceivedEvent.isForkedResponse() + " response "+ response);
           
            if (response.getStatusCode() == Response.OK) {
                if (cseq.getMethod().equals(Request.INVITE)) {
                    // Proxy will fork. I will accept the first dialog.

                    if (ackedDialog == null) {
                        TestCase.assertFalse("retransmission flag should be false", responseReceivedEvent
                                .isRetransmission());
                        TestCase.assertTrue("Dialog state should be CONFIRMED",
                                dialog.getState() == DialogState.CONFIRMED);

                        TestCase.assertTrue("Identity check" , this.ackedDialog == null || this.ackedDialog == dialog);
                        this.ackedDialog = dialog;

                        Request ackRequest = dialog.createAck(cseq.getSeqNumber());
                        dialog.sendAck(ackRequest);
                        this.timer.schedule( new SendBye(dialog),500);
                      } else {
                        TestCase.assertTrue("retransmission flag should be true", responseReceivedEvent
                                .isRetransmission());
                        if (timedOutDialog.isEmpty()) {
                            this.timedOutDialog.add(dialog);
                            // Did not send ACK here so should get DialogTmeoutEvent
                        }
                    }

                } else if (cseq.getMethod().equals(Request.BYE)) {
                    TestCase.assertFalse("retransmission flag should be false", responseReceivedEvent
                            .isRetransmission());
                    if (dialog == this.ackedDialog) {
                        this.byeResponseSeen = true;
                    }
                } else {
                    logger.info("Response method = " + cseq.getMethod());
                }
            } else if ( response.getStatusCode() == Response.RINGING ) {
                TestCase.assertEquals( DialogState.EARLY, dialog.getState() );    
                this.forkedEarlyDialogs.add(dialog);
                // Proxy will fork. This make sure the forked early dialog is not the same as the first one.
                if(isFromFork) {
                    logger.info("forked early dialog= " + dialog + " for response " + response);
                    ResponseEventExt responseEventExt  = (ResponseEventExt) responseReceivedEvent;
                    TestCase.assertTrue("forked event must set flag",responseEventExt.isForkedResponse());
                    TestCase.assertNotSame(dialog, earlyDialog);                       
                    TestCase.assertSame(earlyDialog, responseEventExt.getOriginalTransaction().getDefaultDialog());
                } else {
                    earlyDialog = dialog;
                    logger.info("original early dialog= " + dialog + " for response " + response);
                    ResponseEventExt responseEventExt  = (ResponseEventExt) responseReceivedEvent;
                    TestCase.assertFalse("non forked event must not set flag",responseEventExt.isForkedResponse());
                }
            }
        } catch (Throwable ex) {
            ex.printStackTrace();
            // System.exit(0);
View Full Code Here

        }
    }

    public synchronized void processResponse(ResponseEvent responseReceived) {
        try {           
            ResponseEventExt responseReceivedEvent = (ResponseEventExt) responseReceived;
            Response response = (Response) responseReceivedEvent.getResponse();
            ClientTransaction tid = responseReceivedEvent.getClientTransaction();
            CSeqHeader cseq = (CSeqHeader) response.getHeader(CSeqHeader.NAME);
   
            logger.info("Response received : Status Code = "
                    + response.getStatusCode() + " " + cseq);
            logger.info("Response = " + response + " class=" + response.getClass() );           
   
            Dialog dialog = responseReceivedEvent.getDialog();    
            if(createDialogAfterRequest) {
                TestCase.assertNull( dialog );
                return;
            } else {
                TestCase.assertNotNull( dialog );
            }
            System.out.println("original Tx " + responseReceivedEvent.getOriginalTransaction());           
            if (tid != null)
                logger.info("transaction state is " + tid.getState());
            else
                logger.info("transaction = " + tid);
   
            logger.info("Dialog = " + dialog);
            logger.info("Dialog state is " + dialog.getState());

            String toTag = ((ResponseExt)response).getToHeader().getTag();
            boolean isFromFork = false;
            if(forkFirst) {
                isFromFork = toTag != null && !toTag.contains("shootme-5080");
            } else {
                isFromFork = toTag != null && !toTag.contains("shootme-5081");
            }
            logger.info("isRetransmission = " + responseReceivedEvent.isRetransmission() + " isFromForked = " + isFromFork + " isForked = " + responseReceivedEvent.isForkedResponse() + " response "+ response);
           
            if (response.getStatusCode() == Response.OK) {
                if (cseq.getMethod().equals(Request.INVITE)) {
                     // Proxy will fork. I will accept the first dialog.
                    this.forkedDialogs.add(dialog);
                    if (!isFromFork) {                       
                        TestCase.assertFalse("non forked event must not set flag",responseReceivedEvent.isForkedResponse());                                               
                       
                        if(ackedDialog == null) {
                            TestCase.assertFalse("retransmission flag should be false",responseReceivedEvent.isRetransmission());
                            TestCase.assertTrue(
                                    "Dialog state should be CONFIRMED", dialog
                                            .getState() == DialogState.CONFIRMED);
   
                            TestCase.assertTrue(this.ackedDialog == null ||
                                    this.ackedDialog == dialog);
                            this.ackedDialog = dialog;
                       
                            Request ackRequest = dialog.createAck(cseq
                                    .getSeqNumber());
                       
                            TestCase.assertNotNull( ackRequest.getHeader( MaxForwardsHeader.NAME ) );
                            //  sleeping to see how it reacts with retrans
                            logger.info("Waiting to Send ACK");
                            Thread.sleep(1000);
                            logger.info("Sending " + ackRequest);
                            dialog.sendAck(ackRequest);
                           
                            if ( callerSendsBye ) {
                                timer.schedule( new SendBye(ackedDialog), 2000  );
                            }
                        } else {
                            TestCase.assertTrue("retransmission flag should be true",responseReceivedEvent.isRetransmission());
                        }

                    } else {
                        TestCase.assertTrue("forked event must set flag",responseReceivedEvent.isForkedResponse());
                        TestCase.assertSame("original ctx must match " , this.originalTransaction,
                                        responseReceivedEvent.getOriginalTransaction());
                        if ( cseq.getMethod().equals(Request.INVITE)) {
                            TestCase.assertSame("Must preserve original dialog",
                                this.originalDialog,responseReceivedEvent.getOriginalTransaction().getDefaultDialog());
                        }
                       
                        if(canceledDialog.isEmpty()) {
                            TestCase.assertFalse("retransmission flag should be false",responseReceivedEvent.isRetransmission());
                            TestCase.assertEquals( DialogState.CONFIRMED, dialog.getState() );
                            this.canceledDialog.add(dialog);
                            Request ackRequest = dialog.createAck(cseq
                                    .getSeqNumber());
                       
                            TestCase.assertNotNull( ackRequest.getHeader( MaxForwardsHeader.NAME ) );
                            //  sleeping to see how it reacts with retrans
                            logger.info("Waiting to Send ACK");
                            Thread.sleep(1000);
                            logger.info("Sending " + ackRequest);
                            dialog.sendAck(ackRequest);
                           
                            Thread.sleep(2000);
                           
                            Request byeRequest = dialog.createRequest(Request.BYE);
                            ClientTransaction ct = sipProvider
                                    .getNewClientTransaction(byeRequest);
                            dialog.sendRequest(ct);
                        } else {
                            TestCase.assertTrue("retransmission flag should be true",responseReceivedEvent.isRetransmission());
                        }
                    }


                } else if ( cseq.getMethod().equals(Request.BYE)) {
                    TestCase.assertFalse("retransmission flag should be false",responseReceivedEvent.isRetransmission());
                    if ( dialog == this.ackedDialog) {
                        this.byeResponseSeen = true;
                    }
                } else {
                    logger.info("Response method = " + cseq.getMethod());
                }
            } else if ( response.getStatusCode() == Response.RINGING ) {
                TestCase.assertEquals( DialogState.EARLY, dialog.getState() );    
                this.forkedEarlyDialogs.add(dialog);
                // Proxy will fork. This make sure the forked early dialog is not the same as the first one.
                if(isFromFork) {
                    logger.info("forked early dialog= " + dialog + " for response " + response);
                    ResponseEventExt responseEventExt  = (ResponseEventExt) responseReceivedEvent;
                    TestCase.assertTrue("forked event must set flag",responseEventExt.isForkedResponse());
                    TestCase.assertNotSame(dialog, earlyDialog);                       
                    TestCase.assertSame(earlyDialog, responseEventExt.getOriginalTransaction().getDefaultDialog());
                } else {
                    earlyDialog = dialog;
                    logger.info("original early dialog= " + dialog + " for response " + response);
                    ResponseEventExt responseEventExt  = (ResponseEventExt) responseReceivedEvent;
                    TestCase.assertFalse("non forked event must not set flag",responseEventExt.isForkedResponse());
                }
            }
        } catch (Throwable ex) {
            ex.printStackTrace();
            // System.exit(0);
View Full Code Here

        }
    }

    public synchronized void processResponse(ResponseEvent responseReceived) {
        logger.info("Got a response");
        ResponseEventExt responseReceivedEvent = (ResponseEventExt) responseReceived;
        Response response = (Response) responseReceivedEvent.getResponse();
        ClientTransaction tid = responseReceivedEvent.getClientTransaction();
        CSeqHeader cseq = (CSeqHeader) response.getHeader(CSeqHeader.NAME);

        logger.info("Response received : Status Code = "
                + response.getStatusCode() + " " + cseq);
        logger.info("Response = " + response + " class=" + response.getClass() );
       

        Dialog dialog = responseReceivedEvent.getDialog();
        TestCase.assertNotNull( dialog );
       
        System.out.println("original Tx " + responseReceivedEvent.getOriginalTransaction());
        if ( cseq.getMethod().equals(Request.INVITE)) {
          TestCase.assertSame("Must preserve original dialog",
            this.originalDialog,responseReceivedEvent.getOriginalTransaction().getDefaultDialog());
        }

        if (tid != null)
            logger.info("transaction state is " + tid.getState());
        else
            logger.info("transaction = " + tid);

        logger.info("Dialog = " + dialog);

        logger.info("Dialog state is " + dialog.getState());

        try {
            if (response.getStatusCode() == Response.OK) {
                if (cseq.getMethod().equals(Request.INVITE)) {
                    TestCase.assertEquals( DialogState.CONFIRMED, dialog.getState() );
                    Request ackRequest = dialog.createAck(cseq
                            .getSeqNumber());
               
                    TestCase.assertNotNull( ackRequest.getHeader( MaxForwardsHeader.NAME ) );

                     dialog.sendAck(ackRequest);
                     // Proxy will fork. I will accept the first dialog.
                    this.forkedDialogs.add(dialog);
                    if ( responseReceivedEvent.getClientTransaction() != null ) {
                        this.originalTransaction = responseReceivedEvent.getClientTransaction();
                        logger.info("Sending ACK");
                        TestCase.assertTrue(
                                "Dialog state should be CONFIRMED", dialog
                                        .getState() == DialogState.CONFIRMED);

                        TestCase.assertTrue(this.ackedDialog == null ||
                                this.ackedDialog == dialog);
                        this.ackedDialog = dialog;

                        if ( callerSendsBye ) {
                            timer.schedule( new SendBye(ackedDialog), 4000  );
                        }


                    } else {
                        ResponseEventExt responseEventExt  = (ResponseEventExt) responseReceivedEvent;
                        TestCase.assertTrue("forked event must set flag",responseEventExt.isForkedResponse());
                        this.canceledDialog.add(dialog);
                        SipProvider sipProvider = (SipProvider) responseReceivedEvent
                                .getSource();
                       
                        TestCase.assertSame("original ctx must match " ,
                                responseEventExt.getOriginalTransaction(),this.originalTransaction);

                        Request byeRequest = dialog.createRequest(Request.BYE);
                        ClientTransaction ct = sipProvider
                                .getNewClientTransaction(byeRequest);
                        dialog.sendRequest(ct);
View Full Code Here

TOP

Related Classes of gov.nist.javax.sip.ResponseEventExt

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.