2026-07-07 11:07:59 +00:00
|
|
|
<?php
|
|
|
|
|
|
feat: full package — typed rooms (public/private/presence/open-presence) + call recording
Rooms
- Rooms\RoomType derived from the name prefix (like laravel-websockets channels):
public, private-* (authorized), presence-* (authorized + member list),
open-presence-* (public + member list). Room/RoomManager carry per-member info.
- Contracts\RoomAuthorizer + secure DefaultRoomAuthorizer (denies private/presence
until the host binds one). Presence rooms broadcast the member list + info.
Recording (store the FULL call audio, in PHP, today)
- Pure-P2P audio is DTLS-SRTP end-to-end, so the server can't capture it. Instead
the browser MediaRecords its mic and streams chunks over the WS as BINARY frames
(needs the new laravel-ws onBinary); RelaySignalingHandler appends them per
participant via a RecordingStore. Recording\FileRecordingStore -> <room>/<peer>.webm.
welcome/joined carry a record flag telling the client to stream.
- Contracts\CallEventListener call-log seam (peer/room/recording lifecycle) so calls
are auditable even when unrecorded.
Wiring
- RelaySignalingHandler(authorizer, recorder, events); webrtc:serve + provider +
config/webrtc.php (recording enabled/path/format, authorizer, events).
Tests 35/99 incl on-disk FileRecordingStore, presence member lists, auth gating,
binary recording+finalize+events, RoomType, and the real WS round-trip. README
documents room types + the browser MediaRecorder->WS recording flow.
rel learn-atc #1060 #1055 #1057 #1051
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 07:01:12 +00:00
|
|
|
use Blax\WebRtc\Authorization\DefaultRoomAuthorizer;
|
|
|
|
|
use Blax\WebRtc\Events\NullCallEventListener;
|
feat: WebRTC MVP to Blax standard (namespace, README, tests, scaffolding)
- Rename namespace BlaxSoftware\LaravelWebRtc -> Blax\WebRtc (house standard) +
update kernel imports to Blax\ReactPhpKernel
- README rewritten to the Blax OSS package principles: OSS banner, title+badges,
emoji feature list, quick start, wire shape, config, architecture, star history
- Add PHPUnit suite (8 tests / 18 assertions, green): SignalingHandler routing
(offer/ice/record/connect/bridge/close/error paths via a fake engine) +
NullMediaEngine behaviour
- Add pint.json (laravel preset, applied), composer scripts, .gitattributes,
test.sh (nix), CHANGELOG
- Verified end-to-end: composer install resolves blax-software/reactphp-kernel
from Forgejo VCS and the suite runs green on it
rel learn-atc #1055 #1051 #1019
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 11:28:49 +00:00
|
|
|
use Blax\WebRtc\Media\NullMediaEngine;
|
2026-07-07 11:07:59 +00:00
|
|
|
|
|
|
|
|
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),
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|--------------------------------------------------------------------------
|
feat: full package — typed rooms (public/private/presence/open-presence) + call recording
Rooms
- Rooms\RoomType derived from the name prefix (like laravel-websockets channels):
public, private-* (authorized), presence-* (authorized + member list),
open-presence-* (public + member list). Room/RoomManager carry per-member info.
- Contracts\RoomAuthorizer + secure DefaultRoomAuthorizer (denies private/presence
until the host binds one). Presence rooms broadcast the member list + info.
Recording (store the FULL call audio, in PHP, today)
- Pure-P2P audio is DTLS-SRTP end-to-end, so the server can't capture it. Instead
the browser MediaRecords its mic and streams chunks over the WS as BINARY frames
(needs the new laravel-ws onBinary); RelaySignalingHandler appends them per
participant via a RecordingStore. Recording\FileRecordingStore -> <room>/<peer>.webm.
welcome/joined carry a record flag telling the client to stream.
- Contracts\CallEventListener call-log seam (peer/room/recording lifecycle) so calls
are auditable even when unrecorded.
Wiring
- RelaySignalingHandler(authorizer, recorder, events); webrtc:serve + provider +
config/webrtc.php (recording enabled/path/format, authorizer, events).
Tests 35/99 incl on-disk FileRecordingStore, presence member lists, auth gating,
binary recording+finalize+events, RoomType, and the real WS round-trip. README
documents room types + the browser MediaRecorder->WS recording flow.
rel learn-atc #1060 #1055 #1057 #1051
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 07:01:12 +00:00
|
|
|
| Recording (store the full call audio)
|
2026-07-07 11:07:59 +00:00
|
|
|
|--------------------------------------------------------------------------
|
feat: full package — typed rooms (public/private/presence/open-presence) + call recording
Rooms
- Rooms\RoomType derived from the name prefix (like laravel-websockets channels):
public, private-* (authorized), presence-* (authorized + member list),
open-presence-* (public + member list). Room/RoomManager carry per-member info.
- Contracts\RoomAuthorizer + secure DefaultRoomAuthorizer (denies private/presence
until the host binds one). Presence rooms broadcast the member list + info.
Recording (store the FULL call audio, in PHP, today)
- Pure-P2P audio is DTLS-SRTP end-to-end, so the server can't capture it. Instead
the browser MediaRecords its mic and streams chunks over the WS as BINARY frames
(needs the new laravel-ws onBinary); RelaySignalingHandler appends them per
participant via a RecordingStore. Recording\FileRecordingStore -> <room>/<peer>.webm.
welcome/joined carry a record flag telling the client to stream.
- Contracts\CallEventListener call-log seam (peer/room/recording lifecycle) so calls
are auditable even when unrecorded.
Wiring
- RelaySignalingHandler(authorizer, recorder, events); webrtc:serve + provider +
config/webrtc.php (recording enabled/path/format, authorizer, events).
Tests 35/99 incl on-disk FileRecordingStore, presence member lists, auth gating,
binary recording+finalize+events, RoomType, and the real WS round-trip. README
documents room types + the browser MediaRecorder->WS recording flow.
rel learn-atc #1060 #1055 #1057 #1051
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 07:01:12 +00:00
|
|
|
| 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.
|
2026-07-07 11:07:59 +00:00
|
|
|
*/
|
|
|
|
|
'recording' => [
|
feat: full package — typed rooms (public/private/presence/open-presence) + call recording
Rooms
- Rooms\RoomType derived from the name prefix (like laravel-websockets channels):
public, private-* (authorized), presence-* (authorized + member list),
open-presence-* (public + member list). Room/RoomManager carry per-member info.
- Contracts\RoomAuthorizer + secure DefaultRoomAuthorizer (denies private/presence
until the host binds one). Presence rooms broadcast the member list + info.
Recording (store the FULL call audio, in PHP, today)
- Pure-P2P audio is DTLS-SRTP end-to-end, so the server can't capture it. Instead
the browser MediaRecords its mic and streams chunks over the WS as BINARY frames
(needs the new laravel-ws onBinary); RelaySignalingHandler appends them per
participant via a RecordingStore. Recording\FileRecordingStore -> <room>/<peer>.webm.
welcome/joined carry a record flag telling the client to stream.
- Contracts\CallEventListener call-log seam (peer/room/recording lifecycle) so calls
are auditable even when unrecorded.
Wiring
- RelaySignalingHandler(authorizer, recorder, events); webrtc:serve + provider +
config/webrtc.php (recording enabled/path/format, authorizer, events).
Tests 35/99 incl on-disk FileRecordingStore, presence member lists, auth gating,
binary recording+finalize+events, RoomType, and the real WS round-trip. README
documents room types + the browser MediaRecorder->WS recording flow.
rel learn-atc #1060 #1055 #1057 #1051
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 07:01:12 +00:00
|
|
|
'enabled' => (bool) env('WEBRTC_RECORDING', false),
|
|
|
|
|
'path' => env('WEBRTC_RECORDING_PATH', storage_path('app/webrtc')),
|
|
|
|
|
'format' => env('WEBRTC_RECORDING_FORMAT', 'webm'),
|
2026-07-07 11:07:59 +00:00
|
|
|
],
|
|
|
|
|
|
feat: full package — typed rooms (public/private/presence/open-presence) + call recording
Rooms
- Rooms\RoomType derived from the name prefix (like laravel-websockets channels):
public, private-* (authorized), presence-* (authorized + member list),
open-presence-* (public + member list). Room/RoomManager carry per-member info.
- Contracts\RoomAuthorizer + secure DefaultRoomAuthorizer (denies private/presence
until the host binds one). Presence rooms broadcast the member list + info.
Recording (store the FULL call audio, in PHP, today)
- Pure-P2P audio is DTLS-SRTP end-to-end, so the server can't capture it. Instead
the browser MediaRecords its mic and streams chunks over the WS as BINARY frames
(needs the new laravel-ws onBinary); RelaySignalingHandler appends them per
participant via a RecordingStore. Recording\FileRecordingStore -> <room>/<peer>.webm.
welcome/joined carry a record flag telling the client to stream.
- Contracts\CallEventListener call-log seam (peer/room/recording lifecycle) so calls
are auditable even when unrecorded.
Wiring
- RelaySignalingHandler(authorizer, recorder, events); webrtc:serve + provider +
config/webrtc.php (recording enabled/path/format, authorizer, events).
Tests 35/99 incl on-disk FileRecordingStore, presence member lists, auth gating,
binary recording+finalize+events, RoomType, and the real WS round-trip. README
documents room types + the browser MediaRecorder->WS recording flow.
rel learn-atc #1060 #1055 #1057 #1051
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 07:01:12 +00:00
|
|
|
/*
|
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| 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),
|
|
|
|
|
|
2026-07-07 11:07:59 +00:00
|
|
|
/*
|
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| 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'),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
];
|