androidwebrtcsippjsippjsua2

PJSUA2: Error creating SDP answer: SRTP crypto attribute required


I'm trying to use the latest version of pjsip for android https://github.com/VoiSmart/pjsip-android.

And got an error for incoming call:

Error creating SDP answer: SRTP crypto attribute required (PJMEDIA_SRTP_ESDPREQCRYPTO) [status=220228]
inv0x78653290a8  .Sending Response msg 406/INVITE/cseq=47488686 (tdta0x78bfbcf0a8)

Account configuration for use srtp

    SrtpOpt opt = new SrtpOpt();
    IntVector optVector = new IntVector();
    optVector.add(pjmedia_srtp_keying_method.PJMEDIA_SRTP_KEYING_DTLS_SRTP);
    optVector.add(pjmedia_srtp_keying_method.PJMEDIA_SRTP_KEYING_SDES);
    opt.setKeyings(optVector);

    accCfg.getMediaConfig().setSrtpOpt(opt);

    accCfg.getMediaConfig().setSrtpUse(pjmedia_srtp_use.PJMEDIA_SRTP_OPTIONAL);
    accCfg.getMediaConfig().setRtcpMuxEnabled(true);
    accCfg.getMediaConfig().setSrtpSecureSignaling(0);

Looks like that missed a=crypto: attribute in sdp, but I don't understand how to include it.

However, old version that we used before - works and I don't understand the reason.

And I think if error in creating SDP answer then maybe problem is in incoming sdp. Is it client or server problem?

Please, help me resolve it.


Solution

  • It was a server problem. Works well after upgrade server and add a=crypto attribute into SDP.