Skip to main content

ActiveCall

Struct ActiveCall 

Source
pub struct ActiveCall {
Show 31 fields pub cancel_token: CancellationToken, pub call_type: ActiveCallType, pub session_id: String, pub start_time: DateTime<Utc>, pub media_stream: Arc<MediaStream>, pub track_config: TrackConfig, pub event_sender: EventSender, pub app_state: AppState, pub config: Arc<Config>, pub invitation: Invitation, pub cmd_sender: CommandSender, pub dump_events: bool, pub server_side_track_id: TrackId, pub ssrc: u32, pub bridge_paused: Arc<AtomicBool>, pub progress: Arc<ArcSwap<CallProgress>>, pub leg_terminated_tx: Arc<Sender<bool>>, pub extras: Extras, pub moh: ArcSwapOption<String>, pub current_play_id: ArcSwapOption<String>, pub tts_handle: ArcSwapOption<SynthesisHandle>, pub refer_leg: ArcSwapOption<LegShared>, pub ready_to_answer: ArcSwapOption<ReadyAnswer>, pub pending_sip_answer: ArcSwapOption<PendingSipAnswer>, pub refer_call_token: ArcSwapOption<CancellationToken>, pub wait_input_timeout: ArcSwapOption<u32>, pub pending_asr_resume: ArcSwapOption<(u32, TranscriptionOption)>, pub refer_notifier: ArcSwapOption<ReferProgressNotifier>, pub superseded_bridge: Mutex<Option<SupersededBridge>>, pub superseded_refer_ssrc: AtomicU32, pub audio_receiver: Mutex<Option<WebsocketBytesReceiver>>,
}
Expand description

A call: immutable identity + lock-free shared state (see call::state) plus the infrastructure handles. Actor-owned mutable state lives in CallRuntime inside serve.

Fields§

§cancel_token: CancellationToken§call_type: ActiveCallType§session_id: String§start_time: DateTime<Utc>§media_stream: Arc<MediaStream>§track_config: TrackConfig§event_sender: EventSender§app_state: AppState§config: Arc<Config>

Config snapshot taken when the call was created. Kept for the lifetime of the call, so a hot reload never changes a running call’s behavior; new calls pick up the new snapshot.

§invitation: Invitation§cmd_sender: CommandSender§dump_events: bool§server_side_track_id: TrackId§ssrc: u32

Immutable main-leg SSRC.

§bridge_paused: Arc<AtomicBool>

Bridge pause flag shared with the peer call during bridging.

§progress: Arc<ArcSwap<CallProgress>>

Main-leg lifecycle progress (dialog id, ring/answer times, answer SDP, option…).

§leg_terminated_tx: Arc<Sender<bool>>

Signalled by the main-leg dialog termination (InviteDialogStates:: on_terminated); handed to every main-leg LegShared produced by leg() so do_hangup can wait for the BYE outcome.

§extras: Extras

Main-leg variables (playbook set_var, SIP headers, hangup headers).

§moh: ArcSwapOption<String>

Active music-on-hold path (shared with the spawned refer task).

§current_play_id: ArcSwapOption<String>

play id of the current server-side playback (shared for TrackEnd matching).

§tts_handle: ArcSwapOption<SynthesisHandle>

Live TTS handle (shared so spawned tasks and post-serve cleanup can drop it).

§refer_leg: ArcSwapOption<LegShared>

Shared state of the refer leg, when one is active.

§ready_to_answer: ArcSwapOption<ReadyAnswer>

Answer prepared during ringing (SDP + running track + dialog); taken by accept/reject. Shared so post-serve cleanup can still reject.

§pending_sip_answer: ArcSwapOption<PendingSipAnswer>

Answer prepared for the underlying SIP dialog of non-SIP call types (WebSocket/Webrtc); taken by accept, rejected on reject/cleanup. Same slot family as ready_to_answer: lock-free set/take on the actor path, with ownership recoverable from cleanup.

§refer_call_token: ArcSwapOption<CancellationToken>

Cancel this token to hang up only the refer call, leaving the main call alive.

§wait_input_timeout: ArcSwapOption<u32>

Pending wait-input timeout set by the last Tts/Play command.

§pending_asr_resume: ArcSwapOption<(u32, TranscriptionOption)>

