Continue AGI after Dial() following caller hang up?

Home » Asterisk Users » Continue AGI after Dial() following caller hang up?
Asterisk Users 11 Comments

Hello,

We would like to continue a Perl AGI after a Dial() it has done completes
following caller hangup. We would like to do this in the same AGI, and not
using a new AGI from the ‘h’ extension. It works fine when the called party
hangs up and the ‘g’ option is used, but not for caller hangup.

Is this possible?

If not a confirmation that this is the case would be very helpful.

Thanks for any advice!

11 thoughts on - Continue AGI after Dial() following caller hang up?

  • We do that with the “F” option in Dial().

    F(context^exten^pri): When the caller hangs up, transfer the called
    party to the specified context and extension and continue execution.

    Cheers,
    Kingsley.

  • Thorsten,

    We have SIGHUP set to ‘IGNORE’, but it still does not continue the AGI
    after the Dial(). Do you have any idea why that might happen?

    Thanks for your advice.

  • Kingsley,

    Thanks for the reply, but I am looking to continue within the same AGI
    process and I believe that method would require starting a new AGI.

  • Yeah I think I slightly misread your original question, which I realised
    when I saw Thorsten’s reply. I initially thought you just wanted to
    avoid going into the h extension.

    I’m not doing any AGI stuff here that hangs around while the call does
    stuff – the AGI process just runs quickly then quits, returning control
    back to the dialplan. I had incorrectly assumed you were doing the same.

    Cheers,
    Kingsley.

  • Just offhand, I think you should utilize the FastAGI protocol, since it
    doesn’t seem to live or die based on when the call hangs up. Otherwise,
    the
    $SIG{‘HUP’} = ‘IGNORE’;
    Statement will “separate” the process so it doesn’t die on a hangup.

  • Yeah fastAGI is great, I’ve been using it for a while for performance
    reasons but yes I guess it would solve problems like this too.

    Cheers,
    Kingsley.

  • The strange thing is that we are using fast AGI, and for some reason the
    AGI always exits when the caller hangs up – even when I set HUP to IGNORE.
    If I set HUP to a subroutine that just logs a message, that message is
    never logged.

    Thanks for all the help.

  • When something makes a socket connection to your fastAGI daemon, does
    your daemon fork a child process to deal with that connection, or handle
    it in the main process?

    I’ve set ours up to fork a child process and detach itself from the
    parent socket. When it ends, the child exits (which is what we want) and
    the parent stays running (which is also what we want).

    Is there any particular reason you want your fastAGI instance to persist
    for the duration of the call?

    Cheers,
    Kingsley.

  • Kingsley,

    We have the same – the daemon forks child processes to handle individual
    calls.

    We need the fastAGI to continue so it can take some further action
    recording details of the call. This could be done using the ‘h’ extension,
    but it would be nice to avoid this method for simplicity sake. It does
    appear that some people can continue after the Dial and we can’t for some
    reason.