Skip to content
Snippets Groups Projects
  1. Nov 08, 2017
    • Richard Mudgett's avatar
      AST-2017-010: Fix cdr_object_update_party_b_userfield_cb() buf overrun · b358e441
      Richard Mudgett authored
      cdr_object_update_party_b_userfield_cb() could overrun the fixed buffer if
      the supplied string is too long.  The long string could be supplied by
      external means using the CDR(userfield) function.
      
      This may seem reminiscent to AST-2017-001 (ASTERISK_26897) and it is.  The
      earlier patch fixed the buffer overrun for Party A's userfield while this
      patch fixes the same thing for Party B's userfield.
      
      ASTERISK-27337
      
      Change-Id: I0fa767f65ecec7e676ca465306ff9e0edbf3b652
      b358e441
  2. Oct 16, 2017
    • Richard Mudgett's avatar
      cdr.c: Rename the Party A CDR container. · 73164d0d
      Richard Mudgett authored
      * Rename the Party A CDR container from active_cdrs_by_channel to
      active_cdrs_master.
      
      * Renamed the support functions associated with active_cdrs_master
      appropriately.
      
      ASTERISK-27335
      
      Change-Id: I6104bb3edc3a0b7243ce502e45e8832b0cff14f7
      73164d0d
    • Richard Mudgett's avatar
      cdr.c: Add container to key off of Party B channel names. · fe1120cf
      Richard Mudgett authored
      The CDR performance gets worse the further it gets behind in processing
      stasis messages.  One of the reasons is because of a n*m loop used when
      processing Party B information.
      
      * Added a new CDR container that is keyed to Party B so we don't need such
      a large loop when processing Party B information.
      
      NOTE: To reduce the size of the patch I deferred to another patch the
      renaming of the Party A active_cdrs_by_channel container to
      active_cdrs_master and renaming the container's hash and cmp functions
      appropriately.
      
      ASTERISK-27335
      
      Change-Id: I0bf66e8868f8adaa4b5dcf9e682e34951c350249
      fe1120cf
  3. Oct 13, 2017
    • Richard Mudgett's avatar
      cdr.c: Eliminated many calls to ao2_global_obj_ref(). · f369be21
      Richard Mudgett authored
      The CDR performance gets worse the further it gets behind in processing
      stasis messages.  One of the reasons is we were getting the global config
      to determine if we needed to log a debugging message.
      
      * Many calls to ao2_global_obj_ref() were just so we could determine if
      debug mode is enabled.  Made a global flag to check instead.
      
      * Eliminated many RAII_VAR() usages associated with the remaining
      ao2_global_obj_ref() calls.
      
      * Added missing NULL checks for the returned ao2_global_obj_ref() value.
      
      ASTERISK-27335
      
      Change-Id: Iceaad93172862f610cad0188956634187bfcc7cd
      f369be21
    • Richard Mudgett's avatar
      cdr.c: Defer getting ao2_global_obj_ref() until needed. · 2eea0874
      Richard Mudgett authored
      The CDR performance gets worse the further it gets behind in processing
      stasis messages.  One of the reasons is we were getting the global config
      even if we didn't need it.
      
      * Most uses of the global config were only needed on off nominal code
      paths so it makes sense to not get it until absolutely needed.
      
      ASTERISK-27335
      
      Change-Id: I00c63b7ec233e5bfffd5d976f05568613d3c2365
      2eea0874
    • Richard Mudgett's avatar
      cdr.c: Set stringfields only if they are different. · 7c7a9178
      Richard Mudgett authored
      The CDR performance gets worse the further it gets behind in processing
      stasis messages.  One of the reasons is we were repeatedly setting string
      fields to potentially the same string in base_process_party_a().  Setting
      a string field involves allocating room for the new string out of a memory
      pool which may have to allocate even more memory.
      
      * Check to see if the string field is already set to the desired string.
      
      ASTERISK-27335
      
      Change-Id: I3ccb7e23f1488417e08cafe477755033eed65a7c
      7c7a9178
    • Richard Mudgett's avatar
      cdr.c: Fix setting dnid, callingsubaddr, and calledsubaddr · c80c8f2a
      Richard Mudgett authored
      The string comparisons for setting these CDR variables was inverted.  We
      were repeatedly setting these CDR variables only if the channel snapshots
      had the same value.
      
      ASTERISK-27335
      
      Change-Id: I9482073524411e7ea6c03805b16de200cb1669ea
      c80c8f2a
  4. Oct 11, 2017
    • Richard Mudgett's avatar
      cdr.c: Defer misc checks. · e5b9eb04
      Richard Mudgett authored
      Try to defer some checks until needed in case there is an early exit.
      
      Change-Id: Ibc6b34c38a4f60ad4f9b67984b7d070a07257064
      e5b9eb04
  5. Oct 10, 2017
  6. Oct 09, 2017
  7. 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
  8. Apr 04, 2017
    • Corey Farrell's avatar
      CDR: Protect from data overflow in ast_cdr_setuserfield. · 380973cc
      Corey Farrell authored
      ast_cdr_setuserfield wrote to a fixed length field using strcpy. This could
      result in a buffer overrun when called from chan_sip or func_cdr. This patch
      adds a maximum bytes written to the field by using ast_copy_string instead.
      
      ASTERISK-26897 #close
      patches:
        0001-CDR-Protect-from-data-overflow-in-ast_cdr_setuserfie.patch submitted
          by Corey Farrell (license #5909)
      
      Change-Id: Ib23ca77e9b9e2803a450e1206af45df2d2fdf65c
      380973cc
  9. Mar 22, 2017
  10. 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
  11. Oct 18, 2016
    • Mark Michelson's avatar
      CDR: Alter destruction pattern for CDR chains. · f14ef51e
      Mark Michelson authored
      CDRs form chains. When the root of the chain is destroyed, it then
      unreferences the next CDR in the chain. That CDR is destroyed, and it
      then unreferences the next CDR in the chain. This repeats until the end
      of the chain is reached. While this typically does not cause any sort of
      problems, it is possible in strange scenarios for the CDR chain to grow
      way longer than expected. In such a scenario, the destruction pattern
      can result in a stack overflow.
      
      This patch fixes the problem by switching from a recursive pattern to an
      iterative pattern for destruction. When the root CDR is destroyed, it is
      responsible for iterating over the rest of the CDRs and unreferencing
      each one. Other CDRs in the chain, since they are not the root, will
      simply destroy themselves and be done. This causes the stack depth not
      to increase.
      
      ASTERISK-26421 #close
      Reported by Andrew Nagy
      
      Change-Id: I3ca90c2b8051f3b7ead2e0e43f60d2c18fb204b8
      f14ef51e
  12. Jul 12, 2016
    • George Joseph's avatar
      rest_api/channels: Fix multiple issues with create and dial · 886f2cab
      George Joseph authored
      * We weren't properly subscribing to the channel and it's originator
        on create.
      * We weren't doing a publish_dial after calling ast_call on dial.
      * We weren't calling depart_bridge when a channel left the dial bridge.
      
      The first 2 issues were causing events to not be generated and the third
      was actually causing channels to not get properly destroyed when hung up.
      
      Together these 3 issues were causing the new
      rest_apichannels/create_dial_bridge tests to fail.
      
      As a result of the fixes, the cdr state machine had to be slightly
      tweaked to allow bridge leave events without asserting and the tests
      themselves had to be updated to account for the channels now cleaning
      themselves up.
      
      Change-Id: Ibf23abf5a62de76e82afb4461af5099c961b97d8
      886f2cab
  13. Jun 09, 2016
    • George Joseph's avatar
      cdr.c: Remove assert in base_process_dial_end · f0855358
      George Joseph authored
      Scenario: Caller blonde transfer
      Bob calls Charlie who answers.
      Bob puts Charlie on hold and calls Alice.
      Before Alice answers, Bob transfers Charlie to Alice.
      
      Charlie's channel triggers an assert because he gets an "ANSWERED"
      event even though he never dialed anything. With recent changes to dial
      events, this is now a valid scenario so the assert needed to be removed.
      
      ASTERISK-26103 #close
      
      Change-Id: I2679b517b696e7952ab7fb29403df9140e7d1de2
      f0855358
    • Richard Mudgett's avatar
      stasis: Add setting subscription congestion levels. · dcfef53e
      Richard Mudgett authored
      Stasis subscriptions and message routers create taskprocessors to process
      the event messages.  API calls are needed to be able to set the congestion
      levels of these taskprocessors for selected subscriptions and message
      routers.
      
      * Updated CDR, CEL, and manager's stasis subscription congestion levels
      based upon stress testing.  Increased the congestion levels to reduce the
      potential for bursty call setup/teardown activity from triggering the
      taskprocessor overload alert.  CDRs in particular need an extra high
      congestion level because they can take awhile to process the stasis
      messages.
      
      ASTERISK-26088
      Reported by:  Richard Mudgett
      
      Change-Id: Id0a716394b4eee746dd158acc63d703902450244
      dcfef53e
  14. May 31, 2016
    • Mark Michelson's avatar
      Expand the scope of Dial Events · 205a31f8
      Mark Michelson authored
      Dial events up to this point have come in two flavors
      * A Dial event with no status to indicate that dialing has begun
      * A Dial event with a status to indicate that dialing has ended
      
      With this change, Dial events have been expanded to also give
      intermediate events, such as "RINGING", "PROCEEDING", and "PROGRESS".
      This is especially useful for ARI dialing, as it gives the application
      writer the opportunity to place a channel into an early bridge when
      early media is detected.
      
      AMI handles these in-progress dial events by sending a new event called
      "DialState" that simply indicates that dial state has changed but has
      not ended. ARI never distinguished between DialBegin and DialEnd, so no
      change was made to the event itself.
      
      Another change here relates to dial forwards. A forward-related event
      was previously only sent when a channel was successfully able to forward
      a call to a new channel. With this set of changes, if forwarding is
      blocked, we send a Dial event with a forwarding destination but no
      forwarding channel, since we were prevented from creating one. This is
      again useful for ARI since application writers can now handle call
      forward attempts from within their own application.
      
      ASTERISK-25925 #close
      Reported by Mark Michelson
      
      Change-Id: I42cbec7730d84640a434d143a0d172a740995543
      205a31f8
  15. Jan 02, 2016
    • Matt Jordan's avatar
      main/cdr: Allow setting properties on a finalized CDR if it is the last one · e9dd1636
      Matt Jordan authored
      Prior to this patch, we explicitly disallowed setting any properties on a
      finalized CDR. This seemed like a good idea at the time; in practice, it was
      more restrictive.
      
      There are weird and strange scenarios where setting a property on a finalized
      CDR is definitely wrong. For example, we may Fork a CDR, finalizing the
      previous one, then change a property. In said case, the old CDR is supposed
      to now be 'immutable' (so to speak), and should not be updated. From the
      perspective of the code, a forked CDR that is finalized is just finalized.
      Hence why we decided these should not be updated.
      
      In practice, it is much more common to want to set a property on a CDR in
      the h extension or in a hangup handler. Disallowing a common scenario to make
      an esoteric behaviour work isn't good. This patch fixes this by allowing
      callers to set a property IF we are the last CDR in the chain. This preserves
      the finalized CDR if it was forked, while allowing the more common case to
      function.
      
      ASTERISK-25458 #close
      
      Change-Id: Icf3553c607b9f561152a41e6d8381d594ccdf4b9
      e9dd1636
    • Matt Jordan's avatar
      main/cdr: Set the end time on a CDR if endbeforehexten is Yes · 153547a9
      Matt Jordan authored
      Prior to this patch, the CDR engine attempted to set the end time on a CDR
      that was executing hangup logic and with endbeforehexten set to Yes by
      calling a function that inspects the properties on the Party A snapshot to
      determine if we are ready to set the end time. That always failed. This is
      because a Party A snapshot is not updated for CDRs that are executing hangup
      logic with endbeforehexten=Yes.
      
      Instead of calling a function that looks at the Party A snapshot, we just
      simply set the end time on the CDR. This is safe to call multiple times, and is
      safe to call at this point as we know that (a) we are executing hangup logic,
      and (b) we are supposed to set the end time at this point.
      
      ASTERISK-25458
      
      Change-Id: I0c27b493861f9c13c43addbbb21257f79047a3b3
      153547a9
  16. Oct 20, 2015
    • Jonh Wendell's avatar
      main/cdr: Allow modules to modify CDR fields before dispatching them · 77780790
      Jonh Wendell authored
      This patch adds the functions
      
      	ast_cdr_modifier_register()
      	ast_cdr_modifier_unregister()
      
      That work much like ast_cdr_register() and ast_cdr_unregister().
      
      Modules registered will be given a chance to modify (or to do whatever
      they want) CDR fields just before they are passed to registered engines.
      
      Thus, for instance, if a module change the "userfield" field of a CDR,
      the modified value will be passed to every registered CDR backend for
      logging.
      
      ASTERISK-25479 #close
      
      Change-Id: If11d8fd19ef89b1a66ecacf1201e10fcf86ccd56
      77780790
  17. Jun 15, 2015
    • mjordan's avatar
      main/cdr: Carry over the disable flag when 'disable all' is specified · 15c22087
      mjordan authored
      The CDR_PROP function (as well as the NoCDR application) set the
      'disable all' flag (AST_CDR_FLAG_DISABLE_ALL) on the current CDR. This
      flag is supposed to be applied to all CDRs that are currently in the
      chain, as well as all CDRs that may be created in the future. Currently,
      however, the flag is only applied to the existing CDRs in the chain; new
      CDRs do not receive the 'disable all' flag. In particular, this affects
      parallel dials, which generate new CDRs for each pair of channels in
      the dial attempt.
      
      This patch carries over the 'disable all' flag when it is specified on a
      CDR and a new CDR is generated for the chain.
      
      ASTERISK-24344 #close
      
      Change-Id: I91a0f0031e4d147bdf8a68ecd08304d506fb6a0e
      15c22087
  18. Jun 13, 2015
    • Matt Jordan's avatar
      main/cdr: Copy context/exten on chained CDRs for parallel dials in subroutines · b8bc1528
      Matt Jordan authored
      When a parallel dial occurs, a new CDR will be created for each dial
      attempt that is made. In most circumstances, the act of creating each
      CDR in the chain will include a step that updates the Party A snapshot,
      which causes the context/extension of the Party A to be copied onto the
      CDR object.
      
      However, when the Party A is in a subroutine, we explicitly do *not*
      copy the context/extension onto the CDR. This prevents the Macro or
      GoSub routine name from blowing away the context/extension that the
      channel was originally executing in. For the original CDR, this is not a
      problem: the original CDR already recorded the last known 'good' state
      of the channel just prior to it going into the subroutine. However, for
      newly generated CDRs in a chain, there is no context/extension set on
      them. Since we are in a subroutine, we will never set the Party A's
      context/extension on the CDR, and we end up with a CDR with no
      destination recorded on it.
      
      This patch updates the creation of a chained CDR such that it copies
      over the original CDR's context/extension. This is the last known "good"
      state of the CDR, and is a reasonable starting point for the newly
      generated CDR. In the case where we are not in a subroutine, subsequent
      code will update the location of the CDR from the Party A information;
      in the case where we are in a subroutine, the context/extension on the
      original CDR is the correct information.
      
      ASTERISK-24443 #close
      
      Change-Id: I6a3ef0d6e458d3b9b30572feaec70f2964f3bc2a
      b8bc1528
  19. May 15, 2015
    • snuffy's avatar
      cdr: Fix 'core show channel' CDR variable truncation. · e48d2905
      snuffy authored
      When the new Bridging API was implemented, the workspace variable
      changed to a malloc'd string, causing sizeof() to always be 8 (char).
      
      Revert back to stored on stack string for workspace.
      
      ASTERISK-25090 #close
      
      Change-Id: I51e610ae87371df771ce7693a955510efb90f8f7
      e48d2905
  20. 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
  21. Mar 23, 2015
  22. Nov 14, 2014
  23. Oct 16, 2014
  24. Oct 09, 2014
  25. Sep 06, 2014
  26. Sep 05, 2014
    • Matthew Jordan's avatar
      main/cdrs: Preserve context/extension when executing a Macro or GoSub · d42b1169
      Matthew Jordan authored
      The context/extension in a CDR is generally considered the destination of a
      call. When looking at a 2-party call CDR, users will typically be presented
      with the following:
      
      context    exten      channel     dest_channel app  data
      default    1000       SIP/8675309 SIP/1000     Dial SIP/1000,,20
      
      However, if the Dial actually takes place in a Macro, the current behaviour
      in 12 will result in the following CDR:
      
      context    exten      channel     dest_channel app  data
      macro-dial s          SIP/8675309 SIP/1000     Dial SIP/1000,,20
      
      The same is true of a GoSub:
      
      context    exten      channel     dest_channel app  data
      subs       dial_stuff SIP/8675309 SIP/1000     Dial SIP/1000,,20
      
      This generally makes the context/exten fields less than useful.
      
      It isn't hard to preserve these values in the CDR state machine; however, we
      need to have something that informs us when a channel is executing a
      subroutine. Prior to this patch, there isn't anything that does this.
      
      This patch solves this problem by adding a new channel flag,
      AST_FLAG_SUBROUTINE_EXEC. This flag is set on a channel when it executes a
      Macro or a GoSub. The CDR engine looks for this value when updating a Party A
      snapshot; if the flag is present, we don't override the context/exten on the
      main CDR object. In a funny quirk, executing a hangup handler must *not* abide
      by this logic, as the endbeforehexten logic assumes that the user wants to see
      data that occurs in hangup logic, which includes those subroutines. Since
      those execute outside of a typical Dial operation (and will typically have
      their own dedicated CDR anyway), this is unlikely to cause any heartburn.
      
      Review: https://reviewboard.asterisk.org/r/3962/
      
      ASTERISK-24254 #close
      Reported by: tm1000, Tony Lewis
      Tested by: Tony Lewis
      ........
      
      Merged revisions 422718 from http://svn.asterisk.org/svn/asterisk/branches/12
      ........
      
      Merged revisions 422719 from http://svn.asterisk.org/svn/asterisk/branches/13
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422720 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      d42b1169
    • Matthew Jordan's avatar
      main/cdr: Fix crash/memory consumption in CDRs in multi-party bridge scenarios · 4499eb05
      Matthew Jordan authored
      This patch fixes an issue where CDRs would get stuck generating an infinite
      number of CDRs, eventually crashing Asterisk (and consuming a lot of memory
      along the way).
      
      When a channel enters into a multi-party bridge, the CDR engine creates
      mappings of each participant to each other participant, picking the 'A' party
      as it goes. So, if we have four channels in a multi-party bridge (Alice, Bob,
      Charlie, Denise), we would have something like:
      
      Alice => Bob
      Alice => Charlie
      Alice => Denise
      Bob => Charlie
      Bob => Denise
      Charlie => Denise
      
      This works fine when participants enter the bridge a single time.
      
      When a participant leaves a bridge, the CDRs for that channel are transitioned
      to a finalized state.
      
      The bug occurs if Bob rejoins. When the CDR engine creates mappings between the
      channels, it walks through all the participants currently in the bridge, and
      realizes that no one in the bridge can create a CDR with the channel (Bob).
      As such it creates a new CDR for the candidate and appends it to that
      candidate's chain. Unfortunately, on this particular code path, it doesn't
      stop traversing the candidate's chain. Since we just added ourselves to the
      chain, this causes the loop to keep going, constantly adding new CDRs.
      
      This patch makes it so the engine bails when it creates a CDR match in this
      case.
      
      Review: https://reviewboard.asterisk.org/r/3964/
      
      ASTERISK-24241 #close
      Reported by: Deepak Singh Rawat
      Tested by: Deepak Singh Rawat
      
      ASTERISK-24208
      Reported by: Frankie Chin
      ........
      
      Merged revisions 422715 from http://svn.asterisk.org/svn/asterisk/branches/12
      ........
      
      Merged revisions 422716 from http://svn.asterisk.org/svn/asterisk/branches/13
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422717 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      4499eb05
  27. Aug 06, 2014
  28. May 09, 2014
  29. Apr 15, 2014
  30. Mar 18, 2014
Loading