当前位置: 首页>>代码示例>>Java>>正文


Java Response.OK属性代码示例

本文整理汇总了Java中javax.sip.message.Response.OK属性的典型用法代码示例。如果您正苦于以下问题:Java Response.OK属性的具体用法?Java Response.OK怎么用?Java Response.OK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.sip.message.Response的用法示例。


在下文中一共展示了Response.OK属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processResponse

public void processResponse(ResponseEvent responseReceivedEvent) {
    // System.out.println("Got a response");
    Response response = (Response) responseReceivedEvent.getResponse();
    Transaction tid = responseReceivedEvent.getClientTransaction();

    // System.out.println("Response received with client transaction id "
    // + tid + ":\n" + response);

    System.out.println("GOT RESPONSE: " + response.getStatusCode());
    try {
        if (response.getStatusCode() == Response.OK && ((CSeqHeader) response.getHeader(CSeqHeader.NAME)).getMethod().equals(Request.INVITE)) {

            Dialog dialog = tid.getDialog();
            
            Request request = tid.getRequest();
            dialog.sendAck(request);
        }

    } catch (Exception ex) {
        ex.printStackTrace();
        TxTimeoutTest.fail("Shootme: Failed on process response: " + response.getStatusCode(), ex);
    }

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:24,代码来源:Shootme.java

示例2: processResponse

public void processResponse(ResponseEvent responseReceivedEvent) {
    // System.out.println("Got a response");
    Response response = (Response) responseReceivedEvent.getResponse();
    Transaction tid = responseReceivedEvent.getClientTransaction();

    // System.out.println("Response received with client transaction id "
    // + tid + ":\n" + response);

    System.out.println("GOT RESPONSE: " + response.getStatusCode());
    try {
        if (response.getStatusCode() == Response.OK && ((CSeqHeader) response.getHeader(CSeqHeader.NAME)).getMethod().equals(Request.INVITE)) {

            Dialog dialog = tid.getDialog();
            
            Request request = tid.getRequest();
            dialog.sendAck(request);
        }

    } catch (Exception ex) {
        ex.printStackTrace();
        DialogTimeoutTest.fail("Shootme: Failed on process response: " + response.getStatusCode(), ex);
    }

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:24,代码来源:Shootme.java

示例3: processResponse

public void processResponse(ResponseEvent responseReceivedEvent) {
    Response response = (Response) responseReceivedEvent.getResponse();
    System.out.println("GOT RESPONSE:" + response.getStatusCode());
    if(responseReceivedEvent.getClientTransaction() == null) {
    	return;
    }
    try {
        if (response.getStatusCode() == Response.OK
                && ((CSeqHeader) response.getHeader(CSeqHeader.NAME))
                        .getMethod().equals(Request.INVITE)) {            	
        	System.out.println("Not Sending ACK to test dialog timeout");            	
        }
    } catch (Exception ex) {
        ex.printStackTrace();

        DialogTimeoutTest.fail(
                "Shootist: Exception on process respons/send info", ex);
    }

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:20,代码来源:Shootist.java

示例4: processResponse

public void processResponse(ResponseEvent responseReceivedEvent) {
	CSeqHeader cseq = (CSeqHeader) responseReceivedEvent.getResponse().getHeader(CSeqHeader.NAME);
	String method = cseq.getMethod();
	if(method.equals(Request.INVITE)) {
		if ( responseReceivedEvent.getResponse().getStatusCode() == Response.OK) {
			Dialog d = responseReceivedEvent.getDialog();
			try {
				Request ack = d.createAck(1);
				sipProvider.sendRequest(ack);
			} catch (Exception e) {
				e.printStackTrace();
				fail("Error sending ACK");
			}
		}
	} else if(method.equals(Request.BYE)){
		okByeReceived = true;
	}
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:18,代码来源:WebsocketSelfTest.java

示例5: processResponse

public void processResponse(ResponseEvent responseReceivedEvent) {
    try {
        if ( responseReceivedEvent.getResponse().getStatusCode() == Response.OK) {
            this.sawOk = true;
        Dialog dialog = responseReceivedEvent.getDialog();
        long cseq = ((CSeqHeader) responseReceivedEvent.getResponse()
                .getHeader(CSeqHeader.NAME)).getSeqNumber();
        Request ack = dialog.createAck(cseq);
        dialog.sendAck(ack);
        }
    } catch (Exception ex) {
        fail("Unexpected exception");

    }

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:16,代码来源:DeliverRequestEventWithBadHeaderTest.java

示例6: isAckSeen

/**
 * Return true if the dialog has already seen the ack.
 * 
 * @return flag that records if the ack has been seen.
 */
public boolean isAckSeen() {

    if (lastAckReceivedCSeqNumber == null
            && lastResponseStatusCode == Response.OK) {
        if (logger.isLoggingEnabled(
                LogWriter.TRACE_DEBUG)) {
            logger.logDebug("SIPDialog::isAckSeen:"+
                    this + "lastAckReceived is null -- returning false");
        }
        return false;
    } else if (lastResponseMethod == null) {
        if (logger.isLoggingEnabled(
                LogWriter.TRACE_DEBUG)) {
            logger.logDebug("SIPDialog::isAckSeen:"+
                    this + "lastResponse is null -- returning false");
        }
        return false;
    } else if (lastAckReceivedCSeqNumber == null
            && lastResponseStatusCode / 100 > 2) {
        if (logger.isLoggingEnabled(
                LogWriter.TRACE_DEBUG)) {
            logger.logDebug("SIPDialog::isAckSeen:"+
                    this + "lastResponse statusCode "
                            + lastResponseStatusCode);
        }
        return true;
    } else {
    	if (logger.isLoggingEnabled(LogWriter.TRACE_DEBUG)) {
    		logger.logDebug("SIPDialog::isAckSeen:lastAckReceivedCSeqNumber = " + lastAckReceivedCSeqNumber + " remoteCSeqNumber = " + this.getRemoteSeqNumber());
    	}
        return this.lastAckReceivedCSeqNumber != null
                && this.lastAckReceivedCSeqNumber >= this
                        .getRemoteSeqNumber();
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:40,代码来源:SIPDialog.java

示例7: processResponse

public void processResponse(ResponseEvent responseReceivedEvent) {
	try {
		if(inUse!=false) {
			fail("Concurrent responses should not happen");
			throw new RuntimeException();
		}
		inUse = true;
		if(q%100==0) System.out.println("Receive " + q);
		q++;
		if ( responseReceivedEvent.getResponse().getStatusCode() == Response.OK) {

			Dialog d = responseReceivedEvent.getDialog();
			try {
				Request ack = d.createAck(1);
				sipProvider.sendRequest(ack);
				sipProvider.sendRequest(ack);
				sipProvider.sendRequest(ack);
				sipProvider.sendRequest(ack);
				sipProvider.sendRequest(ack);
			} catch (Exception e) {
				e.printStackTrace();
				fail("Error sending ACK");
			}
		}
	}finally {
		inUse = false;
	}

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:29,代码来源:TcpSingleThreadDeadlockTest.java

示例8: processResponse

public void processResponse(ResponseEvent responseReceivedEvent) {
         

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

         logger.info("Got a response " + response);
         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);
             }
         } catch (Exception ex) {
             logger.error(ex);
             ex.printStackTrace();
             ReconnectTCPTest.fail("unexpected exception");
         }

     }
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:35,代码来源:ReconnectTCPTest.java

示例9: processResponse

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);
             }
         } catch (Exception ex) {
             logger.error(ex);
             ex.printStackTrace();
             RFC5626KeepAliveTest.fail("unexpected exception");
         }
     	timer.schedule(new MyTimerTask(), 1000, 3000);
     }
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:34,代码来源:RFC5626KeepAliveTest.java

示例10: processResponse

public void processResponse(ResponseEvent responseReceivedEvent) {
    if ( responseReceivedEvent.getResponse().getStatusCode() == Response.OK) {

        Dialog d = responseReceivedEvent.getDialog();
        try {
            Request ack = d.createAck(1);
            // Added Thread.sleep to avoid regression on the test
            // as ACKs arriving at the same time may create race condition
            // where the ACK is removing from pending transactions by loose dialog validation 
            // but re created by the next ACK coming in line and thus the EventScanner
            // sipStack.findPendingTransaction(sipRequest.getTransactionId()) gives transaction already exists 
            // and the ACK is not passed to TU
            sipProvider.sendRequest(ack);
            Thread.sleep(50);
            sipProvider.sendRequest(ack);
            Thread.sleep(50);
            sipProvider.sendRequest(ack);
            Thread.sleep(50);
            sipProvider.sendRequest(ack);
            Thread.sleep(50);
            sipProvider.sendRequest(ack);                                       
        } catch (Exception e) {
            e.printStackTrace();
            fail("Error sending ACK");
        }
    }

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:28,代码来源:LooseDialogValidationTest.java

示例11: processResponse

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);
             }
         } catch (Exception ex) {
             logger.error(ex);
             ex.printStackTrace();
             AckReTransmissionTest.fail("unexpected exception");
         }

     }
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:34,代码来源:AckReTransmissionTest.java

