I can’t seem to find any references to how I might solve this problem, even though it seems like it ought not be that unusual.
For illustration purposes, let me construct a scenario that I’d like to achieve. This is not a REAL example, so I don’t need help finding a workaround. I need to find a way to achieve this KIND of scenario more-or-less as described.
Say I call into asterisk from my cell phone. Based on recognizing my callerid, the dial plan automatically dials into my company voicemail and checks for messages. If messages are found, it records the “you have 3 new voicemails” response. Here’s the key part: this second channel is operating asynchronously from my initial call. In the initial call, perhaps I’m checking local voicemail in asterisk while the call to my company voicemail system is happening (to use a *nix analogy, I’ve run the dial command as a background task as if I could append a & at the end). After checking my local asterisk voicemail, I make a menu selection to find out whether there’s any voicemail on my company system. Now, asterisk is already prepared to play the recording back to me.
Again, the example might be a bit contrived, but essentially the model is a familiar “multi-threaded”, “asynchronous” or “background task” model, and that’s what I want to achieve.
So far, my leading candidate is to start a separate call (representing the background task - the one that checks company voicemail in my example) via a callfile, and have both it, and my initial call, managed via AGI scripts. The AGI scripts would then open some channel of communication between them – perhaps a simple unix pipe, or maybe shared memory or a database. But this approach seems awkward, and I’m wondering if I’m missing a more natural construct in Asterisk.
Appreciate any ideas or comments.