Skip to content
Snippets Groups Projects
  1. Nov 18, 2019
    • Kevin Harwell's avatar
      various files - fix some alerts raised by lgtm code analysis · bdd785d3
      Kevin Harwell authored
      This patch fixes several issues reported by the lgtm code analysis tool:
      
      https://lgtm.com/projects/g/asterisk/asterisk
      
      Not all reported issues were addressed in this patch. This patch mostly fixes
      confirmed reported errors, potential problematic code points, and a few other
      "low hanging" warnings or recommendations found in core supported modules.
      These include, but are not limited to the following:
      
      * innapropriate stack allocation in loops
      * buffer overflows
      * variable declaration "hiding" another variable declaration
      * comparisons results that are always the same
      * ambiguously signed bit-field members
      * missing header guards
      
      Change-Id: Id4a881686605d26c94ab5409bc70fcc21efacc25
      bdd785d3
  2. Nov 14, 2019
    • George Joseph's avatar
      stasis: Don't hold app_registry and session locks unnecessarily · 990a91b4
      George Joseph authored
      resource_events:stasis_app_message_handler() was locking the session,
      then attempting to determine if the app had debug enabled which
      locked the app_registry container.  res_stasis:__stasis_app_register
      was locking the app_registry container then calling app_update
      which caused app_handler (which locks the session) to run.
      The result was a deadlock.
      
      * Updated resource_events:stasis_app_message_handler() to determine
        if debug was set (which locks the app_registry) before obtaining the
        session lock.
      
      * Updated res_stasis:__stasis_app_register to release the app_registry
        container lock before calling app_update (which locks the sesison).
      
      ASTERISK-28423
      Reported by Ross Beer
      
      Change-Id: I58c69d08cb372852a63933608e4d6c3e456247b4
      990a91b4
    • Friendly Automation's avatar
  3. Nov 13, 2019
    • Joshua Colp's avatar
      parking: Use channel snapshot instead of channel. · e924c510
      Joshua Colp authored
      There exists a scenario where a thread can hold a lock on the
      channels container while trying to lock a bridge. At the same
      time another thread can hold the lock for said bridge while
      attempting to retrieve a channel. This causes a deadlock.
      
      This change fixes this scenario by retrieving a channel snapshot
      instead of a channel, as information present in the snapshot
      is all that is needed.
      
      ASTERISK-28616
      
      Change-Id: I68ceb1d62c7378addcd286e21be08a660a7cecf2
      e924c510
  4. Nov 12, 2019
    • Kevin Harwell's avatar
      res_pjsip_session: initialize pending's topology to endpoint's · 0e3b3978
      Kevin Harwell authored
      Found during some testing, there is a race condition between selecting an
      appropriate bridge type for a call versus the applying of media on the callee's
      session. In some instances a native bridge type would have been chosen, but
      due to the callee's media not yet being established at bridge compatibility
      check time the simple bridge type is picked instead.
      
      When using chan_pjsip this initiates a topology change event. The topologies
      are then compared for the two sessions. However, when the topology was created
      for the caller its streams are initialized to "inactive". This topology is then
      used as a base when creating the callee's topology, and streams. Soon after
      the caller's topology's stream(s) get updated based on the sdp (get set to
      sendrecv in the failing scenario).
      
      Now when the topology change event is raised, and the two topologies are
      compared, the comparison fails due to a stream state mismatch (sendrecv vs
      inactive). And since they differ a reinvite is sent out (to the caller in
      this case).
      
      This patch makes it such that when the caller's topology is initially created
      it gets created based on its configured endpoint's media topology. When the
      endpoint's topology is created its stream's state(s) are initialized to
      sendrecv instead of inactive. Subsequently, now when the callee's topology is
      created its topology streams are now initialized to sendrecv. Thus when the
      topology change event occurs due to the mentioned scenario the stream states
      match for the given sessions, and the reinvite is not sent unless due to some
      other valid mismatch.
      
      Note, this patch only changes one pending media state's creation point. It's
      possible other places *could* be changed, however for now it was deemed best
      to only alter what's here.
      
      Change-Id: I6ba3a6a75f64824a1b963044c37acbe951c389c7
      0e3b3978
  5. Nov 07, 2019
  6. Oct 31, 2019
  7. Oct 29, 2019
  8. Oct 24, 2019
  9. Oct 21, 2019
  10. Oct 18, 2019
    • Sean Bright's avatar
      utils.h: Set lower bound for thread stack size to PTHREAD_STACK_MIN · a4222614
      Sean Bright authored
      ASTERISK-28590 #close
      
      Change-Id: I51abce00c04d0a06550bda5205580705185b9c1c
      a4222614
    • Joshua Colp's avatar
    • George Joseph's avatar
      ExternalMedia: Change return object from ExternalMedia to Channel · d71d0f94
      George Joseph authored
      When we created the External Media addition to ARI we created an
      ExternalMedia object to be returned from the channels/externalMedia
      REST endpoint.  This object contained the channel object that was
      created plus local_address and local_port attributes (which are
      also in the Channel variables).  At the time, we thought that
      creating an ExternalMedia object would give us more flexibility
      in the future but as we created the sample speech to text
      application, we discovered that it doesn't work so well with ARI
      client libraries that a) don't have the ExternalMedia object
      defined and/or b) can't promote the embedded channel structure
      to a first-class Channel object.
      
      This change causes the channels/externalMedia REST endpoint to
      return a Channel object (like channels/create and channels/originate)
      instead of the ExternalMedia object.
      
      Change-Id: If280094debd35102cf21e0a31a5e0846fec14af9
      d71d0f94
    • Salah Ahmed's avatar
      Crash during "pjsip show channelstats" execution · ddb0091d
      Salah Ahmed authored
      During execution "pjsip show channelstats" cli command by an
      external module asterisk crashed. It seems this is a separate
      thread running to fetch and print rtp stats. The crash happened on
      the ao2_lock method, just before it going to read the rtp stats on
      a rtp instance. According to gdb backtrace log, it seems the
      session media was already cleaned up at that moment.
      
      ASTERISK-28578
      
      Change-Id: I3e05980dd4694577be6d39be2c21a5736bae3c6f
      ddb0091d
  11. Oct 17, 2019
  12. Oct 16, 2019
  13. Oct 14, 2019
  14. Oct 11, 2019
  15. Oct 10, 2019
  16. Oct 09, 2019
    • Kevin Harwell's avatar
      pbx: deadlock when outgoing dialed channel hangs up too quickly · bf6f2738
      Kevin Harwell authored
      Here's the basic scenario that occurred when executing an AMI fast originate
      while at the same time something else locks the channels container, and also
      wants a lock on the dialed channel:
      
      1. pbx_outgoing_attempt obtains a lock on a dialed channel
      2. concurrently another thread obtains a lock on the channels container, and
         subsequently requests a lock on the dialed channel. It waits on #1. For
         instance, "core show channel <dialed channel"
      3. the outgoing call does not fail, but ends before the pbx_outgoing_attempt
         function exits
      4. pbx_outgoing_attempt function exits, the outgoing structure destructs, and
         attempts to hang up the dialed channel
      5. hang up tries to obtain the channels container lock, but can't due to #2.
      6. Asterisk is deadlocked.
      
      The solution was to allow the pbx_outgoing_exec function to "steal" ownership
      of the dialed channel, and handle hanging it up. The channel now is either hung
      up prior to it being potentially locked by the initiating thread, or if locked
      the hang up takes place in a different thread, thus alleviating the deadlock.
      
      ASTERISK-28561
      patches:
        iliketrains.diff submitted by Joshua Colp (license 5000)
      
      Change-Id: I51b42b92dde8f2215b69bb509e28667ee3a3853a
      bf6f2738
  17. Oct 08, 2019
  18. Oct 07, 2019
    • Kevin Harwell's avatar
      res_pjsip_mwi: use an ao2_global object for mwi containers · 12dbeb69
      Kevin Harwell authored
      On shutdown it's possible for the unsolicited mwi container to be freed before
      other dependent threads are done using it. This patch ensures this can no
      longer happen by wrapping the container in an ao2_global object. The solicited
      container was also changed too.
      
      ASTERISK-28552
      
      Change-Id: I8f812286dc19a34916acacd71ce2ec26e1042047
      12dbeb69
Loading