This service connects AVR to the Speechmatics Flow API over WebSocket.
It receives audio chunks from avr-core, forwards them to Speechmatics, and streams generated audio back in near real-time.
- Node.js 18+ and npm
- A valid Speechmatics API key with Flow access
git clone https://github.com/agentvoiceresponse/avr-sts-speechmatics.git
cd avr-sts-speechmaticsnpm installCopy .env.example to .env and set your values:
PORT=6040
SPEECHMATICS_API_KEY=your_speechmatics_api_key_here
SPEECHMATICS_REGION=euRequired:
SPEECHMATICS_API_KEY: Speechmatics API key
Optional:
PORT: Local WebSocket server port (default:6040)SPEECHMATICS_REGION: JWT region used by Speechmatics auth (default:eu)
npm start- Transport: WebSocket
- Input audio expected from AVR: base64-encoded PCM s16le, 8 kHz
- Output audio sent to AVR: base64-encoded PCM s16le, 8 kHz
- Frame pacing: 20 ms frames (
160samples at8000Hz)
- Input codec:
pcm_s16le - Output codec:
pcm_s16le - Sample rate:
8000Hz - Recommended with AVR call paths using
alaw,ulaw, orslin16transcoding as configured inavr-core
Incoming messages from AVR:
{ "type": "init", "uuid": "call-uuid" }
{ "type": "audio", "audio": "<base64_pcm_chunk>" }Outgoing messages to AVR:
{ "type": "audio", "audio": "<base64_pcm_chunk>" }
{ "type": "error", "message": "..." }npm start: run servicenpm run start:dev: run with nodemon and inspectornpm run dc:build: build Docker imagenpm run dc:push: push Docker image
- GitHub: https://github.com/agentvoiceresponse
- Discord: https://discord.gg/DFTU69Hg74
- Docker Hub: https://hub.docker.com/u/agentvoiceresponse
- NPM: https://www.npmjs.com/~agentvoiceresponse
- Wiki: https://wiki.agentvoiceresponse.com/en/home
AVR is free and open-source. Donations are optional and do not unlock extra features or services.
MIT License - see LICENSE.md.