Logging was configured correctly and shipping to Loki, but the stream was useless: measured at 100% healthcheck chatter, with every line wrapped in ANSI escape codes. The real SIP events were there and completely buried. Three causes, each masking the next: - asterisk.conf was written in the first lab commit with `nocolor = yes` and never mounted, so the setting had no effect. Now mounted. It was also overriding [directories] and runuser/rungroup, which the image sets up correctly itself — removed, since overriding them risks breaking the container for no gain. - The image's command is `-vvvdddf`: verbosity 3 and debug 3 forced on the command line, which overrides both asterisk.conf and logger.conf. Overridden in compose to drop -v and -d; warnings and errors still log, and verbosity is raisable at runtime when tracing a call. - The actual source: the image's healthcheck makes ~7 separate `asterisk -rx` connections every 30s, and Asterisk logs a connect/disconnect pair for each. Replaced with a single check on a 60s interval, and the check now runs `pjsip show transports` rather than `core show version` — that fails when Asterisk is up but unconfigured, which is exactly the state that produced a "healthy" container with no SIP stack on first deploy. logger.conf drops both `notice` and `verbose`, which is where those pairs arrive. Verified on galatea: noise down from ~48 to 8 lines per two minutes (-83%), zero ANSI codes in Loki, 90% of the stream now signal, container still healthy, transport and dialplan intact. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
43 lines
2.2 KiB
YAML
43 lines
2.2 KiB
YAML
# Local Asterisk lab — for iterating on caliban before promoting to Virgo.
|
|
#
|
|
# This is the LOCAL variant: ports and credentials are concrete, not Jinja.
|
|
# Ansible templates the same dialplan out to galatea with the estate's
|
|
# variables (see virgo/ansible/asterisk/).
|
|
#
|
|
# Run: docker compose -f docker-compose.lab.yml up -d
|
|
# CLI: docker compose -f docker-compose.lab.yml exec asterisk asterisk -rvvv
|
|
#
|
|
# host networking: SIP/RTP carry IP addresses *inside* the payload, so a
|
|
# bridged network needs external_media_address set correctly or the call
|
|
# connects with no audio. Host networking sidesteps that entirely for local
|
|
# work. The Virgo deploy uses the same approach for the same reason.
|
|
services:
|
|
asterisk:
|
|
image: andrius/asterisk:22.10.1_debian-trixie
|
|
container_name: asterisk-lab
|
|
network_mode: host
|
|
volumes:
|
|
- ./dialplan/extensions.conf:/etc/asterisk/extensions.conf:ro
|
|
- ./dialplan/pjsip.local.conf:/etc/asterisk/pjsip.conf:ro
|
|
- ./dialplan/rtp.local.conf:/etc/asterisk/rtp.conf:ro
|
|
- ./dialplan/logger.conf:/etc/asterisk/logger.conf:ro
|
|
# Carries `nocolor = yes`: without it every log line reaches Loki
|
|
# wrapped in ANSI escape codes.
|
|
- ./dialplan/asterisk.conf:/etc/asterisk/asterisk.conf:ro
|
|
# The image ships no sound files at all. These are generated by
|
|
# sounds/generate.py; Asterisk resolves Playback(lab-music) to
|
|
# lab-music.sln here (8kHz signed-linear, no transcoding).
|
|
- ./sounds:/var/lib/asterisk/sounds/en:ro
|
|
# The image's default command is `-vvvdddf` — verbosity 3 and debug 3
|
|
# forced on the command line, which overrides both asterisk.conf and
|
|
# logger.conf. That makes every healthcheck CLI connection log a
|
|
# "Remote UNIX connection" pair: ~2900 lines/day of pure noise that
|
|
# completely buried the real SIP events in Loki.
|
|
#
|
|
# -f foreground (required: Docker needs PID 1 to stay), -T timestamps,
|
|
# -W colour off, -U run as asterisk, -p realtime priority. No -v, no -d:
|
|
# warnings and errors still log, and verbosity can be raised at runtime
|
|
# with `asterisk -rx "core set verbose 3"` when tracing a call.
|
|
command: ["/usr/sbin/asterisk", "-f", "-T", "-W", "-U", "asterisk", "-p"]
|
|
restart: unless-stopped
|