Skip to main content

session_timer_loop

Function session_timer_loop 

Source
pub async fn session_timer_loop<D: SessionDialogOps>(
    dialog: &D,
    timer: SessionTimer,
    refresh_body: Option<Vec<u8>>,
    peer_refreshed: Arc<Notify>,
    cancel: CancellationToken,
) -> SessionTimerOutcome
Expand description

Drive RFC 4028 session keepalive for one confirmed dialog. Runs until cancelled or the session dies; same shape as crate::Registrar::keepalive_loop.

  • When timer.we_are_refresher, sends a refresh re-INVITE every interval / 2 carrying refresh_body (repeat the SDP you sent when the call was set up — an identical offer is a no-op per RFC 3264). A 2xx resets the clock (adopting any Session-Expires the peer granted); failure tears the call down with BYE.
  • Otherwise runs the expiry watchdog: every peer_refreshed.notify_one() resets the deadline, and if the deadline lapses the call is torn down with BYE. The consumer pings peer_refreshed after answering the peer’s refresh re-INVITE — see the module docs for the DialogState::Updated wiring.

All failures are folded into the returned SessionTimerOutcome; the loop never panics and never returns early without standing the session down.