AMI Data Parser
This repository aims to provide a tool to interpret and process data received from the Asterisk Manager Interface (AMI). It identifies and exposes status changes in queues and extensions in real-time, enabling more efficient integration with external systems or monitoring dashboards.
Key Features
- Parsing data from the AMI.
- Detecting status changes in queues and extensions.
- Exposing processed data in an integration-friendly format.
Repository
Github: https://github.com/tatianno/ami-data-parser
Requirements
- Python 3.10 +
Installation
Clone the repository and install the dependencies:
pip install -r requirements.txt
Dependencies
The project requires the following packages:
pyst2ami-data-parser
Example Code
import sys
from time import sleep
from ami_data_parser import Controller
from asterisk.manager import (
Manager,
ManagerAuthException,
ManagerException,
ManagerSocketException
)
AMI_HOST = '192.168.0.103'
AMI_USERNAME = 'DEV'
AMI_PASSWORD = 'gnew'
if __name__ == '__main__':
manager = Manager()
controller = Controller()
try:
# connect to the manager
try:
manager.connect(AMI_HOST)
manager.login(AMI_USERNAME, AMI_PASSWORD)
while True:
queue_data = manager.command('queue show').response
peer_data = manager.command('core show hints').response
channel_data = manager.command('core show channels concise').response
print('-----------queue data-----------------')
print(controller.queue_update(queue_data))
print('-----------peer data------------------')
print(controller.peer_update(peer_data))
print('-----------channel data---------------')
print(controller.channel_update(channel_data))
sleep(2)
except ManagerSocketException:
print("Error connecting to the manager")
sys.exit(1)
except ManagerAuthException:
print("Error logging in to the manager")
sys.exit(1)
except ManagerException:
print("Error")
sys.exit(1)
except KeyboardInterrupt:
sys.exit(0)
finally:
manager.logoff()
Metadata
Release files for ami-data-parser 0.2.13
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ami_data_parser-0.2.13-py3-none-any.whl | Python 3 | none | any | Details for ami_data_parser-0.2.13-py3-none-any.whl |
Release files / ami_data_parser-0.2.13-py3-none-any.whl
| Download URL | ami_data_parser-0.2.13-py3-none-any.whl |
|---|---|
| Size | 44.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
57eb4e5da4db2868c4d46ee99157a196fb31f35ffdf510a03dc9a08f323b0dd2
|
|
BLAKE2b-256 checksum How to use checksums |
4859323c4ce569866666f38e7e5223f198475d861b91d2ac7a27c0dc9d844883
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Security for ami-data-parser 0.2.13
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.