Files

43 lines
1.4 KiB
Go

// Package testfixture provides protocol fixtures for repository tests only.
package testfixture
import (
"encoding/json"
"git.ipao.vip/rogee/go-sip/contracts"
)
const DispatcherID = "c046b893-8628-4589-ae50-619d049248a6"
// Execute supplies the current V1 external envelope with the stable identifiers
// used by scheduler tests.
func Execute() ([]byte, error) {
raw, err := contracts.Read("examples/call-execute.json")
if err != nil {
return nil, err
}
var envelope map[string]any
if err := json.Unmarshal(raw, &envelope); err != nil {
return nil, err
}
envelope["schema_version"] = "2.0"
envelope["dispatcher_id"] = DispatcherID
envelope["tenant_id"] = "tenant-demo"
envelope["tenant_key"] = "tenant-demo-key"
envelope["issued_at"] = "2026-09-11T08:00:00Z"
envelope["not_after"] = "2099-09-11T08:05:00Z"
payload := envelope["payload"].(map[string]any)
payload["execution_id"] = "exec_demo_001"
payload["task_id"] = "task-demo"
payload["task_item_id"] = "item_demo_001"
payload["callee"] = "18601013734"
payload["route_policy_id"] = "route_policy_test"
payload["caller_profile_id"] = "caller_profile_test"
payload["agent_version_id"] = "agent_v1"
payload["ring_timeout_ms"] = float64(30000)
payload["max_call_duration_ms"] = float64(180000)
return json.MarshalIndent(envelope, "", " ")
}
func InboundKey(tenantKey string) string { return "d." + DispatcherID + ".t." + tenantKey + ".in" }