There does not appear to be any formal documentation on this topic -- of calling external programs from the dialplan using AGI, without interfering with FreePBX. Solution: override the desired context in extensions_custom.conf by making a copy of it from the context generated by FreePBX; it won't interfere with FreePBX, except that the context won't be modifiable through the interface, but the custom-edited context will have to be updated. I have done extensive searching and reading, and all I was able to find were a few posts over 3 years old on the forums here regarding how to edit extensions-custom.conf. Furthermore, what little I could find only covers calling AGI when dialing a specific extension, and nowhere else (i.e. calling the script in response to a caller encountering an IVR or call queue). This hardly seems practical in light of how triggering events that ideally should happen automatically should not require a user to dial a specific number.
All I need to do is to call an external program/script, with no external handling of the call, when a user reaches a certain part of the dialplan, i.e. if coming in through a call route or dialing an extension. My aim is to keep track of calls using an external web application, sending it vital information about the call (i.e. CID, name) but setting it up so that it doesn't interfere with FreePBX or vice versa.
I do not want to interfere with the preexisting IVRs and dialplans, which work, but merely to trigger the script when a caller enters. Considering the nature of Asterisk and what it is capable of doing, this does not seem like a non-trivial thing to set up. Or is it? Will FreePBX erase my work if I manually place AGI calls in the call route and queue configuration?