Asterisk
  1. Asterisk
  2. ASTERISK-10796

[patch] Execute AGI from the CLI and the manager interface

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Severity: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Target Release Version/s: None
    • Labels:
      None
    • SVN Revision Number:
      89394
    • Mantis ID:
      11282
    • Regression:
      No

      Description

      This new application allow to take control of the applications executed using the Asterisk console or via AMI.

      [default]
      exten => _X.,1,Answer()
      exten => _X.,2,DynamicApp()
      exten => _X.,3,Hangup()

      Once the channel enter DynamicApp, it will wait there for applications to execute. Applications may arrive either from the console or AMI, like this:

      *CLI> dynapp SIP/testing-09124338 Playback hello-world

      That will execute Playback application with hello-world arguments.

      The same using AMI:

      Action: AddDynApp
      Channel: SIP/testing-09124338
      App: Playback
      Data: hello-world

      I need some help of you guys to check locking/unlocking of channels, I think I am doing right, but I am still unsure about some cases. It seems to work though.

      Comments and corrections are always welcomed.

      1. app_dynapp-rev89394.c.patch
        11 kB
        Moises Silva
      2. asterisk-async-AGI-rev91983.patch
        18 kB
        Moises Silva
      3. asterisk-async-AGI-rev92002.patch
        18 kB
        Moises Silva
      4. asterisk-async-AGI-rev92324.patch
        17 kB
        Moises Silva
      5. asyncagi-rev89442.patch
        16 kB
        Moises Silva

        Activity

        Hide
        Matthew Nicholson added a comment -

        This exact same thing could be done using FastAGI and AMI in the same application. You would still have two APIs, but you have all the data in one app. This is how adhearsion works.

        Show
        Matthew Nicholson added a comment - This exact same thing could be done using FastAGI and AMI in the same application. You would still have two APIs, but you have all the data in one app. This is how adhearsion works.
        Hide
        Moises Silva added a comment -

        mnicholson: I have not tried Adhearsion, sounds like a pretty cool project. Similar in goals to the closed source framework we developed in PHP at the company I worked for 2 years ago. I would have to try it to be able to give an educated opinion and point out the differences.

        In the other hand, I do know using FastAGI is a feasible way of approaching the same problem. But I don't need nor want a separate TCP socket for each call.

        And what about the CLI AGI feature! ain't that cool?

        Seriously, discussion can continue in asterisk-dev, the "Unified Asterisk Interface" topic is getting hot.

        Show
        Moises Silva added a comment - mnicholson: I have not tried Adhearsion, sounds like a pretty cool project. Similar in goals to the closed source framework we developed in PHP at the company I worked for 2 years ago. I would have to try it to be able to give an educated opinion and point out the differences. In the other hand, I do know using FastAGI is a feasible way of approaching the same problem. But I don't need nor want a separate TCP socket for each call. And what about the CLI AGI feature! ain't that cool? Seriously, discussion can continue in asterisk-dev, the "Unified Asterisk Interface" topic is getting hot.
        Hide
        Tilghman Lesher added a comment -

        Okay, couple of things:

        1) you're open-coding ast_uri_encode(). Please use the API directly, instead of coding your own version.
        2) Wrap comments at 80 characters, please.
        3) The command to exit should be "asyncagi break", not the other way around.
        4) Use the CALL level of AMI control, instead of inventing a new one.
        5) I don't see what differentiates AGI_RESULT_SUCCESS_ASYNC from AGI_RESULT_SUCCESS in a way that you need your own separate status. Please explain or remove it.

        Show
        Tilghman Lesher added a comment - Okay, couple of things: 1) you're open-coding ast_uri_encode(). Please use the API directly, instead of coding your own version. 2) Wrap comments at 80 characters, please. 3) The command to exit should be "asyncagi break", not the other way around. 4) Use the CALL level of AMI control, instead of inventing a new one. 5) I don't see what differentiates AGI_RESULT_SUCCESS_ASYNC from AGI_RESULT_SUCCESS in a way that you need your own separate status. Please explain or remove it.
        Hide
        Moises Silva added a comment -

        Thanks for your comments Tilghman.

        1. Thanks for pointing that out.

        2. Done.

        3. Done.

        4. Done.

        5. Just after launch_script, a verification is done in order to call run_agi(). For the Async AGI, we don't want to run_agi(), since launch_script does all the work. That's why AGI_RESULT_SUCCESS_ASYNC is needed. If you don't like it or find a good reason to try to avoid that return code, we can work around it in some other way.

        The patch is updated for revision 92324.

        Show
        Moises Silva added a comment - Thanks for your comments Tilghman. 1. Thanks for pointing that out. 2. Done. 3. Done. 4. Done. 5. Just after launch_script, a verification is done in order to call run_agi(). For the Async AGI, we don't want to run_agi(), since launch_script does all the work. That's why AGI_RESULT_SUCCESS_ASYNC is needed. If you don't like it or find a good reason to try to avoid that return code, we can work around it in some other way. The patch is updated for revision 92324.
        Hide
        Digium Subversion added a comment -

        Repository: asterisk
        Revision: 96174

        U trunk/res/res_agi.c

        ------------------------------------------------------------------------
        r96174 | tilghman | 2008-01-03 00:13:13 -0600 (Thu, 03 Jan 2008) | 4 lines

        Add coordination between AMI and AGI applications, with an asyncagi method
        Feature proposed and patched by: moy
        (Closes issue ASTERISK-10796)

        ------------------------------------------------------------------------

        http://svn.digium.com/view/asterisk?view=rev&revision=96174

        Show
        Digium Subversion added a comment - Repository: asterisk Revision: 96174 U trunk/res/res_agi.c ------------------------------------------------------------------------ r96174 | tilghman | 2008-01-03 00:13:13 -0600 (Thu, 03 Jan 2008) | 4 lines Add coordination between AMI and AGI applications, with an asyncagi method Feature proposed and patched by: moy (Closes issue ASTERISK-10796 ) ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=96174

          People

          • Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development