WACR is the backend for WebRTC -> VK ASR (speech recognition technology) interaction.
The client just calls to WACR backend by WebRTC technology. After that WACR save an audio stream from WebRTC to file system. Saved audio stream will send to VK ACR backend by API. Then WACR save in-memory recognized text and send it to client.
bash
cargo install wacr
RUST_LOG=debug;VK_API_SERVICE_TOKEN=XXX;VK_API_SERVICE_KEY=YYY wacr
bash
RUST_LOG=debug;VK_API_SERVICE_TOKEN=XXX;VK_API_SERVICE_KEY=YYY cargo run --package wacr --bin wacr
bash
cargo build --package wacr --bin wacr --release
RUST_LOG=debug;VK_API_SERVICE_TOKEN=XXX;VK_API_SERVICE_KEY=YYY ./target/release/wacr
Query must be extracted from mini apps launch params
```http request POST http://127.0.0.1:8080/token/generate Content-Type: application/json
{ "query": "XXX" } ```
json
{
"token": "xxx",
"expiration": 1664718489
}
Creating connection by WebRTC. access_token must be got from Get JWT Token API. Offer is client local WebRTC offer.
```http request POST http://127.0.0.1:8080/session/create?access_token=XXX Content-Type: application/json
{ "offer": {} } ```
json
{
"session_id": "a3b26e68-7fda-4534-bbdd-92a98230a824",
"offer": {}
}
Start recognising of speech accepted from Create session. access_token must be got from Get JWT Token API.
```http request POST http://127.0.0.1:8080/session/asr?access_token=XXX Content-Type: application/json
{ "session_id": "a3b26e68-7fda-4534-bbdd-92a98230a824" } ```
json
{
"text": "Hello world!"
}
http request
GET http://127.0.0.1:8080/session/listen/{session_id}?access_token=XXX
json
{
"error": "error occurred"
}
bash
VK_API_SERVICE_TOKEN=XXX # Service token for requesting VK API endpoints
VK_API_SERVICE_KEY=YYY # Service key for validating query on token generation
bash
LISTEN_ADDRESS=127.0.0.1:8080 # Listening address
JWT_EXPIRATION=3600 # How many seconds access token will valid
GARBAGE_COLLECTOR_TTL=3600 # How many seconds audio files and text results will alive
SESSION_KEEP_ALIVE_TIMEOUT=10 # How many seconds webrtc session will alive without incoming packets
SESSION_TOTAL_TIMEOUT=100 # Max number of seconds webrtc session will alive
AUDIO_PATH=/tmp # The directory where audio files saving
WEBRTC_PORT_MIN=0 # Minimal available port for webrtc peer connections
WEBRTC_PORT_MAX=0 # Maximal available port for webrtc peer connections
WEBRTC_INTERFACES_ALLOWED= # All interfaces allowed by default. List of allowed network interfaces split by ,