本文整理汇总了Java中javax.sip.header.CSeqHeader类的典型用法代码示例。如果您正苦于以下问题:Java CSeqHeader类的具体用法?Java CSeqHeader怎么用?Java CSeqHeader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CSeqHeader类属于javax.sip.header包,在下文中一共展示了CSeqHeader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process200
import javax.sip.header.CSeqHeader; //导入依赖的package包/类
public void process200(ResponseEvent responseEvent) {
try {
final CSeqHeader cSeqHeader = (CSeqHeader) responseEvent.getResponse().getHeader(CSeqHeader.NAME);
if (cSeqHeader.getMethod().equals(Request.INVITE)) {
processInvite200(responseEvent,cSeqHeader);
}
else if (cSeqHeader.getMethod().equals(Request.BYE)) {
processBye200(responseEvent);
}
else {
System.err.println("Unexpected response: "+responseEvent.getResponse());
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
示例2: getHeadersToOmmitOnResponseCopy
import javax.sip.header.CSeqHeader; //导入依赖的package包/类
private static Set<String> getHeadersToOmmitOnResponseCopy() {
if (HEADERS_TO_OMMIT_ON_RESPONSE_COPY == null) {
final Set<String> set = new HashSet<String>();
set.add(RouteHeader.NAME);
set.add(RecordRouteHeader.NAME);
set.add(ViaHeader.NAME);
set.add(CallIdHeader.NAME);
set.add(CSeqHeader.NAME);
set.add(ContactHeader.NAME);
set.add(FromHeader.NAME);
set.add(ToHeader.NAME);
set.add(ContentLengthHeader.NAME);
HEADERS_TO_OMMIT_ON_RESPONSE_COPY = Collections.unmodifiableSet(set);
}
return HEADERS_TO_OMMIT_ON_RESPONSE_COPY;
}
示例3: sendMultipleContactRegistration
import javax.sip.header.CSeqHeader; //导入依赖的package包/类
public void sendMultipleContactRegistration() throws Exception {
Address fromAddress = addressFactory.createAddress("[email protected]:5070");
ContactHeader contactHeader1 = headerFactory.createContactHeader(addressFactory.createAddress("sip:[email protected]:5070"));
ContactHeader contactHeader2 = headerFactory.createContactHeader(addressFactory.createAddress("sip:[email protected]:5080"));
CallIdHeader callId = provider.getNewCallId();
CSeqHeader cSeq = headerFactory.createCSeqHeader(1l, Request.REGISTER);
FromHeader from = headerFactory.createFromHeader(fromAddress, "1234");
ToHeader to = headerFactory.createToHeader(addressFactory.createAddress("[email protected]"+host+":"+SERVER_PORT), null);
List via = Arrays.asList(((ListeningPointImpl)provider.getListeningPoint(testProtocol)).getViaHeader());
MaxForwardsHeader maxForwards = headerFactory.createMaxForwardsHeader(10);
URI requestURI = addressFactory.createURI("sip:[email protected]"+host+":"+SERVER_PORT);
Request request = messageFactory.createRequest(requestURI, Request.REGISTER, callId, cSeq, from, to, via, maxForwards);
request.setRequestURI(requestURI);
request.addHeader(contactHeader1);
request.addHeader(contactHeader2);
ClientTransaction ctx = this.provider.getNewClientTransaction(request);
ctx.sendRequest();
}
示例4: processResponse
import javax.sip.header.CSeqHeader; //导入依赖的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);
}
}
示例5: processResponse
import javax.sip.header.CSeqHeader; //导入依赖的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);
}
}
示例6: processResponse
import javax.sip.header.CSeqHeader; //导入依赖的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);
}
}
示例7: processResponse
import javax.sip.header.CSeqHeader; //导入依赖的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);
}
}
示例8: processResponse
import javax.sip.header.CSeqHeader; //导入依赖的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);
}
}
示例9: processResponse
import javax.sip.header.CSeqHeader; //导入依赖的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");
}
}
示例10: processResponse
import javax.sip.header.CSeqHeader; //导入依赖的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");
}
}
示例11: sendInviteWithRPort
import javax.sip.header.CSeqHeader; //导入依赖的package包/类
public void sendInviteWithRPort() throws Exception {
Address fromAddress = addressFactory.createAddress("[email protected]:5070");
ContactHeader contactHeader1 = headerFactory.createContactHeader(addressFactory.createAddress("sip:[email protected]:5070"));
ContactHeader contactHeader2 = headerFactory.createContactHeader(addressFactory.createAddress("sip:[email protected]:5080"));
CallIdHeader callId = provider.getNewCallId();
CSeqHeader cSeq = headerFactory.createCSeqHeader(1l, Request.INVITE);
FromHeader from = headerFactory.createFromHeader(fromAddress, "1234");
ToHeader to = headerFactory.createToHeader(addressFactory.createAddress("[email protected]"+host+":"+SERVER_PORT), null);
ViaHeader via = ((ListeningPointImpl)provider.getListeningPoint(testProtocol)).getViaHeader();
via.setRPort();
List vias = Arrays.asList(via);
MaxForwardsHeader maxForwards = headerFactory.createMaxForwardsHeader(10);
URI requestURI = addressFactory.createURI("sip:[email protected]"+host+":"+SERVER_PORT);
Request request = messageFactory.createRequest(requestURI, Request.INVITE, callId, cSeq, from, to, vias, maxForwards);
System.out.println(request);
assertTrue(request.toString().indexOf("rport=") == -1);
request.setRequestURI(requestURI);
request.addHeader(contactHeader1);
request.addHeader(contactHeader2);
ClientTransaction ctx = this.provider.getNewClientTransaction(request);
ctx.sendRequest();
}
示例12: processAck
import javax.sip.header.CSeqHeader; //导入依赖的package包/类
/**
* Process the ACK request. Send the bye and complete the call flow.
*/
public void processAck(RequestEvent requestEvent,
ServerTransaction serverTransaction) {
try {
this.ackReceived = true;
System.out.println("Got an ACK! ");
System.out.println("Dialog State = " + dialog.getState());
SipProvider provider = (SipProvider) requestEvent.getSource();
Request messageRequest = dialog.createRequest(Request.MESSAGE);
CSeqHeader cseq = (CSeqHeader)messageRequest.getHeader(CSeqHeader.NAME);
// We will test if the CSEq validation is off by sending CSeq 1 again
ClientTransaction ct = provider
.getNewClientTransaction(messageRequest);
cseq.setSeqNumber(1);
ct.sendRequest();
} catch (Exception ex) {
ex.printStackTrace();
}
}
示例13: processResponse
import javax.sip.header.CSeqHeader; //导入依赖的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;
}
}
示例14: processAck
import javax.sip.header.CSeqHeader; //导入依赖的package包/类
public void processAck(RequestEvent requestEvent, ServerTransaction serverTransaction) {
SipProvider sipProvider = (SipProvider) requestEvent.getSource();
try {
logger.info("shootme: got an ACK " + requestEvent.getRequest());
CSeqHeader cseq = (CSeqHeader) requestEvent.getRequest().getHeader(CSeqHeader.NAME);
if(cseq.getSeqNumber() == 2) this.ack2Received = true;
/* int ackCount = ((ApplicationData) dialog.getApplicationData()).ackCount;*/
dialog = inviteTid.getDialog();
Thread.sleep(1000);
logger.info("shootme is sending RE INVITE now");
System.out.println("Got an ACK " );
this.reInviteCount++;
this.sendReInvite(sipProvider);
} catch (Exception ex) {
String s = "Unexpected error";
logger.error(s, ex);
ReInviteInfoAckOverlapTest.fail(s);
}
}
示例15: processResponse
import javax.sip.header.CSeqHeader; //导入依赖的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());
}