Added following snippits about Asterisk

* A Basic Asterisk server for internal calling with IVR, curl triggers and message playback
* A Asterisk server to act as a bridge between a Bluetooth phone (as in/out bound route)
* A Node-Red Subflow to create a call between extensions using ARI
This commit is contained in:
2024-01-07 21:51:57 +01:00
parent 380353f4ea
commit 2e57050f06
41 changed files with 845 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
# Basic asterisk sever
Go [Here](../../Docs/Setup-Asterisk-Server.md) to read about how to set it up
**Config files that are empty**
these are just here to suppress errors
* ```acl.conf```
* ```ccss.conf```
* ```cdr.conf```
* ```cel.conf```
* ```features.conf```
* ```manager.conf```
* ```pjproject.conf```
* ```pjsip_wizard.conf```
**Config files for basic usage**
If a config file does not have a comment, it does not require any tweaking
`*` Must be updated for each (new) extension
`**` Must be updated if (new) extension if a voip client needs to connect ({Soft}phone) or needs to be connected to (Homeassistant)
* ```asterisk.conf```
* ```extensions.conf``` Dial plan for extensions `*`
* ```indications.conf``` Settings for dial tones
* ```logger.conf```
* ```modules.conf``` If not all functions are used you can disable some modules
* ```pjsip.conf``` Sets listening for PJSIP and loads sub configs
* ```pjsip.extension.conf``` Defines the extension the credentials for the extensions `**`
* ```pjsip.aor.conf``` Sets maximum connections for an extension `**`
* ```pjsip.auth.conf``` Sets the credentials for the extensions`**`
* ```udptl.conf```
**Config files for use with ARI**
* ```ari.conf``` ARI basic config and credentials (Make sure to update this)
* ```http.conf``` Settings for the integrated webserver for ARI
* ```stasis.conf``` (Just here to suppress errors)

View File

@@ -0,0 +1 @@
; Asterisk ACL configuration

View File

@@ -0,0 +1,9 @@
; Asterisk ARI (Asterisk REST API) configuration
[general]
enabled = yes
[aritest]
type = user
read_only = no
password = testme
password_format = plain

View File

@@ -0,0 +1,19 @@
; Asterisk core configuration
[directories](!)
astcachedir => /tmp
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
[options]
;verbose = 3
;debug = 3
documentation_language = en_US

View File

@@ -0,0 +1 @@
; Asterisk ccss (Call Completion Supplementary Services) configuration

View File

@@ -0,0 +1 @@
; Asterisk cdr (Call Detail Record engine) configuration

View File

@@ -0,0 +1 @@
; Asterisk CEL (Channel Event Logging) configuration

View File

