Skip to main content

Crate rvoip_core

Crate rvoip_core 

Source
Expand description

§rvoip-core

Transport-agnostic spine for RVoIP. Carries the voip-3 vocabulary (Conversation, Session, Connection, MediaStream, Message, Participant), the ConnectionAdapter trait that adapter crates implement, the cross-transport BridgeManager, and the Orchestrator entry point.

See INTERFACE_DESIGN.md §3, §6, §7.5, §10.2 for the canonical design.

§Two-layer surface

  • Pure-SIP consumers (carriers, SIP softphones, SIP-only B2BUAs) stay on rvoip_sip::api::* and rvoip_sip::server::* — they don’t touch this crate. See rvoip-sip for that surface.
  • Cross-transport consumers (Thelve, future CPaaS, anyone planning to add WebRTC / QUIC adapters) build a Orchestrator here and register adapters against it. SIP is one such adapter today (rvoip_sip::SipAdapter); rvoip-webrtc and rvoip-quic register against the same handle when they ship.

§Cross-transport entry point

use rvoip_core::{Config, Orchestrator, Transport};
let orchestrator = Orchestrator::new(Config::default());
orchestrator.register(my_adapter)?;

let mut events = orchestrator.subscribe_events();
// events.recv() yields normalized rvoip-core Events (Connection*, Session*,
// Conversation*) translated from each adapter's protocol-native AdapterEvents.

Orchestrator::register dispatches every per-connection command (Orchestrator::route_inbound_connection, Orchestrator::prepare_outbound_connection, PreparedOutboundConnection::commit, Orchestrator::originate_connection, Orchestrator::end_connection, Orchestrator::hold, Orchestrator::resume, Orchestrator::transfer_connection, Orchestrator::send_dtmf, Orchestrator::mute, Orchestrator::unmute, Orchestrator::play_audio) through the adapter for the connection’s Transport. Cross-transport bridging (cross-codec frame-pump per INTERFACE_DESIGN.md §10.2) is fully wired, including hot-swap on renegotiate_media and DTMF auto- route across legs.

§Conversation / Session / Participant lifecycle

Beyond per-Connection dispatch, the Orchestrator owns live Conversation/Session/Participant state. See Orchestrator::open_conversation, Orchestrator::start_session, Orchestrator::join_session, Orchestrator::leave_session, Orchestrator::end_session, Orchestrator::close_conversation and the cross-substrate messaging methods Orchestrator::send_message_to_conversation + Orchestrator::list_messages + Orchestrator::mark_message_read.

§vCon, recording, transcription, AI harness

With the vcon feature enabled, every Session gets a DefaultVconBuilder auto-bound at start_session; on end_session the snapshot is encoded, persisted via VconStore, and emitted as Event::VconReady. Recording and transcription dispatch via consumer-registered providers (Orchestrator::register_recording_sink, Orchestrator::register_asr_provider); the AI harness path includes barge-in support (Event::BargeInDetected).

§Tenant scoping, capacity, observability

Config::TenantQuotas enforces per-tenant maxes on concurrent sessions, recordings, and AI attachments. Periodic emit cadences live in Orchestrator::spawn_capacity_scheduler, Orchestrator::spawn_media_quality_sampler, and Orchestrator::spawn_idle_closer (Ephemeral Conversation close-after-idle driver).

See examples/sip_only_orchestrator.rs for the working SIP-adapter flow end-to-end, and GAP_PLAN.md for the phased-roadmap status.

§Layering rule

Per INTERFACE_DESIGN.md §18: this crate never imports an adapter crate. Adapters depend on rvoip-core, not the other way round. The only external dep that’s transport-flavored is rvoip-media-core (a common crate, not an adapter), used by bridge for the SIP-fast-path bridge handle.

Re-exports§

