You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure Speech-to-Text SDK报错Quota exceeded(cid):Websocket错误码1007求助

实时转录服务报错排查:Quota exceeded (cid) : Websocket error code 1007

我正尝试通过Twilio与Azure Cognitive Service搭建实时转录服务,但Speech Recognizer随机出现报错:"Quota exceeded (cid) : Websocket error code 1007",服务可正常转录一段时间后突然失败。

以下是我的代码:

let pushStream: PushAudioInputStream | null = null;
let speechRecognizer: SpeechRecognizer | null = null;

// Websocket for listening to Twilio Stream
ws.on("message", (message) => {
    const msg = JSON.parse(message.toString());
    switch (msg.event) {
      case "start": {
        // Triggered when the websocket is opened to listen to Twilio Stream

        // create speech config
        const config = SpeechConfig.fromSubscription(
          process.env.AZURE_SPEECH_KEY ?? "",
          process.env.AZURE_SPEECH_REGION ?? ""
        );
        config.speechRecognitionLanguage = "en-US";
        config.setProfanity(ProfanityOption.Raw);
        config.setProperty(
          PropertyId.SpeechServiceResponse_PostProcessingOption,
          "TrueText"
        );

        // create a push stream for audio input that takes in mulaw
        pushStream = AudioInputStream.createPushStream(
          AudioStreamFormat.getWaveFormat(8000, 16, 1, AudioFormatTag.MuLaw)
        );

        // create azure speech recongiser for speech to text recognition
        speechRecognizer = new SpeechRecognizer(
          config,
          AudioConfig.fromStreamInput(pushStream)
        );

        // Attach callback to log out result on speech end
        speechRecognizer.recognized = async (s, e) => {
          if (e.result.reason === ResultReason.RecognizedSpeech) {
            const recognizedText = e.result.text;
            console.log("recognizedText: ", recognizedText);
          }
        };

        // Attach callback to log out reason for canelling speech recognizition
        speechRecognizer.canceled = (s, e) => {
          if (e.reason === CancellationReason.Error) {
            console.log("Recognition cancelled: ", e); // <<---- Here is where the error keeps popping up
          }
        };

        speechRecognizer.startContinuousRecognitionAsync();

        break;
      }
      case "media": {
        // Triggered when Twilio stream sends data packets in Mulaw format
        // We write the data directly into the Azure stream
        pushStream?.write(Buffer.from(msg.media.payload,"base64"));
        break;
      }
      case "stop": {
        // Triggered when Twilio stops Streaming
        // Clean up Azure Speech recognizer
        pushStream?.close();
        pushStream = null;

        speechRecognizer?.stopContinuousRecognitionAsync();
        speechRecognizer = null;
        break;
      }
      default:
    }
});

无配额超标的使用数据
我查看Azure门户后发现,订阅无使用数据记录,也未出现配额超标情况。
Azure配额使用情况1
Azure配额使用情况2

Websocket错误码1007
根据Azure文档,该错误表示识别器收到与消息类型不一致的数据,但我未修改Twilio的payload,且并非转录启动时就报错,而是在多次转录后出现。

请问是否有用户遇到类似情况,能否告知错误原因?


内容的提问来源于stack exchange,提问作者SkySoft

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.15 21:30:15