From 0f93fb928a66be0479368f05ca233ea1286c19e6 Mon Sep 17 00:00:00 2001 From: yibaiba <946100224@qq.com> Date: Mon, 24 Aug 2026 09:06:03 +0800 Subject: [PATCH] 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. --- docs/volte-native.md | 1 + internal/volte/profile.go | 39 ++++++++++++++++++++++------------ internal/volte/profile_test.go | 13 ++++++++++++ 3 files changed, 40 insertions(+), 13 deletions(-) diff --git a/docs/volte-native.md b/docs/volte-native.md index 6f4efaf3..beb45017 100644 --- a/docs/volte-native.md +++ b/docs/volte-native.md @@ -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。 diff --git a/internal/volte/profile.go b/internal/volte/profile.go index 7b507bec..8e1d8740 100644 --- a/internal/volte/profile.go +++ b/internal/volte/profile.go @@ -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 { diff --git a/internal/volte/profile_test.go b/internal/volte/profile_test.go index 45828707..dd85a48c 100644 --- a/internal/volte/profile_test.go +++ b/internal/volte/profile_test.go @@ -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) + } +}