cacofonisk


Namecacofonisk JSON
Version 0.7.7 PyPI version JSON
download
home_pagehttps://github.com/VoIPGRID/cacofonisk
SummaryTrack channels through Asterisk Management Interface (AMI)
upload_time2023-01-19 14:31:45
maintainer
docs_urlNone
authorDevhouse Spindle
requires_python
licenseMIT
keywords ami asterisk callerid
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            # Cacofonisk

Cacofonisk is a framework that connects to the Asterisk PBX, listens to events
on the Asterisk Management Interface (AMI) and tracks the status of calls
currently in progress in Asterisk.

Cacofonisk takes a stream of AMI events as input and uses these to keep track
of the channels currently active in Asterisk and how they are related. When
something interesting happens to one of the channels, it will call a method on
a call state Reporter with interesting information about the call, like who is
in the call, and a unique identifier.

This data can then be used to send webhooks regarding a call, to notify a
person who is being called, or to log calls being performed.

## Status

This product is actively being developed and used at VoIPGRID.

## Usage

### Requirements

- Python >= 3.4
- Panoramisk 1.x
- Asterisk >= 12

### Installation

Cacofonisk is available on Pypi so you can easily install it with pip:

```bash
$ pip install cacofonisk
```

To install the dependencies from source:

```bash
$ python3 setup.py install
```

### Running

To run Cacofonisk, you will need two things: a Runner and a Reporter.

A Runner is a class which is responsible for passing AMI events to the
Cacofonisk. Two runners are included: an AmiRunner (which connects to the
Asterisk Management Interface) and a FileRunner (which imports AMI events from
a JSON file).

A Reporter is a class which takes the interesting data from Cacofonisk and does
awesome things with it. You can find various Reporters in the `examples`
folder.

To create your own reporter, you can extend the BaseReporter class and
implement your own event handlers, like so:

```python
from cacofonisk import AmiRunner, BaseReporter


class ReportAllTheThings(BaseReporter):

    def on_b_dial(self, caller, targets):
        target_channels = [target.name for target in targets]
        caller_number = caller.caller_id.num
        print("{} is now calling {}".format(
            caller_number, ', '.join(target_channels),
        ))

    def on_up(self, caller, target):
        target_number = target.caller_id.num
        caller_number = caller.caller_id.num
        print("{} is now in conversation with {}".format(caller_number, target_number))

    def on_hangup(self, caller, reason):
        caller_number = caller.caller_id.num
        print("{} is no longer calling (reason: {})".format(caller_number, reason))


reporter = ReportAllTheThings()
runner = AmiRunner(['tcp://username:password@127.0.0.1:5038'], reporter)
runner.run()
```

This reporter can then be passed to a Runner of your choice to process AMI
events.

For more information about the parameters of the reporter, please see the docs
in BaseReporter.

You can also listen for
[UserEvents](https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_UserEvent)
using the `on_user_event` function. This can be used to pass additional data
from Asterisk to your Cacofonisk application.

#### Running the tests

To run the test suite:

```bash
$ python3 -m unittest
```

## Contributing

See the [CONTRIBUTING.md](CONTRIBUTING.md) file on how to contribute to this project.

## Contributors

See the [CONTRIBUTORS.md](CONTRIBUTORS.md) file for a list of contributors to the project.

## Roadmap

### Changelog

The changelog can be found in the [CHANGELOG.md](CHANGELOG.md) file.

### In progress

No features are currently in progress.

### Future

No features are currently scheduled. Have great ideas? Please don't hesitate to share them!

## Get in touch with a developer

If you want to report an issue see the [CONTRIBUTING.md](CONTRIBUTING.md) file for more info.

We will be happy to answer your other questions at opensource@wearespindle.com.

## License

