本文整理汇总了Java中javax.sip.ResponseEvent.getClientTransaction方法的典型用法代码示例。如果您正苦于以下问题:Java ResponseEvent.getClientTransaction方法的具体用法?Java ResponseEvent.getClientTransaction怎么用?Java ResponseEvent.getClientTransaction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.sip.ResponseEvent
的用法示例。
在下文中一共展示了ResponseEvent.getClientTransaction方法的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();
System.out.println("GOT RESPONSE:" + response.getStatusCode());
this.statusCode = 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();
TxTimeoutTest.fail(
"Shootist: Exception on process respons/send info", ex);
}
}
示例3: 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);
}
}
示例4: processResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
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);
}
}
示例5: 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);
}
}
示例6: 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());
}
示例7: 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());
}
示例8: 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);
}
}
示例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();
logger.info("Got a response"
+ ((CSeqHeader) response.getHeader(CSeqHeader.NAME))
.getMethod());
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());
if (dialog == null) {
logger.info("SETTING DIALOG SINCE IT WAS NULL!!!!!!");
dialog = tid.getDialog();
}
if (response.getStatusCode() == 180) {
sendCancel();
} else if (response.getStatusCode() == 200)// more checks?
{
cancelOk = true;
} else {
logger.info("Got weird response:" + response);
}
}
示例11: 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;
}
}
示例12: handleResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
public void handleResponse(ResponseEvent responseEvent) {
Response response = responseEvent.getResponse();
BrokerFactory.getLoggingBroker().logDebug("Got response in SipOutboundCall "+response);
String method = ((CSeqHeader) response.getHeader(CSeqHeader.NAME))
.getMethod();
ClientTransaction clientTransaction = responseEvent
.getClientTransaction();
try {
if (response.getStatusCode() == Response.OK) {
if (method.equals(Request.INVITE)) {
if (clientTransaction != null) {
Request ack = (Request) clientTransaction.getDialog()
.createRequest(Request.ACK);
clientTransaction.getDialog().sendAck(ack);
startConversation(response, clientTransaction);
}
} else if (method.equals(Request.ACK)) {
System.out.println("Got ack");
}
} else if ((response.getStatusCode() == Response.BUSY_HERE) ||
(response.getStatusCode() == Response.BUSY_EVERYWHERE)) {
hangup();
}
} catch (Exception e) {
BrokerFactory.getLoggingBroker().logError(e);
}
}
示例13: 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());
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);
}
}
示例14: 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();
if(tid != null) {
logger.info("Response received with client transaction id "
+ tid + ":\n" + response.getStatusCode() +
" cseq = " + response.getHeader(CSeqHeader.NAME) +
" dialog " + tid.getDialog());
} else {
logger.info("Response received with client transaction id "
+ tid + ":\n" + response.getStatusCode() +
" cseq = " + response.getHeader(CSeqHeader.NAME) +
" dialog " + responseReceivedEvent.getDialog());
}
// Filter retransmissions for slow machines
if(tid == null) return;
CSeqHeader cseq = (CSeqHeader) response.getHeader( CSeqHeader.NAME );
if (cseq.getMethod().equals(Request.INVITE)) {
try {
sendNotify( response.getStatusCode(), response.getReasonPhrase() );
} catch (Exception e1) {
TestHarness.fail("Failed to send notify, because of " + e1.getMessage());
}
if (response.getStatusCode() == 200 ) {
try {
Request ack = tid.getDialog().createAck( cseq.getSeqNumber() );
tid.getDialog().sendAck( ack );
// kill it right away
if ( tid.getDialog().getState() != DialogState.TERMINATED ) {
Request bye = tid.getDialog()
.createRequest(Request.BYE);
tid.getDialog().sendRequest(
mySipProvider.getNewClientTransaction(bye));
}
} catch (Exception e) {
logger.error("Caught exception",e);
TestHarness.fail("Failed to send BYE request, because of " + e.getMessage());
}
}
}
}
示例15: processResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
public void processResponse(ResponseEvent responseReceivedEvent) {
System.out.println("Shootist : Got a response");
Response response = (Response) responseReceivedEvent.getResponse();
ClientTransaction tid = responseReceivedEvent.getClientTransaction();
CSeqHeader cseq = (CSeqHeader) response.getHeader(CSeqHeader.NAME);
System.out.println("Shootist : Response received : Status Code = "
+ response.getStatusCode() + " " + cseq);
if (tid == null) {
// RFC3261: MUST respond to every 2xx
if (ackRequest!=null && dialog!=null) {
System.out.println("Shootist : re-sending ACK");
try {
dialog.sendAck(ackRequest);
} catch (SipException se) {
se.printStackTrace();
}
}
return;
}
// If the caller is supposed to send the bye
if ( Shootme.callerSendsBye && !byeTaskRunning) {
byeTaskRunning = true;
new Timer().schedule(new ByeTask(dialog), 4000) ;
}
System.out.println("Shootist : transaction state is " + tid.getState());
System.out.println("Shootist : Dialog = " + tid.getDialog());
System.out.println("Shootist : Dialog State is " + tid.getDialog().getState());
try {
if (response.getStatusCode() == Response.OK) {
if (cseq.getMethod().equals(Request.INVITE)) {
System.out.println("Shootist : Dialog after 200 OK " + dialog);
System.out.println("Shootist : Dialog State after 200 OK " + dialog.getState());
ackRequest = dialog.createAck( ((CSeqHeader) response.getHeader(CSeqHeader.NAME)).getSeqNumber() );
System.out.println("Shootist : Sending ACK");
dialog.sendAck(ackRequest);
// JvB: test REFER, reported bug in tag handling
//dialog.sendRequest( sipProvider.getNewClientTransaction( dialog.createRequest("REFER") ));
} 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("Shootist : Sending BYE -- cancel went in too late !!");
Request byeRequest = dialog.createRequest(Request.BYE);
ClientTransaction ct = sipProvider
.getNewClientTransaction(byeRequest);
dialog.sendRequest(ct);
}
}
}
} catch (Exception ex) {
ex.printStackTrace();
System.exit(0);
}
}