I don't use asterisk but I work on FreeSWITCH. To execute and agi from outside, they people must be listening on a port as FreeSWITCH does, just connect to that socket and you can write what you want.(As I do in FreeSWITCH). Hope it can help you.
One more thing, this is not the right place to ask such question, there must be asterisk forum for these kind of problems.