//! # rutster-trunk
//!
//! Carrier / PSTN reach for rutster — **rented transport, no first-party SIP**
//! ([ADR-0007](../../../docs/adr/0007-trunk-rented-transport.md)). This crate holds the
//! rented-transport ingress: the **CPaaS media-leg adapter** — a WebSocket server accepting a
//! provider raw-media fork (Twilio Media Streams / Telnyx) plus the provider call-control
//! client — and later the glue for an **out-of-tree SBC** when PSTN media must stay on-prem.
//! It owns **no SIP stack**: SIP lives outside the trust boundary, in the rented transport
//! (green zone — [ADR-0008](../../../docs/adr/0008-fob-and-green-zone.md)).
//!
//! ## Spearhead step 5 — what's here
//!
//! FOB-side (dev-c, T1/T3/T4/T5):
//!   * `g711` — G711Codec (µ-law encode/decode + 8kHz↔24kHz resampling).
//!   * `twilio_media_streams` — TwilioMediaStreamsServer (axum WSS handler).
//!   * `session` — TrunkSession (per-trunk-leg struct).
//!   * `loop_driver` — trunk_driver::drive (per-tick function).
//!
//! Green-zone (dev-b, T2/T6):
//!   * `provider/{mod,mock,twilio}` — CallControlClient trait + Mock + live
//!     TwilioCallControlClient (behind `twilio-live` feature).
//!
//! ## Dependency direction
//!
//! `rutster-trunk` → `rutster-call-model` + `rutster-media` + `rutster-tap`:
//! PSTN audio is resampled to the canonical tap format and handed to the media plane
//! as a media-leg ingress, parallel to WebRTC. The provider (call-control) side is
//! green-zone and depends on no FOB media types — only on `url` + `async-trait` (T2).

pub mod g711;
pub mod loop_driver;
mod mulaw_decode_table;
mod mulaw_encode_table;
pub mod provider;
pub mod public_url;
pub mod session;
pub mod twilio_media_streams;

#[cfg(test)]
mod tests {
    use crate::g711::G711Codec;
    use crate::provider::MockCallControlClient;

    /// Stub boundary smoke test, retained after the FOB modules land. Also
    /// exercises the public codec + provider API surface once.
    #[test]
    fn crate_compiles() {
        let _mock = MockCallControlClient::new();
        let frame = G711Codec::decode_mulaw_to_pcm(&[0xFF; 160]);
        assert_eq!(frame.samples.len(), 480);
    }
}
