Skip to content
Snippets Groups Projects
  1. Aug 02, 2013
  2. 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
  3. Jul 31, 2013
  4. Jul 29, 2013
  5. Jul 27, 2013
  6. Jul 25, 2013
  7. Jul 23, 2013
    • David M. Lee's avatar
      Fix bridge/channel AMI event ordering issues · fec66764
      David M. Lee authored
      The stasis_cache_update messages are somewhat cumbersome to handle
      with the stasis_message_router. Since all updates have the same
      message type, they are normally handled with the same route.
      
      Since caching itself is a first class component of stasis-core, it
      makes sense for the router to handle the cache update messages itself.
      This patch adds stasis_message_router_add_cache_update() and
      stasis_message_router_remove_cache_update() to handle the routing of
      stasis_cache_update messages.
      
      This patch also corrects an issue with manager_{bridging,channels}.c,
      where events might be reordered. The reordering occurs because the
      components use different message routers, which they needed because
      they both needed to route cache update messages. They now both use
      manager's router, and add cache routes for just the cache updates they
      are interested in.
      
      (closes issue ASTERISK-22038)
      Review: https://reviewboard.asterisk.org/r/2677/
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@395118 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      fec66764
  8. Jul 22, 2013
  9. Jul 20, 2013
  10. Jul 17, 2013
  11. Jul 12, 2013
    • David M. Lee's avatar
      Fixed intermittent crash when loading test_json.so · c3ffc13e
      David M. Lee authored
      The JSON test attempted an overly clever use of RAII_VAR to run code
      at the beginning and end of each test, in order to validate that no
      JSON objects were leaked during the test.
      
      The problem is that the validation code would run during the initial
      load, when the tests were initialized. This happens during startup,
      when other parts of the system might actively be allocating and
      freeing JSON objects.
      
      This patch changes the RAII_VAR to use the new
      ast_test_register_{init,cleanup} functions to run the validations
      properly.
      
      (closes issue ASTERISK-21978)
      Review: https://reviewboard.asterisk.org/r/2669/
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394203 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      c3ffc13e
  12. Jul 11, 2013
  13. Jul 04, 2013
  14. 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
  15. Jul 02, 2013
  16. Jun 28, 2013
    • Matthew Jordan's avatar
      Handle an originated channel being sent into a non-empty bridge · ca61a055
      Matthew Jordan authored
      Originated channels are a bit odd - they are technically a dialed channel (thus
      the party B or peer) but, since there is no caller, they are treated as the
      party A. When entering into a bridge that already contains participants, the CDR
      engine - if the CDR record is in the Dial state - attempts to match the person
      entering the bridge with an existing participant. The idea is that if you dialed
      someone and the person you dialed is already in the bridge, you don't need a new
      CDR record, the existing CDR record describes the relationship.
      
      Unfortunately, for an originated channel, there is no Party B. If no one was in
      the bridge this didn't cause any issues; however, if participants were in the
      bridge the CDR engine would attempt to match a non-existant Party B on the
      channel's CDR record and explode.
      
      This patch fixes that, and a unit test has been added to cover this case.
      
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393164 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      ca61a055
  17. Jun 24, 2013
  18. Jun 23, 2013
  19. Jun 22, 2013
    • Joshua Colp's avatar
      Make sorcery details opaque and add extended fields. · a330d086
      Joshua Colp authored
      Sorcery specific object information is now opaque and allocated with the object.
      This means that modules do not need to be recompiled if the sorcery specific part
      is changed. It also means that sorcery can store additional information on objects
      and ensure it is freed or the reference count decreased when the object goes away.
      
      To facilitate the above a generic sorcery allocator function has been added which
      also ensures that allocated objects do not have a lock.
      
      Extended fields have been added thanks to all of the above which allows specific fields
      to be marked as extended, and thus simply stored as-is within the object. Type safety
      is *NOT* enforced on these fields. A consumer of them has to query and ultimately perform
      their own safety check. What does this mean? Extra modules can extend already defined
      structures without having to modify them.
      
      Tests have also been included to verify extended field functionality.
      
      Review: https://reviewboard.asterisk.org/r/2585/
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392586 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      a330d086
  20. Jun 18, 2013
  21. Jun 17, 2013
    • Matthew Jordan's avatar
      Update Asterisk's CDRs for the new bridging framework · 6258bbe7
      Matthew Jordan authored
      This patch is the initial push to update Asterisk's CDR engine for the new
      bridging framework. This patch guts the existing CDR engine and builds the new
      on top of messages coming across Stasis. As changes in channel state and bridge
      state are detected, CDRs are built and dispatched accordingly. This
      fundamentally changes CDRs in a few ways.
      (1) CDRs are now *very* reflective of the actual state of channels and bridges.
          This means CDRs track well with what an actual channel is doing - which
          is useful in transfer scenarios (which were previously difficult to pin
          down). It does, however, mean that CDRs cannot be 'fooled'. Previous
          behavior in Asterisk allowed for CDR applications, channels, and other
          properties to be spoofed in parts of the code - this no longer works.
      (2) CDRs have defined behavior in multi-party scenarios. This behavior will not
          be what everyone wants, but it is a defined behavior and as such, it is
          predictable.
      (3) The CDR manipulation functions and applications have been overhauled. Major
          changes have been made to ResetCDR and ForkCDR in particular. Many of the
          options for these two applications no longer made any sense with the new
          framework and the (slightly) more immutable nature of CDRs.
      
      There are a plethora of other changes. For a full description of CDR behavior,
      see the CDR specification on the Asterisk wiki.
      
      (closes issue ASTERISK-21196)
      
      Review: https://reviewboard.asterisk.org/r/2486/
      
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391947 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      6258bbe7
  22. Jun 11, 2013
  23. Jun 07, 2013
  24. May 17, 2013
  25. May 14, 2013
  26. May 10, 2013
  27. May 08, 2013
    • David M. Lee's avatar
      Fixed set-but-not-used warning caught by newer GCC · 07e2eb71
      David M. Lee authored
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@388014 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      07e2eb71
    • 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
    • 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
Loading