This commit is contained in:
2021-06-29 12:37:08 +03:00
commit 12fdc96d20
282 changed files with 13627 additions and 0 deletions

3
asterisk/CHANGELOG.md Normal file
View File

@@ -0,0 +1,3 @@
## 1.0.0 - 2021-05-09
* Add Asterisk server `0.20.21`

19
asterisk/DOCS.md Normal file
View File

@@ -0,0 +1,19 @@
# Configuration
```yaml
config_files:
- /config/asterisk/sip.conf
```
### `config_files`
A list of paths to your configuration files of asterisk.
Every listed file will overwrite the template config file at `/etc/asterisk` on each addon start.
The config files can be located on `/config` or`/share`.
For the sample files take a look at the [official asterisk repository](https://github.com/asterisk/asterisk/blob/master/configs/samples).
## Testing
As default there is a test sip phone setup. With user `1001` and password `1234` the number `100` can be called.
A sound should confirm the working state.

10
asterisk/Dockerfile Normal file
View File

@@ -0,0 +1,10 @@
ARG BUILD_FROM
FROM $BUILD_FROM
RUN apk add --no-cache \
asterisk=18.2.1-r1 \
asterisk-sample-config=18.2.1-r1
ENTRYPOINT [ "/init" ]
CMD []
COPY root /

26
asterisk/README.md Normal file
View File

@@ -0,0 +1,26 @@
# Asterisk
[Asterisk](https://www.asterisk.org/) is an open source framework for building communications applications. Asterisk turns an ordinary computer into a communications server.
![Addon Stage][stage-badge]
![Supports aarch64 Architecture][aarch64-badge]
![Supports amd64 Architecture][amd64-badge]
![Supports armhf Architecture][armhf-badge]
![Supports armv7 Architecture][armv7-badge]
![Supports i386 Architecture][i386-badge]
[![Install on my Home Assistant][install-badge]][install-url]
[![Donate][donation-badge]][donation-url]
[aarch64-badge]: https://img.shields.io/badge/aarch64-yes-green.svg?style=for-the-badge
[amd64-badge]: https://img.shields.io/badge/amd64-yes-green.svg?style=for-the-badge
[armhf-badge]: https://img.shields.io/badge/armhf-yes-green.svg?style=for-the-badge
[armv7-badge]: https://img.shields.io/badge/armv7-yes-green.svg?style=for-the-badge
[i386-badge]: https://img.shields.io/badge/i386-yes-green.svg?style=for-the-badge
[install-url]: https://my.home-assistant.io/redirect/supervisor_addon?addon=243ffc37_asterisk
[stage-badge]: https://img.shields.io/badge/Addon%20stage-stable-green.svg?style=for-the-badge
[install-badge]: https://img.shields.io/badge/Install%20on%20my-Home%20Assistant-41BDF5?logo=home-assistant&style=for-the-badge
[donation-badge]: https://img.shields.io/badge/Buy%20me%20a%20coffee-%23d32f2f?logo=buy-me-a-coffee&style=for-the-badge&logoColor=white
[donation-url]: https://www.buymeacoffee.com/Poeschl

9
asterisk/build.json Normal file
View File

@@ -0,0 +1,9 @@
{
"build_from": {
"armhf": "ghcr.io/home-assistant/armhf-base:3.13",
"armv7": "ghcr.io/home-assistant/armv7-base:3.13",
"aarch64": "ghcr.io/home-assistant/aarch64-base:3.13",
"amd64": "ghcr.io/home-assistant/amd64-base:3.13",
"i386": "ghcr.io/home-assistant/i386-base:3.13"
}
}

36
asterisk/config.json Normal file
View File

@@ -0,0 +1,36 @@
{
"name": "Asterisk",
"version": "1.0.0",
"slug": "asterisk",
"description": "Asterisk is an open source framework for building communications applications. Asterisk turns an ordinary computer into a communications server",
"url": "https://github.com/Poeschl/Hassio-Addons/tree/master/asterisk",
"arch": [
"armv7",
"armhf",
"aarch64",
"amd64",
"i386"
],
"startup": "application",
"boot": "auto",
"image": "ghcr.io/poeschl/ha-asterisk-{arch}",
"map": ["share","config"],
"ports": {
"5060/tcp": 5060,
"5060/udp": 5060,
"4569/udp": 4569,
"2727/udp": 2727
},
"ports_description": {
"5060/tcp": "Port for SIP",
"5060/udp": "Port for SIP",
"4569/udp": "Port for IAX2",
"2727/udp": "Port for MGCP"
},
"options": {
"config_files": []
},
"schema": {
"config_files": ["match(/(share|config)/.+)"]
}
}

BIN
asterisk/icon.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
asterisk/logo.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

View File

@@ -0,0 +1,13 @@
[directories]
astcachedir => /var/cache/asterisk
astetcdir => /etc/asterisk
astmoddir => /usr/lib/asterisk/modules
astvarlibdir => /var/lib/asterisk
astdbdir => /var/lib/asterisk
astkeydir => /var/lib/asterisk
astdatadir => /var/lib/asterisk
astagidir => /var/lib/asterisk/agi-bin
astspooldir => /var/spool/asterisk
astrundir => /var/run/asterisk
astlogdir => /var/log/asterisk
astsbindir => /usr/sbin

View File

@@ -0,0 +1,5 @@
[internal]
exten = 100,1,Answer()
same = n,Wait(1)
same = n,Playback(test)
same = n,Hangup()

View File

@@ -0,0 +1,56 @@
;
; Asterisk configuration file
;
; Module Loader configuration file
;
[modules]
autoload=yes
;
; Any modules that need to be loaded before the Asterisk core has been
; initialized (just after the logger initialization) can be loaded
; using 'preload'. 'preload' forces a module and the modules it
; is known to depend upon to be loaded earlier than they normally get
; loaded.
;
; NOTE: There is no good reason left to use 'preload' anymore. It was
; historically required to preload realtime driver modules so you could
; map Asterisk core configuration files to Realtime storage.
; This is no longer needed.
;
;preload = your_special_module.so
;
; If you want Asterisk to fail if a module does not load, then use
; the "require" keyword. Asterisk will exit with a status code of 2
; if a required module does not load.
;
;require = chan_pjsip.so
;
; If you want you can combine with preload
; preload-require = your_special_module.so
;
;load = res_musiconhold.so
;
; Load one of: chan_oss, alsa, or console (portaudio).
; By default, load chan_oss only (automatically).
;
noload = chan_alsa.so
noload = chan_console.so
;noload = chan_oss.so
;
; Do not load res_hep and kin unless you are using HEP monitoring
; <http://sipcapture.org> in your network.
;
noload = res_hep.so
noload = res_hep_pjsip.so
noload = res_hep_rtcp.so
;
; Do not load chan_sip by default, it may conflict with res_pjsip.
noload = chan_sip.so
;
; Load one of the voicemail modules as they are mutually exclusive.
; By default, load app_voicemail only (automatically).
;
;noload = app_voicemail.so
noload = app_voicemail_imap.so
noload = app_voicemail_odbc.so

View File

@@ -0,0 +1,22 @@
[general]
type=transport
protocol=udp
bind=0.0.0.0
[1001]
type = endpoint
context = internal
disallow=all
allow=ulaw
aors = 1001
auth = auth1001
[1001]
type = aor
max_contacts = 1
[auth1001]
type=auth
auth_type=userpass
password=1234
username=1001

View File

@@ -0,0 +1,13 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
set -e
CONFIG_FILES=$(bashio::config 'config_files')
for config in $CONFIG_FILES; do
bashio::log.info "Apply '$config'"
cp "$config" '/etc/asterisk/'
done
chown -R asterisk:asterisk /etc/asterisk
chmod 640 -R /etc/asterisk

View File

@@ -0,0 +1 @@
/var/lib/asterisk/sounds/test.wav false asterisk:asterisk 0640 0640

View File

@@ -0,0 +1,8 @@
#!/usr/bin/with-contenv bashio
set -e
# Enable Jemalloc for better memory handling
export LD_PRELOAD="/usr/local/lib/libjemalloc.so.2"
bashio::log.info 'Start Asterisk'
asterisk -T -W -p -f -dd