本文整理汇总了Java中javax.sip.ResponseEvent.getDialog方法的典型用法代码示例。如果您正苦于以下问题:Java ResponseEvent.getDialog方法的具体用法?Java ResponseEvent.getDialog怎么用?Java ResponseEvent.getDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.sip.ResponseEvent
的用法示例。
在下文中一共展示了ResponseEvent.getDialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
public void processResponse(ResponseEvent responseEvent) {
try {
Response response = responseEvent.getResponse();
Dialog dialog = responseEvent.getDialog();
this.lastResponseTable.put(dialog, response);
ServerTransaction serverTransaction = (ServerTransaction)responseEvent.getClientTransaction().getApplicationData();
Request stRequest = serverTransaction.getRequest();
Response newResponse = this.messageFactory.createResponse(response.getStatusCode(),stRequest);
SipProvider provider = (SipProvider)responseEvent.getSource();
SipProvider peerProvider = this.getPeerProvider(provider);
ListeningPoint peerListeningPoint = peerProvider.getListeningPoint("udp");
ContactHeader peerContactHeader = ((ListeningPointExt)peerListeningPoint).createContactHeader();
newResponse.setHeader(peerContactHeader);
serverTransaction.sendResponse(newResponse);
} catch (Exception ex) {
ex.printStackTrace();
BackToBackUserAgentTest.fail("Unexpected exception");
}
}
示例2: processResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
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");
}
}
示例3: processResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
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");
}
}
示例4: processResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
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;
}
}
示例5: processResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
public void processResponse(ResponseEvent responseEvent) {
Dialog dialog = responseEvent.getDialog();
if (dialog != null) {
if (responseEvent.getClientTransaction() == null) {
// retransmission, drop it
return;
}
TestCall call = (TestCall) dialog.getApplicationData();
if (call != null) {
switch (responseEvent.getResponse().getStatusCode()) {
case 100:
// ignore
break;
case 180:
call.process180(responseEvent);
break;
case 200:
call.process200(responseEvent);
break;
default:
System.err.println("Received unexpected sip response: "+responseEvent.getResponse());
dialog.setApplicationData(null);
break;
}
} else {
System.err
.println("Received response on dialog with id that does not matches a active call: "+responseEvent.getResponse());
}
} else {
System.err.println("Received response without dialog: "+responseEvent.getResponse());
}
}
示例6: 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);
}
}
示例7: processResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
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;
}
}
示例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();
RFC5626KeepAliveTest.fail("unexpected exception");
}
timer.schedule(new MyTimerTask(), 1000, 3000);
}
示例9: processResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
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");
}
}
}
示例10: 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");
}
}
示例11: 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");
}
}
示例12: processResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
public void processResponse(ResponseEvent responseEvent) {
try {
Response response = responseEvent.getResponse();
Dialog dialog = responseEvent.getDialog();
this.lastResponseTable.put(dialog, response);
ServerTransaction serverTransaction = (ServerTransaction)responseEvent.getClientTransaction().getApplicationData();
if ( serverTransaction != null ) {
Request stRequest = serverTransaction.getRequest();
Response newResponse = this.messageFactory.createResponse(response.getStatusCode(),stRequest);
SipProvider provider = (SipProvider)responseEvent.getSource();
SipProvider peerProvider = this.getPeerProvider(provider);
ListeningPoint peerListeningPoint = peerProvider.getListeningPoint("udp");
ContactHeader peerContactHeader = ((ListeningPointExt)peerListeningPoint).createContactHeader();
newResponse.setHeader(peerContactHeader);
serverTransaction.sendResponse(newResponse);
if ( ((CSeqHeader)response.getHeader(CSeqHeader.NAME)).getMethod().equals(Request.INVITE) &&
response.getStatusCode() == 200 ) {
Request newRequest = dialog.createRequest(Request.INVITE);
ListeningPointExt listeningPoint = (ListeningPointExt) provider.getListeningPoint("udp");
ContactHeader contact = listeningPoint.createContactHeader();
newRequest.setHeader(contact);
ClientTransaction clientTransaction = provider.getNewClientTransaction(newRequest);
// Send without waiting for ACK.
dialog.sendRequest(clientTransaction);
}
} else {
this.inviteOkSeen = true;
if ( ((CSeqHeader)response.getHeader(CSeqHeader.NAME)).getMethod().equals(Request.INVITE) &&
response.getStatusCode() == 200){
long cseqno = ((CSeqHeader)response.getHeader(CSeqHeader.NAME)).getSeqNumber();
Request ack = dialog.createAck(cseqno);
dialog.sendAck(ack);
} else {
if ( !((CSeqHeader)response.getHeader(CSeqHeader.NAME)).getMethod().equals(Request.INVITE)) {
System.out.println("Unexpected response " + response);
BackToBackUserAgentTest.fail("Unexpected response");
}
}
}
} catch (Exception ex) {
ex.printStackTrace();
BackToBackUserAgentTest.fail("Unexpected exception");
}
}
示例13: processResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
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());
TestHarness.assertNotNull(ackRequest.getHeader(MaxForwardsHeader.NAME));
if (dialog == this.ackedDialog) {
dialog.sendAck(ackRequest);
return;
}
this.forkedDialogs.add(dialog);
new AckSender(ackRequest, dialog).sendAck();
} 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);
}
}
示例14: processResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
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("SHOOTIST: Dialog state is " + dialog.getState());
try {
if (response.getStatusCode() == Response.OK) {
if (cseq.getMethod().equals(Request.INVITE)) {
/*
* Can get a late arriving response.
*/
// TestHarness.assertEquals( DialogState.CONFIRMED, dialog.getState());
Request ackRequest = dialog.createAck(cseq
.getSeqNumber());
TestHarness.assertNotNull( ackRequest.getHeader( MaxForwardsHeader.NAME ) );
// Proxy will fork. I will accept the second dialog
// but not the first.
this.forkedDialogs.add(dialog);
logger.info("Sending ACK");
dialog.sendAck(ackRequest);
if ( dialog.getState() == DialogState.TERMINATED ) {
return;
}
if ( forkedDialogs.size() == 2 ) {
TestHarness.assertTrue(
"Dialog state should be CONFIRMED", dialog
.getState() == DialogState.CONFIRMED);
this.ackedDialog = dialog;
// TestHarness.assertNotNull( "JvB: Need CT to find original dialog", tid );
} else {
// Kill the first dialog by sending a bye.
SipProvider sipProvider = (SipProvider) responseReceivedEvent
.getSource();
Request byeRequest = dialog.createRequest(Request.BYE);
ClientTransaction ct = sipProvider
.getNewClientTransaction(byeRequest);
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);
}
}
示例15: processResponse
import javax.sip.ResponseEvent; //导入方法依赖的package包/类
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);
}
}