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: u32Immutable 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: ExtrasMain-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: AtomicU32SSRC 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
impl ActiveCall
Sourcepub fn set_option(&self, option: CallOption)
pub fn set_option(&self, option: CallOption)
Store/replace the main-leg option in the progress snapshot.
pub fn moh_path(&self) -> Option<String>
pub fn set_moh(&self, v: Option<String>)
pub fn current_play(&self) -> Option<String>
pub fn set_current_play(&self, v: Option<String>)
pub fn refer_leg_value(&self) -> Option<LegShared>
pub fn set_refer_leg(&self, v: Option<LegShared>)
Sourcepub fn set_ready_to_answer(&self, ready: ReadyAnswer)
pub fn set_ready_to_answer(&self, ready: ReadyAnswer)
Prepared answer during ringing; taken once by accept/reject.
pub fn take_ready_to_answer(&self) -> Option<Arc<ReadyAnswer>>
pub fn has_ready_to_answer(&self) -> bool
Sourcepub fn set_pending_sip_answer(&self, pending: PendingSipAnswer)
pub fn set_pending_sip_answer(&self, pending: PendingSipAnswer)
Prepared 200 OK for the underlying SIP dialog of non-SIP call types.
pub fn take_pending_sip_answer(&self) -> Option<Arc<PendingSipAnswer>>
Sourcepub fn take_refer_call_token(&self) -> Option<CancellationToken>
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.
pub fn set_refer_call_token(&self, token: CancellationToken)
Sourcepub fn take_wait_input_timeout(&self) -> Option<u32>
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.
pub fn set_wait_input_timeout(&self, v: Option<u32>)
Sourcepub fn set_pending_asr_resume(&self, v: (u32, TranscriptionOption))
pub fn set_pending_asr_resume(&self, v: (u32, TranscriptionOption))
ASR config to resume on the parent leg once the refer leg ends.
pub fn take_pending_asr_resume(&self) -> Option<(u32, TranscriptionOption)>
Sourcepub fn set_refer_notifier(&self, v: Option<Arc<ReferProgressNotifier>>)
pub fn set_refer_notifier(&self, v: Option<Arc<ReferProgressNotifier>>)
RFC 3515 notifier of the pending incoming-REFER transfer (if any).
pub fn take_refer_notifier(&self) -> Option<Arc<ReferProgressNotifier>>
Source§impl ActiveCall
impl ActiveCall
pub fn new(spec: CallSpec) -> Self
pub async fn enqueue_command(&self, command: Command) -> Result<()>
Sourcepub fn new_receiver(&self) -> ActiveCallReceiver
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()
Sourcepub async fn serve(self: Arc<Self>, receiver: ActiveCallReceiver) -> Result<()>
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.
pub async fn cleanup(&self) -> Result<()>
Sourcepub fn get_callrecord(&self) -> Option<CallRecord>
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
impl Drop for ActiveCall
Auto Trait Implementations§
impl !Freeze for ActiveCall
impl !RefUnwindSafe for ActiveCall
impl !UnwindSafe for ActiveCall
impl Forget for ActiveCall
impl Move for ActiveCall
impl Send for ActiveCall
impl Sync for ActiveCall
impl Unpin for ActiveCall
impl UnsafeUnpin for ActiveCall
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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