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


Java SIPResponse.setReasonPhrase方法代码示例

本文整理汇总了Java中gov.nist.javax.sip.message.SIPResponse.setReasonPhrase方法的典型用法代码示例。如果您正苦于以下问题:Java SIPResponse.setReasonPhrase方法的具体用法?Java SIPResponse.setReasonPhrase怎么用?Java SIPResponse.setReasonPhrase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gov.nist.javax.sip.message.SIPResponse的用法示例。


在下文中一共展示了SIPResponse.setReasonPhrase方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendBadRequestResponse

import gov.nist.javax.sip.message.SIPResponse; //导入方法依赖的package包/类
/**
 * Send a BAD REQUEST response.
 * 
 * @param sipRequest
 * @param transaction
 * @param reasonPhrase
 */

private void sendBadRequestResponse(SIPRequest sipRequest,
        SIPServerTransaction transaction, String reasonPhrase) {
    if (transaction.getState() != TransactionState.TERMINATED) {

        SIPResponse sipResponse = sipRequest
                .createResponse(Response.BAD_REQUEST);
        if (reasonPhrase != null)
            sipResponse.setReasonPhrase(reasonPhrase);
        ServerHeader serverHeader = MessageFactoryImpl
                .getDefaultServerHeader();
        if (serverHeader != null) {
            sipResponse.setHeader(serverHeader);
        }
        try {
            if (sipRequest.getMethod().equals(Request.INVITE)) {
                sipStack.addTransactionPendingAck(transaction);
            }
            transaction.sendResponse(sipResponse);
            transaction.releaseSem();
        } catch (Exception ex) {
            logger.logError(
                    "Problem sending error response", ex);
            transaction.releaseSem();
            sipStack.removeTransaction(transaction);

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

示例2: sendServerInternalErrorResponse

import gov.nist.javax.sip.message.SIPResponse; //导入方法依赖的package包/类
/**
 * Send back an error Response.
 * 
 * @param sipRequest
 * @param transaction
 */

private void sendServerInternalErrorResponse(SIPRequest sipRequest,
        SIPServerTransaction transaction) {
    if (transaction.getState() != TransactionState.TERMINATED) {
        if (logger.isLoggingEnabled(LogWriter.TRACE_DEBUG))
            logger.logDebug(
                    "Sending 500 response for out of sequence message");
        SIPResponse sipResponse = sipRequest
                .createResponse(Response.SERVER_INTERNAL_ERROR);
        sipResponse.setReasonPhrase("Request out of order");
        if (MessageFactoryImpl.getDefaultServerHeader() != null) {
            ServerHeader serverHeader = MessageFactoryImpl
                    .getDefaultServerHeader();
            sipResponse.setHeader(serverHeader);
        }

        try {
            RetryAfter retryAfter = new RetryAfter();
            retryAfter.setRetryAfter(10);
            sipResponse.setHeader(retryAfter);
            sipStack.addTransactionPendingAck(transaction);
            transaction.sendResponse(sipResponse);
            transaction.releaseSem();
        } catch (Exception ex) {
            logger.logError("Problem sending response",
                    ex);
            transaction.releaseSem();
            sipStack.removeTransaction(transaction);
        }
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:38,代码来源:DialogFilter.java


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