Skip to content
Snippets Groups Projects
  1. Jul 05, 2017
    • Sean Bright's avatar
      core: Remove 'Data Retrieval API' · 325eeced
      Sean Bright authored
      This API was not actively maintained, was not added to new modules
      (such as res_pjsip), and there exist better alternatives to acquire the
      same information, such as the ARI.
      
      Change-Id: I4b2185a83aeb74798b4ad43ff8f89f971096aa83
      325eeced
  2. May 03, 2017
    • Kevin Harwell's avatar
      bridge_simple: Added support for streams · 7b0e3b92
      Kevin Harwell authored
      This patch is the first cut at adding stream support to the bridging framework.
      Changes were made to the framework that allows mapping of stream topologies to
      a bridge's supported media types.
      
      The first channel to enter a bridge initially defines the media types for a
      bridge (i.e. a one to one mapping is created between the bridge and the first
      channel). Subsequently added channels merge their media types into the bridge's
      adding to it when necessary. This allows channels with different sized
      topologies to map correctly to each other according to media type. The bridge
      drops any frame that does not have a matching index into a given write stream.
      
      For now though, bridge_simple will align its two channels according to size or
      first to join. Once both channels join the bridge the one with the most streams
      will indicate to the other channel to update its streams to be the same as that
      of the other. If both channels have the same number of streams then the first
      channel to join is chosen as the stream base.
      
      A topology change source was also added to a channel when a stream toplogy
      change request is made. This allows subsystems to know whether or not they
      initiated a change request. Thus avoiding potential recursive situations.
      
      ASTERISK-26966 #close
      
      Change-Id: I1eb5987921dd80c3cdcf52accc136393ca2d4163
      7b0e3b92
  3. Apr 28, 2017
  4. Apr 24, 2017
    • Sean Bright's avatar
      core: Use eventfd for alert pipes on Linux when possible · 59203c51
      Sean Bright authored
      The primary win of switching to eventfd when possible is that it only
      uses a single file descriptor while pipe() will use two. This means for
      each bridge channel we're reducing the number of required file
      descriptors by 1, and - if you're using timerfd - we also now have 1
      less file descriptor per Asterisk channel.
      
      The API is not ideal (passing int arrays), but this is the cleanest
      approach I could come up with to maintain API/ABI.
      
      I've also removed what I believe to be an erroneous code block that
      checked the non-blocking flag on the pipe ends for each read. If the
      file descriptor is 'losing' its non-blocking mode, it is because of a
      bug somewhere else in our code.
      
      In my testing I haven't seen any measurable difference in performance.
      
      Change-Id: Iff0fb1573e7f7a187d5211ddc60aa8f3da3edb1d
      59203c51
  5. Mar 27, 2017
    • Joshua Colp's avatar
      channel: Remove old epoll support and fixed max number of file descriptors. · 5d938045
      Joshua Colp authored
      This change removes the old epoll support which has not been used or
      maintained in quite some time.
      
      The fixed number of file descriptors on a channel has also been removed.
      File descriptors are now contained in a growable vector. This can be
      used like before by specifying a specific position to store a file
      descriptor at or using a new API call, ast_channel_fd_add, which adds
      a file descriptor to the channel and returns its position.
      
      Tests have been added which cover the growing behavior of the vector
      and the new API call.
      
      ASTERISK-26885
      
      Change-Id: I1a754b506c009b83dfdeeb08c2d2815db30ef928
      5d938045
  6. Mar 01, 2017
    • George Joseph's avatar
      stream: Unit tests for stream read and tweaks framework · 0560c323
      George Joseph authored
      * Removed the AST_CHAN_TP_MULTISTREAM tech property.  We now rely
        on read_stream being set to indicate a multi stream channel.
      * Added ast_channel_is_multistream convenience function.
      * Fixed issue where stream and default_stream weren't being set on
        a frame retrieved from the queue.
      * Now testing for NULL being returned from the driver's read or
        read_stream callback.
      * Fixed issue where the dropnondefault code was crashing on a
        NULL f.
      * Now enforcing that if either read_stream or write_stream are
        set when ast_channel_tech_set is called that BOTH are set.
      * Added the unit tests.
      
      ASTERISK-26816
      
      Change-Id: If7792b20d782e71e823dabd3124572cf0a4caab2
      0560c323
  7. Feb 23, 2017
    • Joshua Colp's avatar
      channel: Add support for writing to a specific stream. · 6cc890b8
      Joshua Colp authored
      This change adds an ast_write_stream function which allows
      writing a frame to a specific media stream. It also moves
      ast_write() to using this underneath by writing media
      frames provided to it to the default streams of the channel.
      Existing functionality (such as audiohooks, framehooks, etc)
      are limited to being applied to the default stream only.
      
      Unit tests have also been added which test the behavior of
      both non-multistream and multistream channels to confirm that
      the write() and write_stream() callbacks are invoked
      appropriately.
      
      ASTERISK-26793
      
      Change-Id: I4df20d1b65bd4d787fce0b4b478e19d2dfea245c
      6cc890b8
  8. Feb 16, 2017
  9. Feb 14, 2017
  10. Feb 02, 2017
    • Richard Mudgett's avatar
      Frame deferral: Revert API refactoring. · 72e3fc58
      Richard Mudgett authored
      There are several issues with deferring frames that are caused by the
      refactoring.
      
      1) The code deferring frames mishandles adding a deferred frame to the
      deferred queue.  As a result the deferred queue can only be one frame
      long.
      
      2) Deferrable frames can come directly from the channel driver as well as
      the read queue.  These frames need to be added to the deferred queue.
      
      3) Whoever is deferring frames is really only doing the __ast_read() to
      collect deferred frames and doesn't care about the returned frames except
      to detect a hangup event.  When frame deferral is completed we must make
      the normal frame processing see the hangup as a frame anyway.  As such,
      there is no need to have varying hangup frame deferral methods.  We also
      need to be aware of the AST_SOFTHANGUP_ASYNCGOTO hangup that isn't real.
      That fake hangup is to cause the PBX thread to break out of loops to go
      execute a new dialplan location.
      
      4) To properly deal with deferrable frames from the channel driver as
      pointed out by (2) above, means that it is possible to process a dialplan
      interception routine while frames are deferred because of the
      AST_CONTROL_READ_ACTION control frame.  Deferring frames is not
      implemented as a re-entrant operation so you could have the unsupported
      case of two sections of code thinking they have control of the media
      stream.
      
      A worse problem is because of the bad implementation of the AMI PlayDTMF
      action.  It can cause two threads to be deferring frames on the same
      channel at the same time.  (ASTERISK_25940)
      
      * Rather than fix all these problems simply revert the API refactoring as
      there is going to be only autoservice and safe_sleep deferring frames
      anyway.
      
      ASTERISK-26343
      
      ASTERISK-26716 #close
      
      Change-Id: I45069c779aa3a35b6c863f65245a6df2c7865496
      72e3fc58
  11. Dec 14, 2016
  12. Nov 14, 2016
  13. Nov 10, 2016
  14. Nov 08, 2016
    • Mark Michelson's avatar
      Add API for channel frame deferral. · f073f648
      Mark Michelson authored
      There are several places in Asterisk that have duplicated logic
      for deferring important frames until later.
      
      This commit adds a couple of API calls to facilitate this automatically.
      
      ast_channel_start_defer_frames(): Future reads of deferrable frames on
      this channel will be deferred until later.
      
      ast_channel_stop_defer_frames(): Any frames that have been deferred get
      requeued onto the channel.
      
      ASTERISK-26343
      
      Change-Id: I3e1b87bc6796f222442fa6f7d1b6a4706fb33641
      f073f648
  15. Oct 27, 2016
    • Corey Farrell's avatar
      Remove ASTERISK_REGISTER_FILE. · a6e5bae3
      Corey Farrell authored
      ASTERISK_REGISTER_FILE no longer has any purpose so this commit removes
      all traces of it.
      
      Previously exported symbols removed:
      * __ast_register_file
      * __ast_unregister_file
      * ast_complete_source_filename
      
      This also removes the mtx_prof static variable that was declared when
      MTX_PROFILE was enabled.  This variable was only used in lock.c so it
      is now initialized in that file only.
      
      ASTERISK-26480 #close
      
      Change-Id: I1074af07d71f9e159c48ef36631aa432c86f9966
      a6e5bae3
  16. Oct 20, 2016
    • Mark Michelson's avatar
      ARI: Detect duplicate channel IDs · e459b8da
      Mark Michelson authored
      ARI and AMI allow for an explicit channel ID to be specified
      when originating channels. Unfortunately, there is nothing in
      place to prevent someone from using the same ID for multiple
      channels. Further complicating things, adding ID validation to channel
      allocation makes it impossible for ARI to discern why channel allocation
      failed, resulting in a vague error code being returned.
      
      The fix for this is to institute a new method for channel errors to be
      discerned. The method mirrors errno, in that when an error occurs, the
      caller can consult the channel errno value to determine what the error
      was. This initial iteration of the feature only introduces "unknown" and
      "channel ID exists" errors. However, it's possible to add more errors as
      needed.
      
      ARI uses this feature to determine why channel allocation failed and can
      return a 409 error during origination to show that a channel with the
      given ID already exists.
      
      ASTERISK-26421
      
      Change-Id: Ibba7ae68842dab6df0c2e9c45559208bc89d3d06
      e459b8da
  17. Feb 29, 2016
  18. Jul 01, 2015
    • Scott Griepentrog's avatar
      Channel alert pipe: improve diagnostic error return · 537df26f
      Scott Griepentrog authored
      When a frame is queued on a channel, any failure in
      ast_channel_alert_write is logged along with errno.
      
      This change improves the diagnostic message through
      aligning the errno value with actual failure cases.
      
      ASTERISK-25224
      Reported by: Andrey Biglari
      
      Change-Id: I1bf7b3337ad392789a9f02c650589cd065d20b5b
      537df26f
  19. Apr 27, 2015
    • Corey Farrell's avatar
      Astobj2: Allow reference debugging to be enabled/disabled by config. · 5c1d07ba
      Corey Farrell authored
      * The REF_DEBUG compiler flag no longer has any effect on code that uses
        Astobj2.  It is used to determine if reference debugging is enabled by
        default.  Reference debugging can be enabled or disabled in asterisk.conf.
      * Caller information is provided in logger errors for ao2 bad magic numbers.
      * Optimizes AO2 by merging internal functions with the public counterpart.
        This was possible now that we no longer require a dual ABI.
      
      ASTERISK-24974 #close
      Reported by: Corey Farrell
      
      Change-Id: Icf3552721fe999365ba8a8cf00a965aa6b897cc1
      5c1d07ba
  20. Apr 21, 2015
  21. Apr 13, 2015
    • Matt Jordan's avatar
      git migration: Refactor the ASTERISK_FILE_VERSION macro · 4a582616
      Matt Jordan authored
      Git does not support the ability to replace a token with a version
      string during check-in. While it does have support for replacing a
      token on clone, this is somewhat sub-optimal: the token is replaced
      with the object hash, which is not particularly easy for human
      consumption. What's more, in practice, the source file version was often
      not terribly useful. Generally, when triaging bugs, the overall version
      of Asterisk is far more useful than an individual SVN version of a file. As a
      result, this patch removes Asterisk's support for showing source file
      versions.
      
      Specifically, it does the following:
      
      * Rename ASTERISK_FILE_VERSION macro to ASTERISK_REGISTER_FILE, and
        remove passing the version in with the macro. Other facilities
        than 'core show file version' make use of the file names, such as
        setting a debug level only on a specific file. As such, the act of
        registering source files with the Asterisk core still has use. The
        macro rename now reflects the new macro purpose.
      
      * main/asterisk:
        - Refactor the file_version structure to reflect that it no longer
          tracks a version field.
        - Remove the "core show file version" CLI command. Without the file
          version, it is no longer useful.
        - Remove the ast_file_version_find function. The file version is no
          longer tracked.
        - Rename ast_register_file_version/ast_unregister_file_version to
          ast_register_file/ast_unregister_file, respectively.
      
      * main/manager: Remove value from the Version key of the ModuleCheck
        Action. The actual key itself has not been removed, as doing so would
        absolutely constitute a backwards incompatible change. However, since
        the file version is no longer tracked, there is no need to attempt to
        include it in the Version key.
      
      * UPGRADE: Add notes for:
        - Modification to the ModuleCheck AMI Action
        - Removal of the "core show file version" CLI command
      
      Change-Id: I6cf0ff280e1668bf4957dc21f32a5ff43444a40e
      4a582616
  22. Mar 13, 2015
  23. Dec 08, 2014
    • Kinsey Moore's avatar
      Stasis: Fix StasisStart/End order and missing events · 4bb556a8
      Kinsey Moore authored
      This corrects several bugs that currently exist in the stasis
      application code.
      
      * After a masquerade, the resulting channels have channel topics that
        do not match their uniqueids
      ** Masquerades now swap channel topics appropriately
      * StasisStart and StasisEnd messages are leaked to observer
        applications due to being published on channel topics
      ** StasisStart and StasisEnd publishing is now properly restricted
         to controlling apps via app topics
      * Race conditions exist where StasisStart and StasisEnd messages due to
        a masquerade may be received out of order due to being published on
        different topics
      ** These messages are now published directly on the app topic so this
         is now a non-issue
      * StasisEnds are sometimes missing when sent due to masquerades and
        bridge swaps into and out of Stasis()
      ** This was due to StasisEnd processing adjusting message-sent flags
         after Stasis() had already exited and Stasis() had been re-entered
      ** This was corrected by adjusting these flags prior to sending the
         message while the initial Stasis() application was still shutting
         down
      
      Review: https://reviewboard.asterisk.org/r/4213/
      ASTERISK-24537 #close
      Reported by: Matt DiMeo
      ........
      
      Merged revisions 429061 from http://svn.asterisk.org/svn/asterisk/branches/12
      ........
      
      Merged revisions 429062 from http://svn.asterisk.org/svn/asterisk/branches/13
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@429063 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      4bb556a8
  24. Aug 14, 2014
  25. Aug 13, 2014
  26. Jul 22, 2014
    • Matthew Jordan's avatar
      ARI: Fix endpoint/channel subscription issues; allow for subscriptions to tech · bb87796f
      Matthew Jordan authored
      This patch serves two purposes:
      (1) It fixes some bugs with endpoint subscriptions not reporting all of the
          channel events
      (2) It serves as the preliminary work needed for ASTERISK-23692, which allows
          for sending/receiving arbitrary out of call text messages through ARI in a
          technology agnostic fashion.
      
      The messaging functionality described on ASTERISK-23692 requires two things:
      (1) The ability to send/receive messages associated with an endpoint. This is
          relatively straight forwards with the endpoint core in Asterisk now.
      (2) The ability to send/receive messages associated with a technology and an
          arbitrary technology defined URI. This is less straight forward, as
          endpoints are formed from a tech + resource pair. We don't have a
          mechanism to note that a technology that *may* have endpoints exists.
      
      This patch provides such a mechanism, and fixes a few bugs along the way.
      
      The first major bug this patch fixes is the forwarding of channel messages
      to their respective endpoints. Prior to this patch, there were two problems:
      (1) Channel caching messages weren't forwarded. Thus, the endpoints missed
          most of the interesting bits (such as channel creation, destruction, state
          changes, etc.)
      (2) Channels weren't associated with their endpoint until after creation.
          This resulted in endpoints missing the channel creation message, which
          limited the usefulness of the subscription in the first place (a major use
          case being 'tell me when this endpoint has a channel'). Unfortunately,
          this meant another parameter to ast_channel_alloc. Since not all channel
          technologies support an ast_endpoint, this patch makes such a call
          optional and opts for a new function, ast_channel_alloc_with_endpoint.
      
      When endpoints are created, they will implicitly create a technology endpoint
      for their technology (if one does not already exist). A technology endpoint is
      special in that it has no state, cannot have channels created for it, cannot
      be created explicitly, and cannot be destroyed except on shutdown. It does,
      however, have all messages from other endpoints in its technology forwarded to
      it.
      
      Combined with the bug fixes, we now have Stasis messages being properly
      forwarded. Consider the following scenario: two PJSIP endpoints (foo and bar),
      where bar has a single channel associated with it and foo has two channels
      associated with it. The messages would be forwarded as follows:
      
      channel PJSIP/foo-1 --
                            \
                             --> endpoint PJSIP/foo --
                            /                         \
      channel PJSIP/foo-2 --                           \
                                                        ---- > endpoint PJSIP
                                                      /
      channel PJSIP/bar-1 -----> endpoint PJSIP/bar --
      
      ARI, through the applications resource, can:
       - subscribe to endpoint:PJSIP/foo and get notifications for channels
         PJSIP/foo-1,PJSIP/foo-2 and endpoint PJSIP/foo
       - subscribe to endpoint:PJSIP/bar and get notifications for channels
         PJSIP/bar-1 and endpoint PJSIP/bar
       - subscribe to endpoint:PJSIP and get notifications for channels
         PJSIP/foo-1,PJSIP/foo-2,PJSIP/bar-1 and endpoints PJSIP/foo,PJSIP/bar
      
      Note that since endpoint PJSIP never changes, it never has events itself. It
      merely provides an aggregation point for all other endpoints in its technology
      (which in turn aggregate all channel messages associated with that endpoint).
      
      This patch also adds endpoints to res_xmpp and chan_motif, because the actual
      messaging work will need it (messaging without XMPP is just sad).
      
      Review: https://reviewboard.asterisk.org/r/3760/
      
      ASTERISK-23692
      ........
      
      Merged revisions 419196 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419203 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      bb87796f
  27. Jul 20, 2014
  28. Jun 15, 2014
  29. Jun 13, 2014
    • Matthew Jordan's avatar
      stasis: Reduce creation of channel snapshots to improve performance · 9cc1a8e8
      Matthew Jordan authored
      During some performance testing of Asterisk with AGI, ARI, and lots of Local
      channels, we noticed that there's quite a hit in performance during channel
      creation and releasing to the dialplan (ARI continue). After investigating
      the performance spike that occurs during channel creation, we discovered
      that we create a lot of channel snapshots that are technically unnecessary.
      This includes creating snapshots during:
       * AGI execution
       * Returning objects for ARI commands
       * During some Local channel operations
       * During some dialling operations
       * During variable setting
       * During some bridging operations
      And more.
      
      This patch does the following:
       - It removes a number of fields from channel snapshots. These fields were
         rarely used, were expensive to have on the snapshot, and hurt performance.
         This included formats, translation paths, Log Call ID, callgroup, pickup
         group, and all channel variables. As a result, AMI Status,
         "core show channel", "core show channelvar", and "pjsip show channel" were
         modified to either hit the live channel or not show certain pieces of data.
         While this is unfortunate, the performance gain from this patch is worth
         the loss in behaviour.
       - It adds a mechanism to publish a cached snapshot + blob. A large number of
         publications were changed to use this, including:
         - During Dial begin
         - During Variable assignment (if no AMI variables are emitted - if AMI
           variables are set, we have to make snapshots when a variable is changed)
         - During channel pickup
         - When a channel is put on hold/unhold
         - When a DTMF digit is begun/ended
         - When creating a bridge snapshot
         - When an AOC event is raised
         - During Local channel optimization/Local bridging
         - When endpoint snapshots are generated
         - All AGI events
         - All ARI responses that return a channel
         - Events in the AgentPool, MeetMe, and some in Queue
       - Additionally, some extraneous channel snapshots were being made that were
         unnecessary. These were removed.
       - The result of ast_hashtab_hash_string is now cached in stasis_cache. This
         reduces a large number of calls to ast_hashtab_hash_string, which reduced
         the amount of time spent in this function in gprof by around 50%.
      
      #ASTERISK-23811 #close
      Reported by: Matt Jordan
      
      Review: https://reviewboard.asterisk.org/r/3568/
      ........
      
      Merged revisions 416211 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416216 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      9cc1a8e8
  30. Mar 20, 2014
    • Richard Mudgett's avatar
      assigned-uniqueids: Miscellaneous cleanup and fixes. · 1ba13718
      Richard Mudgett authored
      * Fix memory leak in ast_unreal_new_channels().  Made it generate the ;2
      uniqueid on a stack variable instead of mallocing it.
      
      * Made send error response to ARI and AMI requests instead of just logging
      excessive uniqueid length and allowing truncation.  action_originate() and
      ari_channels_handle_originate_with_id().
      
      * Fixed minor truncating uniqueid hole when generating the ;2 uniqueid
      string length.  Created public and internal lengths of uniqueid.  The
      internal length can handle a max public uniqueid plus an appended ;2.
      
      * free() and ast_free() are NULL tolerant so they don't need a NULL test
      before calling.
      
      * Made use better struct initialization format instead of the position
      dependent initialization format.  Also anything not explicitly initialized
      in the struct is initialized to zero by the compiler.
      
      * Made ast_channel_internal_set_fake_ids() use the safer
      ast_copy_string() instead of strncpy().
      
      Review: https://reviewboard.asterisk.org/r/3371/
      ........
      
      Merged revisions 410949 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410950 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      1ba13718
  31. 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
  32. Oct 03, 2013
    • Matthew Jordan's avatar
      Remove publication of a channel snapshot when the technology is set · facebb3f
      Matthew Jordan authored
      This patch removes said publication for a few reasons:
      (1) It is unnecessary. Association of the channel technology with a specific
      channel is an implementation detail that should be assumed to "just happen",
      and consumers of Stasis don't need to be informed about it.
      (2) Publication of said message can now cause crashes, as the actual creation
      of a channel in normal locations now stages its messages. As a result, things
      that create dummy channels (such as the SIP RTP QOS unit test) and associate
      them with a channel technology were now crashing, as the channel itself was
      not known by Stasis.
      ........
      
      Merged revisions 400460 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400461 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      facebb3f
  33. Sep 30, 2013
    • David M. Lee's avatar
      Multiple revisions 399887,400138,400178,400180-400181 · 2de42c2a
      David M. Lee authored
      ........
        r399887 | dlee | 2013-09-26 10:41:47 -0500 (Thu, 26 Sep 2013) | 1 line
        
        Minor performance bump by not allocate manager variable struct if we don't need it
      ........
        r400138 | dlee | 2013-09-30 10:24:00 -0500 (Mon, 30 Sep 2013) | 23 lines
        
        Stasis performance improvements
        
        This patch addresses several performance problems that were found in
        the initial performance testing of Asterisk 12.
        
        The Stasis dispatch object was allocated as an AO2 object, even though
        it has a very confined lifecycle. This was replaced with a straight
        ast_malloc().
        
        The Stasis message router was spending an inordinate amount of time
        searching hash tables. In this case, most of our routers had 6 or
        fewer routes in them to begin with. This was replaced with an array
        that's searched linearly for the route.
        
        We more heavily rely on AO2 objects in Asterisk 12, and the memset()
        in ao2_ref() actually became noticeable on the profile. This was
        #ifdef'ed to only run when AO2_DEBUG was enabled.
        
        After being misled by an erroneous comment in taskprocessor.c during
        profiling, the wrong comment was removed.
        
        Review: https://reviewboard.asterisk.org/r/2873/
      ........
        r400178 | dlee | 2013-09-30 13:26:27 -0500 (Mon, 30 Sep 2013) | 24 lines
        
        Taskprocessor optimization; switch Stasis to use taskprocessors
        
        This patch optimizes taskprocessor to use a semaphore for signaling,
        which the OS can do a better job at managing contention and waiting
        that we can with a mutex and condition.
        
        The taskprocessor execution was also slightly optimized to reduce the
        number of locks taken.
        
        The only observable difference in the taskprocessor implementation is
        that when the final reference to the taskprocessor goes away, it will
        execute all tasks to completion instead of discarding the unexecuted
        tasks.
        
        For systems where unnamed semaphores are not supported, a really
        simple semaphore implementation is provided. (Which gives identical
        performance as the original taskprocessor implementation).
        
        The way we ended up implementing Stasis caused the threadpool to be a
        burden instead of a boost to performance. This was switched to just
        use taskprocessors directly for subscriptions.
        
        Review: https://reviewboard.asterisk.org/r/2881/
      ........
        r400180 | dlee | 2013-09-30 13:39:34 -0500 (Mon, 30 Sep 2013) | 28 lines
        
        Optimize how Stasis forwards are dispatched
        
        This patch optimizes how forwards are dispatched in Stasis.
        
        Originally, forwards were dispatched as subscriptions that are invoked
        on the publishing thread. This did not account for the vast number of
        forwards we would end up having in the system, and the amount of work it
        would take to walk though the forward subscriptions.
        
        This patch modifies Stasis so that rather than walking the tree of
        forwards on every dispatch, when forwards and subscriptions are changed,
        the subscriber list for every topic in the tree is changed.
        
        This has a couple of benefits. First, this reduces the workload of
        dispatching messages. It also reduces contention when dispatching to
        different topics that happen to forward to the same aggregation topic
        (as happens with all of the channel, bridge and endpoint topics).
        
        Since forwards are no longer subscriptions, the bulk of this patch is
        simply changing stasis_subscription objects to stasis_forward objects
        (which, admittedly, I should have done in the first place.)
        
        Since this required me to yet again put in a growing array, I finally
        abstracted that out into a set of ast_vector macros in
        asterisk/vector.h.
        
        Review: https://reviewboard.asterisk.org/r/2883/
      ........
        r400181 | dlee | 2013-09-30 13:48:57 -0500 (Mon, 30 Sep 2013) | 28 lines
        
        Remove dispatch object allocation from Stasis publishing
        
        While looking for areas for performance improvement, I realized that an
        unused feature in Stasis was negatively impacting performance.
        
        When a message is sent to a subscriber, a dispatch object is allocated
        for the dispatch, containing the topic the message was published to, the
        subscriber the message is being sent to, and the message itself.
        
        The topic is actually unused by any subscriber in Asterisk today. And
        the subscriber is associated with the taskprocessor the message is being
        dispatched to.
        
        First, this patch removes the unused topic parameter from Stasis
        subscription callbacks.
        
        Second, this patch introduces the concept of taskprocessor local data,
        data that may be set on a taskprocessor and provided along with the data
        pointer when a task is pushed using the ast_taskprocessor_push_local()
        call. This allows the task to have both data specific to that
        taskprocessor, in addition to data specific to that invocation.
        
        With those two changes, the dispatch object can be removed completely,
        and the message is simply refcounted and sent directly to the
        taskprocessor.
        
        Review: https://reviewboard.asterisk.org/r/2884/
      ........
      
      Merged revisions 399887,400138,400178,400180-400181 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400186 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      2de42c2a
  34. Aug 23, 2013
    • Richard Mudgett's avatar
      Handle DTMF and hold wrapup when a channel leaves the bridging system. · 6ebfac8e
      Richard Mudgett authored
      DTMF start/end and hold/unhold events have state because a DTMF begin
      event and hold event must be ended by something.
      
      The following cases need to be handled when a channel is moved around in
      the system.
      
      * When a channel leaves a bridge it may owe a DTMF end event to the
      bridge.
      
      * When a channel leaves a bridge it may owe an UNHOLD event to the bridge.
      (This case is explicitly ignored because things like transfers need
      explicit control over this.)
      
      * When a channel leaves the bridging system it may need to simulate a DTMF
      end event to the channel.
      
      * When a channel leaves the bridging system it may need to simulate an
      UNHOLD event to the channel.
      
      The patch also fixes the following:
      * Fixes playing a file and restarting MOH using the latest MOH class used.
      
      (closes issue ASTERISK-22043)
      Reported by: Matt Jordan
      
      Review: https://reviewboard.asterisk.org/r/2791/
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397577 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      6ebfac8e
  35. Aug 08, 2013
    • Richard Mudgett's avatar
      Remove some resolved or obsolete BUGBUG comments. · 73b3c70a
      Richard Mudgett authored
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396401 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      73b3c70a
    • Matthew Jordan's avatar
      Hide the Surrogate channels from external consumers; kill Masquerade events · 33e7b76d
      Matthew Jordan authored
      This patch does three things:
      1. It provides a Surrogate channel technology with a consolidated
         "implementation detail flag" on the channel technology. This tells
         consumers of Stasis that the creation of this channel is an implementation
         detail in Asterisk and can be ignored (if they so choose). This
         consolidates the conference recorder/announcer flags as well - these flags
         had no additional meaning beyond "ignore this channel please".
      
      2. It modifies allocation of a channel in two ways:
         (a) If a channel technology can be determined from the name, we set it
             directly in the allocation routine. This prevents the initial
             publication of the message from going out with a NULL channel technology
             where possible. This lets Stasis consumers get the right channel
             technology on the first publication.
         (b) It reorganizes allocation to make use of the 'finalized' property on the
             channel. This was already used to know that a channel had completely
             finished its construction in the masquerade routine; now we also use it
             to know whether or not the setting of certain channel properties is
             occurring during or post construction. The various set routines were
             modified accordingly as well.
      
      3. The masquerade event is now dead, Jim. It no longer served any purpose
         whatsoever - if you perform a call pickup you'll get a Pickup event;
         if you perform an attended transfer you will still get those events; if you
         steal a channel to put it elsewhere you'll get the corresponding NewExten or
         BridgeEnter events.
      
      Review: https://reviewboard.asterisk.org/r/2740
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396392 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      33e7b76d
  36. Aug 02, 2013
  37. 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
  38. Jul 12, 2013
  39. Jul 08, 2013
Loading