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


Java SipCallSessionImpl.setCallState方法代码示例

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


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

示例1: updateSession

import com.csipsimple.service.impl.SipCallSessionImpl; //导入方法依赖的package包/类
/**
 * Copy infos from pjsua call info object to SipCallSession object
 * 
 * @param session the session to copy info to (output)
 * @param pjCallInfo the call info from pjsip
 * @param service PjSipService Sip service to retrieve pjsip accounts infos
 */
private static void updateSession(SipCallSessionImpl session, pjsua_call_info pjCallInfo,
        Context context) {
    // Should be unecessary cause we usually copy infos from a valid
    session.setCallId(pjCallInfo.getId());

    // Nothing to think about here cause we have a
    // bijection between int / state
    session.setCallState(pjCallInfo.getState().swigValue());
    session.setMediaStatus(pjCallInfo.getMedia_status().swigValue());
    session.setRemoteContact(PjSipService.pjStrToString(pjCallInfo.getRemote_info()));
    session.setConfPort(pjCallInfo.getConf_slot());

    // Try to retrieve sip account related to this call
    int pjAccId = pjCallInfo.getAcc_id();
    session.setAccId(PjSipService.getAccountIdForPjsipId(context, pjAccId));

    pj_time_val duration = pjCallInfo.getConnect_duration();
    session.setConnectStart(SystemClock.elapsedRealtime() - duration.getSec() * 1000
            - duration.getMsec());
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:28,代码来源:PjSipCalls.java

示例2: 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.setCallState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。