feat(volte): map China Broadnet 460-15 to a VoLTE MBN

Prefer a dedicated CBN profile when the module has one.
Otherwise use CMCC because CBN shares that radio.
This commit is contained in:
yibaiba committed 2026-08-24 09:06:03 +08:00
1 parent e403ec9599
commit 0f93fb928a
3 files changed
+40 -13

No files matched your search

+1
View File
@@ -23,6 +23,7 @@
| 460-00/02/04/07/08 | `Volte_OpenMkt-Commercial-CMCC` |
| 460-03/05/11 | `VoLTE_OPNMKT_CT` |
| 460-01/06/09 | `CU-VoLTE` |
| 460-15 广电 | 清单里的广电画像(`CBN-VoLTE` 等);没有则用移动 `Volte_OpenMkt-Commercial-CMCC`(共建共享) |
234/xx 等没有唯一画像时启用失败,不会猜画像,也不会回退软件 IMS。
+26 -13
View File
@@ -8,22 +8,24 @@ import (
var ErrNoUniqueProfile = fmt.Errorf("volte: no unique MBN profile for this PLMN")
// UniqueMBN maps a serving PLMN onto one firmware MBN name that is actually
// present on the module. Unknown operators and missing names fail closed;
// ROW_Generic is never used as a guess.
// present on the module. Candidates are tried in order. Unknown operators
// fail closed; ROW_Generic is never used as a guess.
func UniqueMBN(mcc, mnc string, entries []MBNEntry) (string, error) {
want := profileNameForPLMN(mcc, mnc)
if want == "" {
wants := profileNamesForPLMN(mcc, mnc)
if len(wants) == 0 {
return "", ErrNoUniqueProfile
}
for _, e := range entries {
if strings.EqualFold(strings.TrimSpace(e.Name), want) {
return e.Name, nil
for _, want := range wants {
for _, e := range entries {
if strings.EqualFold(strings.TrimSpace(e.Name), want) {
return e.Name, nil
}
}
}
return "", fmt.Errorf("%w: %s not in module list", ErrNoUniqueProfile, want)
return "", fmt.Errorf("%w: none of %s in module list", ErrNoUniqueProfile, strings.Join(wants, ","))
}
func profileNameForPLMN(mcc, mnc string) string {
func profileNamesForPLMN(mcc, mnc string) []string {
mcc = strings.TrimSpace(mcc)
mnc = strings.TrimLeft(strings.TrimSpace(mnc), "0")
if mnc == "" {
@@ -36,14 +38,25 @@ func profileNameForPLMN(mcc, mnc string) string {
case "460":
switch mnc {
case "00", "02", "04", "07", "08":
return "Volte_OpenMkt-Commercial-CMCC"
return []string{"Volte_OpenMkt-Commercial-CMCC"}
case "03", "05", "11":
return "VoLTE_OPNMKT_CT"
return []string{"VoLTE_OPNMKT_CT"}
case "01", "06", "09":
return "CU-VoLTE"
return []string{"CU-VoLTE"}
case "15":
// 中国广电。固件若带专用画像优先用;QDC507 当前清单没有,
// 广电 5G 与移动共建共享,退到移动 VoLTE 画像。
return []string{
"Volte_OpenMkt-Commercial-CBN",
"VoLTE_OpenMkt-Commercial-CBN",
"VoLTE_OPNMKT_CBN",
"CBN-VoLTE",
"VoLTE-CBN",
"Volte_OpenMkt-Commercial-CMCC",
}
}
}
return ""
return nil
}
func NormalizePLMN(mcc, mnc string) string {
+13
View File
@@ -17,6 +17,7 @@ func TestUniqueMBNChinaCarriers(t *testing.T) {
{"460", "11", "VoLTE_OPNMKT_CT"},
{"460", "01", "CU-VoLTE"},
{"460", "7", "Volte_OpenMkt-Commercial-CMCC"},
{"460", "15", "Volte_OpenMkt-Commercial-CMCC"},
}
for _, tc := range cases {
got, err := UniqueMBN(tc.mcc, tc.mnc, list)
@@ -35,3 +36,15 @@ func TestUniqueMBNUnknownOrMissing(t *testing.T) {
t.Fatalf("missing CMCC name must fail: %v", err)
}
}
func TestUniqueMBNChinaBroadnetPrefersDedicatedProfile(t *testing.T) {
list := []MBNEntry{
{Name: "ROW_Generic_3GPP"},
{Name: "Volte_OpenMkt-Commercial-CMCC"},
{Name: "CBN-VoLTE"},
}
got, err := UniqueMBN("460", "15", list)
if err != nil || got != "CBN-VoLTE" {
t.Fatalf("want dedicated CBN profile, got %q err=%v", got, err)
}
}