webrtc – How to Restrict Video Codecs set in SIP.js to VP8, VP9, and H.264 in Outgoing INVITE?

I have a SIP client application ran in browsers which uses the SIP.js library and I’ve encountered an issue where the default outgoing INVITE message includes all possible video codecs in the m-line, as shown below:

 m=video 32694 UDP/TLS/RTP/SAVPF 96 97 102 103 104 105 106 107 108 109 127 125 39 40 45 46 98 99 100 101 112 113 116 117 118 

For that application, I only need to use three specific video codecs: VP8, VP9, and H.264. How can I configure SIP.js to restrict the codecs to just these three in the outgoing INVITE message? Here’s the relevant part of my current SIP.js configuration:

 let user = new SimpleUser("wss://example.com:8443", {
    aor: "sip:" + username + "@" + UriHost,
    reconnectionDelay: 10,
    media: {
        dataChannel: true,
        answerOptions: {
            iceRestart: true,
            offerToReceiveVideo: true,
            offerToReceiveAudio: true,
        },
        offerOptions: {
            iceRestart: true,
            offerToReceiveVideo: true,
            offerToReceiveAudio: true,
        },
        iceGatheringTimeout: 100,
        constraints: {
            audio: true,
            video: true,
        },
    },
    userAgentOptions: userAgentOptions,
    earlyMedia:true
    sendDTMFUsingSessionDescriptionHandler: true,
    delegate: {
    },
});

I’ve looked through the SIP.js documentation and various examples, but I haven’t been able to find a clear way to achieve this. Any reference to respective functions or code snippets on how to specify the desired codecs would be greatly appreciated.

Read more here: Source link