本文整理汇总了Java中javax.sip.ResponseEvent.getResponse方法的典型用法代码示例。如果您正苦于以下问题:Java ResponseEvent.getResponse方法的具体用法?Java ResponseEvent.getResponse怎么用?Java ResponseEvent.getResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.sip.ResponseEvent
的用法示例。
在下文中一共展示了ResponseEvent.getResponse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
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);
}
}
示例2: processResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
public void processResponse(ResponseEvent responseReceivedEvent) {
Response response = (Response) responseReceivedEvent.getResponse();
Transaction tid = responseReceivedEvent.getClientTransaction();
logger.info("Got a response:" + response.getStatusCode()
+ ':' + response.getHeader( CSeqHeader.NAME ) );
logger.info("Response received with client transaction id " + tid
+ ": " + response.getStatusCode() );
if (tid == null) {
logger.info("Stray response -- dropping ");
return;
}
logger.info("transaction state is " + tid.getState());
logger.info("Dialog = " + tid.getDialog());
if ( tid.getDialog () != null )
logger.info("Dialog State is " + tid.getDialog().getState());
}
示例3: processResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
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());
// responses are OKs for SUBSCRIBE. Do nothing
}
示例4: processResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
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);
}
}
示例5: processResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
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());
if (tid.getDialog() != null)
logger.info("Dialog State is " + tid.getDialog().getState());
}
示例6: processResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
public void processResponse(ResponseEvent responseEvent) {
Response response = responseEvent.getResponse();
int code = response.getStatusCode();
if (code == 180) {
try {
o_received180 = true;
Request cancel = responseEvent.getClientTransaction().createCancel();
ClientTransaction cancelTX = provider.getNewClientTransaction(cancel);
cancelTX.sendRequest();
System.out.println("Send CANCEL:\n" + cancel);
o_sentCancel = true;
} catch (SipException e) {
e.printStackTrace();
doFail(doMessage(e));
}
} else if (code == 200) {
System.out.println("Receive Cancel200");
o_receiver200Cancel = true;
}
}
示例7: processResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
public void processResponse(ResponseEvent responseEvent) {
Response response = responseEvent.getResponse();
BrokerFactory.getLoggingBroker().logDebug("Process Response in Sip Handler "+response);
String method = ((CSeqHeader) response.getHeader(CSeqHeader.NAME)).getMethod();
if (response.getStatusCode() == Response.OK) {
if (method.equals(Request.REGISTER)) {
setRegistered(true);
}
}
if (response.getStatusCode() == 401) {
handleAuthorization(responseEvent, response, method);
} else if (response.getStatusCode() == 407) {
handleProxyAuthorization(responseEvent, response, method);
}
for (int i = 0; i < responseListeners.size(); i++) {
ResponseListener listener = (ResponseListener) responseListeners
.elementAt(i);
listener.handleResponse(responseEvent);
}
}
示例8: processResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
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");
}
}
示例9: processResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
public 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);
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();
AbstractRouterTestCase.assertEquals("Provider is not equal to the original proivder",
provider, sipProvider);
try {
if (response.getStatusCode() == Response.OK) {
if (cseq.getMethod().equals(Request.INVITE)) {
Request ackRequest = dialog.createAck(cseq.getSeqNumber());
logger.info("Sending ACK");
dialog.sendAck(ackRequest);
this.gotInviteOK = true;
}
}
} catch (Exception ex) {
AbstractRouterTestCase.fail(ex.getMessage());
}
}
示例10: processResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
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");
}
}
示例11: processResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
public void processResponse(ResponseEvent responseReceivedEvent) {
try {
Response response = responseReceivedEvent.getResponse();
CSeqHeader cseq = (CSeqHeader) response
.getHeader(CSeqHeader.NAME);
System.out.println("Response " + response.getStatusCode()
+ " CSeq = " + cseq.getSeqNumber());
if (response.getStatusCode() == Response.OK
&& cseq.getMethod().equals(Request.INVITE)) {
assertEquals("Should only see OK for seq number of 8", cseq
.getSeqNumber(), 8L);
Request ackRequest = dialog.createAck(cseq.getSeqNumber());
dialog.sendAck(ackRequest);
Request badRequest = dialog.createRequest(Request.INVITE);
CSeqHeader cseq1 = (CSeqHeader) badRequest
.getHeader(CSeqHeader.NAME);
cseq1.setSeqNumber(1L);
ClientTransaction badCt = sipProvider
.getNewClientTransaction(badRequest);
badCt.sendRequest();
} else if ( response.getStatusCode() == Response.SERVER_INTERNAL_ERROR) {
this.saw500 = true;
}
} catch (Exception ex) {
ex.printStackTrace();
TestCase.fail("Unexpected exception");
}
}
示例12: processResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
public synchronized void processResponse(ResponseEvent responseReceivedEvent) {
logger.info("Got a 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);
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());
} else {
logger.info("Response method = " + cseq.getMethod());
}
}
} catch (Throwable ex) {
ex.printStackTrace();
// System.exit(0);
}
}
示例13: processResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
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);
}
示例14: processResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
public void processResponse(ResponseEvent responseReceivedEvent) {
LOG.debug("Response received at Subscriber");
Response response = responseReceivedEvent.getResponse();
Transaction clientTransactionId = responseReceivedEvent.getClientTransaction();
LOG.debug("Response received with client transaction id {}:{}", clientTransactionId, response.getStatusCode());
if (clientTransactionId == null) {
if (LOG.isWarnEnabled()) {
LOG.warn("Stray response -- dropping");
}
return;
}
}
示例15: processResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
public synchronized void processResponse(ResponseEvent responseReceivedEvent) {
Response response = responseReceivedEvent.getResponse();
Integer statusCode = response.getStatusCode();
if (SIP_MESSAGE_CODES.containsKey(statusCode)) {
LOG.debug(SIP_MESSAGE_CODES.get(statusCode) + " received from Subscriber");
}
}