当前位置: 首页>>代码示例>>Java>>正文


Java Response.BUSY_HERE属性代码示例

本文整理汇总了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");
    }

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:58,代码来源:ReInviteBusyTest.java


注:本文中的javax.sip.message.Response.BUSY_HERE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。