ASR config to resume on the parent leg once the refer leg ends.

§refer_notifier: ArcSwapOption<ReferProgressNotifier>

RFC 3515 notifier for a transfer triggered by an incoming REFER; reports the refer leg’s final status back to the referrer.

§superseded_bridge: Mutex<Option<SupersededBridge>>

Pending retire of the superseded INVITE-mode refer bridge leg after an auto-refer transfer succeeds: the bridge leg’s SSRC (to match its TrackEnd) and its cancel token (to hang it up). Captured when the auto-refer INVITE starts, consumed in ReferDone.

§superseded_refer_ssrc: AtomicU32

SSRC of a superseded INVITE-mode bridge leg whose TrackEnd (which carries ByRefer) must not tear the session down.

§audio_receiver: Mutex<Option<WebsocketBytesReceiver>>

WebSocket audio receiver injected at construction, taken once by setup.

Implementations§

Source§

impl ActiveCall

Source

pub fn leg(&self) -> LegShared

Lock-free shared state of the main leg.

Source

pub fn set_option(&self, option: CallOption)

Store/replace the main-leg option in the progress snapshot.

Source

pub fn moh_path(&self) -> Option<String>

Source

pub fn set_moh(&self, v: Option<String>)

Source

pub fn current_play(&self) -> Option<String>

Source

pub fn set_current_play(&self, v: Option<String>)

Source

pub fn refer_leg_value(&self) -> Option<LegShared>

Source

pub fn set_refer_leg(&self, v: Option<LegShared>)

Source

pub fn set_ready_to_answer(&self, ready: ReadyAnswer)

Prepared answer during ringing; taken once by accept/reject.

Source

pub fn take_ready_to_answer(&self) -> Option<Arc<ReadyAnswer>>

Source

pub fn has_ready_to_answer(&self) -> bool

Source

pub fn set_pending_sip_answer(&self, pending: PendingSipAnswer)

Prepared 200 OK for the underlying SIP dialog of non-SIP call types.

Source

pub fn take_pending_sip_answer(&self) -> Option<Arc<PendingSipAnswer>>

Source

pub fn take_refer_call_token(&self) -> Option<CancellationToken>

Cancel token that hangs up only the refer leg, leaving the main call alive; set by do_refer, taken by hangup.

Source

pub fn set_refer_call_token(&self, token: CancellationToken)

Source

pub fn take_wait_input_timeout(&self) -> Option<u32>

Pending wait-input timeout set by the last Tts/Play command, consumed when the track ends.

Source

pub fn set_wait_input_timeout(&self, v: Option<u32>)

Source

pub fn set_pending_asr_resume(&self, v: (u32, TranscriptionOption))

ASR config to resume on the parent leg once the refer leg ends.

Source

pub fn take_pending_asr_resume(&self) -> Option<(u32, TranscriptionOption)>

Source

pub fn set_refer_notifier(&self, v: Option<Arc<ReferProgressNotifier>>)

RFC 3515 notifier of the pending incoming-REFER transfer (if any).

Source

pub fn take_refer_notifier(&self) -> Option<Arc<ReferProgressNotifier>>

Source

pub fn set_extra(&self, key: &str, value: Value)

Insert/overwrite one main-leg extras variable.

Source§

impl ActiveCall

Source

pub fn new(spec: CallSpec) -> Self

Source

pub async fn enqueue_command(&self, command: Command) -> Result<()>

Source

pub fn new_receiver(&self) -> ActiveCallReceiver

Create a new ActiveCallReceiver for this ActiveCall tokio::sync::broadcast not cached messages, so need to early create receiver before calling serve()

Source

pub async fn serve(self: Arc<Self>, receiver: ActiveCallReceiver) -> Result<()>

The call actor: a single select loop owning the CallRuntime.

Commands, session events, background-completion messages, the wait-input timeout tick, the media stream and cancellation all meet in one place, so runtime state is plain (lock-free) data owned by this task — mirroring the concurrency of the previous separate command/event loops without their shared locks.

Source

pub async fn cleanup(&self) -> Result<()>

Source

pub fn get_callrecord(&self) -> Option<CallRecord>

Build the call record from lock-free snapshots; never blocks, so it is safe (and lossless) from synchronous Drop.

Trait Implementations§

Source§

impl Drop for ActiveCall

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more