https://github.com/cygnusnetworks/slack_asterisk
Asterisk Slack Call Notifixation
https://github.com/cygnusnetworks/slack_asterisk
asterisk slack
Last synced: 12 months ago
JSON representation
Asterisk Slack Call Notifixation
- Host: GitHub
- URL: https://github.com/cygnusnetworks/slack_asterisk
- Owner: CygnusNetworks
- License: apache-2.0
- Created: 2018-04-03T10:04:51.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-12-17T08:19:55.000Z (over 1 year ago)
- Last Synced: 2025-04-15T02:18:38.505Z (about 1 year ago)
- Topics: asterisk, slack
- Language: Python
- Homepage:
- Size: 149 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# slack_asterisk
This is a Asterisk Slack Integration, which provides logging of incoming and outgoing phone calls including call progress.
It will post a initial message on the first call and updates this on call progress.
It is implemented as a Asterisk FastAGI server (listening on local socket port 4574).

## Requirements
* Python 3.x
* configobj
* slackclient
* falcon
For a Python 2.7 version see release tag 0.10.
## Installation
Use:
`python3 setup.py install`
or build a rpm using the provided RPM spec file (tested using CentOS 7).
Also a SystemD Unit file is provided, which allows starting and stopping of the FastAGI service.
## Configuration
You will need a Slack API Token to be able to post messages to Slack. Create a Slack API Token with the proper
permissions and put the token into a environment variable, before starting the daemon. In addition you can use
a config file in /etc/slack-asterisk.conf to override the default values.
Start using Slack Token from environment:
```
export SLACK_TOKEN=xoxb....
/usr/bin/slack-asterisk
```
The provided SystemD Unit file will read the Slack Token from /etc/slack-asterisk.token.
### Asterisk extensions
Once the service is running, you need to have the FastAGI included in your extensions. Be sure to included
all incoming and outgoing dials and all call states.
```
; incoming call extension
same => n,AGI(agi://127.0.0.1:4574/)
same => n,Dial(SIP/FIXME,120,trM(slack-answered^${UNIQUEID})) ; Macro see below
...
; congestion, hangup, ... call states
exten => congestion,1,Noop(Congestion called)
same => next,AGI(agi://127.0.0.1:4574/)
same => next,Goto(noanswer,1)
exten => chanunavail,1,Noop(Channel unavailable called)
same => next,AGI(agi://127.0.0.1:4574/)
same => next,Goto(noanswer,1)
exten => h,1,Noop(Channel hangup called)
same => next,AGI(agi://127.0.0.1:4574/)
exten => noanswer,1,Set(GREETING=u)
same => next,Goto(leave-voicemail,${EXTEN},1)
exten => busy,1,Set(GREETING=b)
same => next,AGI(agi://127.0.0.1:4574/)
same => next,Goto(leave-voicemail,${EXTEN},1)
```
In additon define the Macro given below, to catch answered calls.
```
[macro-slack-answered]
exten => s,1,Noop(macro slack-answered called)
same => next,AGI(agi://127.0.0.1:4574/)
```
### Config file
Config file options are the following (defaults are given):
```
[general]
ip = 127.0.0.1
port = 4574
[slack]
client_id = ""
client_secret = ""
channel = "telefon"
username = "User"
emoji = ":telephone_receiver:"
```