Search in sources :

Example 1 with EpConfig

use of org.pjsip.pjsua2.EpConfig in project vialer-android by VoIPGRID.

the class SipConfig method createMediaConfig.

/**
 * Create the MediaConfig with echo cancellation settings.
 * @param endpointConfig
 * @return
 */
private MediaConfig createMediaConfig(EpConfig endpointConfig) {
    MediaConfig mediaConfig = endpointConfig.getMedConfig();
    mediaConfig.setEcOptions(SipConstants.WEBRTC_ECHO_CANCELLATION);
    mediaConfig.setEcTailLen(SipConstants.ECHO_CANCELLATION_TAIL_LENGTH);
    return mediaConfig;
}
Also used : MediaConfig(org.pjsip.pjsua2.MediaConfig)

Example 2 with EpConfig

use of org.pjsip.pjsua2.EpConfig in project vialer-android by VoIPGRID.

the class SipConfig method setSipLogging.

/**
 * Configure the logger for the PJSIP library.
 * @param endpointConfig
 */
private void setSipLogging(EpConfig endpointConfig) {
    endpointConfig.getLogConfig().setLevel(SipConstants.SIP_LOG_LEVEL);
    endpointConfig.getLogConfig().setConsoleLevel(SipConstants.SIP_CONSOLE_LOG_LEVEL);
    LogConfig logConfig = endpointConfig.getLogConfig();
    mSipLogWriter = new SipLogWriter();
    mSipLogWriter.enabledRemoteLogging(mRemoteLogger);
    logConfig.setWriter(mSipLogWriter);
    logConfig.setDecor(logConfig.getDecor() & ~(pj_log_decoration.PJ_LOG_HAS_CR.swigValue() | pj_log_decoration.PJ_LOG_HAS_NEWLINE.swigValue()));
}
Also used : LogConfig(org.pjsip.pjsua2.LogConfig)

Example 3 with EpConfig

use of org.pjsip.pjsua2.EpConfig in project vialer-android by VoIPGRID.

the class SipConfig method createEndpoint.

/**
 * Create the Endpoint and init/start the Endpoint.
 * @return
 * @throws LibraryInitFailedException
 */
private Endpoint createEndpoint() throws LibraryInitFailedException {
    mRemoteLogger.d("createEndpoint");
    Endpoint endpoint = new Endpoint();
    EpConfig endpointConfig = new EpConfig();
    // Set echo cancellation options for endpoint.
    MediaConfig mediaConfig = createMediaConfig(endpointConfig);
    endpointConfig.setMedConfig(mediaConfig);
    try {
        endpoint.libCreate();
    } catch (Exception e) {
        Log.e(TAG, "Unable to create the PJSIP library");
        mRemoteLogger.e("" + Log.getStackTraceString(e));
        e.printStackTrace();
        throw new LibraryInitFailedException();
    }
    if (BuildConfig.DEBUG || mSipService.getPreferences().remoteLoggingIsActive()) {
        setSipLogging(endpointConfig);
    }
    UaConfig uaConfig = endpointConfig.getUaConfig();
    uaConfig.setUserAgent(getUserAgentHeader(mSipService));
    configureStunServer(uaConfig);
    try {
        endpoint.libInit(endpointConfig);
    } catch (Exception e) {
        Log.e(TAG, "Unable to init the PJSIP library");
        mRemoteLogger.e("" + Log.getStackTraceString(e));
        e.printStackTrace();
        throw new LibraryInitFailedException();
    }
    TransportConfig transportConfig = createTransportConfig();
    try {
        mCurrentTransportId = endpoint.transportCreate(getTransportType(), transportConfig);
        endpoint.libStart();
    } catch (Exception exception) {
        Log.e(TAG, "Unable to start the PJSIP library");
        mRemoteLogger.e("" + Log.getStackTraceString(exception));
        throw new LibraryInitFailedException();
    }
    return endpoint;
}
Also used : EpConfig(org.pjsip.pjsua2.EpConfig) Endpoint(org.pjsip.pjsua2.Endpoint) UaConfig(org.pjsip.pjsua2.UaConfig) MediaConfig(org.pjsip.pjsua2.MediaConfig) TransportConfig(org.pjsip.pjsua2.TransportConfig)

Aggregations

MediaConfig (org.pjsip.pjsua2.MediaConfig)2 Endpoint (org.pjsip.pjsua2.Endpoint)1 EpConfig (org.pjsip.pjsua2.EpConfig)1 LogConfig (org.pjsip.pjsua2.LogConfig)1 TransportConfig (org.pjsip.pjsua2.TransportConfig)1 UaConfig (org.pjsip.pjsua2.UaConfig)1