Description
Issue Description
We need to implement a dependency checking mechanism that verifies if required system components (such as AJAM and AMI) are enabled when a module is activated. This mechanism should display appropriate warnings when dependencies are missing.
Current Behavior
When activating modules that depend on specific system components like AJAM (Asynchronous Javascript Asterisk Manager) or AMI (Asterisk Manager Interface), the system does not automatically check if these dependencies are enabled. This can lead to modules not functioning properly without clear indication of the root cause.
Expected Behavior
- When a module is activated, the system should automatically check if all required dependencies are enabled
- If dependencies are disabled, a clear warning message should be displayed to the user
- The warning should specify which components need to be enabled for proper module functionality
- Potentially offer a one-click solution to enable the required dependencies
Technical Details
We need to implement a general dependency checking mechanism that:
- Allows modules to declare their dependencies (AJAM, AMI, Firewall settings, etc.)
- Checks the status of these dependencies when the module is activated
- Provides a standardized way to display warnings and resolve dependency issues
- Potentially prevents module activation until dependencies are resolved
This mechanism could be implemented as a core service that modules can leverage through a simple API.
Modules Affected
- CTI Client (requires AMI and AJAM)
- Potentially other modules with similar system dependencies
Implementation Proposal
- Create a new DependencyChecker service in the core
- Define a standard format for modules to declare dependencies
- Implement verification methods for common dependencies:
- AMI status check
- AJAM status check
- Firewall rules check
- Other system component checks
- Create a standard warning display mechanism
- Document the API for module developers
Example Module Dependency Declaration
// Example of how a module might declare dependencies
public static $dependencies = [
'ami' => [
'required' => true,
'message' => 'The CTI Client requires AMI to be enabled.'
],
'ajam' => [
'required' => true,
'message' => 'The CTI Client requires AJAM to be enabled.'
],
'firewall' => [
'required' => false,
'ports' => [8088, 8089],
'message' => 'The CTI Client requires ports 8088 and 8089 to be open.'
]
];
Additional Context
This enhancement would significantly improve the user experience by providing clear guidance when modules aren't working due to missing dependencies, rather than leaving users to troubleshoot complex issues on their own.