pub use adapter::ConnectionAdapter;
pub use bridge::BridgeManager;
pub use bridge::DirectionalMediaBridgePlan;
pub use commands::AttachmentRef;
pub use commands::AudioSource;
pub use commands::Command;
pub use commands::InboundAction;
pub use commands::ListenerSink;
pub use commands::ListenerTarget;
pub use commands::MuteDirection;
pub use commands::RecordingSink;
pub use commands::RecordingTarget;
pub use config::Config;
pub use conversation::Conversation;
pub use conversation::ConversationPolicy;
pub use conversation::ConversationState;
pub use events::AnomalyKind;
pub use events::ConnectionProgressKind;
pub use events::Event;
pub use events::SessionQualityReport;
pub use events::UsageKind;
pub use identity::Device;
pub use identity::DtlsFingerprint;
pub use identity::Identity;
pub use identity::IdentityProvider;
pub use inbound_admission::InboundAdmission;
pub use inbound_admission::InboundAdmissionTermination;
pub use inbound_admission::ProvisionalMediaRoute;
pub use inbound_admission::StagedInboundDataChannel;
pub use inbound_admission::StagedInboundDataPolicy;
pub use inbound_admission::StagedInboundDataReceiver;
pub use inbound_admission::StagedInboundDataSender;
pub use inbound_admission::MAX_STAGED_INBOUND_DATA_CAPACITY;
pub use inbound_admission::MAX_STAGED_INBOUND_DATA_LABELS;
pub use media_graph::start_media_graph;
pub use media_graph::MediaGraphActivityObservation;
pub use media_graph::MediaGraphHandle;
pub use media_graph::MediaGraphPolicy;
pub use media_graph::DEFAULT_MEDIA_GRAPH_MAX_SINKS;
pub use media_graph::MEDIA_GRAPH_ACTIVITY_OBSERVATION_INTERVAL;
pub use message::ContentType;
pub use message::Message;
pub use message::MessageOrigin;
pub use message::MessageRecipients;
pub use operational_events::OperationalEndReason;
pub use operational_events::OperationalEvent;
pub use operational_events::OperationalEventKind;
pub use operational_events::OperationalEventStreamHealth;
pub use operational_events::OperationalEventStreamHealthSubscription;
pub use operational_events::OperationalFailureReason;
pub use operational_events::OperationalTransferOutcome;
pub use operational_events::OperationalTransferTarget;
pub use orchestrator::Orchestrator;
pub use orchestrator::PreparedOutboundConnection;
pub use participant::Participant;
pub use participant::ParticipantKind;
pub use participant::ParticipantRole;
pub use session::Session;
pub use session::SessionMedium;
pub use session::SessionState;
pub use store::ConversationFilter;
pub use store::ConversationStore;
pub use store::MemoryConversationStore;
pub use store::MemoryMessageStore;
pub use store::MemoryVconStore;
pub use store::MessageFilter;
pub use store::MessagePage;
pub use store::MessageStore;
pub use store::PageCursor;
pub use store::VconStore;
pub use vcon::DefaultVconBuilder;
pub use vcon::VconAnalysis;
pub use vcon::VconAnalysisKind;
pub use vcon::VconAttachment;
pub use vcon::VconBuilderHandle;
pub use vcon::VconDialog;
pub use vcon::VconDialogKind;
pub use vcon::VconParty;
pub use vcon::VconRef;
pub use vcon::VconSnapshot;
pub use virtual_publisher::ManagedVirtualPublisher;
pub use virtual_publisher::VirtualPublisherDescriptor;
pub use virtual_publisher::DEFAULT_VIRTUAL_PUBLISHER_QUEUE_CAPACITY;

Modules§

adapter
bridge
Cross-transport bridge primitive.
broadcast
Broadcast contracts re-exported from the cycle-safe trait surface.
capability
V2.A — re-exports from rvoip-core-traits::capability.
commands
config
connection
V2.A — re-exports from rvoip-core-traits::connection.
conversation
error
V2.A — re-exports from rvoip-core-traits::error.
events
harness
V2.A — re-exports from rvoip-core-traits::harness.
identity
Identity surface — the trait + the rich structs that reference rvoip-core’s Result type live here; the pure data types (Jwk, IdentityKind, DeviceKind, IdentityAssurance, CredentialKind, Credential) moved to rvoip-core-traits in V2.A.1 and are re-exported below so use rvoip_core::identity::* call sites work unchanged.
ids
V2.A — ID newtypes moved to rvoip-core-traits to break the rvoip-core → rvoip-vcon → rvoip-auth-core → rvoip-core cycle. This module re-exports everything so use rvoip_core::ids::* call sites keep working unchanged.
inbound_admission
Opt-in, fail-closed admission for inbound transport connections.
media_graph
Bounded, one-source-to-many real-time media routing.
message
operational_events
Authoritative, bounded operational lifecycle events.
orchestrator
Cross-transport entry point.
participant
session
signing
P7 — RFC 9421 / JSON Canonical Form helpers + envelope replay cache.
store
stream
V2.A — re-exports from rvoip-core-traits::stream.
subscriptions
Per-Session subscription routing table for N-Participant Sessions.
vcon
In-flight vCon builder, per INTERFACE_DESIGN §3.9 / §11.4.
virtual_publisher
MediaGraph-backed logical publishers for transport subscribers.

Structs§

