项目作者: CygnusNetworks

项目描述 :
Asterisk Slack Call Notifixation
高级语言: Python
项目地址: git://github.com/CygnusNetworks/slack_asterisk.git
创建时间: 2018-04-03T10:04:51Z
项目社区:https://github.com/CygnusNetworks/slack_asterisk

开源协议:Apache License 2.0

下载


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).

Slack Asterisk example

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:

  1. export SLACK_TOKEN=xoxb....
  2. /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.

  1. ; incoming call extension
  2. same => n,AGI(agi://127.0.0.1:4574/)
  3. same => n,Dial(SIP/FIXME,120,trM(slack-answered^${UNIQUEID})) ; Macro see below
  4. ...
  5. ; congestion, hangup, ... call states
  6. exten => congestion,1,Noop(Congestion called)
  7. same => next,AGI(agi://127.0.0.1:4574/)
  8. same => next,Goto(noanswer,1)
  9. exten => chanunavail,1,Noop(Channel unavailable called)
  10. same => next,AGI(agi://127.0.0.1:4574/)
  11. same => next,Goto(noanswer,1)
  12. exten => h,1,Noop(Channel hangup called)
  13. same => next,AGI(agi://127.0.0.1:4574/)
  14. exten => noanswer,1,Set(GREETING=u)
  15. same => next,Goto(leave-voicemail,${EXTEN},1)
  16. exten => busy,1,Set(GREETING=b)
  17. same => next,AGI(agi://127.0.0.1:4574/)
  18. same => next,Goto(leave-voicemail,${EXTEN},1)

In additon define the Macro given below, to catch answered calls.

  1. [macro-slack-answered]
  2. exten => s,1,Noop(macro slack-answered called)
  3. same => next,AGI(agi://127.0.0.1:4574/)

Config file

Config file options are the following (defaults are given):

  1. [general]
  2. ip = 127.0.0.1
  3. port = 4574
  4. [slack]
  5. client_id = ""
  6. client_secret = ""
  7. channel = "telefon"
  8. username = "User"
  9. emoji = ":telephone_receiver:"