package rpc import ( "context" "git.ipao.vip/rogee/go-sip/internal/asterisk" "testing" "time" ) func TestRealCallCaptureControlsExternalEvidenceOnly(t *testing.T) { for _, debug := range []bool{false, true} { t.Run(map[bool]string{false: "normal", true: "debug"}[debug], func(t *testing.T) { fixture, _, _, _, approved := recordedMockFixture(t, nil, time.Second) approved.CallerID, approved.DialedCallee, approved.RingTimeout = "BD93205882", "7089"+approved.Callee, time.Second r := &ApprovedRecordedRealCall{Capture: debug, Mirror: asterisk.NewHEPMirror(), MaxWAVBytes: 4096, MediaPayloadType: 118, ReportTimeout: time.Second, Delivery: fixture.Delivery, originator: func(ctx context.Context, _ asterisk.NativeDial) (realMedia, error) { t.Fatal("prepare must not dial") return realMedia{}, nil }} _, err := r.Prepare(approved) if debug && err == nil { t.Fatal("debug must reject missing capture before accepting execution") } if !debug && err != nil { t.Fatalf("normal calls must not depend on tcpdump: %v", err) } }) } }