示例12: processResponse

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("Stray response -- dropping ");
        return;
    }
    logger.info("transaction state is " + tid.getState());
    logger.info("Dialog = " + tid.getDialog());
    logger.info("Dialog State is " + tid.getDialog().getState());
    SipProvider provider = (SipProvider) responseReceivedEvent.getSource();

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

            // Request cancel = inviteTid.createCancel();
            // ClientTransaction ct =
            // sipProvider.getNewClientTransaction(cancel);
            Dialog dialog = tid.getDialog();
            Request ackRequest = dialog.createAck(cseq.getSeqNumber());
            logger.info("Ack request to send = " + ackRequest);
            logger.info("Sending ACK");
            dialog.sendAck(ackRequest);

            // Send a Re INVITE but this time force it
            // to use UDP as the transport. Else, it will
            // Use whatever transport was used to create
            // the dialog.
            if (reInviteCount == 0) {
                Request inviteRequest = dialog
                        .createRequest(Request.INVITE);
                Thread.sleep(100);
                ClientTransaction ct = provider
                        .getNewClientTransaction(inviteRequest);
                dialog.sendRequest(ct);
                reInviteCount++;
            } else {
                this.okReceived = true;
            }

        } else if (response.getStatusCode() == Response.OK
                && ((CSeqHeader) response.getHeader(CSeqHeader.NAME))
                        .getMethod().equals(Request.BYE)) {
            this.byeOkRecieved = true;
        }
    } catch (Exception ex) {
        logger.error(ex);
        SctpTest.fail("unexpected exception");
    }

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:58,代码来源:Shootist.java

