Skip to content
Snippets Groups Projects
  1. Mar 01, 2023
    • George Joseph's avatar
      res_pjsip: Replace invalid UTF-8 sequences in callerid name · ceda5a98
      George Joseph authored
      * Added a new function ast_utf8_replace_invalid_chars() to
        utf8.c that copies a string replacing any invalid UTF-8
        sequences with the Unicode specified U+FFFD replacement
        character.  For example:  "abc\xffdef" becomes "abc\uFFFDdef".
        Any UTF-8 compliant implementation will show that character
        as a � character.
      
      * Updated res_pjsip:set_id_from_hdr() to use
        ast_utf8_replace_invalid_chars and print a warning if any
        invalid sequences were found during the copy.
      
      * Updated stasis_channels:ast_channel_publish_varset to use
        ast_utf8_replace_invalid_chars and print a warning if any
        invalid sequences were found during the copy.
      
      ASTERISK-27830
      
      Change-Id: I4ffbdb19c80bf0efc675d40078a3ca4f85c567d8
      ceda5a98
  2. Feb 28, 2023
  3. Jan 31, 2023
  4. Jan 09, 2023
    • George Joseph's avatar
      res_rtp_asterisk: Asterisk Media Experience Score (MES) · 4710f37e
      George Joseph authored
      -----------------
      
      This commit reinstates MES with some casting fixes to the
      functions in time.h that convert between doubles and timeval
      structures.  The casting issues were causing incorrect
      timestamps to be calculated which caused transcoding from/to
      G722 to produce bad or no audio.
      
      ASTERISK-30391
      
      -----------------
      
      This module has been updated to provide additional
      quality statistics in the form of an Asterisk
      Media Experience Score.  The score is avilable using
      the same mechanisms you'd use to retrieve jitter, loss,
      and rtt statistics.  For more information about the
      score and how to retrieve it, see
      https://wiki.asterisk.org/wiki/display/AST/Media+Experience+Score
      
      * Updated chan_pjsip to set quality channel variables when a
        call ends.
      * Updated channels/pjsip/dialplan_functions.c to add the ability
        to retrieve the MES along with the existing rtcp stats when
        using the CHANNEL dialplan function.
      * Added the ast_debug_rtp_is_allowed and ast_debug_rtcp_is_allowed
        checks for debugging purposes.
      * Added several function to time.h for manipulating time-in-samples
        and times represented as double seconds.
      * Updated rtp_engine.c to pass through the MES when stats are
        requested.  Also debug output that dumps the stats when an
        rtp instance is destroyed.
      * Updated res_rtp_asterisk.c to implement the calculation of the
        MES.  In the process, also had to update the calculation of
        jitter.  Many debugging statements were also changed to be
        more informative.
      * Added a unit test for internal testing.  The test should not be
        run during normal operation and is disabled by default.
      
      Change-Id: I4fce265965e68c3fdfeca55e614371ee69c65038
      4710f37e
    • George Joseph's avatar
      Revert "res_rtp_asterisk: Asterisk Media Experience Score (MES)" · 62ca063f
      George Joseph authored
      This reverts commit d454801c.
      
      Reason for revert: Issue when transcoding to/from g722
      
      Change-Id: I09f49e171b1661548657a9ba7a978c29d0b5be86
      62ca063f
  5. Jan 05, 2023
    • Naveen Albert's avatar
      loader: Allow declined modules to be unloaded. · d33bd6d6
      Naveen Albert authored
      Currently, if a module declines to load, dlopen is called
      to register the module but dlclose never gets called.
      Furthermore, loader.c currently doesn't allow dlclose
      to ever get called on the module, since it declined to
      load and the unload function bails early in this case.
      
      This can be problematic if a module is updated, since the
      new module cannot be loaded into memory since we haven't
      closed all references to it. To fix this, we now allow
      modules to be unloaded, even if they never "loaded" in
      Asterisk itself, so that dlclose is called and the module
      can be properly cleaned up, allowing the updated module
      to be loaded from scratch next time.
      
      ASTERISK-30345 #close
      
      Change-Id: Ifc743aadfa85ebe3284e02a63e124dafa64988d5
      d33bd6d6
  6. Jan 04, 2023
    • Naveen Albert's avatar
      manager: Fix appending variables. · 7b8f7428
      Naveen Albert authored
      The if statement here is always false after the for
      loop finishes, so variables are never appended.
      This removes that to properly append to the end
      of the variable list.
      
      ASTERISK-30351 #close
      Reported by: Sebastian Gutierrez
      
      Change-Id: I1b7f8b85a8918f6a814cb933a479d4278cf16199
      7b8f7428
  7. Jan 03, 2023
    • Boris P. Korzun's avatar
      http.c: Fix NULL pointer dereference bug · edc90c96
      Boris P. Korzun authored
      If native HTTP is disabled but HTTPS is enabled and status page enabled
      too, Core/HTTP crashes while loading. 'global_http_server' references
      to NULL, but the status page tries to dereference it.
      
      The patch adds a check for HTTP is enabled.
      
      ASTERISK-30379 #close
      
      Change-Id: I11b02fc920b72aaed9c809fc43210523ccfdc249
      edc90c96
    • George Joseph's avatar
      res_rtp_asterisk: Asterisk Media Experience Score (MES) · d454801c
      George Joseph authored
      This module has been updated to provide additional
      quality statistics in the form of an Asterisk
      Media Experience Score.  The score is avilable using
      the same mechanisms you'd use to retrieve jitter, loss,
      and rtt statistics.  For more information about the
      score and how to retrieve it, see
      https://wiki.asterisk.org/wiki/display/AST/Media+Experience+Score
      
      * Updated chan_pjsip to set quality channel variables when a
        call ends.
      * Updated channels/pjsip/dialplan_functions.c to add the ability
        to retrieve the MES along with the existing rtcp stats when
        using the CHANNEL dialplan function.
      * Added the ast_debug_rtp_is_allowed and ast_debug_rtcp_is_allowed
        checks for debugging purposes.
      * Added several function to time.h for manipulating time-in-samples
        and times represented as double seconds.
      * Updated rtp_engine.c to pass through the MES when stats are
        requested.  Also debug output that dumps the stats when an
        rtp instance is destroyed.
      * Updated res_rtp_asterisk.c to implement the calculation of the
        MES.  In the process, also had to update the calculation of
        jitter.  Many debugging statements were also changed to be
        more informative.
      * Added a unit test for internal testing.  The test should not be
        run during normal operation and is disabled by default.
      
      ASTERISK-30280
      
      Change-Id: I458cb9a311e8e5dc1db769b8babbcf2e093f107a
      d454801c
  8. Dec 22, 2022
    • Naveen Albert's avatar
      pbx_app: Update outdated pbx_exec channel snapshots. · cc8d9b94
      Naveen Albert authored
      pbx_exec makes a channel snapshot before executing applications.
      This doesn't cause an issue during normal dialplan execution
      where pbx_exec is called over and over again in succession.
      However, if pbx_exec is called "one off", e.g. using
      ast_pbx_exec_application, then a channel snapshot never ends
      up getting made after the executed application returns, and
      inaccurate snapshot information will linger for a while, causing
      "core show channels", etc. to show erroneous info.
      
      This is fixed by manually making a channel snapshot at the end
      of ast_pbx_exec_application, since we anticipate that pbx_exec
      might not get called again immediately.
      
      ASTERISK-30367 #close
      
      Change-Id: I2a5131053aa9d11badbc0ef2ef40b1f83d0af086
      cc8d9b94
  9. Dec 20, 2022
    • Peter Fern's avatar
      streams: Ensure that stream is closed in ast_stream_and_wait on error · 58404b5c
      Peter Fern authored
      When ast_stream_and_wait returns an error (for example, when attempting
      to stream to a channel after hangup) the stream is not closed, and
      callers typically do not check the return code. This results in leaking
      file descriptors, leading to resource exhaustion.
      
      This change ensures that the stream is closed in case of error.
      
      ASTERISK-30198 #close
      Reported-by: Julien Alie
      
      Change-Id: Ie46b67314590ad75154595a3d34d461060b2e803
      58404b5c
  10. Dec 09, 2022
  11. Dec 08, 2022
    • Naveen Albert's avatar
      xmldoc: Allow XML docs to be reloaded. · 52c7d3ed
      Naveen Albert authored
      The XML docs are currently only loaded on
      startup with no way to update them during runtime.
      This makes it impossible to load modules that
      use ACO/Sorcery (which require documentation)
      if they are added to the source tree and built while
      Asterisk is running (e.g. external modules).
      
      This adds a CLI command to reload the XML docs
      during runtime so that documentation can be updated
      without a full restart of Asterisk.
      
      ASTERISK-30289 #close
      
      Change-Id: I4f265b0e5517e757c5453a0f241201a5788d3a07
      52c7d3ed
  12. Dec 03, 2022
  13. Nov 29, 2022
    • Naveen Albert's avatar
      pbx_builtins: Allow Answer to return immediately. · c7df5ee7
      Naveen Albert authored
      The Answer application currently waits for up to 500ms
      for media, even if users specify a different timeout.
      
      This adds an option to not wait for media on the channel
      by doing a raw answer instead. The default 500ms threshold
      is also documented.
      
      ASTERISK-30308 #close
      
      Change-Id: Id59cd340c44b8b8b2384c479e17e5123e917cba4
      c7df5ee7
    • Maximilian Fridrich's avatar
      core & res_pjsip: Improve topology change handling. · 60b81eab
      Maximilian Fridrich authored
      This PR contains two relatively separate changes in channel.c and
      res_pjsip_session.c which ensure that topology changes are not ignored
      in cases where they should be handled.
      
      For channel.c:
      
      The function ast_channel_request_stream_topology_change only triggers a
      stream topology request change indication, if the channel's topology
      does not equal the requested topology. However, a channel could be in a
      state where it is currently "negotiating" a new topology but hasn't
      updated it yet, so the topology request change would be lost. Channels
      need to be able to handle such situations internally and stream
      topology requests should therefore always be passed on.
      
      In the case of chan_pjsip for example, it queues a session refresh
      (re-INVITE) if it is currently in the middle of a transaction or has
      pending requests (among other reasons).
      
      Now, ast_channel_request_stream_topology_change always indicates a
      stream topology request change even if the requested topology equals the
      channel's topology.
      
      For res_pjsip_session.c:
      
      The function resolve_refresh_media_states does not process stream state
      changes if the delayed active state differs from the current active
      state. I.e. if the currently active stream state has changed between the
      time the sip session refresh request was queued and the time it is being
      processed, the session refresh is ignored. However, res_pjsip_session
      contains logic that ensures that session refreshes are queued and
      re-queued correctly if a session refresh is currently not possible. So
      this check is not necessary and led to some session refreshes being
      lost.
      
      Now, a session refresh is done even if the delayed active state differs
      from the current active state and it is checked whether the delayed
      pending state differs from the current active - because that means a
      refresh is necessary.
      
      Further, the unit test of resolve_refresh_media_states was adapted to
      reflect the new behavior. I.e. the changes to delayed pending are
      prioritized over the changes to current active because we want to
      preserve the original intention of the pending state.
      
      ASTERISK-30184
      
      Change-Id: Icd0703295271089057717006730b555b9a1d4e5a
      60b81eab
  14. Nov 08, 2022
    • Naveen Albert's avatar
      manager: Update ModuleCheck documentation. · 49cfdbbd
      Naveen Albert authored
      The ModuleCheck XML documentation falsely
      claims that the module's version number is returned.
      This has not been the case since 14, since the version
      number is not available anymore, but the documentation
      was not changed at the time. It is now updated to
      reflect this.
      
      ASTERISK-30285 #close
      
      Change-Id: Idde2d1205a11f2623fa1ddab192faa3dc4081e91
      49cfdbbd
  15. Nov 06, 2022
  16. Oct 31, 2022
    • Naveen Albert's avatar
      tcptls: Prevent crash when freeing OpenSSL errors. · afd86b47
      Naveen Albert authored
      write_openssl_error_to_log has been erroneously
      using ast_free instead of free, which will
      cause a crash when MALLOC_DEBUG is enabled since
      the memory was not allocated by Asterisk's memory
      manager. This changes it to use the actual free
      function directly to avoid this.
      
      ASTERISK-30278 #close
      
      Change-Id: Iac8b6468b718075809c45d8ad16b101af21a474d
      afd86b47
  17. Oct 27, 2022
    • Frederic LE FOLL's avatar
      Dialing API: Cancel a running async thread, may not cancel all calls · 50a44957
      Frederic LE FOLL authored
      race condition: ast_dial_join() may not cancel outgoing call, if
      function is called just after called party answer and before
      application execution (bit is_running_app not yet set).
      
      This fix adds ast_softhangup() calls in addition to existing
      pthread_kill() when is_running_app is not set.
      
      ASTERISK-30258
      
      Change-Id: Idbdd5c15122159661aa8e996a42d5800083131e4
      50a44957
  18. Oct 26, 2022
    • Naveen Albert's avatar
      say: Don't prepend ampersand erroneously. · 407216a0
      Naveen Albert authored
      Some logic in say.c for determining if we need
      to also add an ampersand for file seperation was faulty,
      as non-successful files would increment the count, causing
      a leading ampersand to be added improperly.
      
      This is fixed, and a unit test that captures this regression
      is also added.
      
      ASTERISK-30248 #close
      
      Change-Id: I02c1d3a11d82fe4ea8b462070cbd1effb5834d2b
      407216a0
  19. Oct 11, 2022
    • Mike Bradeen's avatar
      audiohook: add directional awareness · 907d7e7d
      Mike Bradeen authored
      Add enum to allow setting optional direction. If set to only one
      direction, only feed matching-direction frames to the associated
      slin factory.
      
      This prevents mangling the transcoder on non-mixed frames when the
      READ and WRITE frames would have otherwise required it.  Also
      removes the need to mute or discard the un-wanted frames as they
      are no longer added in the first place.
      
      res_stasis_snoop is changed to use this addition to set direction
      on audiohook based on spy direction.
      
      If no direction is set, the ast_audiohook_init will init this enum
      to BOTH which maintains existing functionality.
      
      ASTERISK-30252
      
      Change-Id: If8716bad334562a5d812be4eeb2a92e4f3be28eb
      907d7e7d
  20. Oct 10, 2022
    • Naveen Albert's avatar
      cdr: Allow bridging and dial state changes to be ignored. · b331caca
      Naveen Albert authored
      Allows bridging, parking, and dial messages to be globally
      ignored for all CDRs such that only a single CDR record
      is generated per channel.
      
      This is useful when CDRs should endure for the lifetime of
      an entire channel and bridging and dial updates in the
      dialplan should not result in multiple CDR records being
      created for the call. With the ignore bridging option,
      bridging changes have no impact on the channel's CDRs.
      With the ignore dial state option, multiple Dials and their
      outcomes have no impact on the channel's CDRs. The
      last disposition on the channel is preserved in the CDR,
      so the actual disposition of the call remains available.
      
      These two options can reduce the amount of "CDR hacks" that
      have hitherto been necessary to ensure that CDR was not
      "spoiled" by these messages if that was undesired, such as
      putting a dummy optimization-disabled local channel between
      the caller and the actual call and putting the CDR on the channel
      in the middle to ensure that CDR would persist for the entire
      call and properly record start, answer, and end times.
      Enabling these options is desirable when calls correspond
      to the entire lifetime of channels and the CDR should
      reflect that.
      
      Current default behavior remains unchanged.
      
      ASTERISK-30091 #close
      
      Change-Id: I393981af42732ec5ac3ff9266444abb453b7c832
      b331caca
  21. Sep 26, 2022
    • Naveen Albert's avatar
      db: Fix incorrect DB tree count for AMI. · 7335b0cf
      Naveen Albert authored
      The DBGetTree AMI action's ListItem previously
      always reported 1, regardless of the count. This
      is corrected to report the actual count.
      
      ASTERISK-30245 #close
      patches:
        gettreecount.diff submitted by Birger Harzenetter (license 5870)
      
      Change-Id: I46d8992710f1b8524426b1255f57d1ef4a4934d4
      7335b0cf
    • Naveen Albert's avatar
      features: Add no answer option to Bridge. · a5ec60e6
      Naveen Albert authored
      Adds the n "no answer" option to the Bridge application
      so that answer supervision can not automatically
      be provided when Bridge is executed.
      
      Additionally, a mechanism (dialplan variable)
      is added to prevent bridge targets (typically the
      target of a masquerade) from answering the channel
      when they enter the bridge.
      
      ASTERISK-30223 #close
      
      Change-Id: I76f73fcd8e403bcd18f2abb40c658f537ac1ba6d
      a5ec60e6
    • Philip Prindeville's avatar
      test: initialize capture structure before freeing · 3e7ce90f
      Philip Prindeville authored
      ASTERISK-30232 #close
      
      Change-Id: I2603e2cef8f93f6b0a6ef39f7eac744251bb3902
      3e7ce90f
  22. Sep 22, 2022
    • Jaco Kroon's avatar
      manager: be more aggressive about purging http sessions. · 278c5726
      Jaco Kroon authored
      
      If we find that n_max (currently hard wired to 1) sessions were purged,
      schedule the next purge for 1ms into the future rather than 5000ms (as
      per current).  This way we will purge up to 1000 sessions per second
      rather than 1 every 5 seconds.
      
      This mitigates a build-up of sessions should http sessions gets
      established faster than 1 per 5 seconds.
      
      Change-Id: I9820d39aa080109df44fe98c1325cafae48d54f5
      Signed-off-by: default avatarJaco Kroon <jaco@uls.co.za>
      278c5726
  23. Sep 19, 2022
  24. Sep 13, 2022
    • George Joseph's avatar
      res_geolocation: Fix segfault when there's an empty element · 8cbea1c7
      George Joseph authored
      Fixed a segfault caused by var_list_from_loc_info() encountering
      an empty location info element.
      
      Fixed an issue in ast_strsep() where a value with only whitespace
      wasn't being preserved.
      
      Fixed an issue in ast_variable_list_from_quoted_string() where
      an empty value was considered a failure.
      
      ASTERISK-30215
      Reported by: Dan Cropp
      
      Change-Id: Ieca64e061a6d9298f0196c694b60d986ef82613a
      8cbea1c7
  25. Sep 12, 2022
  26. Sep 11, 2022
    • Naveen Albert's avatar
      lock.c: Add AMI event for deadlocks. · c4874256
      Naveen Albert authored
      Adds an AMI event to indicate that a deadlock
      has likely started, when Asterisk is compiled
      with DETECT_DEADLOCKS enabled. This can make
      it easier to perform automated deadlock detection
      and take appropriate action (such as doing a core
      dump). Unlike the deadlock warnings, the AMI event
      is emitted only once per deadlock.
      
      ASTERISK-30161 #close
      
      Change-Id: Ifc6ed3e390f8b4cff7f8077a50e4d7a5b54e42fb
      c4874256
    • Naveen Albert's avatar
      pbx_variables: Use const char if possible. · 2de016b1
      Naveen Albert authored
      Use const char for char arguments to
      pbx_substitute_variables_helper_full_location
      that can do so (context and exten).
      
      ASTERISK-30209 #close
      
      Change-Id: I001357177e9c3dca2b2b4eebc5650c1095b3da6f
      2de016b1
  27. Sep 10, 2022
    • Naveen Albert's avatar
      cli: Prevent assertions on startup from bad ao2 refs. · c7612521
      Naveen Albert authored
      If "core show channels" is run before startup has completed, it
      is possible for bad ao2 refs to occur because the system is not
      yet fully initialized. This will lead to an assertion failing.
      
      To prevent this, initialization of CLI builtins is moved to be
      later along in the main load sequence. Core CLI commands are
      loaded at the same time, but channel-related commands are loaded
      later on.
      
      ASTERISK-29846 #close
      
      Change-Id: If6b3cde802876bd738c1b4cf2683bea6ddc615b6
      c7612521
  28. Sep 08, 2022
    • Naveen Albert's avatar
      features: Add transfer initiation options. · 3fa66c92
      Naveen Albert authored
      Adds additional control options over the transfer
      feature functionality to give users more control
      in how the transfer feature sounds and works.
      
      First, the "transfer" sound that plays when a transfer is
      initiated can now be customized by the user in
      features.conf, just as with the other transfer sounds.
      
      Secondly, the user can now specify the transfer extension
      in advance by using the TRANSFER_EXTEN variable. If
      a valid extension is contained in this variable, the call
      will automatically be transferred to this destination.
      Otherwise, it will fall back to collecting the extension
      from the user as is always done now.
      
      ASTERISK-29899 #close
      
      Change-Id: Ibff309caa459a2b958706f2ed0ca393b1ef502e3
      3fa66c92
  29. Aug 17, 2022
    • Naveen Albert's avatar
      general: Very minor coding guideline fixes. · e2e049e4
      Naveen Albert authored
      Fixes a few coding guideline violations:
      * Use of C99 comments
      * Opening brace on same line as function prototype
      
      ASTERISK-30163 #close
      
      Change-Id: I07771c4c89facd41ce8d323859f022ddbddf6ca7
      e2e049e4
  30. Aug 10, 2022
    • George Joseph's avatar
      res_geolocation: Address user issues, remove complexity, plug leaks · 8a8416e3
      George Joseph authored
      * Added processing for the 'confidence' element.
      * Added documentation to some APIs.
      * removed a lot of complex code related to the very-off-nominal
        case of needing to process multiple location info sources.
      * Create a new 'ast_geoloc_eprofile_to_pidf' API that just takes
        one eprofile instead of a datastore of multiples.
      * Plugged a huge leak in XML processing that arose from
        insufficient documentation by the libxml/libxslt authors.
      * Refactored stylesheets to be more efficient.
      * Renamed 'profile_action' to 'profile_precedence' to better
        reflect it's purpose.
      * Added the config option for 'allow_routing_use' which
        sets the value of the 'Geolocation-Routing' header.
      * Removed the GeolocProfileCreate and GeolocProfileDelete
        dialplan apps.
      * Changed the GEOLOC_PROFILE dialplan function as follows:
        * Removed the 'profile' argument.
        * Automatically create a profile if it doesn't exist.
        * Delete a profile if 'inheritable' is set to no.
      * Fixed various bugs and leaks
      * Updated Asterisk WiKi documentation.
      
      ASTERISK-30167
      
      Change-Id: If38c23f26228e96165be161c2f5e849cb8e16fa0
      8a8416e3
  31. Aug 02, 2022
    • Naveen Albert's avatar
      manager: Remove documentation for nonexistent action. · f4a020a4
      Naveen Albert authored
      The manager XML documentation documents a "FilterList"
      action, but there is no such action. Therefore, this can
      lead to confusion when people try to use a documented
      action that does not, in fact, exist. This is removed
      as the action never did exist in the past, nor would it
      be trivial to add since we only store the regex_t
      objects, so the filter list can't actually be provided
      without storing that separately. Most likely, the
      documentation was originally added (around version 10)
      in anticipation of something that never happened.
      
      ASTERISK-29917 #close
      
      Change-Id: I846b16fd6f80a91d4ddc5d8a861b522d7c6f8f97
      f4a020a4
  32. Aug 01, 2022
    • Naveen Albert's avatar
      general: Improve logging levels of some log messages. · c6544865
      Naveen Albert authored
      Adjusts some logging levels to be more or less important,
      that is more prominent when actual problems occur and less
      prominent for less noteworthy things.
      
      ASTERISK-30153 #close
      
      Change-Id: Ifc8f7df427aa018627db462125ae744986d3261b
      c6544865
  33. Jul 26, 2022
    • Naveen Albert's avatar
      pbx_functions.c: Manually update ast_str strlen. · c771e2dd
      Naveen Albert authored
      When ast_func_read2 is used to read a function using
      its read function (as opposed to a native ast_str read2
      function), the result is copied directly by the function
      into the ast_str buffer. As a result, the ast_str length
      remains initialized to 0, which is a bug because this is
      not the real string length.
      
      This can cascade and have issues elsewhere, such as when
      reading substrings of functions that only register read
      as opposed to read2 callbacks. In this case, since reading
      ast_str_strlen returns 0, the returned substring is empty
      as opposed to the actual substring. This has caused
      the ast_str family of functions to behave inconsistently
      and erroneously, in contrast to the pbx_variables substitution
      functions which work correctly.
      
      This fixes this issue by manually updating the ast_str length
      when the result is copied directly into the ast_str buffer.
      
      Additionally, an assertion and a unit test that previously
      exposed these issues are added, now that the issue is fixed.
      
      ASTERISK-29966 #close
      
      Change-Id: I4e2dba41410f9d4dff61c995d2ca27718248e07f
      c771e2dd
Loading