Skip to content
Snippets Groups Projects
  1. Apr 18, 2014
  2. Mar 07, 2014
    • Scott Griepentrog's avatar
      uniqueid: channel linkedid, ami, ari object creation with id's · 80ef9a21
      Scott Griepentrog authored
      Much needed was a way to assign id to objects on creation, and
      much change was necessary to accomplish it.  Channel uniqueids
      and linkedids are split into separate string and creation time
      components without breaking linkedid propgation.  This allowed
      the uniqueid to be specified by the user interface - and those
      values are now carried through to channel creation, adding the
      assignedids value to every function in the chain including the
      channel drivers. For local channels, the second channel can be
      specified or left to default to a ;2 suffix of first.  In ARI,
      bridge, playback, and snoop objects can also be created with a
      specified uniqueid.
      
      Along the way, the args order to allocating channels was fixed
      in chan_mgcp and chan_gtalk, and linkedid is no longer lost as
      masquerade occurs.
      
      (closes issue ASTERISK-23120)
      Review: https://reviewboard.asterisk.org/r/3191/
      ........
      
      Merged revisions 410157 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410158 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      80ef9a21
  3. Jan 21, 2014
  4. Dec 17, 2013
  5. Dec 13, 2013
  6. Nov 27, 2013
    • David M. Lee's avatar
      ari:Add application/json parameter support · fccb427c
      David M. Lee authored
      The patch allows ARI to parse request parameters from an incoming JSON
      request body, instead of requiring the request to come in as query
      parameters (which is just weird for POST and DELETE) or form
      parameters (which is okay, but a bit asymmetric given that all of our
      responses are JSON).
      
      For any operation that does _not_ have a parameter defined of type
      body (i.e. "paramType": "body" in the API declaration), if a request
      provides a request body with a Content type of "application/json", the
      provided JSON document is parsed and searched for parameters.
      
      The expected fields in the provided JSON document should match the
      query parameters defined for the operation. If the parameter has
      'allowMultiple' set, then the field in the JSON document may
      optionally be an array of values.
      
      (closes issue ASTERISK-22685)
      Review: https://reviewboard.asterisk.org/r/2994/
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403177 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      fccb427c
  7. Nov 07, 2013
    • David M. Lee's avatar
      ari: User better nicknames for ARI operations · 7d0d1a1e
      David M. Lee authored
      While working on building client libraries from the Swagger API, I
      noticed a problem with the nicknames.
      
          channel.deleteChannel()
          channel.answerChannel()
          channel.muteChannel()
      
      Etc. We put the object name in the nickname (since we were generating C
      code), but it makes OO generators redundant.
      
      This patch makes the nicknames more OO friendly. This resulted in a lot
      of name changing within the res_ari_*.so modules, but not much else.
      
      There were a couple of other fixed I made in the process.
      
       * When reversible operations (POST /hold, POST /unhold) were made more
         RESTful (POST /hold, DELETE /unhold), the path for the second operation
         was left in the API declaration. This worked, but really the two
         operations should have been on the same API.
       * The POST /unmute operation had still not been REST-ified.
      
      Review: https://reviewboard.asterisk.org/r/2940/
      ........
      
      Merged revisions 402528 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402529 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      7d0d1a1e
  8. Oct 25, 2013
  9. Oct 16, 2013
  10. Oct 15, 2013
  11. Aug 27, 2013
    • David M. Lee's avatar
      ARI: WebSocket event cleanup · 451993f4
      David M. Lee authored
      Stasis events (which get distributed over the ARI WebSocket) are created
      by subscribing to the channel_all_cached and bridge_all_cached topics,
      filtering out events for channels/bridges currently subscribed to.
      
      There are two issues with that. First was a race condition, where
      messages in-flight to the master subscribe-to-all-things topic would get
      sent out, even though the events happened before the channel was put
      into Stasis. Secondly, as the number of channels and bridges grow in the
      system, the work spent filtering messages becomes excessive.
      
      Since r395954, individual channels and bridges have caching topics, and
      can be subscribed to individually. This patch takes advantage, so that
      channels and bridges are subscribed to on demand, instead of filtering
      the global topics.
      
      The one case where filtering is still required is handling BridgeMerge
      messages, which are published directly to the bridge_all topic.
      
      Other than the change to how subscriptions work, this patch mostly just
      moves code around. Most of the work generating JSON objects from
      messages was moved to .to_json handlers on the message types. The
      callback functions handling app subscriptions were moved from res_stasis
      (b/c they were global to the model) to stasis/app.c (b/c they are local
      to the app now).
      
      (closes issue ASTERISK-21969)
      Reported by: Matt Jordan
      Review: https://reviewboard.asterisk.org/r/2754/
      ........
      
      Merged revisions 397816 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397820 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      451993f4
  12. Aug 23, 2013
  13. Aug 05, 2013
  14. Aug 02, 2013
    • 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
  15. Jul 27, 2013
  16. Jul 23, 2013
  17. Jul 19, 2013
    • Jonathan Rose's avatar
      ARI: Bridge Playback, Bridge Record · 17c54617
      Jonathan Rose authored
      Adds a new channel driver for creating channels for specific purposes
      in bridges, primarily to act as either recorders or announcers. Adds
      ARI commands for playing announcements to ever participant in a bridge
      as well as for recording a bridge. This patch also includes some
      documentation/reponse fixes to related ARI models such as playback
      controls.
      
      (closes issue ASTERISK-21592)
      Reported by: Matt Jordan
      
      (closes issue ASTERISK-21593)
      Reported by: Matt Jordan
      
      Review: https://reviewboard.asterisk.org/r/2670/
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394809 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      17c54617
  18. Jul 03, 2013
    • David M. Lee's avatar
      Fix load errors related to the new ari_model_validators. · dbc588b0
      David M. Lee authored
      The Asterisk strategy of loading modules with RTLD_LAZY to extract metadata
      from the module works well enough, until you try to take the address of a
      function.
      
      If a module takes the address of a function, that function needs to be
      resolved at load time. That kinda defeats RTLD_LAZY.
      
      This patch adds some ari_validator_{id}_fn() wrapper functions for safely
      getting the function pointer from a different module.
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393576 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      dbc588b0
    • 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
  19. Jun 24, 2013
  20. May 10, 2013
  21. 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