๐Ÿ“— Ansible playbooks and roles for building an idempotent, interconnected and scalable infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

621 lines
16 KiB

2 years ago
asterisk_user: asterisk
asterisk_group: asterisk
asterisk_dir: /var/lib/asterisk
asterisk_conf_dir: /etc/asterisk
asterisk_tls_dir: "{{ asterisk_conf_dir }}/tls"
asterisk_recordings_dir: /opt/recordings
asterisk_data_dir: "{{ asterisk_dir }}"
asterisk_users: {}
asterisk_trunks: {}
asterisk_language: ru
asterisk_pjsip_ciphers:
- ECDHE-ECDSA-CHACHA20-POLY1305
- ECDHE-ECDSA-AES256-GCM-SHA384
- ECDHE-ECDSA-AES128-GCM-SHA256
- ECDHE-RSA-CHACHA20-POLY1305
- ECDHE-RSA-AES256-GCM-SHA384
- ECDHE-RSA-AES128-GCM-SHA256
- DHE-RSA-AES128-SHA256
# meta definitions:
# __template__ (bool) (section): this section is a template
# __template_from__ (string/list) (section): templates to inherit from
# __comment__ (string) (section): specify a comment before the section definition
# __inner_objects__ (boolean) (config/section): use object syntax when enumerating section members
asterisk_default_config:
acl:
acl_lan_clients:
deny:
- 0.0.0.0/0.0.0.0
permit:
- "{{ int_net | ansible.utils.ipaddr('network') }}/{{ int_net | ansible.utils.ipaddr('netmask') }}"
acl_inet_clients:
deny:
- "{{ int_net | ansible.utils.ipaddr('network') }}/{{ int_net | ansible.utils.ipaddr('netmask') }}"
permit:
- 0.0.0.0/0.0.0.0
asterisk:
directories:
__template__: yes
__inner_objects__: yes
astetcdir: "{{ asterisk_conf_dir }}"
astvarlibdir: "{{ asterisk_dir }}"
astdatadir: "{{ asterisk_data_dir }}"
astdbdir: "{{ asterisk_db_dir | d(asterisk_dir) }}"
astkeydir: "{{ asterisk_key_dir | d(asterisk_dir) }}"
astagidir: "{{ asterisk_agi_dir | d(asterisk_dir ~ '/agi-bin') }}"
astspooldir: "{{ asterisk_spool_dir | d('/var/spool/asterisk') }}"
astrundir: "{{ asterisk_run_dir | d('/var/run/asterisk') }}"
astlogdir: "{{ asterisk_log_dir | d('/var/log/asterisk') }}"
astsbindir: /usr/sbin
astmoddir: /usr/lib/asterisk/modules
options:
verbose: 0
debug: no
trace: 0
execincludes: no
highpriority: yes
initcrypto: yes
nocolor: yes
dumpcore: no
runuser: "{{ asterisk_user }}"
rungroup: "{{ asterisk_group }}"
autosystemname: yes
maxcalls: 200
maxload: "100.0"
minmemfree: 1
languageprefix: yes
transmit_silence: no
defaultlanguage: en
documentation_language: en_US
ccss:
general:
cc_max_requests: 15
cdr:
general:
enable: yes
unanswered: yes
congestion: yes
cel:
general:
enable: no
cdr_pgsql:
global:
hostname: "{{ database_host }}"
port: 5432
user: "{{ database_user | d('cdr') }}"
dbname: "{{ database_name | d('cdr') }}"
table: "{{ database_table | d('cdr') }}"
password: "{{ database_pass }}"
encoding: UNICODE
cli_aliases:
general:
template: friendly
friendly:
"hangup request": channel request hangup
"originate": channel originate
"help": core show help
"pri intense debug span": pri set debug intense span
"reload": module reload
"pjsip reload": module reload res_pjsip.so res_pjsip_authenticator_digest.so res_pjsip_endpoint_identifier_ip.so res_pjsip_mwi.so res_pjsip_notify.so res_pjsip_outbound_publish.so res_pjsip_publish_asterisk.so res_pjsip_outbound_registration.so
cli_permissions:
general:
default_perm: permit
codecs:
plc:
__inner_objects__: yes
genericplc: "true"
genericplc_on_equal_codecs: "false"
opus:
type: opus
packet_loss: 2
signal: voice
confbridge:
default_user:
type: user
dsp_drop_silence: yes
jitterbuffer: yes
default_bridge:
type: bridge
max_members: 30
language: "{{ asterisk_language }}"
features:
__inner_objects__: yes
featuremap:
blindxfer: "**"
atxfer: "*#"
applicationmap:
volume-up-tx: "#1,self/caller,Gosub(volume-up-tx,s,1)"
volume-up-rx: "#2,self/caller,Gosub(volume-up-rx,s,1)"
volume-down-tx: "#3,self/caller,Gosub(volume-down-tx,s,1)"
volume-down-rx: "#4,self/caller,Gosub(volume-down-rx,s,1)"
volume-increase-all: "#5,self/caller,Gosub(volume-increase-all,s,1)"
call-controls:
volume-up-tx: ""
volume-up-rx: ""
volume-down-tx: ""
volume-down-rx: ""
volume-increase-all: ""
followme:
__inner_objects__: yes
general:
featuredigittimeout: 3500
enable_callee_prompt: "true"
takecall: 1
declinecall: 2
call_from_prompt: followme/call-from
norecording_prompt: followme/no-recording
options_prompt: followme/options
pls_hold_prompt: followme/pls-hold-while-try
status_prompt: followme/status
sorry_prompt: followme/sorry
connecting_prompt: ""
default:
musicclass: default
context: default
enable_callee_prompt: "true"
takecall: 1
declinecall: 2
call_from_prompt: followme/call-from
norecording_prompt: followme/no-recording
options_prompt: followme/options
pls_hold_prompt: followme/pls-hold-while-try
status_prompt: followme/status
sorry_prompt: followme/sorry
connecting_prompt: ""
indications:
general:
country: ru
ru:
description: Russian Federation / ex Soviet Union
ringcadence: "1000,4000"
dial: "425"
busy: "425/350,0/350"
ring: "425/1000,0/4000"
congestion: "425/175,0/175"
callwaiting: "425/200,0/5000"
record: "1400/400,0/15000"
info: "950/330,1400/330,1800/330,0/1000"
dialrecall: "425/400,0/40"
stutter: "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425"
logger:
general:
queue_log: no
logfiles:
__inner_objects__: yes
console: notice,warning,error,verbose,dtmf
"syslog.local0": "[plain]notice,warning,error"
manager:
general:
enabled: yes
webenabled: no
port: 5038
bindaddr: 0.0.0.0
debug: "off"
allowmultiplelogin: yes
displayconnects: yes
timestampevents: yes
authtimeout: 10
musiconhold:
default:
mode: files
directory: moh
pjproject:
startup:
cache_pools: yes
pjsip:
system:
type: system
threadpool_auto_increment: 3
timer_t1: 250
timer_b: 16000
global:
type: global
max_forwards: 40
keep_alive_interval: 15
user_agent: "{{ org }} Asterisk PBX"
endpoint_identifier_order: username,ip
default_from_user: pbx
default_realm: "{{ host_fqdn }}"
transport-common:
__template__: yes
type: transport
tos: cs3
cos: 3
allow_reload: no
local_net: "{{ int_net | ansible.utils.ipaddr('network') }}/{{ int_net | ansible.utils.ipaddr('netmask') }}"
transport-ext:
__template__: yes
__template_from__: transport-common
external_media_address: "{{ asterisk_external_ipv4 | d(hostvars[selected_node]['external_ipv4']) }}"
external_signaling_address: "{{ asterisk_external_ipv4 | d(hostvars[selected_node]['external_ipv4']) }}"
transport-udp:
__template__: yes
__template_from__: transport-common
protocol: udp
transport-tcp:
__template__: yes
__template_from__: transport-common
protocol: tcp
transport-lan:
__template_from__: transport-udp
bind: 0.0.0.0:5060
transport-lan-tcp:
__template_from__: transport-tcp
bind: 0.0.0.0:5060
transport-lan-tls:
__template_from__: transport-common
protocol: tls
bind: 0.0.0.0:5061
cert_file: "{{ asterisk_tls_dir }}/asterisk.crt"
priv_key_file: "{{ asterisk_tls_dir }}/asterisk.key"
cipher: "{{ asterisk_pjsip_ciphers | join(',') }}"
method: tlsv1_2
require_client_cert: no
verify_client: no
verify_server: no
endpoint-common:
__template__: yes
type: endpoint
allow: "!all,opus,g722,alaw,ulaw,g726,ilbc,gsm"
allow_overlap: no
send_connected_line: yes
trust_connected_line: yes
direct_media: no
dtmf_mode: auto_info
force_rport: yes
ice_support: no
identify_by: username
rewrite_contact: yes
rtp_symmetric: yes
send_diversion: yes
send_history_info: yes
send_pai: no
send_rpid: no
use_ptime: yes
t38_udptl: no
tone_zone: ru
language: ru
tos_audio: ef
cos_audio: 5
rtp_keepalive: 5
rtp_timeout: 360
rtp_timeout_hold: 720
rtcp_mux: yes
max_video_streams: 0
max_audio_streams: 1
bundle: no
sdp_session: "{{ org }} Asterisk PBX"
sdp_owner: PBX
suppress_q850_reason_headers: yes
endpoint-trunk:
__template__: yes
__template_from__: endpoint-common
identify_by: ip,username
trust_id_inbound: yes
acl: acl_inet_clients
contact_acl: acl_inet_clients
endpoint-lan:
__template__: yes
__template_from__: endpoint-common
identify_by: username
trust_id_inbound: no
trust_id_outbound: yes
acl: acl_lan_clients
contact_acl: acl_lan_clients
context: outbound
allow_subscribe: yes
device_state_busy_at: 1
sub_min_expiry: 15
media_encryption: sdes
media_encryption_optimistic: yes
auth-common:
__template__: yes
type: auth
auth_type: userpass
registration-common:
__template__: yes
type: registration
expiration: 1800
auth_rejection_permanent: no
max_retries: 10000
retry_interval: 20
forbidden_retry_interval: 60
fatal_retry_interval: 60
aor-common:
__template__: yes
type: aor
qualify_frequency: 30
max_contacts: 2 # https://asterisk.org/pjsip-mis-configuration-can-cause-loss-sip-registrations
__include__: custom_pjsip.conf
pjsip_notify:
__inner_objects__: yes
clear-mwi:
Event: message-summary
Content-type: application/simple-message-summary
Content:
- "Messages-Waiting: no"
- "Message-Account: sip:asterisk@127.0.0.1"
- "Voice-Message: 0/0 (0/0)"
- ""
polycom-check-cfg:
Event: check-sync
yealink-reboot:
Event: check-sync
queues:
general:
persistentmembers: no
autofill: yes
monitor-type: MixMonitor
updatecdr: yes
log_membername_as_agent: yes
shared_lastcall: yes
queue-template:
__template__: yes
musicclass: default
strategy: ringall
servicelevel: 30
maxlen: 128
timeoutpriority: conf
timeout: 300
wrapuptime: 5
announce-frequency: 0
periodic-announce-frequency: 0
announce-position: no
autopause: yes
autopausedelay: 60
autopausebusy: yes
joinempty: unavailable
leavewhenempty: unavailable
ringinuse: no
queue-single:
__template__: yes
__template_from__: queue-template
weight: 1
autopause: no
context: inbound-queued-inqueue-busy
queue-le:
__template__: yes
__template_from__: queue-template
weight: 1
autopause: no
__include__: custom_queues.conf
queuerules:
general:
rtp:
general:
rtpstart: 15000
rtpend: 19000
strictrtp: yes
icesupport: "false"
udptl:
general:
modules:
modules:
autoload: no
load:
- app_attended_transfer.so
- app_blind_transfer.so
- app_bridgeaddchan.so
- app_bridgewait.so
- app_cdr.so
- app_celgenuserevent.so
- app_chanisavail.so
- app_channelredirect.so
- app_chanspy.so
- app_confbridge.so
- app_controlplayback.so
- app_dial.so
- app_directed_pickup.so
- app_dumpchan.so
- app_echo.so
- app_exec.so
- app_followme.so
- app_forkcdr.so
- app_mixmonitor.so
- app_originate.so
- app_playback.so
- app_queue.so
- app_read.so
- app_readexten.so
- app_senddtmf.so
- app_softhangup.so
- app_stack.so
- app_stream_echo.so
- app_talkdetect.so
- app_transfer.so
- app_verbose.so
- app_waitforring.so
- app_waitforsilence.so
- app_waituntil.so
- app_while.so
- bridge_builtin_features.so
- bridge_builtin_interval_features.so
- bridge_holding.so
- bridge_native_rtp.so
- bridge_simple.so
- bridge_softmix.so
- cdr_pgsql.so
- chan_bridge_media.so
- chan_pjsip.so
- chan_rtp.so
- codec_a_mu.so
- codec_adpcm.so
- codec_alaw.so
- codec_g722.so
- codec_g726.so
- codec_gsm.so
- codec_ilbc.so
- codec_opus_open_source.so
- codec_resample.so
- codec_ulaw.so
- format_g719.so
- format_g723.so
- format_g726.so
- format_gsm.so
- format_ilbc.so
- format_pcm.so
- format_sln.so
- format_vox.so
- format_wav.so
- format_wav_gsm.so
- func_blacklist.so
- func_callcompletion.so
- func_callerid.so
- func_cdr.so
- func_channel.so
- func_config.so
- func_cut.so
- func_devstate.so
- func_dialplan.so
- func_global.so
- func_hangupcause.so
- func_holdintercept.so
- func_jitterbuffer.so
- func_logic.so
- func_module.so
- func_pjsip_aor.so
- func_pjsip_contact.so
- func_pjsip_endpoint.so
- func_rand.so
- func_sorcery.so
- func_strings.so
- func_talkdetect.so
- func_timeout.so
- func_volume.so
- pbx_config.so
- pbx_loopback.so
- pbx_realtime.so
- pbx_spool.so
- res_audiosocket.so
- res_clialiases.so
- res_clioriginate.so
- res_convert.so
- res_crypto.so
- res_format_attr_celt.so
- res_format_attr_g729.so
- res_format_attr_ilbc.so
- res_format_attr_opus.so
- res_format_attr_silk.so
- res_format_attr_siren14.so
- res_format_attr_siren7.so
- res_musiconhold.so
- res_mutestream.so
- res_pjproject.so
- res_pjsip.so
- res_pjsip_acl.so
- res_pjsip_authenticator_digest.so
- res_pjsip_caller_id.so
- res_pjsip_dialog_info_body_generator.so
- res_pjsip_diversion.so
- res_pjsip_dlg_options.so
- res_pjsip_dtmf_info.so
- res_pjsip_empty_info.so
- res_pjsip_endpoint_identifier_ip.so
- res_pjsip_endpoint_identifier_user.so
- res_pjsip_exten_state.so
- res_pjsip_header_funcs.so
- res_pjsip_history.so
- res_pjsip_logger.so
- res_pjsip_messaging.so
- res_pjsip_mwi.so
- res_pjsip_mwi_body_generator.so
- res_pjsip_nat.so
- res_pjsip_notify.so
- res_pjsip_outbound_authenticator_digest.so
- res_pjsip_outbound_publish.so
- res_pjsip_outbound_registration.so
- res_pjsip_path.so
- res_pjsip_pidf_body_generator.so
- res_pjsip_publish_asterisk.so
- res_pjsip_pubsub.so
- res_pjsip_refer.so
- res_pjsip_registrar.so
- res_pjsip_rfc3326.so
- res_pjsip_sdp_rtp.so
- res_pjsip_send_to_voicemail.so
- res_pjsip_session.so
- res_pjsip_sips_contact.so
- res_pjsip_xpidf_body_generator.so
- res_rtp_asterisk.so
- res_rtp_multicast.so
- res_security_log.so
- res_sorcery_astdb.so
- res_sorcery_config.so
- res_sorcery_memory.so
- res_sorcery_memory_cache.so
- res_srtp.so
- res_stasis.so
- res_stasis_answer.so
- res_stasis_device_state.so
- res_stasis_playback.so
- res_stasis_recording.so
- res_timing_pthread.so
- res_timing_timerfd.so
- res_pjsip_header_funcs.so
- res_pjsip_history.so
- res_pjsip_sdp_rtp.so