Struct AdminApi

Source
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

Source

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");
Source

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());
Source

pub async fn update_agent(&self, agent: Agent) -> Result<(), CallCenterError>

Update an existing agent

Source

pub async fn remove_agent( &self, agent_id: &AgentId, ) -> Result<(), CallCenterError>

Remove an agent

Source

pub async fn list_agents(&self) -> Result<Vec<Agent>, CallCenterError>

List all agents

Source

pub async fn update_agent_skills( &self, agent_id: &AgentId, skills: Vec<String>, ) -> Result<(), CallCenterError>

Update agent skills

Source

pub async fn create_queue(&self, queue_id: &str) -> CallCenterResult<()>

Create a new queue

Source

pub async fn update_queue( &self, queue_id: &str, config: QueueConfig, ) -> CallCenterResult<()>

Update queue configuration

Source

pub async fn delete_queue(&self, queue_id: &str) -> CallCenterResult<()>

Delete a queue

This will fail if the queue has active calls

Source

pub fn get_config(&self) -> &CallCenterConfig

Get current system configuration

Source

pub async fn update_routing_config( &self, config: RoutingConfig, ) -> CallCenterResult<()>

Update routing configuration

This allows dynamic updates to routing rules without restart

Source

pub async fn get_system_health(&self) -> SystemHealth

Get system health status

Source

pub async fn optimize_database(&self) -> CallCenterResult<()>

Perform database maintenance

Source

pub async fn export_config(&self) -> CallCenterResult<String>

Export system configuration

Source

pub async fn import_config( &self, config_json: &str, ) -> CallCenterResult<CallCenterConfig>

Import system configuration

Note: This requires a system restart to take effect

Source

pub async fn get_queue_configs(&self) -> HashMap<String, QueueConfig>

Get detailed queue configuration

Source

pub async fn get_statistics(&self) -> CallCenterStats

Get statistics

Trait Implementations§

Source§

impl Clone for AdminApi

Source§

fn clone(&self) -> AdminApi

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for AdminApi

Source§

fn default() -> Self

Returns the “default value” for a type. 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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,