Skip to content
Snippets Groups Projects
  1. Aug 06, 2013
    • David M. Lee's avatar
      ARI: Add recording controls · c7908487
      David M. Lee authored
      This patch implements the controls from ARI recordings. The controls
      are:
      
       * DELETE /recordings/live/{recordingName} - stop recording and
         discard it
       * POST /recordings/live/{recordingName}/stop - stop recording
       * POST /recordings/live/{recordingName}/pause - pause recording
       * POST /recordings/live/{recordingName}/unpause - resume recording
       * POST /recordings/live/{recordingName}/mute - mute recording (record
         silence to the file)
       * POST /recordings/live/{recordingName}/unmute - unmute recording.
      
      Since this underlying functionality did not already exist, is was
      added to app.c by a set of control frames, similar to how playback
      control works. The pause/mute control frames are toggles, even though
      the ARI controls are idempotent, to be consistent with the playback
      control frames.
      
      (closes issue ASTERISK-22181)
      Review: https://reviewboard.asterisk.org/r/2697/
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396331 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      c7908487
  2. Aug 05, 2013
  3. Aug 02, 2013
    • David M. Lee's avatar
      ARI - GET /ari/asterisk/info · 5114e4fc
      David M. Lee authored
      This patch adds basic system information access to ARI.
      
      The results are roughly what you get from 'core show settings', with a
      few minor differences.
      
       * Data is structured, with 'build', 'system', 'config' and 'status'
         sub-objects.
       * Each sub-object is selectable, using the ?only= parameter. A comma
         separated list can be provided to select multiple sections.
       * A few config options are numeric, for which 0 means 'unlimited'.
         Instead of having a special interpretation of those fields, they
         are simply omitted if they're 0.
       * The information is limited to what might be useful to building
         external applications.
      
      (closes issue ASTERISK-21575)
      Review: https://reviewboard.asterisk.org/r/2702/
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396125 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      5114e4fc
    • David M. Lee's avatar
      ARI - implement allowMultiple for parameters · 537ecebd
      David M. Lee authored
      Swagger allows parameters to be specified as 'allowMultiple', meaning
      that the parameter may be specified as a comma separated list of
      values.
      
      I had written some of the API docs using that, but promptly forgot
      about implementing it. This patch finally fills in that gap.
      
      The codegen template was updated to represent 'allowMultiple' fields
      as array/size fields in the _args structs. It also parses the comma
      separated list using ast_app_separate_args(), so quoted strings in the
      argument will be handled properly.
      
      Review: https://reviewboard.asterisk.org/r/2698/
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396122 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      537ecebd
  4. Jul 19, 2013
  5. Jul 10, 2013
  6. Jul 08, 2013
  7. Jul 05, 2013
  8. Jul 03, 2013
    • David M. Lee's avatar
      ARI - channel recording support · a75fd322
      David M. Lee authored
      This patch is the first step in adding recording support to the
      Asterisk REST Interface.
      
      Recordings are stored in /var/spool/recording. Since recordings may be
      destructive (overwriting existing files), the API rejects attempts to
      escape the recording directory (avoiding issues if someone attempts to
      record to ../../lib/sounds/greeting, for example).
      
      (closes issue ASTERISK-21594)
      (closes issue ASTERISK-21581)
      Review: https://reviewboard.asterisk.org/r/2612/
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393550 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      a75fd322
    • David M. Lee's avatar
      Update events to use Swagger 1.3 subtyping, and related aftermath · c9a3d456
      David M. Lee authored
      This patch started with the simple idea of changing the /events data
      model to be more sane. The original model would send out events like:
      
          { "stasis_start": { "args": [], "channel": { ... } } }
      
      The event discriminator was the field name instead of being a value in
      the object, due to limitations in how Swagger 1.1 could model objects.
      While technically sufficient in communicating event information, it was
      really difficult to deal with in terms of client side JSON handling.
      
      This patch takes advantage of a proposed extension[1] to Swagger which
      allows type variance through the use of a discriminator field. This had
      a domino effect that made this a surprisingly large patch.
      
       [1]: https://groups.google.com/d/msg/wordnik-api/EC3rGajE0os/ey_5dBI_jWcJ
      
      In changing the models, I also had to change the swagger_model.py
      processor so it can handle the type discriminator and subtyping. I took
      that a big step forward, and using that information to generate an
      ari_model module, which can validate a JSON object against the Swagger
      model.
      
      The REST and WebSocket generators were changed to take advantage of the
      validators. If compiled with AST_DEVMODE enabled, JSON objects that
      don't match their corresponding models will not be sent out. For REST
      API calls, a 500 Internal Server response is sent. For WebSockets, the
      invalid JSON message is replaced with an error message.
      
      Since this took over about half of the job of the existing JSON
      generators, and the .to_json virtual function on messages took over the
      other half, I reluctantly removed the generators.
      
      The validators turned up all sorts of errors and inconsistencies in our
      data models, and the code. These were cleaned up, with checks in the
      code generator avoid some of the consistency problems in the future.
      
       * The model for a channel snapshot was trimmed down to match the
         information sent via AMI. Many of the field being sent were not
         useful in the general case.
       * The model for a bridge snapshot was updated to be more consistent
         with the other ARI models.
      
      Another impact of introducing subtyping was that the swagger-codegen
      documentation generator was insufficient (at least until it catches up
      with Swagger 1.2). I wanted it to be easier to generate docs for the API
      anyways, so I ported the wiki pages to use the Asterisk Swagger
      generator. In the process, I was able to clean up many of the model
      links, which would occasionally give inconsistent results on the wiki. I
      also added error responses to the wiki docs, making the wiki
      documentation more complete.
      
      Finally, since Stasis-HTTP will now be named Asterisk REST Interface
      (ARI), any new functions and files I created carry the ari_ prefix. I
      changed a few stasis_http references to ari where it was non-intrusive
      and made sense.
      
      (closes issue ASTERISK-21885)
      Review: https://reviewboard.asterisk.org/r/2639/
      
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393529 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      c9a3d456
    • David M. Lee's avatar
      Shuffle RESTful URL's around. · dcf03554
      David M. Lee authored
      This patch moves the RESTful URL's around to more appropriate
      locations for release.
      
      The /stasis URL's are moved to /ari, since Asterisk REST Interface was
      a more appropriate name than Stasis-HTTP. (Most of the code still has
      stasis_http references, but they will be cleaned up after there are no
      more outstanding branches that would have merge conflicts with such a
      change).
      
      A larger change was moving the ARI events WebSocket off of the shared
      /ws URL to its permanent home on /ari/events. The Swagger code
      generator was extended to handle "upgrade: websocket" and
      "websocketProtocol:" attributes on an operation.
      
      The WebSocket module was modified to better handle WebSocket servers
      that have a single registered protocol handler. If a client
      connections does not specify the Sec-WebSocket-Protocol header, and
      the server has a single protocol handler registered, the WebSocket
      server will go ahead and accept the client for that subprotocol.
      
      (closes issue ASTERISK-21857)
      Review: https://reviewboard.asterisk.org/r/2621/
      
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393528 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      dcf03554
  9. Jul 01, 2013
  10. Jun 28, 2013
  11. Jun 26, 2013
  12. Jun 24, 2013
    • Kinsey Moore's avatar
      Index installed sounds and implement ARI sounds queries · a0b7a49a
      Kinsey Moore authored
      This adds support for stasis/sounds and stasis/sounds/{ID} queries via
      the Asterisk RESTful Interface (ARI, formerly Stasis-HTTP).
      
      The following changes have been made to accomplish this:
      * A modular indexer was created for local media.
      * A new function to get an ast_format associated with a file extension
        was added.  
      * Modifications were made to the built-in HTTP server so that URI
        decoding could be deferred to the URI handler when necessary.
      * The Stasis-HTTP sounds JSON documentation was modified to handle
        cases where multiple languages are installed in different formats.
      * Register and Unregister events for formats were added to the system
        topic.
      
      (closes issue ASTERISK-21584)
      (closes issue ASTERISK-21585)
      Review: https://reviewboard.asterisk.org/r/2507/
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392700 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      a0b7a49a
  13. Jun 21, 2013
  14. Jun 18, 2013
  15. Jun 14, 2013
  16. Jun 10, 2013
    • Kinsey Moore's avatar
      Stasis-HTTP: Flesh out bridge-related capabilities · a5bbc790
      Kinsey Moore authored
      This adds support for Stasis applications to receive bridge-related
      messages when the application shows interest in a given bridge.
      
      To supplement this work and test it, this also adds support for the
      following bridge-related Stasis-HTTP functionality:
      * GET stasis/bridges
      * GET stasis/bridges/{bridgeId}
      * POST stasis/bridges
      * DELETE stasis/bridges/{bridgeId}
      * POST stasis/bridges/{bridgeId}/addChannel
      * POST stasis/bridges/{bridgeId}/removeChannel
      
      Review: https://reviewboard.asterisk.org/r/2572/
      (closes issue ASTERISK-21711)
      (closes issue ASTERISK-21621)
      (closes issue ASTERISK-21622)
      (closes issue ASTERISK-21623)
      (closes issue ASTERISK-21624)
      (closes issue ASTERISK-21625)
      (closes issue ASTERISK-21626)
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391199 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      a5bbc790
  17. Jun 07, 2013
  18. May 23, 2013
  19. May 21, 2013
  20. May 10, 2013
    • Kinsey Moore's avatar
      Add channel events for res_stasis apps · 7ce05bfb
      Kinsey Moore authored
      This change adds a framework in res_stasis for handling events from
      channel topics. JSON event generation and validation code is created
      from event documentation in rest-api/api-docs/events.json to assist in
      JSON event generation, ensure consistency, and ensure that accurate
      documentation is available for ALL events that are received by
      res_stasis applications.
      
      The userevent application has been refactored along with the code that
      handles userevent channel blob events to pass the headers as key/value
      pairs in the JSON blob. As a side-effect, app_userevent now handles
      duplicate keys by overwriting the previous value.
      
      Review: https://reviewboard.asterisk.org/r/2428/
      
      
      (closes issue ASTERISK-21180)
      Patch-By: default avatarKinsey Moore <kmoore@digium.com>
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@388275 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      7ce05bfb
  21. May 08, 2013
    • David M. Lee's avatar
      Initial support for endpoints. · e06e519a
      David M. Lee authored
      An endpoint is an external device/system that may offer/accept
      channels to/from Asterisk. While this is a very useful concept for end
      users, it is surprisingly not a core concept within Asterisk itself.
      
      This patch defines ast_endpoint as a separate object, which channel
      drivers may use to expose their concept of an endpoint. As the channel
      driver creates channels, it can use ast_endpoint_add_channel() to
      associate channels to the endpoint. This updated the endpoint
      appropriately, and forwards all of the channel's events to the
      endpoint's topic.
      
      In order to avoid excessive locking on the endpoint object itself, the
      mutable state is not accessible via getters. Instead, you can create a
      snapshot using ast_endpoint_snapshot_create() to get a consistent
      snapshot of the internal state.
      
      This patch also includes a set of topics and messages associated with
      endpoints, and implementations of the endpoint-related RESTful
      API. chan_sip was updated to create endpoints with SIP peers, but the
      state of the endpoints is not updated with the state of the peer.
      
      Along for the ride in this patch is a Stasis test API. This is a
      stasis_message_sink object, which can be subscribed to a Stasis
      topic. It has functions for blocking while waiting for conditions in
      the message sink to be fulfilled.
      
      (closes issue ASTERISK-21421)
      Review: https://reviewboard.asterisk.org/r/2492/
      
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@387932 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      e06e519a
  22. Apr 22, 2013
    • David M. Lee's avatar
      This patch adds a RESTful HTTP interface to Asterisk. · 1c21b857
      David M. Lee authored
      The API itself is documented using Swagger, a lightweight mechanism for
      documenting RESTful API's using JSON. This allows us to use swagger-ui
      to provide executable documentation for the API, generate client
      bindings in different languages, and generate a lot of the boilerplate
      code for implementing the RESTful bindings. The API docs live in the
      rest-api/ directory.
      
      The RESTful bindings are generated from the Swagger API docs using a set
      of Mustache templates.  The code generator is written in Python, and
      uses Pystache. Pystache has no dependencies, and be installed easily
      using pip. Code generation code lives in rest-api-templates/.
      
      The generated code reduces a lot of boilerplate when it comes to
      handling HTTP requests. It also helps us have greater consistency in the
      REST API.
      
      (closes issue ASTERISK-20891)
      Review: https://reviewboard.asterisk.org/r/2376/
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@386232 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      1c21b857
Loading