feat: deliver versioned SIP config to Cells

This commit is contained in:
2026-09-14 14:38:15 +08:00
parent 3a47914a6c
commit c8716608a2
26 changed files with 4665 additions and 21 deletions
+26 -2
View File
@@ -247,8 +247,16 @@ class AsteriskTests(unittest.TestCase):
"public_ip": cloud.PUBLIC_IP,
"transport": "udp",
"local_net": "10.1.0.0/16",
"primary": {"host": "sip-a.test", "auth_mode": "ip"},
"backup": {"host": "sip-b.test", "auth_mode": "ip"},
"primary": {
"host": "sip-a.test",
"auth_mode": "ip",
"codec_profile": {"allowed": ["PCMA"], "preferred": "PCMA"},
},
"backup": {
"host": "sip-b.test",
"auth_mode": "ip",
"codec_profile": {"allowed": ["PCMA"], "preferred": "PCMA"},
},
}
def test_build_user_data_pins_image_and_does_not_print_secret(self):
@@ -258,11 +266,27 @@ class AsteriskTests(unittest.TestCase):
"x" * 32,
)
self.assertIn("ASTERISK_IMAGE=registry.example/asterisk@sha256:", content)
self.assertIn("pjsip set logger on", content)
self.assertIn("HTTP_CONF_B64=", content)
self.assertNotIn("password=" + "x" * 32, content)
with self.assertRaises(ValueError):
user_data.immutable_image("registry.example/asterisk:latest")
def test_codec_profile_is_rendered_without_global_fallback(self):
cfg = self.cfg()
cfg["primary"]["codec_profile"] = {
"allowed": ["PCMU", "PCMA"],
"preferred": "PCMA",
}
files = ast.render(cfg, {"ARI_PASSWORD": "x" * 32})
self.assertIn("allow=alaw,ulaw", files["pjsip.conf"])
cfg["primary"]["codec_profile"] = {
"allowed": ["G729"],
"preferred": "G729",
}
with self.assertRaises(ValueError):
ast.render(cfg, {"ARI_PASSWORD": "x" * 32})
def test_private_ari_fixed_nat_and_recording_config(self):
files = ast.render(self.cfg(), {"ARI_PASSWORD": "x" * 32})
self.assertEqual(len(files), 5)