Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codec Preference Selection Not Supported in JsSIP #866

Open
chandrarishabh opened this issue Sep 10, 2024 · 4 comments
Open

Codec Preference Selection Not Supported in JsSIP #866

chandrarishabh opened this issue Sep 10, 2024 · 4 comments

Comments

@chandrarishabh
Copy link

Description

Currently, JsSIP does not provide a way to set or prioritize specific codecs during the SIP negotiation process. This is a crucial feature for optimizing call quality and adapting to different network conditions. Without the ability to select or prioritize codecs, users have limited control over how media is transmitted, potentially leading to suboptimal call quality or compatibility issues with certain systems.

Expected Behavior

JsSIP should expose a method or option that allows users to:
Set codec preferences (e.g., Opus, G.711, G.729, etc.).
Prioritize codecs by defining an order of preference, which would then be reflected in the SDP offer/answer.

Actual Behavior:

JsSIP currently selects codecs without providing a mechanism to modify the codec order or preference. Users cannot influence which codecs are prioritized during SDP negotiation.

Suggested Enhancement

Add a method (e.g., setCodecPreferences()) that allows developers to define the desired codec order for SIP sessions.
Allow this method to take an array of codec identifiers (such as payload types or names), which would then be used to construct the SDP. Ensure that this functionality works for both audio and video codecs.

Example Usage

const codecPreferences: ['opus/48000/2', 'PCMU/8000', 'PCMA/8000'];

session.answer({
mediaConstraints,
pcConfig,
rtcOfferConstraints: {
 offerToReceiveAudio: true,
 offerToReceiveVideo: false,
codecPreferences
}
})

This would result in the SDP offer being constructed with the specified codecs in the preferred order.

Impact

This enhancement would significantly improve the flexibility and performance of JsSIP in various network conditions and across different SIP systems by allowing developers to fine-tune the media negotiation process.

@chandrarishabh
Copy link
Author

chandrarishabh commented Sep 10, 2024

Let me know if you guys think this feature aligns with vision of JsSIP as a library, will be happy to raise a pull request for the same.

@ibc @jmillan

@ROBERT-MCDOWELL
Copy link

would be nice

@AlijiEmmanuel-dev
Copy link

AlijiEmmanuel-dev commented Sep 11, 2024 via email

@chandrarishabh
Copy link
Author

yes, we can handle that as well.
Browser has API for getting all the supported codecs. We can handle that gracefully and only honour those which are actually supported by the client browser.

I will raise a pull request for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants