Skip to content
Snippets Groups Projects
  1. Aug 15, 2013
  2. Aug 13, 2013
    • David M. Lee's avatar
      ARI: allow other operations to happen while bridged · 987fdfb4
      David M. Lee authored
      This patch changes ARI bridging to allow other channel operations to
      happen while the channel is bridged.
      
      ARI channel operations are designed to queue up and execute
      sequentially. This meant, though, that while a channel was bridged,
      any other channel operations would queue up and execute only after the
      channel left the bridge.
      
      This patch changes ARI bridging so that channel commands can execute
      while the channel is bridged. For most operations, things simply work
      as expected. The one thing that ended up being a bit odd is recording.
      
      The current recording implementation will fail when one attempts to
      record a channel that's in a bridge. Note that the bridge itself may
      be recording; it's recording a specific channel in the bridge that
      fails. While this is an annoying limitation, channel recording is
      still very useful for use cases such as voice mail, and bridge
      recording makes up much of the difference for other use cases.
      
      (closes issue ASTERISK-22084)
      Review: https://reviewboard.asterisk.org/r/2726/
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396568 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      987fdfb4
  3. Aug 01, 2013
    • David M. Lee's avatar
      Split caching out from the stasis_caching_topic. · e1b959cc
      David M. Lee authored
      In working with res_stasis, I discovered a significant limitation to
      the current structure of stasis_caching_topics: you cannot subscribe
      to cache updates for a single channel/bridge/endpoint/etc.
      
      To address this, this patch splits the cache away from the
      stasis_caching_topic, making it a first class object. The stasis_cache
      object is shared amongst individual stasis_caching_topics that are
      created per channel/endpoint/etc. These are still forwarded to global
      whatever_all_cached topics, so their use from most of the code does
      not change.
      
      In making these changes, I noticed that we frequently used a similar
      pattern for bridges, endpoints and channels:
      
           single_topic  ---------------->  all_topic
                 ^
                 |
           single_topic_cached  ----+---->  all_topic_cached
                                    |
                                    +---->  cache
      
      This pattern was extracted as the 'Stasis Caching Pattern', defined in
      stasis_caching_pattern.h. This avoids a lot of duplicate code between
      the different domain objects.
      
      Since the cache is now disassociated from its upstream caching topics,
      this also necessitated a change to how the 'guaranteed' flag worked
      for retrieving from a cache. The code for handling the caching
      guarantee was extracted into a 'stasis_topic_wait' function, which
      works for any stasis_topic.
      
      (closes issue ASTERISK-22002)
      Review: https://reviewboard.asterisk.org/r/2672/
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@395954 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      e1b959cc
  4. Jul 25, 2013
  5. Jul 23, 2013
    • David M. Lee's avatar
      Continue events when ARI WebSocket reconnects · f6a227a4
      David M. Lee authored
      This patch addresses a bug in the /ari/events WebSocket in handling
      reconnects.
      
      When a Stasis application's associated WebSocket was disconnected and
      reconnected, it would not receive events for any channels or bridges
      it was subscribed to.
      
      The fix was to lazily clean up Stasis application registrations,
      instead of removing them as soon as the WebSocket goes away.
      
      When an application is unregistered at the WebSocket level, the
      underlying application is simply deactivated. If the application
      WebSocket is reconnected, the application is reactivated for the new
      connection.
      
      To avoid memory leaks from lingering, unused application, the
      application list is cleaned up whenever new applications are
      registered/unregistered.
      
      (closes issue ASTERISK-21970)
      Review: https://reviewboard.asterisk.org/r/2678/
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@395120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      f6a227a4
  6. 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
  7. Jul 03, 2013
    • 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
  8. Jun 24, 2013
  9. 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
  10. May 24, 2013
  11. May 17, 2013
    • David M. Lee's avatar
      Fix shutdown assertions in stasis-core · b97c71bb
      David M. Lee authored
      In r388005, macros were introduced to consistently define message
      types. This added an assert if a message type was used either before
      it was initialized or after it had been cleaned up. It turns out that
      this assertion fires during shutdown.
      
      This actually exposed a hidden shutdown ordering problem. Since
      unsubscribing is asynchronous, it's possible that the message types
      used by the subscription could be freed before the final message of
      the subscription was processed.
      
      This patch adds stasis_subscription_join(), which blocks until the
      last message has been processed by the subscription. Since joining was
      most commonly done right after an unsubscribe, a
      stasis_unsubscribe_and_join() convenience function was also added.
      
      Similar functions were also added to the stasis_caching_topic and
      stasis_message_router, since they wrap subscriptions and have similar
      problems.
      
      Other code in trunk was refactored to join() where appropriate, or at
      least verify that the subscription was complete before being
      destroyed.
      
      Review: https://reviewboard.asterisk.org/r/2540
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389011 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      b97c71bb
  12. May 14, 2013
  13. May 10, 2013
  14. May 08, 2013
    • David M. Lee's avatar
      Remove required type field from channel blobs · 0eb4cf8c
      David M. Lee authored
      When we first introduced the channel blob types, the JSON blobs were
      self identifying by a required "type" field in the JSON object
      itself. This, as it turns out, was a bad idea.
      
      When we introduced the message router, it was useless for routing based
      on the JSON type. And messages had two type fields to check: the
      stasis_message_type() of the message itself, plus the type field in the
      JSON blob (but only if it was a blob message).
      
      This patch corrects that mistake by removing the required type field
      from JSON blobs, and introducing first class stasis_message_type objects
      for the actual message type.
      
      Since we now will have a proliferation of message types, I introduced a
      few macros to help reduce the amount of boilerplate necessary to set
      them up.
      
      Review: https://reviewboard.asterisk.org/r/2509
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@388005 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      0eb4cf8c
  15. Apr 23, 2013
  16. 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
  17. Apr 15, 2013
    • David M. Lee's avatar
      Moved core logic from app_stasis to res_stasis · c599aca5
      David M. Lee authored
      After some discussion on asterisk-dev, it was decided that the bulk of
      the logic in app_stasis actually belongs in a resource module instead
      of the application module.
      
      This patch does that, leaves the app specific stuff in app_stasis, and
      fixes up everything else to be consistent with that change.
      
       * Renamed test_app_stasis to test_res_stasis
       * Renamed app_stasis.h to stasis_app.h
         * This is still stasis application support, even though it's no
           longer in an app_ module. The name should never have been tied to
           the type of module, anyways.
       * Now that json isn't a resource module anymore, moved the
         ast_channel_snapshot_to_json function to main/stasis_channels.c,
         where it makes more sense.
      
      Review: https://reviewboard.asterisk.org/r/2430/
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@385742 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      c599aca5
    • David M. Lee's avatar
      DTMF events are now published on a channel's stasis_topic. AMI was · 2450722f
      David M. Lee authored
      refactored to use these events rather than producing the events directly
      in channel.c. Finally, the code was added to app_stasis to produce
      DTMF events on the WebSocket.
      
      The AMI events are completely backward compatible, including sending
      events on transmitted DTMF, and sending DTMF start events.
      
      The Stasis-HTTP events are somewhat simplified. Since DTMF start and
      DTMF send events are generally less useful, Stasis-HTTP will only send
      events on received DTMF end.
      
      (closes issue ASTERISK-21282)
      (closes issue ASTERISK-21359)
      Review: https://reviewboard.asterisk.org/r/2439
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@385734 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      2450722f
  18. Apr 09, 2013
  19. Apr 08, 2013
    • Matthew Jordan's avatar
      Add multi-channel Stasis messages; refactor Dial AMI events to Stasis · b8d4e573
      Matthew Jordan authored
      This patch does the following:
       * A new Stasis payload has been defined for multi-channel messages. This
         payload can store multiple ast_channel_snapshot objects along with a single
         JSON blob. The payload object itself is opaque; the snapshots are stored
         in a container keyed by roles. APIs have been provided to query for and
         retrieve the snapshots from the payload object.
       * The Dial AMI events have been refactored onto Stasis. This includes dial
         messages in app_dial, as well as the core dialing framework. The AMI events
         have been modified to send out a DialBegin/DialEnd events, as opposed to
         the subevent type that was previously used.
       * Stasis messages, types, and other objects related to channels have been
         placed in their own file, stasis_channels. Unit tests for some of these
         objects/messages have also been written.
      
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@384910 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      b8d4e573
    • David M. Lee's avatar
      Stasis application WebSocket support · a2a53cc3
      David M. Lee authored
      This is the API that binds the Stasis dialplan application to external
      Stasis applications. It also adds the beginnings of WebSocket
      application support.
      
      This module registers a dialplan function named Stasis, which is used
      to put a channel into the named Stasis app. As a channel enters and
      leaves the Stasis diaplan application, the Stasis app receives a
      'stasis-start' and 'stasis-end' events.
      
      Stasis apps register themselves using the stasis_app_register and
      stasis_app_unregister functions. Messages are sent to an application
      using stasis_app_send.
      
      Finally, Stasis apps control channels through the use of the
      stasis_app_control object, and the family of stasis_app_control_*
      functions.
      
      Other changes along for the ride are:
       * An ast_frame_dtor function that's RAII_VAR safe
       * Some common JSON encoders for name/number, timeval, and
         context/extension/priority
      
      Review: https://reviewboard.asterisk.org/r/2361/
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@384879 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      a2a53cc3
Loading