Create the service
create().
tenantId and userId, and checks the destination, caller ID, calling permission, and spending policy. A value supplied in a request body is not a verified identity.
Send one business intent
The following helper accepts an authenticated identity and an intent ID persisted by your application. Calling it with a live provider places a real outbound call.intentId only for the same business operation and identical payload. A duplicate returns the existing record; changed input conflicts. The service claims a dispatching intent before contacting the provider.
Store and track the result
For multiple workers, implementCallIntentStore with atomic, durable claim and revision-based compareAndSet. Use a unique key on (tenantId, intentId) and preserve immutable request, digest, and provider fields. Never expire an unresolved intent: losing it can permit duplicate dialing. InMemoryCallIntentStore is only for a single-process demonstration.
Use get(identity, intentId) to refresh provider status, getIntent() to inspect stored state, and hangup() to request a remote hangup. All operations recheck authorization. See callbacks and recovery for timeouts and uncertain outcomes.