Lets say AGI-1 is running. From within that AGI, I execute another AGI (AGI-2). Now which one would have the control of the channel?
what are you writing your AGI scripts in? are you spawning a new thread or are you just adding to the stack on the original thread?
Hi ffadaie,
I don’t really have experience with the situation that you have described. That’s why I ran some tests
Here is the plain result:
*CLI> -- Executing [4@trtest:1] AGI("Console/dsp", "agi1.sh") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/agi1.sh
-- AGI Script Executing Application: (NOOP) Options: (THIS IS POINT 1.1)
-- AGI Script Executing Application: (AGI) Options: (agi2.sh)
-- Launched AGI Script /var/lib/asterisk/agi-bin/agi2.sh
-- AGI Script Executing Application: (NOOP) Options: (THIS IS POINT 2.1)
-- AGI Script Executing Application: (WAIT) Options: (10)
-- AGI Script Executing Application: (NOOP) Options: (THIS IS POINT 2.2)
-- AGI Script agi2.sh completed, returning 0
-- AGI Script Executing Application: (NOOP) Options: (THIS IS POINT 1.2)
-- AGI Script agi1.sh completed, returning 0
== Auto fallthrough, channel 'Console/dsp' status is 'UNKNOWN'
<< Hangup on console >>
Source of the two AGIs:
agi1.sh:#!/bin/bash
echo -en "EXEC NOOP \"THIS IS POINT 1.1\"\n"
echo EXEC AGI agi2.sh
echo -en "EXEC NOOP \"THIS IS POINT 1.2\"\n"
agi2.sh:#!/bin/bash
echo -ne "EXEC NOOP \"THIS IS POINT 2.1\"\n"
echo EXEC WAIT 10
echo -ne "EXEC NOOP \"THIS IS POINT 2.2\"\n"
So… As you can see the first AGI loses control when it executes the first AGI (because it waits the application that is been executed to finish 
Regards,
Arcopix
Thanks Arcopix. Yeah, it makes sense.
I found out something else and I just post it here if anybody is interested:
If in AGI-1, you run MeetMe with X option and let the caller to enter a DTFM tone to jump to a specific extension within MEETME_EXIT_CONTEXT in which you run another AGI (AGI-2), here is what happens:
Once the caller enters a DTMF tone, s/he will exit the room, continue running AGI-1 and once it finishes, it will run AGI-2.