Repository: Azure-Samples/cognitive-services-speech-sdk

Issue #1747: [LINUX SDK Java] Openssl 3 compatibility
Created: 2022-11-16T14:40:16Z
Hello,
Is there soon to be an integration of version 3 of OpenSSL ? We use the ASR with the Java SDK inside a Docker container with OS Ubuntu 22.04 and the library libssl1.1_1.1.1f-1ubuntu2.16_amd64.deb. But as you know new vulnerabilities about OpenSSL arrived since the end of October. Unless building yourself the latest version from sources (https://github.com/openssl/openssl/releases/tag/OpenSSL_1_1_1s) it is impossible to have it. Ubuntu 22.04 (Jammy version) registry provides only OpenSSL 3 with fix vulnerabilities of course.
My other worry is the end of the support OpenSSL 1.1.1 after 2023 (https://www.openssl.org/policies/releasestrat.html). This confirms my question with OpenSSL 3.
Thanks :)

Duplicate issue #1986: Python SDK in python:3.11 - Failed to initialize platform (azure-c-shared) 
Created: 2023-06-17T22:19:34Z
Describe the bug
When python sdk is used in default python:3.X container it is not working. Library is correctly installed, everything is correctly started, but stream is canceled with " Failed to initialize platform (azure-c-shared) ".
Tested with python:3.8 and python 3.11 containers
But it is working with -buster suffix: python:3.11-buster
To Reproduce
working Dockerfile
FROM python:3.11-buster
WORKDIR /app
RUN pip install azure-cognitiveservices-speech
RUN apt update && apt install -y tcpdump
COPY azure_test.py /app/azure_test.py
COPY test.wav /app/test.wav
CMD ["/bin/bash"]

not working Dockerfile
FROM python:3.11
WORKDIR /app
RUN pip install azure-cognitiveservices-speech
RUN apt update && apt install -y tcpdump
COPY azure_test.py /app/azure_test.py
COPY test.wav /app/test.wav
CMD ["/bin/bash"]

code (1:1 from your samples)
import wave

import azure.cognitiveservices.speech as speechsdk
import time

speech_key = # ADD YOURS SPEECH KEY
service_region = # ADD YOURS SPEECH REGION

def main():
    class WavFileReaderCallback(speechsdk.audio.PullAudioInputStreamCallback):
        """Example class that implements the Pull Audio Stream interface to recognize speech from
        an audio file"""

        def __init__(self, filename: str):
            super().__init__()
            self._file_h = wave.open(filename, mode=None)

            self.sample_width = self._file_h.getsampwidth()

            assert self._file_h.getnchannels() == 1
            assert self._file_h.getsampwidth() == 2
            assert self._file_h.getframerate() == 16000
            assert self._file_h.getcomptype() == 'NONE'

        def read(self, buffer: memoryview) -> int:
            """read callback function"""
            size = buffer.nbytes
            frames = self._file_h.readframes(size // self.sample_width)

            buffer[:len(frames)] = frames

            print('sending data', len(frames))

            return len(frames)

        def close(self):
            """close callback function"""
            self._file_h.close()

    speech_config = speechsdk.SpeechConfig(subscription=speech_key, region=service_region)

    # specify the audio format
    wave_format = speechsdk.audio.AudioStreamFormat(samples_per_second=16000, bits_per_sample=16,
                                                    channels=1)

    # setup the audio stream
    callback = WavFileReaderCallback("test.wav")
    stream = speechsdk.audio.PullAudioInputStream(callback, wave_format)
    audio_config = speechsdk.audio.AudioConfig(stream=stream)

    # instantiate the speech recognizer with pull stream input
    speech_recognizer = speechsdk.SpeechRecognizer(
        speech_config=speech_config,
        audio_config=audio_config,
        language="cs-CZ"
    )

    done = False

    def stop_cb(evt: speechsdk.SessionEventArgs):
        nonlocal done
        done = True
        print('CLOSING on {}'.format(evt))

    def canceled_cb(evt: speechsdk.SpeechRecognitionCanceledEventArgs):
        nonlocal done
        done = True
        print('CANCELED on {}'.format(evt.cancellation_details))

    # Connect callbacks to the events fired by the speech recognizer
    speech_recognizer.recognizing.connect(lambda evt: print('RECOGNIZING: {}'.format(evt)))
    speech_recognizer.recognized.connect(lambda evt: print('RECOGNIZED: {}'.format(evt)))
    speech_recognizer.session_started.connect(lambda evt: print('SESSION STARTED: {}'.format(evt)))
    speech_recognizer.session_stopped.connect(lambda evt: print('SESSION STOPPED {}'.format(evt)))
    # speech_recognizer.canceled.connect(lambda evt: print('CANCELED {} {]'.format(evt, evt.reason)))
    # stop continuous recognition on either session stopped or canceled events
    speech_recognizer.session_stopped.connect(stop_cb)
    speech_recognizer.canceled.connect(canceled_cb)

    # Start continuous speech recognition
    speech_recognizer.start_continuous_recognition()

    while not done:
        time.sleep(.5)

    speech_recognizer.stop_continuous_recognition()


main()

create some test.wav with speech
Expected behavior
Installation should not be allowed if it will have errors like "Failed to initialize platform"
Unfortunately I don't know how to investigate difference between python:3.11-buster and python:3.11 and find solution but I hope this helps.

Closing comment (2023-06-19T18:16:15Z): Duplicate of #1747.