AiAttachmentId
AttachmentId
AuthenticatedPrincipal
Transport-neutral result of successful authentication.
BridgeHandle
Handle representing an active bridge between two media sessions.
BridgeId
BroadcastDescriptor
Legacy publication descriptor retained for source compatibility.
BroadcastDrainDescriptor
Result snapshot for a drain operation.
BroadcastDrainRequest
Request to stop admitting listeners and finish by a fixed deadline.
BroadcastEndpoint
Subscriber-facing endpoint and protocol resource.
BroadcastHealthDescriptor
Point-in-time publisher health and bounded capacity data.
BroadcastLifecycleDescriptor
Lifecycle snapshot suitable for an API or diagnostic response.
BroadcastProtocolDescriptor
Protocol compatibility tuple used by a publication.
BroadcastRelayHop
One diagnosable hop from a publisher origin to its subscribers.
BroadcastSanitizedEvent
One fixed-model sanitized event indexed by Unix wallclock milliseconds.
BroadcastSanitizedEventCapability
Bounded fixed-model event capability exposed by a publisher.
CapabilityDescriptor
Capability descriptor that round-trips through CONVERSATION_PROTOCOL.md §8’s JSON shape. Field order matches the spec for readability.
CapabilityIntersection
CodecInfo
Legacy flat-fields codec entry — used internally by SIP/RTP adapters that need the parsed clock_rate_hz / channels numbers directly. Bridges to/from Codec (the spec wire shape) via From/TryFrom.
Connection
ConnectionHandle
ConnectionId
ConversationId
DataMessage
A data-plane message that can be mapped to a WebRTC DataChannel, UCTP message.send, SIP MESSAGE, or an application-owned metadata transport.
DeviceId
ExternalConnectionReference
A stable external identifier learned while activating an outbound route.
IdentityId
InboundConnectionContext
Principal- and transport-bound context for one inbound connection.
InboundRoutingHint
Opaque, redacted routing material captured before an inbound adapter normalizes its signaling event.
InboundSignalingMetadata
Ordered, duplicate-preserving signaling metadata captured for an inbound connection. Field values are redacted from Debug output.
Jwk
Opaque JWK placeholder. Real shape lives in rvoip-identity.
ListenerId
MediaFrame
MediaReceiverReservation
Provisional ownership of a stream’s single-consumer inbound receiver.
MediaRouteId
MediaStreamHandle
Cheap, cloneable reference a crate::Connection holds to its media flows. Wraps an Arc<dyn MediaStream> so the trait object can live in Debug types like Connection without forcing every adapter to implement Debug.
MessageId
NegotiatedCodecs
OriginateContext
Opaque adapter-owned options for one outbound originate operation.
OriginateRequest
OutboundActivation
Adapter receipt produced only after outbound activation succeeds.
ParticipantId
PlaybackHandle
Handle returned by adapter playback paths that lets callers stop an in-flight playback.
PlaybackId
PrincipalOwnershipKey
Stable authorization ownership boundary for a principal-owned resource.
QualitySnapshot
RecordingId
SessionId
SignatureHeaders
StreamId
TenantId
TranscriptionId
TransferAttemptId

Enums§

AdapterEvent
Adapter-native event surface. rvoip-core normalizes these into the orchestration event vocabulary; consumers wanting protocol-native access can subscribe directly to the adapter.
AdapterKind
AuthenticationMethod
Authentication mechanism that established an AuthenticatedPrincipal.
BearerAuthError
Bearer validation failure retained in the dependency-cycle-free trait surface so AuthenticatedPrincipal::require_scope remains source compatible when the principal type is re-exported by auth-core.
BridgeError
Errors specific to bridge creation and teardown.
BroadcastDrainReason
Operator intent behind a drain operation.
BroadcastDrainState
Progress of a drain operation.
BroadcastHealthIssue
Bounded health reason codes. Resource identifiers intentionally do not appear here so these values are safe to aggregate in metrics.
BroadcastHealthStatus
Aggregate health state with a bounded metric-label vocabulary.
BroadcastLifecycleState
Managed publisher lifecycle state.
BroadcastProtocolFamily
Stable protocol family used for aggregate metrics and compatibility checks.
BroadcastRelayRole
Role of one address in a relay path.
BroadcastResource
Transport-specific resource addressed by a broadcast endpoint.
BroadcastSanitizedEventError
BroadcastSanitizedEventKind
Fixed, transport-neutral lifecycle events allowed on sanitized broadcasts.
BroadcastSubstrate
Network substrate carrying the application broadcast protocol.
BroadcastTransport
Broadcast protocol family exposed by a publisher.
ConnectionState
Credential
CredentialKind
DataMessageValidationError
DataReliability
Delivery contract requested by an application data message.
Direction
EndReason
ExternalConnectionReferenceError
Validation failure for an adapter-owned external connection reference.
IdentityAssurance
IdentityAssurance gradient per CONVERSATION_PROTOCOL.md §5.6.
InboundContextError
Validation failure for adapter-supplied inbound connection context.
RejectReason
RvoipError
StreamKind
TransferStatus
Transport-neutral asynchronous transfer status.
TransferTarget
Transport

Constants§

MAX_BROADCAST_EVENT_JSON_INTEGER
Largest integer represented exactly by interoperable JSON number parsers.
MAX_CONTENT_TYPE_BYTES
MAX_DATA_LABEL_BYTES
MAX_DATA_MESSAGE_BYTES
MAX_DATA_MESSAGE_ID_BYTES
MAX_EXTERNAL_CONNECTION_REFERENCES
Maximum number of adapter-owned external identifiers on one activation.
MAX_EXTERNAL_REFERENCE_KIND_BYTES
Maximum UTF-8 size of an external identifier namespace.
MAX_EXTERNAL_REFERENCE_VALUE_BYTES
Maximum UTF-8 size of one external identifier value.
MAX_INBOUND_ROUTING_HINT_BYTES
Maximum UTF-8 size of an adapter-owned inbound routing hint.

Traits§

BroadcastPublisher
Object-safe lifecycle and media contract shared by broadcast publishers.
MediaStream
Transport-agnostic media flow. Channel-based per INTERFACE_DESIGN §3.6 to avoid per-frame async overhead at high frame rates.

Type Aliases§

Result