laravel-webrtc/config/webrtc.php

84 lines
3.6 KiB
PHP

<?php
use Blax\WebRtc\Authorization\DefaultRoomAuthorizer;
use Blax\WebRtc\Events\NullCallEventListener;
use Blax\WebRtc\Media\NullMediaEngine;
return [
/*
|--------------------------------------------------------------------------
| Signaling bind
|--------------------------------------------------------------------------
| Where the signaling server (on the shared ReactPHP kernel) listens. For
| browser clients you will typically front this with the laravel-websockets
| WS transport instead; this raw endpoint drives + tests the media engine.
*/
'host' => env('WEBRTC_HOST', '127.0.0.1'),
'port' => (int) env('WEBRTC_PORT', 8090),
// ReactPHP TLS context; leave both unset for plain TCP.
'tls' => array_filter([
'local_cert' => env('WEBRTC_TLS_CERT'),
'local_pk' => env('WEBRTC_TLS_KEY'),
]),
/*
|--------------------------------------------------------------------------
| Media engine
|--------------------------------------------------------------------------
| The backend that terminates media (ICE/DTLS/SRTP/RTP/Opus), records, and
| bridges to external realtime providers. NullMediaEngine = signaling only;
| Str0mMediaEngine requires the blax_webrtc Rust extension (see rust/).
*/
'media_engine' => env('WEBRTC_MEDIA_ENGINE', NullMediaEngine::class),
/*
|--------------------------------------------------------------------------
| Recording (store the full call audio)
|--------------------------------------------------------------------------
| When enabled, the browser streams its mic to the server as binary WS frames
| and RelaySignalingHandler appends them per participant via a RecordingStore
| (FileRecordingStore by default: <path>/<room>/<peer>.<format>). See README.
*/
'recording' => [
'enabled' => (bool) env('WEBRTC_RECORDING', false),
'path' => env('WEBRTC_RECORDING_PATH', storage_path('app/webrtc')),
'format' => env('WEBRTC_RECORDING_FORMAT', 'webm'),
],
/*
|--------------------------------------------------------------------------
| Room authorization + call-event log
|--------------------------------------------------------------------------
| `authorizer` gates private-* / presence-* joins (bind your own that checks a
| token / the authenticated user; the default DENIES them). `events` receives
| call-lifecycle events so you can log the call (bind your own to persist).
*/
'authorizer' => env('WEBRTC_AUTHORIZER', DefaultRoomAuthorizer::class),
'events' => env('WEBRTC_EVENTS', NullCallEventListener::class),
/*
|--------------------------------------------------------------------------
| ICE servers (STUN/TURN) advertised to browsers
|--------------------------------------------------------------------------
*/
'ice_servers' => [
// ['urls' => 'stun:stun.l.google.com:19302'],
// ['urls' => 'turn:turn.example.com:3478', 'username' => '...', 'credential' => '...'],
],
/*
|--------------------------------------------------------------------------
| External realtime bridge (provider hidden from the browser)
|--------------------------------------------------------------------------
| The media engine dials these; the browser only ever talks to us, so the AI
| provider is invisible and the model is swappable server-side.
*/
'bridge' => [
'openai' => [
'model' => env('WEBRTC_OPENAI_MODEL', 'gpt-realtime'),
'api_key' => env('OPENAI_API_KEY'),
],
],
];