-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update project to conform with Spindle open source requirements.
- Loading branch information
Showing
8 changed files
with
276 additions
and
300 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
### Version | ||
|
||
{version or tag here} | ||
|
||
### File / Feature | ||
|
||
{file or feature containing the issue} | ||
|
||
### Expected behaviour | ||
|
||
{what should happen} | ||
|
||
### Actual behaviour | ||
|
||
{what happens} | ||
|
||
### Stacktrace / Error message | ||
|
||
{paste here} | ||
|
||
### Other info | ||
|
||
{anything else that might be related/useful} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
### Issue number | ||
|
||
{if exists provide related issue} | ||
|
||
### Expected behaviour | ||
|
||
{what should have happened} | ||
|
||
### Actual behaviour | ||
|
||
{what happens} | ||
|
||
### Description of fix | ||
|
||
{small description of what fixes the issue} | ||
|
||
### Other info | ||
|
||
{anything else that might be related/useful} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Changelog | ||
|
||
## 0.4.0 - ConnectAB | ||
|
||
- Add support for calls where Asterisk calls and connects both parties. | ||
|
||
## 0.3.0 - Fixed Destinations | ||
|
||
- Calls to external phone numbers (rather than just phone accounts) are now | ||
tracked correctly. | ||
- The `on_transfer` hook was split to `on_warm_transfer` (for attended | ||
transfers) and `on_cold_transfer` (for blind and blonde transfers), with | ||
different method signatures. | ||
- The `on_b_dial` events for a single call have been merged. If multiple | ||
destinations start to ring for a single call, one `on_b_dial` event will be | ||
triggered with a list of CallerId objects. | ||
- The `on_pickup` event was removed. You can compare the data from the | ||
`on_b_dial` call with the `on_up` call to see whether the callee's phone rang. | ||
|
||
## 0.2.2 - Cancelled Calls | ||
|
||
- Fix issue where calls which were hung up by the caller before being answered | ||
were not tracked correctly. | ||
|
||
## 0.2.1 - Call Confirmation | ||
|
||
- Fix issue where `on_up` would trigger before both call parties were connected. | ||
This issue was most prevalent when one party needed to perform additional steps | ||
before the call was patched through (like pressing a button). | ||
|
||
## 0.2.0 - Queues | ||
|
||
- Calls passed through the Queue app are now tracked correctly (requires the | ||
`eventwhencalled` flag to be enabled). | ||
|
||
## 0.1.0 - Ups and Downs | ||
|
||
- Major refactor of the existing code. | ||
- Add `on_up` and `on_hangup` events. | ||
- Add `call_id` to uniquely identify a call (based on the source channel's | ||
UniqueId, just like Asterisk's LinkedId). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Contributing | ||
Nice having you on board! | ||
|
||
We love contributions from everyone and here are a few things to keep in mind when contributing. | ||
|
||
## Issues | ||
Somethings not working like it should? We've got you covered! | ||
|
||
- Use GitHub to create an issue. | ||
- Write a descriptive title. | ||
- Fill out the issue template. | ||
- Wait for a developer to make coffee and get back to you. | ||
|
||
## Pull requests | ||
You want to help out by contributing code? Here's a checklist for a pull request: | ||
|
||
- Fork the project. | ||
- Create a branch for your code. | ||
- Write your awesome code. | ||
- Don't forget to add yourself to the [CONTRIBUTORS.md](CONTRIBUTORS.md) file. | ||
- Squash commits and provide a sane commit message. | ||
- Create a pull request. | ||
- Write a descriptive title. | ||
- Fill out the pull request template. | ||
- Wait for a developer to make coffee and get back to you. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Contributors | ||
We would like to thank everyone on this list for contributing to this project! | ||
|
||
Contributors can add themselves to the list by using to following format: | ||
|
||
John Doe {[email protected]} | ||
|
||
Keep the list in alfabetical order please. | ||
|
||
## Many thanks to | ||
|
||
- Devhouse Spindle {[email protected]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2017 Devhouse Spindle | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
# 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 | ||
|
||
### 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. Two reports have been included: a DebugReporter (which just dumps the data to stdout) and a JsonReporter (which creates JSON files for the FileRunner). | ||
|
||
To create your own reporter, you can extend the BaseReport class and implement your own event handlers, like so: | ||
|
||
```python | ||
from cacofonisk import AmiRunner, BaseReporter | ||
|
||
|
||
class ReportAllTheThings(BaseReporter): | ||
|
||
def on_b_dial(self, call_id, caller, to_number, targets): | ||
callee_codes = [target.code for target in targets] | ||
caller_number = caller.number | ||
print("{} is now ringing {} on number {}".format( | ||
caller_number, ', '.join(callee_codes), to_number, | ||
)) | ||
|
||
def on_up(self, call_id, caller, to_number, callee): | ||
callee_account_code = callee.code | ||
caller_number = caller.number | ||
print("{} is now in conversation with {}".format(caller_number, callee_account_code)) | ||
|
||
def on_warm_transfer(self, call_id, merged_id, redirector, caller, destination): | ||
print('{} is now calling with {} (was calling {})'.format(caller, destination, redirector)) | ||
|
||
def on_cold_transfer(self, call_id, merged_id, redirector, caller, to_number, targets): | ||
print('{} tried to transfer the call from {} to number {} (ringing {})'.format( | ||
redirector, caller, to_number, ', '.join(targets), | ||
)) | ||
|
||
def on_hangup(self, call_id, caller, to_number, reason): | ||
print("{} is no longer calling number {} (reason: {})".format(caller, to_number, reason)) | ||
|
||
|
||
reporter = ReportAllTheThings() | ||
runner = AmiRunner([ | ||
{'host': '127.0.0.1', 'username': 'cacofonisk', 'password': 'bard', 'port': 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+11+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 [email protected]. | ||
|
||
## License | ||
|
||
Cacofonisk is made available under the MIT license. See the [LICENSE file](LICENSE) for more info. |
Oops, something went wrong.