services:
  asterisk:
    image: ${ASTERISK_IMAGE:?Set ASTERISK_IMAGE in deployment/.env.images or shell env}
    container_name: call-center-asterisk
    restart: unless-stopped
    env_file:
      - ../.env.production
    environment:
      ASTERISK_EXTERNAL_ADDRESS: 92.38.48.166
    network_mode: host
    volumes:
      - ./asterisk:/config-template:ro
      - ../.asterisk_assets:/assets
      - ../.data_local/generated_ivr_yandex/ivr:/usr/share/asterisk/sounds/ivr
      - ../.data_local/generated_ivr_yandex/ivr:/var/lib/asterisk/sounds/ivr
      - /var/spool/asterisk/monitor:/var/spool/asterisk/monitor
    healthcheck:
      test:
        - CMD-SHELL
        - asterisk -rx "core show version" >/dev/null 2>&1
      interval: 15s
      timeout: 5s
      retries: 10
      start_period: 20s
