本文整理汇总了Java中javax.sip.message.Response.BUSY_HERE属性的典型用法代码示例。如果您正苦于以下问题:Java Response.BUSY_HERE属性的具体用法?Java Response.BUSY_HERE怎么用?Java Response.BUSY_HERE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.sip.message.Response
的用法示例。
在下文中一共展示了Response.BUSY_HERE属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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 {
if (response.getStatusCode() == Response.OK
&& ((CSeqHeader) response.getHeader(CSeqHeader.NAME)).getMethod().equals(
Request.INVITE)) {
// Request cancel = inviteTid.createCancel();
// ClientTransaction ct =
// sipProvider.getNewClientTransaction(cancel);
Dialog dialog = tid.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);
Thread.sleep(100);
Request inviteRequest = dialog.createRequest(Request.INVITE);
((SipURI) inviteRequest.getRequestURI()).removeParameter("transport");
((ViaHeader) inviteRequest.getHeader(ViaHeader.NAME)).setTransport("udp");
inviteRequest.addHeader(contactHeader);
MaxForwardsHeader mf = protocolObjects.headerFactory
.createMaxForwardsHeader(10);
inviteRequest.addHeader(mf);
ClientTransaction ct = provider.getNewClientTransaction(inviteRequest);
dialog.sendRequest(ct);
reInviteCount++;
logger.info("RE-INVITE sent");
} else if (response.getStatusCode() == Response.BUSY_HERE) {
this.busyHereReceived = true;
TestCase.assertEquals("Dialog State must be CONFIRMED", dialog.getState(), DialogState.CONFIRMED);
}
} catch (Exception ex) {
ex.printStackTrace();
logger.error(ex);
ReInviteBusyTest.fail("unexpceted exception");
}
}