@@ -0,0 +1,45 @@
; Asterisk exention configuration
[from-internal]
;Play audio message and hangup if 6010 is dialed
exten = 6010,1,Answer()
same = n,Wait(2)
same = n,Playback(demo-congrats)
same = n,Hangup()
;Send http request, play audio message and hangup if 6011 is dialed
exten = 6011,1,Answer()
same = n,Wait(2)
same = n,Set(CURL_RESULT=${CURL(http://<NoderedIP>:1880/endpoint/<ENDPOINT NAME>?exten=${EXTEN})})
same = n,Playback(activated)
same = n,Hangup()
;Internal extentions (Phone,softphones or other Voip clients)
; The number at the end (,30) sets the dial time out
exten => 6000,1,Dial(PJSIP/${EXTEN},30)
;Connect to extenal the Homeassistent 'Assistent' service when 6020 is dialed
exten => 6020,1,Dial(PJSIP/HomeAssistant,10)
;IVR,
;send to ivr if 6012 is dialed
exten = 6012,1,Goto(ivr-test,s,1)
;;The following section must be at the end of the file
[ivr-test]
exten =>s,1,Answer()
same =>n,set(IVRName=TestIVR)
same => n,wait(2)
same => n,Background(basic-pbx-ivr-main)
same => n,WaitExten(10)
;;Nr 1 to 4 are vaild options
exten => _[1-4],1,Set(CURL_RESULT=${CURL(http://<NoderedIP>:1880/endpoint/<ENDPOINT NAME>?${IVRName}=${EXTEN})}
same = n,Playback(activated)
same = n,Playback(goodbye)
same = n,Hangup()
;;If option invalid
exten => i,1,Playback(pm-invalid-option)
exten => i,2,Goto(ivr-test,s,5)
;; If timed out
exten => t,1,Playback(vm-pls-try-again)
exten => t,2,Goto(ivr-test,s,5)

View File

@@ -0,0 +1 @@
; Asterisk Call Features (transfer, monitor/mixmonitor, etc) configuration

View File

@@ -0,0 +1,5 @@
; Asterisk HTTP server (for ARI, etc) configuration
[general]
enabled=yes
bindaddr=0.0.0.0
bindport=8088

View File

@@ -0,0 +1,30 @@
; Asterisk indication (location specific tone indications) configuration
[general]
country=nl
[nl]
description = Netherlands
ringcadence = 1000,4000
dial = 425
busy = 425/500,0/500
ring = 425/1000,0/4000
congestion = 425/250,0/250
callwaiting = 425/500,0/9500
dialrecall = 425/500,0/50
record = 1400/500,0/15000
info = 950/330,1400/330,1800/330,0/1000
stutter = 425/500,0/50
[us]
description = United States / North America
ringcadence = 2000,4000
dial = 350+440
busy = 480+620/500,0/500
ring = 440+480/2000,0/4000
congestion = 480+620/250,0/250
callwaiting = 440/300,0/10000
dialrecall = !350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440
record = 1400/500,0/15000
info = !950/330,!1400/330,!1800/330,0
stutter = !350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440

View File

@@ -0,0 +1,7 @@
; Asterisk logging configuration
[general]
[logfiles]
console => notice,warning,error
messages => notice,warning,error

View File

@@ -0,0 +1 @@
; Asterisk AMI - (Asterisk Manager Interface) configuration

View File

@@ -0,0 +1,109 @@
; Asterisk Module Loader configuration file
[modules]
autoload=no
;Core (BasicCalling)
load = app_dial.so
load = pbx_config.so
load = pbx_loopback.so
load = pbx_realtime.so
load = pbx_spool.so
load = func_callerid.so
load = func_dialplan.so
load = func_dialgroup.so
load = res_ael_share.so
load = res_timing_timerfd.so
;Codecs (BasicCalling)
load = codec_alaw.so
load = codec_g722.so
load = codec_g726.so
load = codec_gsm.so
load = codec_opus_open_source.so
load = codec_resample.so
load = codec_ulaw.so
;Formats (BasicCalling)
load = format_g719.so
load = format_g726.so
load = format_gsm.so
load = format_ogg_speex.so
load = format_siren14.so
load = format_siren7.so
load = format_wav.so
load = format_wav_gsm.so
load = res_format_attr_g729.so
load = res_format_attr_opus.so
load = res_format_attr_siren14.so
load = res_format_attr_siren7.so
;PJSIP (BasicCalling)
require = chan_pjsip.so
load = func_pjsip_aor.so
load = func_pjsip_endpoint.so
load = res_pjproject.so
load = res_pjsip.so
load = res_pjsip_authenticator_digest.so
load = res_pjsip_caller_id.so
load = res_pjsip_endpoint_identifier_ip.so
load = res_pjsip_endpoint_identifier_user.so
load = res_pjsip_exten_state.so
load = res_pjsip_outbound_publish.so
load = res_pjsip_outbound_registration.so
load = res_pjsip_path.so
load = res_pjsip_pubsub.so
load = res_pjsip_refer.so
load = res_pjsip_registrar.so
load = res_pjsip_sdp_rtp.so
load = res_pjsip_session.so
;Sorcery (Rqired by PJSIP)
load = res_sorcery_astdb.so
load = res_sorcery_config.so
load = res_sorcery_memory.so
;RTP (Reqired by BasicCalling)
load = chan_rtp.so
load = bridge_native_rtp.so
load = res_rtp_asterisk.so
load = res_rtp_multicast.so
;Bridge (Reqired by BasicCalling)
load = bridge_simple.so
load = bridge_builtin_features.so
;FilePlayback (Reqired for playing a audio message for dialplan or IVR)
load = app_controlplayback.so
load = app_playback.so
;;Make call from asterisk cli
;load = app_originate.so
;load = res_clioriginate.so
;ARI (Asterisk RESTful Interface)
load => res_ari.so
load => res_ari_applications.so
load => res_ari_asterisk.so
load => res_ari_bridges.so
load => res_ari_channels.so
load => res_ari_device_states.so
load => res_ari_endpoints.so
;load => res_ari_events.so
load => res_ari_model.so
load => res_ari_playbacks.so
load => res_ari_recordings.so
load => res_ari_sounds.so
; stasis (Reqired by ARI)
load => app_stasis.so
load => res_stasis.so
load => res_stasis_answer.so
load => res_stasis_device_state.so
load => res_stasis_playback.so
load => res_stasis_recording.so
load => res_stasis_snoop.so
;cURL (Reqired for send curl commands form dialplan)
load = func_curl.so
load = res_curl.so

View File

@@ -0,0 +1 @@
; Asterisk pjproject options

View File

@@ -0,0 +1,15 @@
; Asterisk AOR (address of record) config
;Address for extenal the Homeassistent 'Assistent' service
[HomeAssistant]
type=aor
qualify_frequency=0
contact=sip:<HomeAssistant IP>:5060
;Internal extentions (Phone,softphones or other Voip clients)
[6000]
type=aor
; if one device is connected setting '1' is okay
; when a device sometimes fails to register (like my Friz!box) try increasing it, '5' is a safe value
max_contacts=5

View File

@@ -0,0 +1,15 @@
; Asterisk PJSIP auth/credentials config
;Credentials for extenal the Homeassistent 'Assistent' service
[HomeAssistant]
type=auth
auth_type=userpass
password=
username=HA
;Internal extentions (Phone,softphones or other Voip clients)
[6000]
type=auth
auth_type=userpass
password=<PASSWORD>
username=6000

View File

@@ -0,0 +1,10 @@
; Asterisk PJSIP config
#include pjsip.extension.conf
#include pjsip.auth.conf
#include pjsip.aor.conf
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0

View File

@@ -0,0 +1,32 @@
; Asterisk PJSIP extention config
;settings Homeassistent 'Assistent' service extention
[HomeAssistant]
type=endpoint
context=from-external
disallow=all
allow=opus
aors=HA
send_connected_line=false
rtp_keepalive=0
user_eq_phone=no
trust_id_inbound=no
direct_media=no
rtp_symmetric=yes
auth=HomeAssistant
aors=HomeAssistant
;dtmf_mode=auto
;Internal extentions (Phone,softphones or other Voip clients)
[6000]
type=endpoint
context=from-internal
callerid=DeskPhone <6000>
disallow=all
;Some phone may reqire other codecs,
;the following are available ulaw,alaw,gsm,g726,g722,opus
allow=g722
auth=6000
aors=6000

View File

@@ -0,0 +1 @@
; Asterisk PJSIP Wizard configuration

View File

@@ -0,0 +1,4 @@
; Asterisk Stasis config
[threadpool]
[declined_message_types]

View File

@@ -0,0 +1,8 @@
; Asterisk udptl config
[general]
udptlstart=4000
udptlend=4999
udptlfecentries = 3
udptlfecspan = 3
use_even_ports = no