Skip to content
Snippets Groups Projects
  1. Nov 21, 2022
    • Naveen Albert's avatar
      func_json: Fix memory leak. · 002afc3f
      Naveen Albert authored
      A memory leak was present in func_json due to
      using ast_json_free, which just calls ast_free,
      as opposed to recursively freeing the JSON
      object as needed. This is now fixed to use the
      right free functions.
      
      ASTERISK-30293 #close
      
      Change-Id: I982324dde841dc9147c8d8ad35c8719daf418b49
      002afc3f
  2. 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
  3. Sep 26, 2022
    • Naveen Albert's avatar
      func_logic: Don't emit warning if both IF branches are empty. · 407167cc
      Naveen Albert authored
      The IF function currently emits warnings if both IF branches
      are empty. However, there is no actual necessity that either
      branch be non-empty as, unlike other conditional applications/
      functions, nothing is inherently done with IF, and both
      sides could legitimately be empty. The warning is thus turned
      into a debug message.
      
      ASTERISK-30243 #close
      
      Change-Id: I5250625dd720f95e1859b5dfb933905d7e7a730e
      407167cc
    • Naveen Albert's avatar
      func_export: Add EXPORT function · 1ed45183
      Naveen Albert authored
      Adds the EXPORT function, which allows write
      access to variables and functions on other
      channels.
      
      ASTERISK-29432 #close
      
      Change-Id: I7492645ae4307553d0f586d78e13a4f586231fdf
      1ed45183
  4. Sep 22, 2022
  5. Sep 11, 2022
    • Naveen Albert's avatar
      func_frame_trace: Remove bogus assertion. · 2dac2bf8
      Naveen Albert authored
      The FRAME_TRACE function currently asserts if it sees
      a MASQUERADE_NOTIFY. However, this is a legitimate thing
      that can happen so asserting is inappropriate, as there
      are no clear negative ramifications of such a thing. This
      is adjusted to be like the other frames to print out
      the subclass.
      
      ASTERISK-30210 #close
      
      Change-Id: I8ecbdcf17e35f64bdeab42868471f581ad1d1a56
      2dac2bf8
  6. Jul 27, 2022
    • Naveen Albert's avatar
      func_srv: Document field parameter. · 83912496
      Naveen Albert authored
      Adds missing documentation for the field parameter
      for the SRVRESULT function.
      
      ASTERISK-30151
      Reported by: Chris Young
      
      Change-Id: I4385a2e0892a07e30dea1a8a0588e2c1bea2b1f1
      83912496
  7. Jul 12, 2022
  8. Jun 09, 2022
    • Naveen Albert's avatar
      xmldocs: Improve examples. · 51d262af
      Naveen Albert authored
      Use example tags instead of regular para tags
      where possible.
      
      ASTERISK-30090
      
      Change-Id: Iada8bbfda08f30b118cedf2d040bbb21e4966ec5
      51d262af
  9. May 09, 2022
    • George Joseph's avatar
      GCC12: Fixes for 16+ · 4aa54168
      George Joseph authored
      Most issues were in stringfields and had to do with comparing
      a pointer to an constant/interned string with NULL.  Since the
      string was a constant, a pointer to it could never be NULL so
      the comparison was always "true".  gcc now complains about that.
      
      There were also a few issues where determining if there was
      enough space for a memcpy or s(n)printf which were fixed
      by defining some of the involved variables as "volatile".
      
      There were also a few other miscellaneous fixes.
      
      ASTERISK-30044
      
      Change-Id: Ia081ca1bcfb329df6487c4660aaf1944309eb570
      4aa54168
  10. Apr 27, 2022
  11. Apr 26, 2022
    • Naveen Albert's avatar
      documentation: Adds versioning information. · 0c70d497
      Naveen Albert authored
      Adds version information for applications, functions,
      and manager events/actions.
      
      This is not completely exhaustive by any means but
      covers most new things added that have release
      versioning information in the issue tracker.
      
      ASTERISK-29940 #close
      
      Change-Id: I506401e93c799715dbbe97c0a8ba18af2bf5e131
      0c70d497
  12. Apr 14, 2022
    • Joshua C. Colp's avatar
      func_odbc: Add SQL_ESC_BACKSLASHES dialplan function. · 4aedaaad
      Joshua C. Colp authored
      Some databases depending on their configuration using backslashes
      for escaping. When combined with the use of ' this can result in
      a broken func_odbc query.
      
      This change adds a SQL_ESC_BACKSLASHES dialplan function which can
      be used to escape the backslashes.
      
      This is done as a dialplan function instead of being always done
      as some databases do not require this, and always doing it would
      result in incorrect data being put into the database.
      
      ASTERISK-29838
      
      Change-Id: I152bf34899b96ddb09cca3e767254d8d78f0c83d
      4aedaaad
  13. Feb 25, 2022
    • Naveen Albert's avatar
      func_channel: Add lastcontext and lastexten. · 27fb4fd5
      Naveen Albert authored
      Adds the lastcontext and lastexten channel fields to allow users
      to access previous dialplan execution locations.
      
      ASTERISK-29840 #close
      
      Change-Id: Ib455fe300cc8e9a127686896ee2d0bd11e900307
      27fb4fd5
    • Naveen Albert's avatar
      asterisk: Add macro for curl user agent. · e26b5798
      Naveen Albert authored
      Currently, each module that uses libcurl duplicates the standard
      Asterisk curl user agent.
      
      This adds a global macro for the Asterisk user agent used for
      curl requests to eliminate this duplication.
      
      ASTERISK-29861 #close
      
      Change-Id: I9fc37935980384b4daf96ae54fa3c9adb962ed2d
      e26b5798
  14. Feb 23, 2022
    • Naveen Albert's avatar
      func_db: Add validity check for key names when writing. · b1765c93
      Naveen Albert authored
      Adds a simple sanity check for key names when users are
      writing data to AstDB. This captures four cases indicating
      malformed keynames that generally result in bad data going
      into the DB that the user didn't intend: an empty key name,
      a key name beginning or ending with a slash, and a key name
      containing two slashes in a row. Generally, this is the
      result of a variable being used in the key name being empty.
      
      If a malformed key name is detected, a warning is emitted
      to indicate the bug in the dialplan.
      
      ASTERISK-29925 #close
      
      Change-Id: Ifc08a9fe532a519b1b80caca1aafed7611d573bf
      b1765c93
  15. Jan 31, 2022
    • Naveen Albert's avatar
      func_frame_drop: Fix typo referencing wrong buffer · 7ae83219
      Naveen Albert authored
      In order to get around the issue of certain frames
      having names that could overlap, func_frame_drop
      surrounds names with commas for the purposes of
      comparison.
      
      The buffer is allocated and printed to properly,
      but the original buffer is used for comparison.
      In most cases, this wouldn't have had any effect,
      but that was not the intention behind the buffer.
      This updates the code to reference the modified
      buffer instead.
      
      ASTERISK-29854 #close
      
      Change-Id: I430b52e14e712d0e62a23aa3b5644fe958b684a7
      7ae83219
  16. Jan 12, 2022
    • Naveen Albert's avatar
      documentation: Document built-in system and channel vars · 5f59e0d3
      Naveen Albert authored
      Documentation for built-in special system and channel
      vars is currently outdated, and updating is a manual
      process since there is no XML documentation for these
      anywhere.
      
      This adds documentation for system vars to func_env
      and for channel vars to func_channel so that they
      appear along with the corresponding fields that would
      be accessed using a function.
      
      ASTERISK-29848 #close
      
      Change-Id: I6997f925c4a45fffe71321861f5898a8b7182fa9
      5f59e0d3
  17. Dec 13, 2021
    • Naveen Albert's avatar
      func_json: Adds JSON_DECODE function · b64e8946
      Naveen Albert authored
      Adds the JSON_DECODE function for parsing JSON in the
      dialplan. JSON parsing already exists in the Asterisk
      core and is used for many different things. This
      function exposes the basic parsing capability to
      the user in the dialplan, for instance, in conjunction
      with CURL for using API responses.
      
      ASTERISK-29706 #close
      
      Change-Id: Iea60c49a7358dfdc2db60803cdc9a742f808ba2c
      b64e8946
  18. Dec 02, 2021
  19. Dec 01, 2021
    • Naveen Albert's avatar
      documentation: Standardize examples · 24a04054
      Naveen Albert authored
      Most examples in the XML documentation use the
      example tag to demonstrate examples, which gets
      parsed specially in the Wiki to make it easier
      to follow for users.
      
      This fixes a few modules to use the example
      tag instead of vanilla para tags to bring them
      in line with the standard syntax.
      
      ASTERISK-29777 #close
      
      Change-Id: I9acb6cc5faf1d220e73c6dd28592371d768d279b
      24a04054
  20. Nov 19, 2021
  21. Nov 16, 2021
    • Josh Soref's avatar
      funcs: Spelling fixes · 1b1f5f9f
      Josh Soref authored
      Correct typos of the following word families:
      
      effectively
      emitted
      expect
      anthony
      
      ASTERISK-29714
      
      Change-Id: Ic16f9ec855bb6d14ec8e170b90af9a36b06d488a
      1b1f5f9f
  22. Oct 19, 2021
    • Sean Bright's avatar
      func_talkdetect.c: Fix logical errors in silence detection. · 886983b1
      Sean Bright authored
      There are 3 separate changes here:
      
      1. The documentation erroneously stated that the dsp_talking_threshold
         argument was a number of milliseconds when it is actually an energy
         level used by the DSP code to classify talking vs. silence.
      
      2. Fixes a copy paste error in the argument handling code.
      
      3. Don't erroneously switch to the talking state if we aren't actively
         handling a frame we've classified as talking.
      
      Patch inspired by one provided by Moritz Fain (License #6961).
      
      ASTERISK-27816 #close
      
      Change-Id: I5953fd570b98b49c41cee55bfe3b941753fb2511
      886983b1
  23. Sep 22, 2021
  24. Sep 10, 2021
    • Naveen Albert's avatar
      func_strings: Add STRBETWEEN function · b8fc77a3
      Naveen Albert authored
      Adds the STRBETWEEN function, which can be used to insert a
      substring between each character in a string. For instance,
      this can be used to insert pauses between DTMF tones in a
      string of digits.
      
      ASTERISK-29627
      
      Change-Id: Ice23009d4a8e9bb9718d2b2301d405567087d258
      b8fc77a3
    • Naveen Albert's avatar
      func_env: Add DIRNAME and BASENAME functions · e0111a56
      Naveen Albert authored
      Adds the DIRNAME and BASENAME functions, which are
      wrappers around the corresponding C library functions.
      These can be used to safely and conveniently work with
      file paths and names in the dialplan.
      
      ASTERISK-29628 #close
      
      Change-Id: Id3aeb907f65c0ff96b6e57751ff0cb49d61db7f3
      e0111a56
    • Naveen Albert's avatar
      func_sayfiles: Retrieve say file names · ddf6299b
      Naveen Albert authored
      Up until now, all of the logic used to translate
      arguments to the Say applications has been
      directly coupled to playback, preventing other
      modules from using this logic.
      
      This refactors code in say.c and adds a SAYFILES
      function that can be used to retrieve the file
      names that would be played. These can then be
      used in other applications or for other purposes.
      
      Additionally, a SayMoney application and a SayOrdinal
      application are added. Both SayOrdinal and SayNumber
      are also expanded to support integers greater than
      one billion.
      
      ASTERISK-29531
      
      Change-Id: If9718c89353b8e153d84add3cc4637b79585db19
      ddf6299b
  25. Aug 19, 2021
    • Naveen Albert's avatar
      func_math: Return integer instead of float if possible · 85ef06d3
      Naveen Albert authored
      The MIN, MAX, and ABS functions all support float
      arguments, but currently return floats even if the
      arguments are all integers and the response is
      a whole number, in which case the user is likely
      expecting an integer. This casts the float to an integer
      before printing into the response buffer if possible.
      
      ASTERISK-29495
      
      Change-Id: I902d29eacf3ecd0f8a6a5e433c97f0421d205488
      85ef06d3
    • Naveen Albert's avatar
      func_scramble: Audio scrambler function · 498db708
      Naveen Albert authored
      Adds a function to scramble audio on a channel using
      whole spectrum frequency inversion. This can be used
      as a privacy enhancement with applications like
      ChanSpy or other potentially sensitive audio.
      
      ASTERISK-29542
      
      Change-Id: I01020769d91060a1f56a708eb405f87648d1a67e
      498db708
  26. Aug 09, 2021
    • Naveen Albert's avatar
      func_frame_drop: New function · 6a89266b
      Naveen Albert authored
      Adds function to selectively drop specified frames
      in the TX or RX direction on a channel, including
      control frames.
      
      ASTERISK-29478
      
      Change-Id: I8147c9d55d74e2e48861edba6b22f930920541ec
      6a89266b
  27. Jun 11, 2021
    • Jaco Kroon's avatar
      func_lock: Add "dialplan locks show" cli command. · 56c2cc47
      Jaco Kroon authored
      
      For example:
      
      arthur*CLI> dialplan locks show
      func_lock locks:
      Name                                     Requesters Owner
      uls-autoref                              0          (unlocked)
      1 total locks listed.
      
      Obviously other potentially useful stats could be added (eg, how many
      times there was contention, how many times it failed etc ... but that
      would require keeping the stats and I'm not convinced that's worth the
      effort.  This was useful to troubleshoot some other issues so submitting
      it.
      
      Change-Id: Ib875e56feb49d523300aec5f36c635ed74843a9f
      Signed-off-by: default avatarJaco Kroon <jaco@uls.co.za>
      56c2cc47
    • Jaco Kroon's avatar
      func_lock: Prevent module unloading in-use module. · 19a8383a
      Jaco Kroon authored
      
      The scenario where a channel still has an associated datastore we
      cannot unload since there is a function pointer to the destroy and fixup
      functions in play.  Thus increase the module ref count whenever we
      allocate a datastore, and decrease it during destroy.
      
      In order to tighten the race that still exists in spite of this (below)
      add some extra failure cases to prevent allocations in these cases.
      
      Race:
      
      If module ref is zero, an LOCK or TRYLOCK is invoked (near)
      simultaneously on a channel that has NOT PREVIOUSLY taken a lock, and if
      in such a case the datastore is created *prior* to unloading being set
      to true (first step in module unload) then it's possible that the module
      will unload with the destructor being called (and segfault) post the
      module being unloaded.  The module will however wait for such locks to
      release prior to unloading.
      
      If post that we can recheck the module ref before returning the we can
      (in theory, I think) eliminate the last of the race.  This race is
      mostly theoretical in nature.
      
      Change-Id: I21a514a0b56755c578a687f4867eacb8b59e23cf
      Signed-off-by: default avatarJaco Kroon <jaco@uls.co.za>
      19a8383a
    • Jaco Kroon's avatar
      func_lock: Fix memory corruption during unload. · e8875d5c
      Jaco Kroon authored
      
      AST_TRAVERSE accessess current as current = current->(field).next ...
      and since we free current (and ast_free poisons the memory) we either
      end up on a ast_mutex_lock to a non-existing lock that can never be
      obtained, or a segfault.
      
      Incidentally add logging in the "we have to wait for a lock to release"
      case, and remove an ineffective statement that sets memory that was just
      cleared by ast_calloc to zero.
      
      Change-Id: Id19ba3d9867b23d0e6783b97e6ecd8e62698b8c3
      Signed-off-by: default avatarJaco Kroon <jaco@uls.co.za>
      e8875d5c
    • Jaco Kroon's avatar
      func_lock: Fix requesters counter in error paths. · caceba79
      Jaco Kroon authored
      
      In two places we bail out with failure after we've already incremented
      the requesters counter, if this occured then it would effectively result
      in unload to wait indefinitely, thus preventing clean shutdown.
      
      Change-Id: I362a6c0dc424f736d4a9c733d818e72d19675283
      Signed-off-by: default avatarJaco Kroon <jaco@uls.co.za>
      caceba79
  28. May 26, 2021
    • Naveen Albert's avatar
      func_math: Three new dialplan functions · eeffad1b
      Naveen Albert authored
      Introduces three new dialplan functions, MIN and MAX,
      which can be used to calculate the minimum or
      maximum of up to two numbers, and ABS, an absolute
      value function.
      
      ASTERISK-29431
      
      Change-Id: I2bda9269d18f9d54833c85e48e41fce0e0ce4d8d
      eeffad1b
    • Naveen Albert's avatar
      func_volume: Add read capability to function. · 19b5097d
      Naveen Albert authored
      Up until now, the VOLUME function has been write
      only, so that TX/RX values can be set but not
      read afterwards. Now, previously set TX/RX values
      can be read later.
      
      ASTERISK-29439
      
      Change-Id: Ia23e92fa2e755c36e9c8e69f2940d2703ccccb5f
      19b5097d
Loading