CyCoreSystems/agi ? reverse-engineered prompt
Reverse engineered prompt
Build me a small Go library for working with Asterisk AGI.
I want to be able to use it in two ways, as a normal AGI script that talks over stdin and stdout, and as a FastAGI server that listens on a TCP port. It should make it easy to answer a call, set channel variables, hang up, and send the usual AGI commands without me having to deal with the low level protocol details. Please include a simple way to create an AGI connection from standard input, and a helper to start a TCP listener that hands each request to a handler function.
Keep the API clean and easy to use, with a few small examples I can copy and run right away. If there are any tricky AGI protocol details, handle them inside the library. Add tests for the important bits, especially around command handling and DTMF or other response parsing if that fits naturally. Look up current Go docs or Asterisk AGI behavior online if you need to.
Are you gonna build this?
make sure you review the code using coderabbit