示例13: processResponse

public void processResponse(ResponseEvent responseReceivedEvent) {
    System.out.println("Got a response");
    Response response = (Response) responseReceivedEvent.getResponse();
    ClientTransaction tid = responseReceivedEvent.getClientTransaction();
    CSeqHeader cseq = (CSeqHeader) response.getHeader(CSeqHeader.NAME);

    System.out.println("Response received : Status Code = "
            + response.getStatusCode() + " " + cseq);
    if (tid == null) {
        System.out.println("Stray response -- dropping ");
        return;
    }
    System.out.println("transaction state is " + tid.getState());
    System.out.println("Dialog = " + tid.getDialog());
    System.out.println("Dialog State is " + tid.getDialog().getState());

    try {
        if (response.getStatusCode() == Response.OK) {
            if (cseq.getMethod().equals(Request.INVITE)) {
                Dialog dialog = inviteTid.getDialog();
                Request ackRequest = dialog.createAck( cseq.getSeqNumber() );
                System.out.println("Sending ACK");
                dialog.sendAck(ackRequest);
            } else if (cseq.getMethod().equals(Request.CANCEL)) {
                if (dialog.getState() == DialogState.CONFIRMED) {
                    // oops cancel went in too late. Need to hang up the
                    // dialog.
                    System.out
                            .println("Sending BYE -- cancel went in too late !!");
                    Request byeRequest = dialog.createRequest(Request.BYE);
                    ClientTransaction ct = sipProvider
                            .getNewClientTransaction(byeRequest);
                    dialog.sendRequest(ct);
                }
            }
        } else if (response.getStatusCode() == Response.PROXY_AUTHENTICATION_REQUIRED
                || response.getStatusCode() == Response.UNAUTHORIZED) {
            AuthenticationHelper authenticationHelper = 
                ((SipStackExt) sipStack).getAuthenticationHelper(new AccountManagerImpl(), headerFactory);
            
            inviteTid = authenticationHelper.handleChallenge(response, tid, sipProvider, 5);
         
            inviteTid.sendRequest();
          
            invco++;
        }
    } catch (Exception ex) {
        ex.printStackTrace();
        System.exit(0);
    }

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:52,代码来源:ShootistAuth.java

示例14: processResponse

public synchronized void processResponse(ResponseEvent responseReceivedEvent) {
    logger.info("Got a response");
    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();
    TestHarness.assertNotNull(dialog);

    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)) {
                TestHarness.assertEquals(DialogState.CONFIRMED, dialog
                        .getState());
                Request ackRequest = dialog.createAck(cseq.getSeqNumber());

                dialog.sendAck(ackRequest);

                TestHarness.assertNotNull(ackRequest
                        .getHeader(MaxForwardsHeader.NAME));

                // Proxy will fork. I will accept the second dialog
                // but not the first.

                SipProvider sipProvider = (SipProvider) responseReceivedEvent
                        .getSource();

                Request infoRequest = dialog.createRequest(Request.INFO);
                ClientTransaction ct = sipProvider
                        .getNewClientTransaction(infoRequest);
                dialog.sendRequest(ct);

            } else {
                logger.info("Response method = " + cseq.getMethod());
            }
        } else if (response.getStatusCode() == Response.RINGING) {
            // TestHarness.assertEquals( DialogState.EARLY,
            // dialog.getState() );
        }
    } catch (Throwable ex) {
        ex.printStackTrace();
        // System.exit(0);
    }

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:58,代码来源:Shootist.java

