SdpEndpoint.conf for Docker

Hi,

I would like to make dockerized KMS to NOT offer audio in generateOffer. As far as I can see, those settings in /etc/kurento/modules/kurento/SdpEndpoint.conf.json are not exposed to the environment (e.g. there is no KMS_NUM_AUDIO_MEDIAS=0)

What chances do I have to achieve that?

{
    "numAudioMedias": 1,
    "numVideoMedias": 1,
    "audioCodecs": [
        {
            "name": "opus/48000/2",
            "//": "Next is an example about how a codec can be configured.",
            "//": "WARNING: Usage of properties is not yet supported",
            "//properties": {
                "//maxcodedaudiobandwidth": "16000",
                "//maxaveragebitrate": "20000",
                "//stereo": "1",
                "//useinbandfec": "1",
                "//usedtx": "0"
            }
        },
        { "name": "PCMU/8000" },
        { "name": "AMR/8000" }
    ],
    "videoCodecs": [
        { "name": "VP8/90000" },
        { "name": "H264/90000" }
    ]
}

Well, one way would be to enter the docker bash and sed the changes. But is this the way to go?

Read this section of the docs:

https://doc-kurento.readthedocs.io/en/latest/user/faq.html?highlight=Dockerfile#about-using-kurento-with-docker

Perfect. Thanks, Micael. Wondering, why I didn’t find this by myself…

OK, I tested both ways. The “bind” way works for me. The new image creation does not work.

What I did:

  1. Copied the current configuration out of KMS as suggested:
CONTAINER="$(docker create kurento/kurento-media-server:latest)"
docker cp "$CONTAINER":/etc/kurento/. ./etc-kurento
docker rm "$CONTAINER"
  1. Altered ./etc-kurento/modules/kurento/SdpEndpoint.conf.json and set numAudioMedias to 0. This file is changed and still there

  2. Created a Dockerfile and successfully run the build image step

However, my test app shows m=audio in the KMS offer. A quick check of the config file in the new image reveals, that numAudioMedias is 1 in the image…

What am I doing wrong?

Some quotes from the VM where I did that (20.04):

The altered config on the host:

ubuntu@echez:~$ cat etc-kurento/modules/kurento/SdpEndpoint.conf.json 
{
    "numAudioMedias": 0,

The Dockerfile:

ubuntu@echez:~$ cat Dockerfile 
FROM kurento/kurento-media-server:latest
COPY etc-kurento/* /etc/kurento/

The build:

ubuntu@echez:~$ docker build --tag kms-with-my-config:latest .
Sending build context to Docker daemon  5.324GB
Step 1/2 : FROM kurento/kurento-media-server:latest
 ---> 63c5a7f5e0ba
Step 2/2 : COPY etc-kurento/* /etc/kurento/
 ---> Using cache
 ---> d179f54f49d0
Successfully built d179f54f49d0
Successfully tagged kms-with-my-config:latest

The run

ubuntu@echez:~$ docker run -d --name kms --network host kms-with-my-config:latest
c2657d9dd79fbec59cd11bb5331187c212cadcb9513fbd374f625ca12851d5d5

Audio in the offer and in candidates:

a=mid:audio0
a=ssrc:594182210 cname:user1155800972@host-cf79a265
a=ice-ufrag:FDCK
a=ice-pwd:Atz2+ca4U1cKRoFnRjZDYJ
a=fingerprint:sha-256 8D:F3:45:11:78:37:35:EC:EB:59:0B:6D:2C:9A:DA:1D:6D:D6:E0:AD:A2:54:7D:59:2E:DB:3A:EA:AE:68:ED:67
m=video 1 RTP/SAVPF 100 101
b=AS:5000
a=setup:actpass
a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=rtpmap:100 VP8/90000
a=rtpmap:101 H264/90000
a=fmtp:101 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
a=rtcp:9 IN IP4 0.0.0.0
a=rtcp-mux
a=recvonly
a=mid:video0
a=rtcp-fb:100 nack
a=rtcp-fb:100 nack pli
a=rtcp-fb:100 goog-remb
a=rtcp-fb:100 ccm fir
a=rtcp-fb:101 nack
a=rtcp-fb:101 nack pli
a=rtcp-fb:101 ccm fir
a=ssrc:1853686942 cname:user1155800972@host-cf79a265
a=ice-ufrag:FDCK
a=ice-pwd:Atz2+ca4U1cKRoFnRjZDYJ
a=fingerprint:sha-256 8D:F3:45:11:78:37:35:EC:EB:59:0B:6D:2C:9A:DA:1D:6D:D6:E0:AD:A2:54:7D:59:2E:DB:3A:EA:AE:68:ED:67

IceCandidateFound candidate:1 1 UDP 2015363327 192.168.188.67 51593 typ host, sdpMid: audio0
IceCandidateFound candidate:1 1 UDP 2015363327 192.168.188.67 51593 typ host, sdpMid: video0
IceCandidateFound candidate:2 1 TCP 1015021823 192.168.188.67 9 typ host tcptype active, sdpMid: audio0
IceCandidateFound candidate:2 1 TCP 1015021823 192.168.188.67 9 typ host tcptype active, sdpMid: video0
IceCandidateFound candidate:3 1 TCP 1010827519 192.168.188.67 61814 typ host tcptype passive, sdpMid: audio0
IceCandidateFound candidate:3 1 TCP 1010827519 192.168.188.67 61814 typ host tcptype passive, sdpMid: video0

Diving into the image:

ubuntu@echez:~$ docker exec -it kms /bin/bash
root@echez:/# cat /etc/kurento/modules/kurento/SdpEndpoint.conf.json 
{
    "numAudioMedias": 1,
    "numVideoMedias": 1,

Well, I will go with the “bind” option. Maybe something with the fact that I’m running on 20.04. The image stops after a while and my VM is freezing regularly

ubuntu@echez:~$ docker ps -a
CONTAINER ID   IMAGE                       COMMAND            CREATED          STATUS                       PORTS     NAMES
c2657d9dd79f   kms-with-my-config:latest   "/entrypoint.sh"   14 minutes ago   Exited (255) 2 minutes ago             kms

PS: It is also way easier to alter the config then.