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


Java SipCallSessionImpl.setLastStatusComment方法代码示例

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


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

示例1: updateSessionFromPj

import com.csipsimple.service.impl.SipCallSessionImpl; //导入方法依赖的package包/类
/**
 * Update the call session infos
 * 
 * @param session The session to update (input/output). Must have a correct
 *            call id set
 * @param service PjSipService Sip service to retrieve pjsip accounts infos
 * @throws SameThreadException
 */
public static void updateSessionFromPj(SipCallSessionImpl session, pjsip_event e, Context context)
        throws SameThreadException {
    Log.d(THIS_FILE, "Update call " + session.getCallId());
    pjsua_call_info pjInfo = new pjsua_call_info();
    int status = pjsua.call_get_info(session.getCallId(), pjInfo);

    if (status == pjsua.PJ_SUCCESS) {
        // Transform pjInfo into CallSession object
        updateSession(session, pjInfo, context);
        
        // Update state here because we have pjsip_event here and can get q.850 state
        if(e != null) {
            // Status code
            int status_code = pjsua.get_event_status_code(e);
            if(status_code == 0) {
                try {
                    status_code = pjInfo.getLast_status().swigValue();
                } catch (IllegalArgumentException err) {
                    // The status code does not exist in enum ignore it
                }
            }
            session.setLastStatusCode(status_code);
            Log.d(THIS_FILE, "Last status code is " + status_code);
            // TODO - get comment from q.850 state as well
            String status_text = PjSipService.pjStrToString(pjInfo.getLast_status_text());
            session.setLastStatusComment(status_text);
            
            // Reason code
            int reason_code = pjsua.get_event_reason_code(e);
            if (reason_code != 0) {
                session.setLastReasonCode(reason_code);
            }
        }
        
        // And now, about secure information
        session.setSignalisationSecure(pjsua.call_secure_sig_level(session.getCallId()));
        String secureInfo = PjSipService.pjStrToString(pjsua.call_secure_media_info(session
                .getCallId()));
        session.setMediaSecureInfo(secureInfo);
        session.setMediaSecure(!TextUtils.isEmpty(secureInfo));
        zrtp_state_info zrtpInfo = pjsua.jzrtp_getInfoFromCall(session.getCallId());
        session.setZrtpSASVerified(zrtpInfo.getSas_verified() == pjsuaConstants.PJ_TRUE);
        session.setHasZrtp(zrtpInfo.getSecure() == pjsuaConstants.PJ_TRUE);

        // About video info
        int vidStreamIdx = pjsua.call_get_vid_stream_idx(session.getCallId());
        if(vidStreamIdx >= 0) {
             int hasVid = pjsua.call_vid_stream_is_running(session.getCallId(), vidStreamIdx, pjmedia_dir.PJMEDIA_DIR_DECODING);
             session.setMediaHasVideo((hasVid == pjsuaConstants.PJ_TRUE));
        }
        

    } else {
        Log.d(THIS_FILE,
                "Call info from does not exists in stack anymore - assume it has been disconnected");
        session.setCallState(pjsip_inv_state.PJSIP_INV_STATE_DISCONNECTED.swigValue());
    }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:67,代码来源:PjSipCalls.java


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