ami2rabbitmq


Nameami2rabbitmq JSON
Version 0.2.1 PyPI version JSON
download
home_page
SummaryProducer Events Asterisk Manager Interface (AMI) for RabbitMQ Broker
upload_time2022-12-30 19:22:22
maintainer
docs_urlNone
authorTatianno Alves
requires_python
licenseMIT License
keywords asterisk ami rabbitmq producer
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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()
```


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "ami2rabbitmq",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "asterisk ami rabbitmq producer",
    "author": "Tatianno Alves",
    "author_email": "tferreiraalves@gmail.com",
    "download_url": "",
    "platform": null,
    "description": "# AMI2RabbitMQ\n\n## Overview\n\nIs 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.\n\nThe generated data is persisted on the Redis Server with keys starting with the prefix **Online:**< SUFIX >.\n\n## Dependencies\n\nIt is necessary to have Redis, RabbitMQ, Asterisk installed and configured to use the lib.\n\n## Installing AMI2RabbitMQ and Supported Versions\n\nAMI2RabbitMQ is available on PyPI:\n\n`$ python -m pip install ami2rabbitmq`\n\nAMI2RabbitMQ officially supports Python 3.8+.\n\n## Cloning the repository\n\n`https://github.com/tatianno/ami2rabbitmq.git`\n\n## Examples\n\n### Simple producer application\n\n```\nfrom ami2rabbitmq import AMI2RabbitMQ\n\n\nAMI_SETTINGS = {\n    'host' : 'localhost',\n    'user' : 'user',\n    'password' : 'password'\n}\n\nRABBITMQ_SETTINGS = RABBITMQ_SETTINGS = {\n    'host' : 'localhost',\n    'user' : 'user',\n    'password' : 'password',\n    'queuename' : 'online'\n}\n\nproducer = AMI2RabbitMQ(\n    ami_settings = AMI_SETTINGS,\n    rabbitmq_settings = RABBITMQ_SETTINGS,\n)\n\nproducer.run()\n```\n\n### Advanced producer application\n\n```\nfrom ami2rabbitmq import AMI2RabbitMQ\n\n\nAMI_SETTINGS = {\n    'host' : 'localhost',\n    'user' : 'user',\n    'password' : 'password'\n}\n\nRABBITMQ_SETTINGS = RABBITMQ_SETTINGS = {\n    'host' : 'localhost',\n    'user' : 'user',\n    'password' : 'password',\n    'queuename' : 'online'\n}\n\n\nclass CustomProducerApp(AMI2RabbitMQ):\n\n    def update_events(self):\n        '''\n        The change_entities variable receives a list containing the entities that received state change events.\n\n        Entities can be of the type:\n\n        - Bridge : Call established between two endpoints\n        - QueueCaller : Call waiting in a queue\n        - Endpoint : Can be an extension or trunk\n        - QueueMember : Member of a queue\n        - Queue : Service queue\n\n        Entities are available for import:\n\n        import from ami2rabbitmq.entities import Bridge, Endpoint, QueueCaller, QueueMember, Queue\n        '''\n        change_entities = self._pabx.update(self.last_events)\n        self._send_change_to_broker(change_entities)\n\n\ncustom_producer = CustomProducerApp(\n    ami_settings = AMI_SETTINGS,\n    rabbitmq_settings = RABBITMQ_SETTINGS,\n)\n\ncustom_producer.run()\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Producer Events Asterisk Manager Interface (AMI) for RabbitMQ Broker",
    "version": "0.2.1",
    "split_keywords": [
        "asterisk",
        "ami",
        "rabbitmq",
        "producer"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "7051d86cc4efe326b579e6c4f2b4c70e",
                "sha256": "d286ad8466abf9e104294dd06e15cef4ffb3a8f676a48290b0b991356ee62d21"
            },
            "downloads": -1,
            "filename": "ami2rabbitmq-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7051d86cc4efe326b579e6c4f2b4c70e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 9918,
            "upload_time": "2022-12-30T19:22:22",
            "upload_time_iso_8601": "2022-12-30T19:22:22.154805Z",
            "url": "https://files.pythonhosted.org/packages/93/f0/09755c18d574df43f73a3f60a26a522c0861947416aaa832872417fb38a8/ami2rabbitmq-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-30 19:22:22",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "ami2rabbitmq"
}
        
Elapsed time: 0.08369s