Skip to content
Snippets Groups Projects
  1. Oct 17, 2016
    • Matt Jordan's avatar
      res/ari: Add the Asterisk EID field to outgoing events · dd5129d8
      Matt Jordan authored
      This patch adds the Asterisk EID field to all outgoing ARI events.
      Because this field should be added to all events as they are
      transmitted, it is appended to the JSON message just prior to it being
      handed off to the application message handler. This makes it somewhat
      resilient to both new events being added to ARI, as well as other
      potential event transport mechanisms.
      
      ASTERISK-26470 #close
      
      Change-Id: Ieff0ecc24464e83f3f44e9c3e7bd9a5d70b87a1d
      dd5129d8
  2. May 17, 2016
    • Matt Jordan's avatar
      ARI: Add the ability to play multiple media URIs in a single operation · 03d88b56
      Matt Jordan authored
      Many ARI applications will want to play multiple media files in a row to
      a resource. The most common use case is when building long-ish IVR prompts
      made up of multiple, smaller sound files. Today, that requires building a
      small state machine, listening for each PlaybackFinished event, and triggering
      the next sound file to play. While not especially challenging, it is tedious
      work. Since requiring developers to write tedious code to do normal activities
      stinks, this patch adds the ability to play back a list of media files to a
      resource.
      
      Each of the 'play' operations on supported resources (channels and bridges)
      now accepts a comma delineated list of media URIs to play. A single Playback
      resource is created as a handle to the entire list. The operation of playing
      a list is identical to playing a single media URI, save that a new event,
      PlaybackContinuing, is raised instead of a PlaybackFinished for each non-final
      media URI. When the entire list is finished being played, a PlaybackFinished
      event is raised.
      
      In order to help inform applications where they are in the list playback, the
      Playback resource now includes a new, optional attribute, 'next_media_uri',
      that contains the next URI in the list to be played.
      
      It's important to note the following:
       - If an offset is provided to the 'play' operations, it only applies to the
         first media URI, as it would be weird to skip n seconds forward in every
         media resource.
       - Operations that control the position of the media only affect the current
         media being played. For example, once a media resource in the list
         completes, a 'reverse' operation on a subsequent media resource will not
         start a previously completed media resource at the appropiate offset.
       - This patch does not add any new operations to control the list. Hopefully,
         user feedback and/or future patches would add that if people want it.
      
      ASTERISK-26022 #close
      
      Change-Id: Ie1ea5356573447b8f51f2e7964915ea01792f16f
      03d88b56
  3. Sep 22, 2015
    • Matt Jordan's avatar
      ARI: Add the ability to subscribe to all events · b99a7052
      Matt Jordan authored
      This patch adds the ability to subscribe to all events. There are two possible
      ways to accomplish this:
      (1) On initial WebSocket connection. This patch adds a new query parameter,
          'subscribeAll'. If present and True, Asterisk will subscribe the
          applications to all ARI events.
      (2) Via the applications resource. When subscribing in this manner, an ARI
          client should merely specify a blank resource name, i.e., 'channels:'
          instead of 'channels:12354'. This will subscribe the application to all
          resources of the 'channels' type.
      
      ASTERISK-24870 #close
      
      Change-Id: I4a943b4db24442cf28bc64b24bfd541249790ad6
      b99a7052
  4. Sep 21, 2015
    • Matt Jordan's avatar
      ARI: Add events for Contact and Peer Status changes · 5206aa9d
      Matt Jordan authored
      This patch adds support for receiving events regarding Peer status changes
      and Contact status changes. This is particularly useful in scenarios where
      we are subscribed to all endpoints and channels, where we often want to know
      more about the state of channel technology specific items than a single
      endpoint's state.
      
      ASTERISK-24870
      
      Change-Id: I6137459cdc25ce27efc134ad58abf065653da4e9
      5206aa9d
  5. May 21, 2015
    • Matt Jordan's avatar
      ARI: Update version to 1.7.0 · 3e2a994c
      Matt Jordan authored
      This patch updates the version of ARI to 1.7.0 to reflect the backwards
      compatible changes that will be introduced in 13.4.0.
      
      Change-Id: I6c36e6144da426412f25828a868e4df916bff60a
      (cherry picked from commit 9d8a4623)
      3e2a994c
  6. Apr 10, 2015
  7. Apr 07, 2015
    • Matthew Jordan's avatar
      ARI: Add the ability to intercept hold and raise an event · c2f50ba6
      Matthew Jordan authored
      For some applications - such as SLA - a phone pressing hold should not behave
      in the fashion that the Asterisk core would like it to. Instead, the hold
      action has some application specific behaviour associated with it - such as
      disconnecting the channel that initiated the hold; only playing MoH to channels
      in the bridge if the channels are of a particular type, etc.
      
      One way of accomplishing this is to use a framehook to intercept the
      hold/unhold frames, raise an event, and eat the frame. Tasty. This patch
      accomplishes that using a new dialplan function, HOLD_INTERCEPT.
      
      In addition, some general cleanup of raising hold/unhold Stasis messages was
      done, including removing some RAII_VAR usage.
      
      Review: https://reviewboard.asterisk.org/r/4549/
      
      ASTERISK-24922 #close
      ........
      
      Merged revisions 434216 from http://svn.asterisk.org/svn/asterisk/branches/13
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434217 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      c2f50ba6
  8. Dec 08, 2014
  9. Sep 20, 2014
  10. Aug 20, 2014
  11. Aug 11, 2014
  12. Aug 07, 2014
  13. Aug 05, 2014
    • Matthew Jordan's avatar
      Multiple revisions 420089-420090,420097 · 47bf7efc
      Matthew Jordan authored
      ........
        r420089 | mjordan | 2014-08-05 15:10:52 -0500 (Tue, 05 Aug 2014) | 72 lines
        
        ARI: Add channel technology agnostic out of call text messaging
        
        This patch adds the ability to send and receive text messages from various
        technology stacks in Asterisk through ARI. This includes chan_sip (sip),
        res_pjsip_messaging (pjsip), and res_xmpp (xmpp). Messages are sent using the
        endpoints resource, and can be sent directly through that resource, or to a
        particular endpoint.
        
        For example, the following would send the message "Hello there" to PJSIP
        endpoint alice with a display URI of sip:asterisk@mycooldomain.org:
        
        ari/endpoints/sendMessage?to=pjsip:alice&from=sip:asterisk@mycooldomain.org&body=Hello+There
        
        This is equivalent to the following as well:
        
        ari/endpoints/PJSIP/alice/sendMessage?from=sip:asterisk@mycooldomain.org&body=Hello+There
        
        Both forms are available for message technologies that allow for arbitrary
        destinations, such as chan_sip.
        
        Inbound messages can now be received over ARI as well. An ARI application that
        subscribes to endpoints will receive messages from those endpoints:
        
        {
          "type": "TextMessageReceived",
          "timestamp": "2014-07-12T22:53:13.494-0500",
          "endpoint": {
            "technology": "PJSIP",
            "resource": "alice",
            "state": "online",
            "channel_ids": []
          },
          "message": {
            "from": "\"alice\" <sip:alice@127.0.0.1>",
            "to": "pjsip:asterisk@127.0.0.1",
            "body": "Watson, come here.",
            "variables": []
          },
          "application": "testsuite"
        }
        
        The above was made possible due to some rather major changes in the message
        core. This includes (but is not limited to):
        - Users of the message API can now register message handlers. A handler has
          two callbacks: one to determine if the handler has a destination for the
          message, and another to handle it.
        - All dialplan functionality of handling a message was moved into a message
          handler provided by the message API.
        - Messages can now have the technology/endpoint associated with them.
          Various other properties are also now more easily accessible.
        - A number of ao2 containers that weren't really needed were replaced with
          vectors. Iteration over ao2_containers is expensive and pointless when
          the lifetime of things is well defined and the number of things is very
          small.
        
        res_stasis now has a new file that makes up its structure, messaging. The
        messaging functionality implements a message handler, and passes received
        messages that match an interested endpoint over to the app for processing.
        
        Note that inadvertently while testing this, I reproduced ASTERISK-23969.
        res_pjsip_messaging was incorrectly parsing out the 'to' field, such that
        arbitrary SIP URIs mangled the endpoint lookup. This patch includes the
        fix for that as well.
        
        Review: https://reviewboard.asterisk.org/r/3726
        
        ASTERISK-23692 #close
        Reported by: Matt Jordan
        
        ASTERISK-23969 #close
        Reported by: Andrew Nagy
      ........
        r420090 | mjordan | 2014-08-05 15:16:37 -0500 (Tue, 05 Aug 2014) | 2 lines
        
        Remove automerge properties :-(
      ........
        r420097 | mjordan | 2014-08-05 16:36:25 -0500 (Tue, 05 Aug 2014) | 2 lines
        
        test_message: Fix strict-aliasing compilation issue
      ........
      
      Merged revisions 420089-420090,420097 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420098 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      47bf7efc
  14. Jul 08, 2014
  15. Jul 03, 2014
  16. May 30, 2014
  17. May 28, 2014
  18. May 22, 2014
    • Scott Griepentrog's avatar
      ARI: Add ability to raise arbitrary User Events · cf21644d
      Scott Griepentrog authored
      User events can now be generated from ARI.  Events can be signalled with
      arbitrary json variables, and include one or more of channel, bridge, or
      endpoint snapshots.  An application must be specified which will receive
      the event message (other applications can subscribe to it).  The message
      will also be delivered via AMI provided a channel is attached.  Dialplan
      generated user event messages are still transmitted via the channel, and
      will only be received by a stasis application they are attached to or if
      the channel is subscribed to.
      
      This change also introduces the multi object blob mechanism used to send
      multiple snapshot types in a single message.  The dialplan app UserEvent
      was also changed to use multi object blob, and a new stasis message type
      created to handle them.
      
      ASTERISK-22697 #close
      Review: https://reviewboard.asterisk.org/r/3494/
      ........
      
      Merged revisions 414405 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414406 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      cf21644d
  19. Mar 28, 2014
  20. Feb 05, 2014
  21. Feb 01, 2014
  22. Dec 18, 2013
  23. Dec 14, 2013
  24. Nov 30, 2013
  25. Nov 23, 2013
    • Kevin Harwell's avatar
      ARI: Implement device state API · ed483779
      Kevin Harwell authored
      Created a data model and implemented functionality for an ARI device state
      resource.  The following operations have been added that allow a user to
      manipulate an ARI controlled device:
      
      Create/Change the state of an ARI controlled device
      PUT    /deviceStates/{deviceName}&{deviceState}
      
      Retrieve all ARI controlled devices
      GET    /deviceStates
      
      Retrieve the current state of a device
      GET    /deviceStates/{deviceName}
      
      Destroy a device-state controlled by ARI
      DELETE /deviceStates/{deviceName}
      
      The ARI controlled device must begin with 'Stasis:'.  An example controlled
      device name would be Stasis:Example.  A 'DeviceStateChanged' event has also
      been added so that an application can subscribe and receive device change
      events.  Any device state, ARI controlled or not, can be subscribed to.
      
      While adding the event, the underlying subscription control mechanism was
      refactored so that all current and future resource subscriptions would be
      the same.  Each event resource must now register itself in order to be able
      to properly handle [un]subscribes.
      
      (issue ASTERISK-22838)
      Reported by: Matt Jordan
      Review: https://reviewboard.asterisk.org/r/3025/
      ........
      
      Merged revisions 403134 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403135 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      ed483779
    • Joshua Colp's avatar
      ari: Add events for playback and recording. · 14a74529
      Joshua Colp authored
      While there were events defined for playback and recording
      these were not actually sent. This change implements the
      to_json handlers which produces them.
      
      (closes issue ASTERISK-22710)
      Reported by: Jonathan Rose
      
      Review: https://reviewboard.asterisk.org/r/3026/
      ........
      
      Merged revisions 403119 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      14a74529
  26. Nov 12, 2013
  27. Oct 25, 2013
  28. Oct 24, 2013
  29. Oct 04, 2013
    • Matthew Jordan's avatar
      ARI: Add subscription support · 8d7873b8
      Matthew Jordan authored
      This patch adds an /applications API to ARI, allowing explicit management of
      Stasis applications.
      
       * GET /applications - list current applications
       * GET /applications/{applicationName} - get details of a specific application
       * POST /applications/{applicationName}/subscription - explicitly subscribe to
         a channel, bridge or endpoint
       * DELETE /applications/{applicationName}/subscription - explicitly unsubscribe
         from a channel, bridge or endpoint
      
      Subscriptions work by a reference counting mechanism: if you subscript to an
      event source X number of times, you must unsubscribe X number of times to stop
      receiveing events for that event source.
      
      Review: https://reviewboard.asterisk.org/r/2862
      
      (issue ASTERISK-22451)
      Reported by: Matt Jordan
      ........
      
      Merged revisions 400522 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400523 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      8d7873b8
  30. 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
  31. Jul 05, 2013
  32. 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
    • 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
  33. 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
  34. May 23, 2013
    • David M. Lee's avatar
      This patch implements the REST API's for POST /channels/{channelId}/play · 10ba6bf8
      David M. Lee authored
      and GET /playback/{playbackId}.
      
      This allows an external application to initiate playback of a sound on a
      channel while the channel is in the Stasis application.
      
      /play commands are issued asynchronously, and return immediately with
      the URL of the associated /playback resource. Playback commands queue up,
      playing in succession. The /playback resource shows the state of a
      playback operation as enqueued, playing or complete. (Although the
      operation will only be in the 'complete' state for a very short time,
      since it is almost immediately freed up).
      
      (closes issue ASTERISK-21283)
      (closes issue ASTERISK-21586)
      Review: https://reviewboard.asterisk.org/r/2531/
      
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389587 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      10ba6bf8
  35. May 21, 2013
  36. 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
Loading