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


Java SipCallSessionImpl类代码示例

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


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

示例1: getCalls

import com.csipsimple.service.impl.SipCallSessionImpl; //导入依赖的package包/类
/**
 * Get list of calls session available.
 * 
 * @return List of calls.
 */
public SipCallSessionImpl[] getCalls() {
    if (callsList != null) {
        List<SipCallSessionImpl> calls = new ArrayList<SipCallSessionImpl>();

        synchronized (callsList) {
            for (int i = 0; i < callsList.size(); i++) {
                SipCallSessionImpl callInfo = getCallInfo(i);
                if (callInfo != null) {
                    calls.add(callInfo);
                }
            }
        }
        return calls.toArray(new SipCallSessionImpl[calls.size()]);
    }
    return new SipCallSessionImpl[0];
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:22,代码来源:UAStateReceiver.java

示例2: 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

示例3: getCallInfo

import com.csipsimple.service.impl.SipCallSessionImpl; //导入依赖的package包/类
/**
 * Get call info for a given call id.
 * 
 * @param callId the id of the call we want infos for
 * @return the call session infos.
 */
public SipCallSessionImpl getCallInfo(Integer callId) {
    SipCallSessionImpl callInfo;
    synchronized (callsList) {
        callInfo = callsList.get(callId, null);
    }
    return callInfo;
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:14,代码来源:UAStateReceiver.java

示例4: updateRecordingStatus

import com.csipsimple.service.impl.SipCallSessionImpl; //导入依赖的package包/类
/**
 * Update status of call recording info in call session info
 * 
 * @param callId The call id to modify
 * @param canRecord if we can now record the call
 * @param isRecording if we are currently recording the call
 */
public void updateRecordingStatus(int callId, boolean canRecord, boolean isRecording) {
    SipCallSessionImpl callInfo = getCallInfo(callId);
    callInfo.setCanRecord(canRecord);
    callInfo.setIsRecording(isRecording);
    synchronized (callsList) {
        // Re-add it just to be sure
        callsList.put(callId, callInfo);
    }
    onBroadcastCallState(callInfo);
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:18,代码来源:UAStateReceiver.java

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