示例15: processResponse

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

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

            if (cseq.getMethod() == Request.PRACK) {
                prackConfirmed = true;
            }

            if (tid == null) {
                logger.info("Stray response -- dropping ");
                return;
            }
            logger.info("transaction state is " + tid.getState());
            logger.info("Dialog = " + tid.getDialog());
            logger.info("Dialog State is " + tid.getDialog().getState());
            SipProvider provider = (SipProvider) responseReceivedEvent.getSource();
            dialog = tid.getDialog();

            try {
                if (response.getStatusCode() == Response.OK) {
                    if (cseq.getMethod().equals(Request.INVITE)) {
                        Request ackRequest = dialog.createAck(((CSeqHeader) response.getHeader(CSeqHeader.NAME)).getSeqNumber());
                        logger.info("Sending ACK");
                        dialog.sendAck(ackRequest);
                    }

                } else if ( response.getStatusCode() == Shootme.PRACK_CODE) {
//                  prackTriggerReceived = true;
//                  RequireHeader requireHeader = (RequireHeader) response.getHeader(RequireHeader.NAME);
//                  if ( requireHeader.getOptionTag().equalsIgnoreCase("100rel")) {
//                      Dialog dialog = tid.getDialog();
//                      Request prackRequest = dialog.createPrack(response);
//                      // create Request URI
//                      SipURI requestURI = addressFactory.createSipURI(toUser,
//                              "127.0.0.1:" + Shootme.myPort);
//                      prackRequest.setRequestURI(requestURI);
//                      ClientTransaction ct = provider.getNewClientTransaction(prackRequest);
//                      dialog.sendRequest(ct);
//                  }
                }
            } catch (Exception ex) {
                ex.printStackTrace();
                TestHarness.fail("Unexpected exception " + ex.getMessage());

            }

        }
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:53,代码来源:UdpPrackTimeoutTest.java


注:本文中的javax.sip.message.Response.OK属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。