Async AGI

Home » Asterisk Users » Async AGI
Asterisk Users 9 Comments

Hi,

Is there a way to execute next priority in the dialplan if you have called agi:async? I want to play warning message if adhearsion is down. Currently I wasn’t able to make it work. The dialplan execution ends after the first priority.

[incomming]
exten => _X.,1,AGI(agi:async)
exten => _X.,2,Answer exten => _X.,3,Playback(some-message)
exten => _X.,4,Hangup

Regards, Pavel

9 thoughts on - Async AGI

  • As I understand it, when the AGI is asynchronous, you lose the control of checking for completion, etc. Since you are running prior to answer(), why run it asynchronously.

    From: asterisk-users-bounces@lists.digium.com
    [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Pavel Siderov Sent: Wednesday, September 05, 2012 11:26 AM
    To: asterisk-users@lists.digium.com Subject: [asterisk-users] Async AGI

    Hi,

    Is there a way to execute next priority in the dialplan if you have called agi:async? I want to play warning message if adhearsion is down. Currently I
    wasn’t able to make it work. The dialplan execution ends after the first priority.

    [incomming]

    exten => _X.,1,AGI(agi:async)

    exten => _X.,2,Answer

    exten => _X.,3,Playback(some-message)

    exten => _X.,4,Hangup

    Regards,

    Pavel

  • Hi Danny,

    I am running it asynchronously because adhearsion needs it.

    Regards, Pavel

    Date: Wed, 5 Sep 2012 11:28:46 -0500
    From: “Danny Nicholas”
    Subject: Re: [asterisk-users] Async AGI
    To: “‘Asterisk Users Mailing List – Non-Commercial Discussion'”

    Message-ID: <00cd01cd8b83$862a05d0$927e1170$@debsinc.com>
    Content-Type: text/plain; charset=”us-ascii”

    As I understand it, when the AGI is asynchronous, you lose the control of checking for completion, etc. Since you are running prior to answer(), why run it asynchronously.

    From: asterisk-users-bounces@lists.digium.com
    [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Pavel Siderov Sent: Wednesday, September 05, 2012 11:26 AM
    To: asterisk-users@lists.digium.com Subject: [asterisk-users] Async AGI

    Hi,

    Is there a way to execute next priority in the dialplan if you have called agi:async? I want to play warning message if adhearsion is down. Currently I
    wasn’t able to make it work. The dialplan execution ends after the first priority.

    [incomming]

    exten => _X.,1,AGI(agi:async)

    exten => _X.,2,Answer

    exten => _X.,3,Playback(some-message)

    exten => _X.,4,Hangup

    Regards,

    Pavel

  • That being the case, you are going to need to do a dialplan modification something like this:

    Exten => _X.,1.Set(answerstatus

  • Danny as I mentioned in the first message the dialplan execution stops after AGI(agi:async). So the provided example doesn’t help.

    Regards, Pavel

  • Perhaps the AGI is improperly terminating and should stop and return an error instead of just “dying” like it does now. Just catch the failing condition and return a variable to the dialplan so life will be good.

    From: asterisk-users-bounces@lists.digium.com
    [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Pavel Siderov Sent: Monday, September 10, 2012 11:17 AM
    To: asterisk-users@lists.digium.com Subject: Re: [asterisk-users] Async AGI

    Danny as I mentioned in the first message the dialplan execution stops after AGI(agi:async). So the provided example doesn’t help.

    Regards,

    Pavel

  • Pavel,

    This may be due to the asynchronous nature of Async AGI. The AGI(agi:async) command will continue to run until the channel is hung up, the ‘asyncagi break’ command is sent over AMI, or some sort of fatal error is encountered.

    When a call comes in, the AGI(agi:async) command sill send out a start event over AMI. But if Adhearsion isn’t there to hear it, it’s also not there to tell Asterisk what to do with the channel. So it will sit there, waiting for a break or hangup.

    I’m sure the Adhearsion guys have run into this sort of thing before. You may want to ask on their forum[1] for how they handle the situation.

    [1]: https://groups.google.com/forum/?fromgroups=#!forum/adhearsion

  • Hi David,

    For sure I will ask them but I think Asterisk should be able to handle this case because it doesn’t matter if it is adhearsion or something else. If it is not present there is no way to get answer. So there must be some way to go to another priority in the dialplan.

    @Danny – this is the normal behaviour of async agi

    Regards, Pavel

    AGI(agi:async) command will continue to run until the channel is hung up, the ‘asyncagi break’ command is sent over AMI, or some sort of fatal error is >encountered. event over AMI. But if Adhearsion isn’t there to hear it, it’s also not there to tell Asterisk what to do with the channel. So it will sit there, waiting for >a break or hangup. may want to ask on their forum[1] for how they handle the situation.