pub enum ClientEvent {
IncomingCall {
info: IncomingCallInfo,
priority: EventPriority,
},
CallStateChanged {
info: CallStatusInfo,
priority: EventPriority,
},
MediaEvent {
info: MediaEventInfo,
priority: EventPriority,
},
RegistrationStatusChanged {
info: RegistrationStatusInfo,
priority: EventPriority,
},
ClientError {
error: ClientError,
call_id: Option<CallId>,
priority: EventPriority,
},
NetworkEvent {
connected: bool,
reason: Option<String>,
priority: EventPriority,
},
}Expand description
Comprehensive client event types
Unified event type that encompasses all possible events in the VoIP client, with associated priority levels for filtering and handling.
§Examples
use rvoip_client_core::events::{ClientEvent, IncomingCallInfo, EventPriority};
use rvoip_client_core::call::CallId;
use chrono::Utc;
let call_info = IncomingCallInfo {
call_id: uuid::Uuid::new_v4(),
caller_uri: "sip:caller@example.com".to_string(),
callee_uri: "sip:callee@example.com".to_string(),
caller_display_name: None,
subject: None,
created_at: Utc::now(),
};
let event = ClientEvent::IncomingCall {
info: call_info,
priority: EventPriority::High,
};
assert_eq!(event.priority(), EventPriority::High);Variants§
IncomingCall
Incoming call received from a remote party
Fields
info: IncomingCallInfoInformation about the incoming call
priority: EventPriorityPriority level of this event
CallStateChanged
Call state changed (connecting, connected, disconnected, etc.)
Fields
info: CallStatusInfoInformation about the state change
priority: EventPriorityPriority of this event
MediaEvent
Media event occurred (audio start/stop, quality change, etc.)
Fields
info: MediaEventInfoInformation about the media event
priority: EventPriorityPriority of this event
RegistrationStatusChanged
Registration status changed with SIP server
Fields
info: RegistrationStatusInfoInformation about the registration change
priority: EventPriorityPriority of this event
ClientError
Client error occurred
NetworkEvent
Network connectivity changed
Implementations§
Source§impl ClientEvent
impl ClientEvent
Sourcepub fn priority(&self) -> EventPriority
pub fn priority(&self) -> EventPriority
Get the priority of this event
Returns the priority level assigned to this event, which can be used for filtering and prioritization in event handling systems.
§Examples
use rvoip_client_core::events::{ClientEvent, EventPriority};
use rvoip_client_core::ClientError;
let error_event = ClientEvent::ClientError {
error: ClientError::internal_error("Test error"),
call_id: None,
priority: EventPriority::High,
};
assert_eq!(error_event.priority(), EventPriority::High);Sourcepub fn call_id(&self) -> Option<CallId>
pub fn call_id(&self) -> Option<CallId>
Get the call ID associated with this event (if any)
Returns the call ID for events that are related to a specific call. Not all events have an associated call ID (e.g., network events).
§Examples
use rvoip_client_core::events::{ClientEvent, EventPriority};
let network_event = ClientEvent::NetworkEvent {
connected: true,
reason: Some("Connection restored".to_string()),
priority: EventPriority::Normal,
};
assert_eq!(network_event.call_id(), None);Sourcepub fn passes_filter(&self, filter: &EventFilter) -> bool
pub fn passes_filter(&self, filter: &EventFilter) -> bool
Check if this event passes the given filter
Tests whether this event matches the criteria specified in the filter. This is used by the event system to determine which subscriptions should receive this event.
§Examples
use rvoip_client_core::events::{ClientEvent, EventFilter, EventPriority};
let event = ClientEvent::NetworkEvent {
connected: true,
reason: None,
priority: EventPriority::Normal,
};
let filter = EventFilter {
min_priority: Some(EventPriority::High),
call_ids: None,
call_states: None,
media_event_types: None,
registration_ids: None,
};
// This normal priority event should not pass a high-priority filter
assert!(!event.passes_filter(&filter));Trait Implementations§
Source§impl Clone for ClientEvent
impl Clone for ClientEvent
Source§fn clone(&self) -> ClientEvent
fn clone(&self) -> ClientEvent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more