Genesys Cloud - Developer Community!

 View Only

Sign Up

  • 1.  Audio quality degradation in softphones using the WebRTC SDK

    Posted 13 days ago

    We have developed a softphone utilizing the `genesys-cloud-webrtc-sdk`.
    When making an external call using this softphone, we encountered a specific issue: if the external party's environment contained significant background noise, the audio from our operator (OP) side during the initial 10 seconds of the call would intermittently drop in volume or cut out, making it difficult to hear.
    After the initial 10-second period had elapsed, the audio from the OP side returned to normal; furthermore, the audio from the external party remained clear and problem-free throughout the entire call.
    Playback of the corresponding Genesys Cloud call recording files reveals the exact same audio anomalies.

    We tested the SDK's audio-related parameters using the following configurations:
    ・Automatic Gain Control: ON, Echo Cancellation: OFF, Noise Suppression: OFF
    ・Automatic Gain Control: OFF, Echo Cancellation: ON, Noise Suppression: OFF

    Notably, this issue does not occur when using the standard Genesys Cloud softphone-which operates directly within a web browser-as opposed to the custom softphone we developed.
    Furthermore, if we make a call using the standard Genesys Cloud softphone immediately before making a call with our custom softphone, the issue does not manifest. However, if we then proceed to make a second consecutive call using our custom softphone, the issue reappears.

    Is anyone familiar with similar occurrences or symptoms? Additionally, does anyone know of a potential solution to this problem?


    #EmbeddableFramework
    #PlatformSDK

    ------------------------------
    Masahiro Shioi
    なし
    ------------------------------


  • 2.  RE: Audio quality degradation in softphones using the WebRTC SDK

    Posted 12 days ago

    Hi Masahiro,

    This behavior looks like a WebRTC audio processing "warm-up" issue, especially related to AGC/VAD reacting to strong background noise at the start of the call.

    Key clues:

    • Only happens during the first ~10 seconds
    • Recorded audio shows the same issue → it's client-side processing
    • Doesn't happen after using the Genesys softphone → likely better initialization

    Some things you can try:

    • Force explicit audio constraints in getUserMedia (enable/disable AGC/NS/EC explicitly)
    • Always create a new media stream per call and fully stop tracks after each call
    • Reset any AudioContext if used
    • Add a short mic "warm-up" (2–3s) before starting the call

    Most likely cause is audio processing ramp-up or incomplete media reinitialization between calls.

    Hope this helps 👍



    ------------------------------
    Cesar Padilla
    INDRA COLOMBIA
    ------------------------------



  • 3.  RE: Audio quality degradation in softphones using the WebRTC SDK

    Posted 11 days ago

    Hi, Cesar,
    Thank you for your comment.

    I would like to share what I have discovered since my last update.

    Currently, I am setting values ​​during the SDK initialization phase as follows:

    const defaults = {
    micAutoGainControl: { exact: true },
    echoCancellation: { exact: false },
    noiseSuppression: { exact: false }
    };
    :
    :
    async start(accessToken, environment) {
    this.accessToken = accessToken;
    try {
    // Initialize the Genesys Cloud WebRTC SDK
    // https://github.com/MyPureCloud/genesys-cloud-webrtc-sdk/blob/develop/doc/index.md#constructor
    let webrtc_sdk = new window.GenesysCloudWebrtcSdk.GenesysCloudWebrtcSdk({
    environment: environment,
    accessToken: accessToken,
    defaults: defaults,
    });

    While changing the `micAutoGainControl` value between `true` and `false` does alter the audio output during a call,
    it appears that changing the values ​​for `echoCancellation` and `noiseSuppression` between `true` and `false` does *not* affect the audio output during a call.

    Although I previously stated, "this issue does not occur when using the standard Genesys Cloud softphone-which operates directly within a web browser"
    I have since found that the phenomenon *does* occur when `micAutoGainControl`, `echoCancellation`, and `noiseSuppression` are all enabled;
    conversely, the phenomenon does *not* occur when only `micAutoGainControl` is enabled.

    Therefore, I hypothesized that if I were to disable both `micAutoGainControl` and `noiseSuppression` within the SDK settings,
    the phenomenon would cease to occur.

    Could you please tell me how I can go about disabling `micAutoGainControl` and `noiseSuppression`?



    ------------------------------
    Masahiro Shioi
    なし
    ------------------------------



  • 4.  RE: Audio quality degradation in softphones using the WebRTC SDK

    Posted 11 days ago
    Edited by Cesar Padilla 11 days ago

    Hi Masahiro,

    Great findings - that actually helps narrow it down a lot 👍

    From what you describe, it looks like echoCancellation and noiseSuppression are not being fully controlled by the SDK defaults, which is a known limitation. In many cases, these constraints are ultimately enforced by the browser's WebRTC engine, not just the SDK config.

    To properly disable micAutoGainControl and noiseSuppression, you should:

    1. Set them explicitly in defaults

    JavaScript
    const defaults = {
    micAutoGainControl: { exact: false },
    echoCancellation: { exact: false },
    noiseSuppression: { exact: false }
    };

    2. But more importantly → enforce it at getUserMedia level

    If the SDK allows overriding or injecting constraints, make sure you're effectively applying:

    JavaScript
    audio: {
    autoGainControl: false,
    noiseSuppression: false,
    echoCancellation: false
    }

    👉 This is key because SDK-level settings alone may not override browser defaults.


    Important insight from your test

    What you observed strongly suggests:

    • The issue is triggered when AGC + Noise Suppression interact
    • When only AGC is ON → behavior is stable
    • When multiple processors are ON → WebRTC overreacts to background noise (especially at call start)

    Recommendation

    Try forcing:

    • autoGainControl: false
    • noiseSuppression: false
    • Leave echoCancellation depending on your use case

    And validate in chrome://webrtc-internals to confirm the constraints are really applied.


    You're very close - this looks more like browser-level audio processing behavior than a pure SDK issue.

    Hope this helps 👍



    ------------------------------
    Cesar Padilla
    INDRA COLOMBIA
    ------------------------------



  • 5.  RE: Audio quality degradation in softphones using the WebRTC SDK

    Posted 10 days ago
    Thanks, Cesar,
    The situation has improved.
     
    > 2. But more importantly → enforce it at getUserMedia level
    > If the SDK allows overriding or injecting constraints, make sure you're effectively applying:
    >  :
    > This is key because SDK-level settings alone may not override browser defaults.
     
    After receiving this comment and modifying the program code as described below,
    "If the external party's environment contained significant background noise,
    the audio from our operator (OP) side during the initial 10 seconds of the call
    would intermittently drop in volume or cut out, making it difficult to hear."
    This issue has been resolved. Thank you very much for your cooperation.
     
    The specific changes are as follows:
     
    - Before change 
        const defaults = { 
            micAutoGainControl: { exact: true }, 
            echoCancellation: { exact: false }, 
            noiseSuppression: { exact: false } 
        }; 
            : 
            : 
        let webrtc_sdk = new window.GenesysCloudWebrtcSdk.GenesysCloudWebrtcSdk({ 
            environment: environment, 
            accessToken: accessToken, 
            defaults: defaults, 
        });
     
    - After change 
        const audioOptions = { 
            micAutoGainControl: true, 
            echoCancellation: false, 
            noiseSuppression: false 
        }; 
            : 
            : 
        const audioStream = await navigator.mediaDevices.getUserMedia({ 
            audio: { 
                autoGainControl: audioOptions.micAutoGainControl, 
                echoCancellation: audioOptions.echoCancellation, 
                noiseSuppression: audioOptions.noiseSuppression } 
         }); 
            : 
            : 
        let webrtc_sdk = new window.GenesysCloudWebrtcSdk.GenesysCloudWebrtcSdk({ 
            environment: environment, 
            accessToken: accessToken, 
            defaults: { 
                ...audioOptions, 
                audioStream, 
            }, 
        });

    That was a great help.


    ------------------------------
    Masahiro Shioi
    なし
    ------------------------------



  • 6.  RE: Audio quality degradation in softphones using the WebRTC SDK

    Posted 10 days ago

    @Masahiro Shioi, I'm glad it helped you. Ideally, you should monitor and check how it behaves to see if any further adjustments are needed.



    ------------------------------
    Cesar Padilla
    INDRA COLOMBIA
    ------------------------------