From my research, it appears there is no API call to disconnect or transfer phone calls in Amazon Connect.
The closest I could find are
It seems there would be a way to do this programmatically outside of contact flows?
Tried: Disconnecting a call via StopContact. Result: Did not disconnect. After research, this API only works on Outbound Campaign calls, not regular inbound/outbound calls.
Tried: Disconnecting a call via TransferContact. Result: Did not transfer. After research, this API only works on Tasks.
By design, before calls are routed to agents, they are in the control of a contact flow. There is no server-side API to enforce call control such as disconnect/transfer/mute/etc.
After calls are routed to agents, you could use the Amazon Connect Streams API to programmatically handle calls control (it's the API behind the CCP). Just be aware Streams is a client-side API, not server-side.