DCAS handbook

Voice region switch procedure

  1. Client changes voice region via settings;
  2. Http api touches DB;
  3. DB:
    • updates channel table – this makes all related voice states immediately have new voice_region;
    • fires VoiceRegionChange event, only if voice region is actually changed (corner case: old/new region might be null (automatic), which means actual voice region must be derived first)
  4. Voice IPC catches event:
    • if we’re serving old region: drop states;
    • if we’re serving new region: insert states;
  5. Gateway catches event and sends VOICE_SERVER_UPDATE w/ the same channel/guild/token and new endpoint;

Automatic voice region assignment

voice_region = null means “auto-assign voice region”

Current approach:

  1. Calc hash of voice channel id;
  2. Get region index by index = hash % voice_regions.len()
  3. Get region name by voice_regions[index].name()