Cacofonisk is made available under the MIT license. See the [LICENSE file](LICENSE) for more info.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/VoIPGRID/cacofonisk",
    "name": "cacofonisk",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "ami asterisk callerid",
    "author": "Devhouse Spindle",
    "author_email": "opensource+cacofonisk@wearespindle.com",
    "download_url": "https://files.pythonhosted.org/packages/b8/99/983dd1257252c1493dd2dda2fd1385ee0d4df2b8ace132055eec6c547ae9/cacofonisk-0.7.7.tar.gz",
    "platform": null,
    "description": "# Cacofonisk\n\nCacofonisk is a framework that connects to the Asterisk PBX, listens to events\non the Asterisk Management Interface (AMI) and tracks the status of calls\ncurrently in progress in Asterisk.\n\nCacofonisk takes a stream of AMI events as input and uses these to keep track\nof the channels currently active in Asterisk and how they are related. When\nsomething interesting happens to one of the channels, it will call a method on\na call state Reporter with interesting information about the call, like who is\nin the call, and a unique identifier.\n\nThis data can then be used to send webhooks regarding a call, to notify a\nperson who is being called, or to log calls being performed.\n\n## Status\n\nThis product is actively being developed and used at VoIPGRID.\n\n## Usage\n\n### Requirements\n\n- Python >= 3.4\n- Panoramisk 1.x\n- Asterisk >= 12\n\n### Installation\n\nCacofonisk is available on Pypi so you can easily install it with pip:\n\n```bash\n$ pip install cacofonisk\n```\n\nTo install the dependencies from source:\n\n```bash\n$ python3 setup.py install\n```\n\n### Running\n\nTo run Cacofonisk, you will need two things: a Runner and a Reporter.\n\nA Runner is a class which is responsible for passing AMI events to the\nCacofonisk. Two runners are included: an AmiRunner (which connects to the\nAsterisk Management Interface) and a FileRunner (which imports AMI events from\na JSON file).\n\nA Reporter is a class which takes the interesting data from Cacofonisk and does\nawesome things with it. You can find various Reporters in the `examples`\nfolder.\n\nTo create your own reporter, you can extend the BaseReporter class and\nimplement your own event handlers, like so:\n\n```python\nfrom cacofonisk import AmiRunner, BaseReporter\n\n\nclass ReportAllTheThings(BaseReporter):\n\n    def on_b_dial(self, caller, targets):\n        target_channels = [target.name for target in targets]\n        caller_number = caller.caller_id.num\n        print(\"{} is now calling {}\".format(\n            caller_number, ', '.join(target_channels),\n        ))\n\n    def on_up(self, caller, target):\n        target_number = target.caller_id.num\n        caller_number = caller.caller_id.num\n        print(\"{} is now in conversation with {}\".format(caller_number, target_number))\n\n    def on_hangup(self, caller, reason):\n        caller_number = caller.caller_id.num\n        print(\"{} is no longer calling (reason: {})\".format(caller_number, reason))\n\n\nreporter = ReportAllTheThings()\nrunner = AmiRunner(['tcp://username:password@127.0.0.1:5038'], reporter)\nrunner.run()\n```\n\nThis reporter can then be passed to a Runner of your choice to process AMI\nevents.\n\nFor more information about the parameters of the reporter, please see the docs\nin BaseReporter.\n\nYou can also listen for\n[UserEvents](https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_UserEvent)\nusing the `on_user_event` function. This can be used to pass additional data\nfrom Asterisk to your Cacofonisk application.\n\n#### Running the tests\n\nTo run the test suite:\n\n```bash\n$ python3 -m unittest\n```\n\n## Contributing\n\nSee the [CONTRIBUTING.md](CONTRIBUTING.md) file on how to contribute to this project.\n\n## Contributors\n\nSee the [CONTRIBUTORS.md](CONTRIBUTORS.md) file for a list of contributors to the project.\n\n## Roadmap\n\n### Changelog\n\nThe changelog can be found in the [CHANGELOG.md](CHANGELOG.md) file.\n\n### In progress\n\nNo features are currently in progress.\n\n### Future\n\nNo features are currently scheduled. Have great ideas? Please don't hesitate to share them!\n\n## Get in touch with a developer\n\nIf you want to report an issue see the [CONTRIBUTING.md](CONTRIBUTING.md) file for more info.\n\nWe will be happy to answer your other questions at opensource@wearespindle.com.\n\n## License\n\nCacofonisk is made available under the MIT license. See the [LICENSE file](LICENSE) for more info.\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Track channels through Asterisk Management Interface (AMI)",
    "version": "0.7.7",
    "split_keywords": [
        "ami",
        "asterisk",
        "callerid"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f37e6f867ebbb329453218b99666f75df41db03acfe1c877dfd363b278835649",
                "md5": "3043557c46b43130433dba3267b33c82",
                "sha256": "4b51e560e26f441bffcdf6637028ee80ec58fd8c51f98252ee33e7c8776efc6b"
            },
            "downloads": -1,
            "filename": "cacofonisk-0.7.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3043557c46b43130433dba3267b33c82",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 38123,
            "upload_time": "2023-01-19T14:31:43",
            "upload_time_iso_8601": "2023-01-19T14:31:43.318720Z",
            "url": "https://files.pythonhosted.org/packages/f3/7e/6f867ebbb329453218b99666f75df41db03acfe1c877dfd363b278835649/cacofonisk-0.7.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b899983dd1257252c1493dd2dda2fd1385ee0d4df2b8ace132055eec6c547ae9",
                "md5": "fbb04c5d6251d0591103af2dcc7e7b63",
                "sha256": "bcca08657c7a4fe4e12439fdebb0c08ab3823adcc2e3ddcca0ccd101158e7684"
            },
            "downloads": -1,
            "filename": "cacofonisk-0.7.7.tar.gz",
            "has_sig": false,
            "md5_digest": "fbb04c5d6251d0591103af2dcc7e7b63",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 30547,
            "upload_time": "2023-01-19T14:31:45",
            "upload_time_iso_8601": "2023-01-19T14:31:45.116518Z",
            "url": "https://files.pythonhosted.org/packages/b8/99/983dd1257252c1493dd2dda2fd1385ee0d4df2b8ace132055eec6c547ae9/cacofonisk-0.7.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-19 14:31:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "VoIPGRID",
    "github_project": "cacofonisk",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "cacofonisk"
}
        
Elapsed time: 0.06711s