Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
slack: new module, send message to slack channel
- Loading branch information
Showing
8 changed files
with
1,216 additions
and
0 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,31 @@ | ||
# | ||
# Slac client for Kamailio | ||
# | ||
# | ||
# WARNING: do not run this directly, it should be run by the main Makefile | ||
|
||
include ../../Makefile.defs | ||
auto_gen= | ||
NAME=slack.so | ||
|
||
ifeq ($(CROSS_COMPILE),) | ||
CURL_BUILDER=$(shell \ | ||
if pkg-config --exists libcurl; then \ | ||
echo 'pkg-config libcurl'; \ | ||
else \ | ||
which curl-config; \ | ||
fi) | ||
endif | ||
|
||
ifneq ($(CURL_BUILDER),) | ||
CURLDEFS += $(shell $(CURL_BUILDER) --cflags) | ||
CURLLIBS += $(shell $(CURL_BUILDER) --libs) | ||
else | ||
CURLDEFS+=-I$(LOCALBASE)/include -I$(SYSBASE)/include | ||
CURLLIBS+=-L$(LOCALBASE)/lib -L$(SYSBASE)/lib -lcurl | ||
endif | ||
|
||
DEFS+=$(CURLDEFS) | ||
LIBS=$(CURLLIBS) | ||
|
||
include ../../Makefile.modules |
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,154 @@ | ||
Slack Module | ||
|
||
Arsen Semenov | ||
|
||
<arsperger@gmail.com> | ||
|
||
Copyright � 2021 arsperger.com | ||
__________________________________________________________________ | ||
|
||
Table of Contents | ||
|
||
1. Admin Guide | ||
|
||
1. Overview | ||
2. Dependencies | ||
|
||
2.1. Kamailio Modules | ||
2.2. External Libraries or Applications | ||
|
||
3. Parameters | ||
|
||
3.1. slack url (str) | ||
3.2. channel (str) | ||
3.3. username (str) | ||
3.4. icon_emogi (str) | ||
|
||
4. Functions | ||
|
||
4.1. slack_send(format) | ||
|
||
List of Examples | ||
|
||
1.1. Set slack webhook URL parameter | ||
1.2. Set channel parameter | ||
1.3. Set username parameter | ||
1.4. Set icon_emogi parameter | ||
1.5. slack_send usage | ||
|
||
Chapter 1. Admin Guide | ||
|
||
Table of Contents | ||
|
||
1. Overview | ||
2. Dependencies | ||
|
||
2.1. Kamailio Modules | ||
2.2. External Libraries or Applications | ||
|
||
3. Parameters | ||
|
||
3.1. slack url (str) | ||
3.2. channel (str) | ||
3.3. username (str) | ||
3.4. icon_emogi (str) | ||
|
||
4. Functions | ||
|
||
4.1. slack_send(format) | ||
|
||
1. Overview | ||
|
||
This module provides integration with Slack over webhooks. Slack | ||
integration (https://api.slack.com/messaging/webhooks) | ||
|
||
It relays on libcurl. library (https://curl.se/libcurl). | ||
|
||
2. Dependencies | ||
|
||
2.1. Kamailio Modules | ||
2.2. External Libraries or Applications | ||
|
||
2.1. Kamailio Modules | ||
|
||
The following modules must be loaded before this module: | ||
* none. | ||
|
||
2.2. External Libraries or Applications | ||
|
||
The following libraries or applications must be installed before | ||
running Kamailio with this module loaded: | ||
* libcurl | ||
|
||
3. Parameters | ||
|
||
3.1. slack url (str) | ||
3.2. channel (str) | ||
3.3. username (str) | ||
3.4. icon_emogi (str) | ||
|
||
3.1. slack url (str) | ||
|
||
Slack webhook url | ||
|
||
Default value is not set (empty) | ||
|
||
Example 1.1. Set slack webhook URL parameter | ||
... | ||
modparam("slack", "slack_url", "https://hooks.slack.com/services/T00000000/B0000 | ||
0000/XXXXXXXXXXXXXXXXXXXXXXXX") | ||
... | ||
|
||
3.2. channel (str) | ||
|
||
Slack channel name | ||
|
||
Default value is #kamailio | ||
|
||
Example 1.2. Set channel parameter | ||
... | ||
modparam("slack", "channel", "#kamailio") | ||
... | ||
|
||
3.3. username (str) | ||
|
||
Specify the username for the published message | ||
|
||
Default value is webhookbot. | ||
|
||
Example 1.3. Set username parameter | ||
... | ||
modparam("slack", "username", "webhookbot") | ||
... | ||
|
||
3.4. icon_emogi (str) | ||
|
||
specify an emoji (using colon shortcodes, eg. :white_check_mark:) to | ||
use as the profile photo alongside the message. | ||
|
||
Default value is :ghost: | ||
|
||
Example 1.4. Set icon_emogi parameter | ||
... | ||
modparam("slack", "icon_emogi", ":ghost:") | ||
... | ||
|
||
4. Functions | ||
|
||
4.1. slack_send(format) | ||
|
||
4.1. slack_send(format) | ||
|
||
Send a formatted message to slack channel. | ||
|
||
The parameters are: | ||
* format - The formatted string to be send. | ||
|
||
The parameters can contain pseudo-variables. | ||
|
||
This function can be used from ANY_ROUTE. | ||
|
||
Example 1.5. slack_send usage | ||
... | ||
slack_send("Hello from Kamailio! caller=$fU;callee=$tU;callid=$ci"); | ||
... |
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,4 @@ | ||
docs = slack.xml | ||
|
||
docbook_dir = ../../../../doc/docbook | ||
include $(docbook_dir)/Makefile.module |
Oops, something went wrong.