Skip to content
Snippets Groups Projects
  1. Jan 02, 2020
    • Jean Aunis's avatar
      ARI: Ability to inhibit COLP frames when adding channels to a bridge · 034ac357
      Jean Aunis authored
      This patch adds a new flag "inhibitConnectedLineUpdates" to the 'addChannel'
      operation in the Bridges REST API. When set, this flag avoids generating COLP
      frames when the specified channels enter the bridge.
      
      ASTERISK-28629
      
      Change-Id: Ib995d4f0c6106279aa448b34b042b68f0f2ca5dc
      034ac357
  2. Nov 19, 2019
  3. Nov 18, 2019
    • Joshua Colp's avatar
      res_rtp_asterisk: Always return provided DTLS packet length. · 02129ad4
      Joshua Colp authored
      OpenSSL can not tolerate if the packet sent out does not
      match the length that it provided to the sender. This change
      lies and says that each time the full packet was sent. If
      a problem does occur then a retransmission will occur as
      appropriate.
      
      ASTERISK-28576
      
      Change-Id: Id42455b15c9dc4eb987c8c023ece6fbf3c22a449
      02129ad4
    • 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
  4. Nov 15, 2019
  5. 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
  6. 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
  7. 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
  8. Oct 31, 2019
  9. Oct 24, 2019
  10. Oct 18, 2019
    • 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
  11. Oct 17, 2019
  12. Oct 14, 2019
    • Christoph Moench-Tegeder's avatar
      cdr_pgsql cel_pgsql res_config_pgsql: compatibility with PostgreSQL 12 · 52ade184
      Christoph Moench-Tegeder authored
      PostgreSQL 12 finally removed column adsrc from table pg_catalog.pg_attrdef
      (column default values), which has been deprecated since version 8.0.
      Since then, the official/correct/supported way to retrieve the column
      default value from the catalog is function pg_catalog.pg_get_expr().
      
      This change breaks compatibility with pre-8.0 PostgreSQL servers,
      but has reached end-of-support more than a decade ago.
      cdr_pgsql and res_config_pgsql still have support for pre-7.3
      servers, but cleaning that up is perhaps a topic for a major release,
      not this bugfix.
      
      ASTERISK-28571
      
      Change-Id: I834cb3addf1937e19e87ede140bdd16cea531ebe
      52ade184
  13. Oct 10, 2019
    • Kevin Harwell's avatar
      res_pjsip_mwi: potential double unref, and potential unwanted double link · 5dae803e
      Kevin Harwell authored
      When creating an unsolicited MWI aggregate subscription it was possible for
      the subscription object to be double unref'ed. This patch removes the explicit
      unref as it is not needed since the RAII_VAR will handle it at function end.
      
      Less concerning there was also a bug that could potentially allow the aggregate
      subscription object to be added to the unsolicited container twice. This patch
      ensures it is added only once.
      
      ASTERISK-28575
      
      Change-Id: I9ccfdb5ea788bc0c3618db183aae235e53c12763
      5dae803e
  14. 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
    • Kevin Harwell's avatar
      res_pjsip/res_pjsip_mwi: use centralized serializer pools · 2970a13f
      Kevin Harwell authored
      Both res_pjsip and res_pjsip_mwi made use of serializer pools. However, they
      both implemented their own serializer pool functionality that was pretty much
      identical in each of the source files. This patch removes the duplicated code,
      and uses the new 'ast_serializer_pool' object instead.
      
      Additionally res_pjsip_mwi enables a shutdown group on the pool since if the
      timing was right the module could be unloaded while taskprocessor threads still
      needed to execute, thus causing a crash.
      
      Change-Id: I959b0805ad024585bbb6276593118be34fbf6e1d
      2970a13f
  15. Oct 01, 2019
  16. Sep 27, 2019
  17. Sep 25, 2019
    • Sean Bright's avatar
      res_musiconhold: Add new 'playlist' mode · 966488ab
      Sean Bright authored
      Allow the list of files to be played to be provided explicitly in the
      music class's configuration. The primary driver for this change is to
      allow URLs to be used for MoH.
      
      Change-Id: I9f43b80b43880980b18b2bee26ec09429d0b92fa
      966488ab
    • Sean Bright's avatar
      res_pjsip_registrar: Validate Contact URI before adding to responses · 982a5025
      Sean Bright authored
      If a permanent contact URI associated with an AOR is invalid, we add a
      Contact header to REGISTER responses with a NULL URI, causing a crash.
      
      ASTERISK-28463 #close
      
      Change-Id: Id2b643e58b975bc560aab1c111e6669d54db9102
      982a5025
  18. Sep 24, 2019
    • Kevin Harwell's avatar
      res_pjsip_pubsub: change warning to debug · 67ba62f4
      Kevin Harwell authored
      The following message:
      
      "Subscription request from endpoint <blah> rejected. Expiration of 0 is invalid"
      
      Would sometimes spam the log with warnings if Asterisk restarted and a bunch
      of clients sent unsubscribes. This patch changes it from a warning to a debug
      message.
      
      Change-Id: I841ec42f65559f3135e037df0e55f89b6447a467
      67ba62f4
  19. Sep 23, 2019
    • Kevin Harwell's avatar
      res_sorcery_memory_cache: stale item update leak · a4caaef6
      Kevin Harwell authored
      When a stale item was being updated the object was being retrieved, but its
      reference was not being decremented after the update. This patch makes it so
      the object is now appropriately de-referenced.
      
      ASTERISK-28523
      
      Change-Id: I9d8173d3a0416a242f4eba92fa0853279c500ec7
      a4caaef6
  20. Sep 18, 2019
    • Joshua Colp's avatar
      func_jitterbuffer: Add audio/video sync support. · 7298a785
      Joshua Colp authored
      This change adds support to the JITTERBUFFER dialplan function
      for audio and video synchronization. When enabled the RTCP SR
      report is used to produce an NTP timestamp for both the audio and
      video streams. Using this information the video frames are queued
      until their NTP timestamp is equal to or behind the NTP timestamp
      of the audio. The audio jitterbuffer acts as the leader deciding
      when to shrink/grow the jitterbuffer when adaptive is in use. For
      both adaptive and fixed the video buffer follows the size of the
      audio jitterbuffer.
      
      ASTERISK-28533
      
      Change-Id: I3fd75160426465e6d46bb2e198c07b9d314a4492
      7298a785
  21. Sep 13, 2019
    • Ben Ford's avatar
      res_rtp_asterisk.c: Send RTCP as compound packets. · 723b695c
      Ben Ford authored
      According to RFC3550, ALL RTCP packets must be sent in a compond packet
      of at least two individual packets, including SR/RR and SDES. REMB,
      FIR, and NACK were not following this format, and as a result, would
      fail the packet check in ast_rtcp_interpret. This was found from writing
      unit tests for RTCP. The browser would accept the way we were
      constructing these RTCP packets, but when sending directly from one
      Asterisk instance to another, the above mentioned problem would occur.
      
      Change-Id: Ieb140e9c22568a251a564cd953dd22cd33244605
      723b695c
  22. Sep 12, 2019
    • Sean Bright's avatar
      channels: Allow updating variable value · 32ce6e9a
      Sean Bright authored
      When modifying an already defined variable in some channel drivers they
      add a new variable with the same name to the list, but that value is
      never used, only the first one found.
      
      Introduce ast_variable_list_replace() and use it where appropriate.
      
      ASTERISK-23756 #close
      Patches:
        setvar-multiplie.patch submitted by Michael Goryainov
      
      Change-Id: Ie1897a96c82b8945e752733612ee963686f32839
      32ce6e9a
  23. Sep 10, 2019
    • sungtae kim's avatar
      res_musiconhold: Added unregister realtime moh class · cf364cd0
      sungtae kim authored
      This fix allows a realtime moh class to be unregistered from the command
      line. This is useful when the contents of a directory referenced by a
      realtime moh class have changed.
      The realtime moh class is then reloaded on the next request and uses the
      new directory contents.
      
      ASTERISK-17808
      
      Change-Id: Ibc4c6834592257c4bb90601ee299682d15befbce
      cf364cd0
    • Ben Ford's avatar
      res_rtp: Add unit tests for RTCP stats. · 0e56643d
      Ben Ford authored
      Added unit tests for RTCP video stats. These tests include NACK, REMB,
      FIR/FUR/PLI, SR/RR/SDES, and packet loss statistics. The REMB and FIR
      tests are currently disabled due to a bug. We expect to receive a
      compound packet, but the code sends this out as a single packet, which
      the browser accepts, but makes Asterisk upset.
      
      While writing these tests, I noticed an issue with NACK as well. Where
      it is handling a received NACK request, it was reading in only the first
      8 bits of following packets that were also lost. This has been changed
      to the correct value of 16 bits.
      
      Also made a minor fix to the data buffer unit test.
      
      Change-Id: I56107c7411003a247589bbb6086d25c54719901b
      0e56643d
    • George Joseph's avatar
      ARI: External Media · 2ae1a22e
      George Joseph authored
      The Channel resource has a new sub-resource "externalMedia".
      This allows an application to create a channel for the sole purpose
      of exchanging media with an external server.  Once created, this
      channel could be placed into a bridge with existing channels to
      allow the external server to inject audio into the bridge or
      receive audio from the bridge.
      See https://wiki.asterisk.org/wiki/display/AST/External+Media+and+ARI
      for more information.
      
      Change-Id: I9618899198880b4c650354581b50c0401b58bc46
      2ae1a22e
  24. Sep 05, 2019
    • Kevin Harwell's avatar
      AST-2019-004 - res_pjsip_t38.c: Add NULL checks before using session media · 18f5f5fc
      Kevin Harwell authored
      After receiving a 200 OK with a declined stream in response to a T.38
      initiated re-invite Asterisk would crash when attempting to dereference
      a NULL session media object.
      
      This patch checks to make sure the session media object is not NULL before
      attempting to use it.
      
      ASTERISK-28495
      patches:
        ast-2019-004.patch submitted by Alexei Gradinari (license 5691)
      
      Change-Id: I168f45f4da29cfe739acf87e597baa2aae7aa572
      18f5f5fc
  25. Aug 28, 2019
    • Kevin Harwell's avatar
      res_pjsip_mwi: add better handling of solicited vs unsolicited subscriptions · 172e183b
      Kevin Harwell authored
      res_pjsip_mwi allows both solicited and unsolicited MWI subscription types.
      While both can be set in the configuration for a given endpoint/aor, only
      one is allowed. Precedence is given to unsolicited. Meaning if an endpoint/aor
      is configured to allow both types then the solicited subscription is rejected
      when it comes in. However, there is a configuration option to override that
      behavior:
      
      mwi_subscribe_replaces_unsolicited
      
      When set to "yes" then when a solicited subscription comes in instead of
      rejecting it Asterisk is suppose to replace the unsolicited one if it exists.
      Prior to this patch there was a bug in Asterisk that allowed the solicted one
      to be added, but did not remove the unsolicited. As a matter of fact a new
      unsolicited subscription got added everytime a SIP register was received.
      Over time this eventually could "flood" a phone with SIP notifies.
      
      This patch fixes that behavior to now make it work as expected. If configured
      to do so a solicited subscription now properly replaces the unsolicited one.
      As well when an unsubscribe is received the unsolicited subscription is
      restored. Logic was also put in to handle reloads, and any configuration changes
      that might result from that. For instance, if a solicited subscription had
      previously replaced an unsolicited one, but after reload it was configured to
      not allow that then the solicited one needs to be shutdown, and the unsolicited
      one added.
      
      ASTERISK-28488
      
      Change-Id: Iec2ec12d9431097e97ed5f37119963aee41af7b1
      172e183b
  26. Aug 23, 2019
  27. Aug 20, 2019
    • George Joseph's avatar
      res_ari.c: Prefer exact handler match over wildcard · 8da4e28a
      George Joseph authored
      Given the following request path and 2 handler paths...
      Request: /channels/externalMedia
      Handler: /channels/{channelId}      "wildcard"
      Handler: /channels/externalmedia    "non-wildcard"
      
      ...if /channels/externalMedia was registered as a handler after
      /channels/{channelId} as shown above, the request would automatically
      match the wildcard handler and attempt to parse "externalMedia" into
      the channelId variable which isn't what was intended.  It'd work
      if the non-wildard entry was defined in rest-api/api-docs/channels.json
      before the wildcard entry but that makes the json files
      order-dependent which isn't a good thing.
      
      To combat this issue, the search loop saves any wildcard match but
      continues looking for exact matches at the same level.  If it finds
      one, it's used.  If it hasn't found an exact match at the end of
      the current level, the wildcard is used.  Regardless, after
      searching the current level, the wildcard is cleared so it won't
      accidentally match for a different object or a higher level.
      
      BTW, it's currently not possible for more than 1 wildcard entry
      to be defined for a level.  For instance, there couldn't be:
      Handler: /channels/{channelId}
      Handler: /channels/{channelName}
      We wouldn't know which one to match.
      
      Change-Id: I574aa3cbe4249c92c30f74b9b40e750e9002f925
      8da4e28a
    • Stas Kobzar's avatar
      res_pjsip: Channel variable SIPFROMDOMAIN · c7270dca
      Stas Kobzar authored
      In chan_sip, there was variable SIPFROMDOMAIN that allows to set
      From header URI domain per channel. This patch introduces res_pjsip
      variable SIPFROMDOMAIN for backward compatibility with chan_sip.
      
      ASTERISK-28489
      
      Change-Id: I715133e43172ce2a1e82093538dc39f9e99e5f2e
      c7270dca
  28. Aug 08, 2019
    • Kevin Harwell's avatar
      srtp: Fix possible race condition, and add NULL checks · b805e123
      Kevin Harwell authored
      Somehow it's possible for the srtp session object to be NULL even though the
      Asterisk srtp object itself is valid. When this happened it would cause a
      crash down in the srtp code when attempting to protect or unprotect data.
      
      After looking at the code there is at least one spot that makes this situation
      possible. If Asterisk fails to unprotect the data, and after several retries
      it still can't then the srtp->session gets freed, and set to NULL while still
      leaving the Asterisk srtp object around. However, according to the original
      issue reporter this does not appear to be their situation since they found
      no errors logged stating the above happened (which Asterisk does for that
      situation).
      
      An issue was found however, where a possible race condition could occur between
      the pjsip incoming negotiation, and the receiving of RTP packets. Both places
      could attempt to create/setup srtp for the same rtp instance at the same time.
      This potentially could be the cause of the problem as well.
      
      Given the above this patch adds locking around srtp setup for a given rtp, or
      rtcp instance. NULL checks for the session have also been added within the
      protect and unprotect functions as a precaution. These checks should at least
      stop Asterisk from crashing if it gets in this situation again.
      
      This patch also fixes one other issue noticed during investigation. When doing
      a replace the old object was freed before creating the replacement. If the new
      replacement object failed to create then the rtp/rtcp instance would now point
      to freed srtp data which could potentially cause a crash as well when the next
      attempt to reference it was made. This is now fixed so the old srtp object is
      kept upon replacement failure.
      
      Lastly, more logging has been added to help diagnose future issues.
      
      ASTERISK-28472
      
      Change-Id: I240e11cbb1e9ea8083d59d50db069891228fe5cc
      b805e123
  29. Aug 01, 2019
  30. Jul 29, 2019
  31. Jul 24, 2019
Loading