Architecture review of bin-call-manager identified 5 bugs across the callhandler and models packages.
Files: pkg/callhandler/hold.go, moh.go, silence.go
Methods: HoldOn, HoldOff, MOHOn, MOHOff, SilenceOn, SilenceOff
Each method calls h.Get(ctx, id) into err, then calls a channelHandler method into errHold/errMoh/errSilence. On failure, they return errors.Wrap(err, "...") — wrapping the outer err (nil from successful Get) instead of the inner error. The function silently returns nil on failure.
Fix: Change to errors.Wrap(errHold, ...) / errMoh / errSilence.
File: pkg/callhandler/hangup.go:70
A goroutine captures err from outer scope instead of its own errReq.
Fix: Change err to errReq in the log statement.
File: models/groupcall/webhook.go:67
AnswerGroupcallID: h.AnswerCallID should be AnswerGroupcallID: h.AnswerGroupcallID.
Fix: Use correct source field. Add test assertion.
File: models/externalmedia/main.go:16
JSON tag has double-e: json:"reference_typee". This is a breaking API change but the field name is clearly wrong.
Fix: Change to json:"reference_type". Update all test fixtures.
File: pkg/callhandler/mute.go:38-41
UpdateMuteDirection failure is logged but not returned. DB state diverges from Asterisk state.
Fix: Return the error.
go mod tidy && go mod vendor && go generate ./... && go test ./... && golangci-lint run -v --timeout 5m