AMI2RabbitMQ
Overview
Is a consumer of events produced by the Asterisk Manager Interface, where it organizes endpoints, bridges and queues into entities, persisting the last state on a redis server and producing an event for a queue on a RabbitMQ server.
The generated data is persisted on the Redis Server with keys starting with the prefix Online:< SUFIX >.
Dependencies
It is necessary to have Redis, RabbitMQ, Asterisk installed and configured to use the lib.
Installing AMI2RabbitMQ and Supported Versions
AMI2RabbitMQ is available on PyPI:
$ python -m pip install ami2rabbitmq
AMI2RabbitMQ officially supports Python 3.8+.
Cloning the repository
https://github.com/tatianno/ami2rabbitmq.git
Examples
Simple producer application
from ami2rabbitmq import AMI2RabbitMQ
AMI_SETTINGS = {
'host' : 'localhost',
'user' : 'user',
'password' : 'password'
}
RABBITMQ_SETTINGS = RABBITMQ_SETTINGS = {
'host' : 'localhost',
'user' : 'user',
'password' : 'password',
'queuename' : 'online'
}
producer = AMI2RabbitMQ(
ami_settings = AMI_SETTINGS,
rabbitmq_settings = RABBITMQ_SETTINGS,
)
producer.run()
Advanced producer application
from ami2rabbitmq import AMI2RabbitMQ
AMI_SETTINGS = {
'host' : 'localhost',
'user' : 'user',
'password' : 'password'
}
RABBITMQ_SETTINGS = RABBITMQ_SETTINGS = {
'host' : 'localhost',
'user' : 'user',
'password' : 'password',
'queuename' : 'online'
}
class CustomProducerApp(AMI2RabbitMQ):
def update_events(self):
'''
The change_entities variable receives a list containing the entities that received state change events.
Entities can be of the type:
- Bridge : Call established between two endpoints
- QueueCaller : Call waiting in a queue
- Endpoint : Can be an extension or trunk
- QueueMember : Member of a queue
- Queue : Service queue
Entities are available for import:
import from ami2rabbitmq.entities import Bridge, Endpoint, QueueCaller, QueueMember, Queue
'''
change_entities = self._pabx.update(self.last_events)
self._send_change_to_broker(change_entities)
custom_producer = CustomProducerApp(
ami_settings = AMI_SETTINGS,
rabbitmq_settings = RABBITMQ_SETTINGS,
)
custom_producer.run()
Metadata
Release files for ami2rabbitmq 0.2.1
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 |
|---|---|---|---|---|
| ami2rabbitmq-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for ami2rabbitmq-0.2.1-py3-none-any.whl |
Release files / ami2rabbitmq-0.2.1-py3-none-any.whl
| Download URL | ami2rabbitmq-0.2.1-py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d286ad8466abf9e104294dd06e15cef4ffb3a8f676a48290b0b991356ee62d21
|
|
BLAKE2b-256 checksum How to use checksums |
93f009755c18d574df43f73a3f60a26a522c0861947416aaa832872417fb38a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.10
|
Security for ami2rabbitmq 0.2.1
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.