Closed MayamaTakeshi closed 10 months ago
Documentation is good: https://docs.pjsip.org/en/latest/specific-guides/security/srtp.html This example app requires the SRTP keys to be passed to the app: https://github.com/pjsip/pjproject/blob/master/pjsip-apps/src/samples/streamutil.c I think we should create the keys ourselves and set them in the a=crypto fields:
m=audio 59454 RTP/SAVP 3 18 101
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:k436fLbKPMbchV79TI5yRLTxtPHG08jvl12DKWNg
a=crypto:2 AES_CM_128_HMAC_SHA1_32 inline:gabwSsJ598QLtWzFOv/psvxcfFy7iWXBBrcmUO1O
So we might go with:
[
{
type: 'audio',
fields: [
"a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:k436fLbKPMbchV79TI5yRLTxtPHG08jvl12DKWNg",
"a=crypto:2 AES_CM_128_HMAC_SHA1_32 inline:gabwSsJ598QLtWzFOv/psvxcfFy7iWXBBrcmUO1O"
]
}
]
Done. For now, we will just allow to specify if the media (currently, only for audio) should be secure or not:
media: [
{
type: 'audio',
secure: true,
},
]
See samples/srtp.js.
We already link to pjmedia with SRTP support but we need to actually use it when setting up calls. This might go in the media description with a new parameter "secure" (that could be set to "true" or specifying which ciphers to offer/accept).
Or maybe for flexibility we should just use a=crypto in the fields:
(however, we cannot set anything. It must be what libsrtp/pjmedia supports).