sound_port.c EC suspended because of inactivity PjSip 2.8 on Android

DD
Dariusch Dideban
Tue, May 14, 2019 2:20 PM

We are developing a Void-Application for Android using PjSip 2.8 with openssl. On some devices we encounter the following problem: After successfully establishing a sip call the participants can’t hear each other. Whenever this happens the following message appears in the Log:

“sound_port.c EC suspended because of inactivity”

On devices where the participants can hear each other this message is followed by:

"sound_port.c EC activated"

This message does not appear on the affected devices or it appears but with a delay of a minute or even more.

For activating the sound port we use following code, which we took from the Pjsip sample Application:

@Override
public void onCallMediaState(OnCallMediaStateParam prm) {
CallInfo ci;
try {
ci = getInfo();
} catch (Exception e) {
return;
}

CallMediaInfoVector cmiv = ci.getMedia();

for (int i = 0; i < cmiv.size(); i++) {
    CallMediaInfo cmi = cmiv.get(i);
    if (cmi.getType() == pjmedia_type.PJMEDIA_TYPE_AUDIO &&
            (cmi.getStatus() ==
                    pjsua_call_media_status.PJSUA_CALL_MEDIA_ACTIVE ||
                    cmi.getStatus() ==
                            pjsua_call_media_status.PJSUA_CALL_MEDIA_REMOTE_HOLD)) {
        // unfortunately, on Java too, the returned Media cannot be
        // downcasted to AudioMedia
        Media m = getMedia(i);
        AudioMedia am = AudioMedia.typecastFromMedia(m);

        // connect ports
        try {
            MyApp.ep.audDevManager().getCaptureDevMedia().
                    startTransmit(am);
            am.startTransmit(MyApp.ep.audDevManager().
                    getPlaybackDevMedia());
        } catch (Exception e) {
            continue;
        }
    } else if (cmi.getType() == pjmedia_type.PJMEDIA_TYPE_VIDEO &&
            cmi.getStatus() ==
                    pjsua_call_media_status.PJSUA_CALL_MEDIA_ACTIVE &&
            cmi.getVideoIncomingWindowId() != pjsua2.INVALID_ID) {
        vidWin = new VideoWindow(cmi.getVideoIncomingWindowId());
        vidPrev = new VideoPreview(cmi.getVideoCapDev());
    }
}

MyApp.observer.notifyCallMediaState(this);

}

Like i said this code seems to work on some devices, on other devices it sadly doesn’t (reliably). Any help is appreciated!

Greets!

We are developing a Void-Application for Android using PjSip 2.8 with openssl. On some devices we encounter the following problem: After successfully establishing a sip call the participants can’t hear each other. Whenever this happens the following message appears in the Log: “sound_port.c EC suspended because of inactivity” On devices where the participants can hear each other this message is followed by: "sound_port.c EC activated" This message does not appear on the affected devices or it appears but with a delay of a minute or even more. For activating the sound port we use following code, which we took from the Pjsip sample Application: @Override public void onCallMediaState(OnCallMediaStateParam prm) { CallInfo ci; try { ci = getInfo(); } catch (Exception e) { return; } CallMediaInfoVector cmiv = ci.getMedia(); for (int i = 0; i < cmiv.size(); i++) { CallMediaInfo cmi = cmiv.get(i); if (cmi.getType() == pjmedia_type.PJMEDIA_TYPE_AUDIO && (cmi.getStatus() == pjsua_call_media_status.PJSUA_CALL_MEDIA_ACTIVE || cmi.getStatus() == pjsua_call_media_status.PJSUA_CALL_MEDIA_REMOTE_HOLD)) { // unfortunately, on Java too, the returned Media cannot be // downcasted to AudioMedia Media m = getMedia(i); AudioMedia am = AudioMedia.typecastFromMedia(m); // connect ports try { MyApp.ep.audDevManager().getCaptureDevMedia(). startTransmit(am); am.startTransmit(MyApp.ep.audDevManager(). getPlaybackDevMedia()); } catch (Exception e) { continue; } } else if (cmi.getType() == pjmedia_type.PJMEDIA_TYPE_VIDEO && cmi.getStatus() == pjsua_call_media_status.PJSUA_CALL_MEDIA_ACTIVE && cmi.getVideoIncomingWindowId() != pjsua2.INVALID_ID) { vidWin = new VideoWindow(cmi.getVideoIncomingWindowId()); vidPrev = new VideoPreview(cmi.getVideoCapDev()); } } MyApp.observer.notifyCallMediaState(this); } Like i said this code seems to work on some devices, on other devices it sadly doesn’t (reliably). Any help is appreciated! Greets!