pub struct AdminApi { /* private fields */ }
Expand description
§Administrative API for Call Center Management
The AdminApi
provides comprehensive administrative capabilities for call center
management, including agent operations, queue configuration, system monitoring,
and maintenance tasks. This API is designed for system administrators who need
complete control over call center operations and configuration.
§Core Administrative Functions
§Agent Management
- Add/Remove Agents: Complete lifecycle management of agent profiles
- Update Agent Information: Modify agent details, skills, and configuration
- Skills Management: Assign and update agent capabilities and specializations
- Status Monitoring: Track agent availability and performance
§Queue Operations
- Queue Creation: Establish new call queues with custom configurations
- Configuration Updates: Modify queue parameters and routing rules
- Queue Deletion: Remove unused queues (with safety checks)
- Performance Monitoring: Track queue metrics and utilization
§System Management
- Health Monitoring: Comprehensive system health and status tracking
- Configuration Management: Import/export and dynamic configuration updates
- Database Operations: Maintenance, optimization, and integrity checks
- Statistics & Analytics: System-wide performance metrics and reporting
§Security and Access Control
The AdminApi
provides powerful system management capabilities and should be
used with appropriate security measures:
- Administrative authentication required
- Role-based access control recommended
- Audit logging for all operations
- Network access restrictions
- Secure communication channels
§Thread Safety
The AdminApi
is thread-safe and can be cloned for use across multiple
administrative components or tasks. All operations are asynchronous and
designed for concurrent administrative access.
§Examples
§Basic Administrative Setup
use rvoip_call_engine::api::AdminApi;
use rvoip_call_engine::CallCenterEngine;
use std::sync::Arc;
let engine = Arc::new(CallCenterEngine::new(Default::default(), None).await?);
let admin = AdminApi::new(Arc::clone(&engine));
// Get system health overview
let health = admin.get_system_health().await;
println!("System status: {:?}", health.status);
// Get system statistics
let stats = admin.get_statistics().await;
println!("Total agents: {}", stats.total_agents);
Implementations§
Source§impl AdminApi
impl AdminApi
Sourcepub fn new(engine: Arc<CallCenterEngine>) -> Self
pub fn new(engine: Arc<CallCenterEngine>) -> Self
Create a new admin API instance
Initializes a new administrative API connected to the specified call center engine. This provides access to all administrative functions and system management capabilities.
§Arguments
engine
- Shared reference to the call center engine
§Examples
use rvoip_call_engine::api::AdminApi;
use rvoip_call_engine::CallCenterEngine;
use std::sync::Arc;
let engine = Arc::new(CallCenterEngine::new(Default::default(), None).await?);
let admin = AdminApi::new(Arc::clone(&engine));
println!("Administrative API ready");
Sourcepub async fn add_agent(&self, agent: Agent) -> Result<(), CallCenterError>
pub async fn add_agent(&self, agent: Agent) -> Result<(), CallCenterError>
Add a new agent
Registers a new agent profile with the call center system, including database storage and registry updates. This is the primary method for agent onboarding and profile creation.
§Arguments
agent
- Complete agent profile including identification, skills, and configuration
§Returns
Ok(())
if agent added successfully, or error if operation fails.
§Examples
use rvoip_call_engine::api::AdminApi;
use rvoip_call_engine::agent::{Agent, AgentStatus};
let admin = AdminApi::new(Arc::clone(&engine));
let new_agent = Agent {
id: "agent-005".to_string(),
sip_uri: "sip:john.doe@call-center.com".to_string(),
display_name: "John Doe".to_string(),
skills: vec!["technical".to_string(), "escalation".to_string()],
max_concurrent_calls: 3,
status: AgentStatus::Offline, // Will be set to Available when agent logs in
department: Some("Technical Support".to_string()),
extension: Some("5005".to_string()),
};
admin.add_agent(new_agent).await?;
println!("✅ Agent added to system");
// Verify agent was added
let agents = admin.list_agents().await?;
println!("Total agents now: {}", agents.len());
Sourcepub async fn update_agent(&self, agent: Agent) -> Result<(), CallCenterError>
pub async fn update_agent(&self, agent: Agent) -> Result<(), CallCenterError>
Update an existing agent
Sourcepub async fn remove_agent(
&self,
agent_id: &AgentId,
) -> Result<(), CallCenterError>
pub async fn remove_agent( &self, agent_id: &AgentId, ) -> Result<(), CallCenterError>
Remove an agent
Sourcepub async fn list_agents(&self) -> Result<Vec<Agent>, CallCenterError>
pub async fn list_agents(&self) -> Result<Vec<Agent>, CallCenterError>
List all agents
Sourcepub async fn update_agent_skills(
&self,
agent_id: &AgentId,
skills: Vec<String>,
) -> Result<(), CallCenterError>
pub async fn update_agent_skills( &self, agent_id: &AgentId, skills: Vec<String>, ) -> Result<(), CallCenterError>
Update agent skills
Sourcepub async fn create_queue(&self, queue_id: &str) -> CallCenterResult<()>
pub async fn create_queue(&self, queue_id: &str) -> CallCenterResult<()>
Create a new queue
Sourcepub async fn update_queue(
&self,
queue_id: &str,
config: QueueConfig,
) -> CallCenterResult<()>
pub async fn update_queue( &self, queue_id: &str, config: QueueConfig, ) -> CallCenterResult<()>
Update queue configuration
Sourcepub async fn delete_queue(&self, queue_id: &str) -> CallCenterResult<()>
pub async fn delete_queue(&self, queue_id: &str) -> CallCenterResult<()>
Delete a queue
This will fail if the queue has active calls
Sourcepub fn get_config(&self) -> &CallCenterConfig
pub fn get_config(&self) -> &CallCenterConfig
Get current system configuration
Sourcepub async fn update_routing_config(
&self,
config: RoutingConfig,
) -> CallCenterResult<()>
pub async fn update_routing_config( &self, config: RoutingConfig, ) -> CallCenterResult<()>
Update routing configuration
This allows dynamic updates to routing rules without restart
Sourcepub async fn get_system_health(&self) -> SystemHealth
pub async fn get_system_health(&self) -> SystemHealth
Get system health status
Sourcepub async fn optimize_database(&self) -> CallCenterResult<()>
pub async fn optimize_database(&self) -> CallCenterResult<()>
Perform database maintenance
Sourcepub async fn export_config(&self) -> CallCenterResult<String>
pub async fn export_config(&self) -> CallCenterResult<String>
Export system configuration
Sourcepub async fn import_config(
&self,
config_json: &str,
) -> CallCenterResult<CallCenterConfig>
pub async fn import_config( &self, config_json: &str, ) -> CallCenterResult<CallCenterConfig>
Import system configuration
Note: This requires a system restart to take effect
Sourcepub async fn get_queue_configs(&self) -> HashMap<String, QueueConfig>
pub async fn get_queue_configs(&self) -> HashMap<String, QueueConfig>
Get detailed queue configuration
Sourcepub async fn get_statistics(&self) -> CallCenterStats
pub async fn get_statistics(&self) -> CallCenterStats
Get statistics
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AdminApi
impl !RefUnwindSafe for AdminApi
impl Send for AdminApi
impl Sync for AdminApi
impl Unpin for AdminApi
impl !UnwindSafe for AdminApi
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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