Skip to content
Snippets Groups Projects
  1. Mar 05, 2021
    • Joshua C. Colp's avatar
      sorcery: Add support for more intelligent reloading. · 304f8ddf
      Joshua C. Colp authored
      Some sorcery objects actually contain dynamic content
      that can change despite the underlying configuration
      itself not changing. A good example of this is the
      res_pjsip_endpoint_identifier_ip module which allows
      specifying hostnames. While the configuration may not
      change between reloads the DNS information of the
      hostnames can.
      
      This change adds the ability for a sorcery object to be
      marked as having dynamic contents which is then taken
      into account when reloading by the sorcery file based
      config module. If there is an object with dynamic content
      then a reload will be forced while if there are none
      then the existing behavior of not reloading occurs.
      
      ASTERISK-29321
      
      Change-Id: I9342dc55be46cc00204533c266a68d972760a0b1
      304f8ddf
  2. Mar 04, 2021
  3. Mar 03, 2021
    • Joshua C. Colp's avatar
      channel: Fix memory leak in suppress API. · 3e5b9e39
      Joshua C. Colp authored
      A frame suppression API exists as part of channels
      which allows audio frames to or from a channel to
      be dropped. The MuteAudio AMI action uses this
      API to perform its job.
      
      This API uses a framehook to intercept flowing
      audio and drop it when appropriate. It is the
      responsibility of the framehook to free the
      frame it is given if it changes the frame. The
      suppression API failed to do this resulting in
      a leak of audio frames.
      
      This change adds the freeing of these frames.
      
      ASTERISK-29071
      
      Change-Id: Ie50acd454d672d36af914050c327d2e120d8ba7b
      3e5b9e39
  4. Mar 02, 2021
    • Nico Kooijman's avatar
      main: With Dutch language year after 2020 is not spoken in say.c · 2ea75ed3
      Nico Kooijman authored
      Implemented the english way of saying the year in ast_say_date_with_format_nl.
      Currently the numbers are spoken correctly until 2020 and stopped working
      this year.
      
      ASTERISK-29297 #close
      Reported-by: Jacek Konieczny
      
      Change-Id: If5918eed5ab05df31df4dd23f08a909a60f6aba4
      2ea75ed3
  5. Feb 23, 2021
    • Alexander Traud's avatar
      chan_sip: Filter pass-through audio/video formats away, again. · 5894535f
      Alexander Traud authored
      Instead of looking for pass-through formats in the list of transcodable
      formats (which is going to find nothing), go through the result which
      is going to be the jointcaps of the tech_pvt of the channel. Finally,
      only with that list, ast_format_cap_remove(.) is going to succeed.
      
      This restores the behaviour of Asterisk 1.8. However, it does not fix
      ASTERISK_29282 because that issue report is about chan_sip and PJSIP.
      Here, only chan_sip is fixed because PJSIP does not even call
      ast_rtp_instance_available_formats -> ast_translate_available_format.
      
      Change-Id: Icade2366ac2b82935b95a9981678c987da2e8c34
      5894535f
    • Sebastien Duthil's avatar
      app_mixmonitor: Add AMI events MixMonitorStart, -Stop and -Mute. · 6e695c86
      Sebastien Duthil authored
      ASTERISK-29244
      
      Change-Id: I1862d58264c2c8b5d8983272cb29734b184d67c5
      6e695c86
  6. Feb 16, 2021
    • Ben Ford's avatar
      core_unreal: Fix T.38 faxing when using local channels. · 00b229c6
      Ben Ford authored
      After some changes to streams and topologies, receiving fax through
      local channels stopped working. This change adds a stream topology with
      a stream of type IMAGE to the local channel pair and allows fax to be
      received.
      
      ASTERISK-29035 #close
      
      Change-Id: Id103cc5c9295295d8e68d5628e76220f8f17e9fb
      00b229c6
  7. Jan 27, 2021
  8. Jan 06, 2021
    • Sean Bright's avatar
      asterisk: Export additional manager functions · 1b74555f
      Sean Bright authored
      Rename check_manager_enabled() and check_webmanager_enabled() to begin
      with ast_ so that the symbols are automatically exported by the
      linker.
      
      ASTERISK~29184
      
      Change-Id: I85762b9a5d14500c15f6bad6507138c8858644c9
      1b74555f
  9. Jan 04, 2021
    • Alexander Traud's avatar
      codecs: Remove test-law. · 80c14f74
      Alexander Traud authored
      This was dead code, test code introduced with Asterisk 13. This was
      found while analyzing ASTERISK_28416 and ASTERISK_29185. This change
      partly fixes, not closes those two issues.
      
      Change-Id: I42d0daa37f6f334c7d86672f06f085858a3f3940
      80c14f74
  10. Dec 17, 2020
    • Sean Bright's avatar
      app_chanspy: Spyee information missing in ChanSpyStop AMI Event · 357510ce
      Sean Bright authored
      The documentation in the wiki says there should be spyee-channel
      information elements in the ChanSpyStop AMI event.
      
          https://wiki.asterisk.org/wiki/x/Xc5uAg
      
      However, this is not the case in Asterisk <= 16.10.0 Version. We're
      using these Spyee* arguments since Asterisk 11.x, so these arguments
      vanished in Asterisk 12 or higher.
      
      For maximum compatibility, we still send the ChanSpyStop event even if
      we are not able to find any 'Spyee' information.
      
      ASTERISK-28883 #close
      
      Change-Id: I81ce397a3fd614c094d043ffe5b1b1d76188835f
      357510ce
    • George Joseph's avatar
      logger.c: Automatically add a newline to formats that don't have one · 7d4ae7dc
      George Joseph authored
      Scope tracing allows you to not specify a format string or variable,
      in which case it just prints the indent, file, function, and line
      number.  The trace output automatically adds a newline to the end
      in this case.  If you also have debugging turned on for the module,
      a debug message is also printed but the standard log functionality
      which prints it doesn't add the newline so you have messages
      that don't break correctly.
      
       * format_log_message_ap(), which is the common log
         message formatter for all channels, now adds a
         newline to the end of format strings that don't
         already have a newline.
      
      ASTERISK-29209
      Reported by: Alexander Traud
      
      Change-Id: I994a7df27f88df343b7d19f3e81a4b562d9d41da
      7d4ae7dc
  11. Dec 09, 2020
    • lvl's avatar
      Introduce astcachedir, to be used for temporary bucket files · b0842713
      lvl authored
      As described in the issue, /tmp is not a suitable location for a
      large amount of cached media files, since most distributions make
      /tmp a RAM-based tmpfs mount with limited capacity.
      
      I opted for a location that can be configured separately, as opposed
      to using a subdirectory of spooldir, given the different storage
      profile (transient files vs files that might stay there indefinitely).
      
      This commit just makes the cache directory configurable, and changes
      the default location from /tmp to /var/cache/asterisk.
      
      ASTERISK-29143
      
      Change-Id: Ic54e95199405abacd9e509cef5f08fa14c510b5d
      b0842713
  12. Dec 03, 2020
  13. Nov 18, 2020
    • Boris P. Korzun's avatar
      bridge_basic: Fixed setup of recall channels · 8cb439f7
      Boris P. Korzun authored
      Fixed a bug (like a typo) in retransfer_enter() at main/bridge_basic.c:2641.
      common_recall_channel_setup() setups common things on the recalled transfer
      target, but used same target as source instead trasfered.
      
      ASTERISK-29161 #close
      
      Change-Id: Ieb549654a621c38b1ad5e9d15b9f18823d9cc31f
      8cb439f7
  14. Nov 03, 2020
  15. Oct 29, 2020
    • Walter Doekes's avatar
      main/say: Work around gcc 9 format-truncation false positive · 1650d50e
      Walter Doekes authored
      Version: gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0
      Warning:
        say.c:2371:24: error: ‘%d’ directive output may be truncated writing
          between 1 and 11 bytes into a region of size 10
          [-Werror=format-truncation=]
        2371 |     snprintf(buf, 10, "%d", num);
        say.c:2371:23: note: directive argument in the range [-2147483648, 9]
      
      That's not possible though, as the if() starts out checking for (num < 0),
      making this Warning a false positive.
      
      (Also replaced some else<TAB>if with else<SP>if while in the vicinity.)
      
      Change-Id: Ic7a70120188c9aa525a6d70289385bfce878438a
      1650d50e
  16. Oct 08, 2020
  17. Oct 02, 2020
    • Kevin Harwell's avatar
      Logging: Add debug logging categories · 56028426
      Kevin Harwell authored
      Added debug logging categories that allow a user to output debug
      information based on a specified category. This lets the user limit,
      and filter debug output to data relevant to a particular context,
      or topic. For instance the following categories are now available for
      debug logging purposes:
      
        dtls, dtls_packet, ice, rtcp, rtcp_packet, rtp, rtp_packet,
        stun, stun_packet
      
      These debug categories can be enable/disable via an Asterisk CLI command.
      
      While this overrides, and outputs debug data, core system debugging is
      not affected by this patch. Statements still output at their appropriate
      debug level. As well backwards compatibility has been maintained with
      past debug groups that could be enabled using the CLI (e.g. rtpdebug,
      stundebug, etc.).
      
      ASTERISK-29054 #close
      
      Change-Id: I6e6cb247bb1f01dbf34750b2cd98e5b5b41a1849
      56028426
    • Sean Bright's avatar
      pbx.c: On error, ast_add_extension2_lockopt should always free 'data' · 51cba591
      Sean Bright authored
      In the event that the desired extension already exists,
      ast_add_extension2_lockopt() will free the 'data' it is passed before
      returning an error, so we should not be freeing it ourselves.
      
      Additionally, there were two places where ast_add_extension2_lockopt()
      could return an error without also freeing the 'data' pointer, so we
      add that.
      
      ASTERISK-29097 #close
      
      Change-Id: I904707aae55169feda050a5ed7c6793b53fe6eae
      51cba591
    • George Joseph's avatar
      app_confbridge/bridge_softmix: Add ability to force estimated bitrate · 773f424c
      George Joseph authored
      app_confbridge now has the ability to set the estimated bitrate on an
      SFU bridge.  To use it, set a bridge profile's remb_behavior to "force"
      and set remb_estimated_bitrate to a rate in bits per second.  The
      remb_estimated_bitrate parameter is ignored if remb_behavior is something
      other than "force".
      
      Change-Id: Idce6464ff014a37ea3b82944452e56cc4d75ab0a
      773f424c
  18. Sep 30, 2020
  19. Sep 23, 2020
  20. Sep 15, 2020
  21. Sep 14, 2020
    • George Joseph's avatar
      debugging: Add enough to choke a mule · 44bb0858
      George Joseph authored
      Added to:
       * bridges/bridge_softmix.c
       * channels/chan_pjsip.c
       * include/asterisk/res_pjsip_session.h
       * main/channel.c
       * res/res_pjsip_session.c
      
      There NO functional changes in this commit.
      
      Change-Id: I06af034d1ff3ea1feb56596fd7bd6d7939dfdcc3
      44bb0858
    • George Joseph's avatar
      res_pjsip_session: Handle multi-stream re-invites better · 86f1bce1
      George Joseph authored
      When both Asterisk and a UA send re-invites at the same time, both
      send 491 "Transaction in progress" responses to each other and back
      off a specified amount of time before retrying. When Asterisk
      prepares to send its re-invite, it sets up the session's pending
      media state with the new topology it wants, then sends the
      re-invite.  Unfortunately, when it received the re-invite from the
      UA, it partially processed the media in the re-invite and reset
      the pending media state before sending the 491 losing the state it
      set in its own re-invite.
      
      Asterisk also was not tracking re-invites received while an existing
      re-invite was queued resulting in sending stale SDP with missing
      or duplicated streams, or no re-invite at all because we erroneously
      determined that a re-invite wasn't needed.
      
      There was also an issue in bridge_softmix where we were using a stream
      from the wrong topology to determine if a stream was added.  This also
      caused us to erroneously determine that a re-invite wasn't needed.
      
      Regardless of how the delayed re-invite was triggered, we need to
      reconcile the topology that was active at the time the delayed
      request was queued, the pending topology of the queued request,
      and the topology currently active on the session.  To do this we
      need a topology resolver AND we need to make stream named unique
      so we can accurately tell what a stream has been added or removed
      and if we can re-use a slot in the topology.
      
      Summary of changes:
      
       * bridge_softmix:
         * We no longer reset the stream name to "removed" in
           remove_all_original_streams().  That was causing  multiple streams
           to have the same name and wrecked the checks for duplicate streams.
      
         * softmix_bridge_stream_sources_update() was checking the old_stream
           to see if it had the softmix prefix and not considering the stream
           as "new" if it did.  If the stream in that slot has something in it
           because another re-invite happened, then that slot in old might
           have a softmix stream but the same stream in new might actually
           be a new one.  Now we check the new_stream's name instead of
           the old_stream's.
      
       * stream:
         * Instead of using plain media type name ("audio", "video", etc) as
           the default stream name, we now append the stream position to it
           to make it unique.  We need to do this so we can distinguish multiple
           streams of the same type from each other.
      
         * When we set a stream's state to REMOVED, we no longer reset its
           name to "removed" or destroy its metadata.  Again, we need to
           do this so we can distinguish multiple streams of the same
           type from each other.
      
       * res_pjsip_session:
         * Added resolve_refresh_media_states() that takes in 3 media states
           and creates an up-to-date pending media state that includes the changes
           that might have happened while a delayed session refresh was in the
           delayed queue.
      
         * Added is_media_state_valid() that checks the consistency of
           a media state and returns a true/false value. A valid state has:
           * The same number of stream entries as media session entries.
               Some media session entries can be NULL however.
           * No duplicate streams.
           * A valid stream for each non-NULL media session.
           * A stream that matches each media session's stream_num
             and media type.
      
         * Updated handle_incoming_sdp() to set the stream name to include the
           stream position number in the name to make it unique.
      
         * Updated the ast_sip_session_delayed_request structure to include both
           the pending and active media states and updated the associated delay
           functions to process them.
      
         * Updated sip_session_refresh() to accept both the pending and active
           media states that were in effect when the request was originally queued
           and to pass them on should the request need to be delayed again.
      
         * Updated sip_session_refresh() to call resolve_refresh_media_states()
           and substitute its results for the pending state passed in.
      
         * Updated sip_session_refresh() with additional debugging.
      
         * Updated session_reinvite_on_rx_request() to simply return PJ_FALSE
           to pjproject if a transaction is in progress.  This stops us from
           creating a partial pending media state that would be invalid later on.
      
         * Updated reschedule_reinvite() to clone both the current pending and
           active media states and pass them to delay_request() so the resolver
           can tell what the original intention of the re-invite was.
      
         * Added a large unit test for the resolver.
      
      ASTERISK-29014
      
      Change-Id: Id3440972943c611a15f652c6c569fa0e4536bfcb
      86f1bce1
  22. Sep 10, 2020
    • Sungtae Kim's avatar
      res_stasis.c: Added video_single option for bridge creation · aae0904c
      Sungtae Kim authored
      Currently, it was not possible to create bridge with video_mode single.
      This made hard to put the bridge in a vidoe_single mode.
      So, added video_single option for Bridge creation using the ARI.
      This allows create a bridge with video_mode single.
      
      ASTERISK-29055
      
      Change-Id: I43e720e5c83fc75fafe10fe22808ae7f055da2ae
      aae0904c
    • Ben Ford's avatar
      Bridging: Use a ref to bridge_channel's channel to prevent crash. · 80a609fc
      Ben Ford authored
      There's a race condition with bridging where a bridge can be torn down
      causing the bridge_channel's ast_channel to become NULL when it's still
      needed. This particular case happened with attended transfers, but the
      crash occurred when trying to publish a stasis message. Now, the
      bridge_channel is locked, a ref to the ast_channel is obtained, and that
      ref is passed down the chain.
      
      Change-Id: Ic48715c0c041615d17d286790ae3e8c61bb28814
      80a609fc
  23. Sep 02, 2020
  24. Aug 28, 2020
    • Joshua C. Colp's avatar
      pbx: Fix hints deadlock between reload and ExtensionState. · 28bae5e9
      Joshua C. Colp authored
      When the ExtensionState AMI action is executed on a pattern matched
      hint it can end up adding a new hint if one does not already exist.
      This results in a locking order of contexts -> hints -> contexts.
      
      If at the same time a reload is occurring and adding its own hint
      it will have a locking order of hints -> contexts.
      
      This results in a deadlock as one thread wants a lock on contexts
      that the other has, and the other thread wants a lock on hints
      that the other has.
      
      This change enforces a hints -> contexts locking order by explicitly
      locking hints in the places where a hint is added when queried for.
      This matches the order seen through normal adding of hints.
      
      ASTERISK-29046
      
      Change-Id: I49f027f4aab5d2d50855ae937bcf5e2fd8bfc504
      28bae5e9
    • George Joseph's avatar
      logger.c: Added a new log formatter called "plain" · 54ddf191
      George Joseph authored
      Added a new log formatter called "plain" that always prints
      file, function and line number if available (even for verbose
      messages) and never prints color control characters.  It also
      doesn't apply any special formatting for verbose messages.
      Most suitable for file output but can be used for other channels
      as well.
      
      You use it in logger.conf like so:
      debug => [plain]debug
      console => [plain]error,warning,debug,notice,pjsip_history
      messages => [plain]warning,error,verbose
      
      Change-Id: I4fdfe4089f66ce2f9cb29f3005522090dbb5243d
      54ddf191
  25. Aug 25, 2020
    • Sean Bright's avatar
      bridge_channel: Ensure text messages are zero terminated · 35531929
      Sean Bright authored
      T.140 data in RTP is not zero terminated, so when we are queuing a text
      frame on a bridge we need to ensure that we are passing a zero
      terminated string.
      
      ASTERISK-28974 #close
      
      Change-Id: Ic10057387ce30b2094613ea67e3ae8c5c431dda3
      35531929
  26. Aug 24, 2020
    • George Joseph's avatar
      scope_trace: Added debug messages and added additional macros · 64ca2d48
      George Joseph authored
      The SCOPE_ENTER and SCOPE_EXIT* macros now print debug messages
      at the same level as the scope level.  This allows the same
      messages to be printed to the debug log when AST_DEVMODE
      isn't enabled.
      
      Also added a few variants of the SCOPE_EXIT macros that will
      also call ast_log instead of ast_debug to make it easier to
      use scope tracing and still print error messages.
      
      Change-Id: I7fe55f7ec28069919a0fc0b11a82235ce904cc21
      64ca2d48
  27. Aug 20, 2020
    • George Joseph's avatar
      stream.c: Added 2 more debugging utils and added pos to stream string · 118cb3f0
      George Joseph authored
       * Added ast_stream_to_stra and ast_stream_topology_to_stra() macros
         which are shortcuts for
            ast_str_tmp(256, ast_stream_to_str(stream, &STR_TMP))
      
       * Added the stream position to the string representation of the
         stream.
      
       * Fixed some formatting in ast_stream_to_str().
      
      Change-Id: Idaf4cb0affa46d4dce58a73a111f35435331cc4b
      118cb3f0
  28. Aug 18, 2020
    • George Joseph's avatar
      ACN: Changes specific to the core · 647c53c4
      George Joseph authored
      Allow passing a topology from the called channel back to the
      calling channel.
      
       * Added a new function ast_queue_answer() that accepts a stream
         topology and queues an ANSWER CONTROL frame with it as the
         data.  This allows the called channel to indicate its resolved
         topology.
      
       * Added a new virtual function to the channel tech structure
         answer_with_stream_topology() that allows the calling channel
         to receive the called channel's topology.  Added
         ast_raw_answer_with_stream_topology() that invokes that virtual
         function.
      
       * Modified app_dial.c and features.c to grab the topology from the
         ANSWER frame queued by the answering channel and send it to
         the calling channel with ast_raw_answer_with_stream_topology().
      
       * Modified frame.c to automatically cleanup the reference
         to the topology on ANSWER frames.
      
      Added a few debugging messages to stream.c.
      
      Change-Id: I0115d2ed68d6bae0f87e85abcf16c771bdaf992c
      647c53c4
  29. Aug 06, 2020
    • Ben Ford's avatar
      utils.c: NULL terminate ast_base64decode_string. · 9ed6387c
      Ben Ford authored
      With the addition of STIR/SHAKEN, the function ast_base64decode_string
      was added for convenience since there is a lot of converting done during
      the STIR/SHAKEN process. This function returned the decoded string for
      you, but did not NULL terminate it, causing some issues (specifically
      with MALLOC_DEBUG). Now, the returned string is NULL terminated, and the
      documentation has been updated to reflect this.
      
      Change-Id: Icdd7d05b323b0c47ff6ed43492937a03641bdcf5
      9ed6387c
  30. Jul 28, 2020
    • Sean Bright's avatar
      utf8.c: Add UTF-8 validation and utility functions · 7d96b3e4
      Sean Bright authored
      There are various places in Asterisk - specifically in regards to
      database integration - where having some kind of UTF-8 validation would
      be beneficial. This patch adds:
      
      * Functions to validate that a given string contains only valid UTF-8
        sequences.
      
      * A function to copy a string (similar to ast_copy_string) stopping when
        an invalid UTF-8 sequence is encountered.
      
      * A UTF-8 validator that allows for progressive validation.
      
      All of this is based on the excellent UTF-8 decoder by Björn Höhrmann.
      More information is available here:
      
          https://bjoern.hoehrmann.de/utf-8/decoder/dfa/
      
      The API was written in such a way that should allow us to replace the
      implementation later should we determine that we need something more
      comprehensive.
      
      Change-Id: I3555d787a79e7c780a7800cd26e0b5056368abf9
      7d96b3e4
  31. Jul 24, 2020
    • sungtae kim's avatar
      stasis_bridge.c: Fixed wrong video_mode shown · c10ed8d4
      sungtae kim authored
      Currently, if the bridge has created by the ARI, the video_mode
      parameter was
      not shown in the BridgeCreated event correctly.
      
      Fixed it and added video_mode shown in the 'bridge show <bridge id>'
      cli.
      
      ASTERISK-28987
      
      Change-Id: I8c205126724e34c2bdab9380f523eb62478e4295
      c10ed8d4
Loading