Skip to content
Snippets Groups Projects
  1. 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
  2. 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
  3. 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
  4. 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
  5. 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
  6. Mar 16, 2021
    • Joshua C. Colp's avatar
      xml: Embed module information into core XML documentation. · 149e5e5b
      Joshua C. Colp authored
      This change embeds the MODULEINFO block of modules
      into the core XML documentation. This provides a shared
      mechanism for use by both menuselect and Asterisk for
      information and a definitive source of truth.
      
      ASTERISK-29335
      
      Change-Id: Ifbfd5c700049cf320a3e45351ac65dd89bc99d90
      149e5e5b
  7. Mar 10, 2021
  8. Feb 23, 2021
    • Jaco Kroon's avatar
      func_odbc: Introduce minargs config and expose ARGC in addition to ARGn. · b0f349a3
      Jaco Kroon authored
      
      minargs enables enforcing of minimum count of arguments to pass to
      func_odbc, so if you're unconditionally using ARG1 through ARG4 then
      this should be set to 4.  func_odbc will generate an error in this case,
      so for example
      
      [FOO]
      minargs = 4
      
      and ODBC_FOO(a,b,c) in dialplan will now error out instead of using a
      potentially leaked ARG4 from Gosub().
      
      ARGC is needed if you're using optional argument, to verify whether or
      not an argument has been passed, else it's possible to use a leaked ARGn
      from Gosub (app_stack).  So now you can safely do
      ${IF($[${ARGC}>3]?${ARGV}:default value)} kind of thing.
      
      Change-Id: I6ca0b137d90b03f6aa9c496991f6cbf1518f6c24
      Signed-off-by: default avatarJaco Kroon <jaco@uls.co.za>
      b0f349a3
  9. Jan 06, 2021
    • Jaco Kroon's avatar
      func_lock: fix multiple-channel-grant problems. · c7975009
      Jaco Kroon authored
      
      Under contention it becomes possible that multiple channels will be told
      they successfully obtained the lock, which is a bug.  Please refer
      
      ASTERISK-29217
      
      This introduces a couple of changes.
      
      1.  Replaces requesters ao2 container with simple counter (we don't
          really care who is waiting for the lock, only how many).  This is
          updated undex ->mutex to prevent memory access races.
      2.  Correct semantics for ast_cond_timedwait() as described in
          pthread_cond_broadcast(3P) is used (multiple threads can be released
          on a single _signal()).
      3.  Module unload races are taken care of and memory properly cleaned
          up.
      
      Change-Id: I6f68b5ec82ff25b2909daf6e4d19ca864a463e29
      Signed-off-by: default avatarJaco Kroon <jaco@uls.co.za>
      c7975009
  10. Nov 20, 2020
  11. Nov 06, 2020
    • Dovid Bender's avatar
      func_curl.c: Allow user to set what return codes constitute a failure. · bc58e84f
      Dovid Bender authored
      Currently any response from res_curl where we get an answer from the
      web server, regardless of what the response is (404, 403 etc.) Asterisk
      currently treats it as a success. This patch allows you to set which
      codes should be considered as a failure by Asterisk. If say we set
      failurecodes=404,403 then when using curl in realtime if a server gives
      a 404 error Asterisk will try to failover to the next option set in
      extconfig.conf
      
      ASTERISK-28825
      
      Reported by: Dovid Bender
      Code by: Gobinda Paul
      
      Change-Id: I94443e508343e0a3e535e51ea6e0562767639987
      bc58e84f
  12. Nov 03, 2020
  13. Sep 23, 2020
    • Sean Bright's avatar
      func_curl.c: Prevent crash when using CURLOPT(httpheader) · b11b4994
      Sean Bright authored
      Because we use shared thread-local cURL instances, we need to ensure
      that the state of the cURL instance is correct before each invocation.
      
      In the case of custom headers, we were not resetting cURL's internal
      HTTP header pointer which could result in a crash if subsequent
      requests do not configure custom headers.
      
      ASTERISK-29085 #close
      
      Change-Id: I8b4ab34038156dfba613030a45f10e932d2e992d
      b11b4994
  14. Apr 20, 2020
  15. Apr 14, 2020
  16. Apr 08, 2020
  17. Mar 31, 2020
  18. Feb 10, 2020
  19. Jan 13, 2020
    • Sean Bright's avatar
      func_curl: Add 'followlocation' option to CURLOPT() · 0c2bf166
      Sean Bright authored
      We allow for 'maxredirs' to be set, but this value is ignored when
      followlocation is not enabled which, by default, it is not.
      
      ASTERISK-17491 #close
      Reported by: candrews
      
      Change-Id: I96a4ab0142f2fb7d2e96ff976f6cf7b2982c761a
      0c2bf166
  20. Dec 11, 2019
    • Pascal Cadotte Michaud's avatar
      PJSIP_CONTACT: add missing argument documentation · bf4dd3d8
      Pascal Cadotte Michaud authored
      add missing argument "rtt" and "status" to the documentation
      
      The change to the dtd file allow an enumlist to contain one or many
      configOptionToEnum or enum.
      
      This is different from the previous patch I submitted when you could have a
      configOptionToEnum or (a configOptionToEnum followed by one or manu enums) or
      (one or many enums)
      
      ASTERISK-28626
      
      Change-Id: Ia71743ee7ec813f40297b0ddefeee7909db63b6d
      Unverified
      bf4dd3d8
    • Joshua Colp's avatar
      Revert "PJSIP_CONTACT: add missing argument documentation" · d0b198b3
      Joshua Colp authored
      This reverts commit 7e3015d7.
      
      Reason for revert: Regression in XML validation.
      
      validity error : Content model of enumlist is not determinist:
      (configOptionToEnum | (configOptionToEnum , enum+) | enum+)
      
      As we are preparing to do releases and this is not critical
      I am reverting this for now until resolved.
      
      Change-Id: I30c2295f9d7f0a0475674ee77071a7ebabf5b83f
      d0b198b3
  21. Nov 21, 2019
  22. Nov 18, 2019
    • Sean Bright's avatar
      func_env: Prevent FILE() from reading garbage at end-of-file · bf7c8086
      Sean Bright authored
      If the last line of a file does not have a terminating EOL sequence, we
      potentially add garbage to the value returned from the FILE() function.
      
      There is no overflow potential here as we are reading from a buffer of a
      known size, we are just reading too much of it.
      
      ASTERISK-26481 #close
      
      Change-Id: I50dd4fcf416fb3c83150040a1a79a59d9eb1ae01
      bf7c8086
  23. Nov 15, 2019
    • Martin Tomec's avatar
      func_curl.c: Support custom http headers · d257a089
      Martin Tomec authored
      When user wants to send json data, the default Content-Type header
      is incorect (application/x-www-form-urlencoded). This patch allows
      to set any custom headers so the Content-Type header can be
      overriden. User can set multiple headers by multiple calls of
      curlopt(). This approach is not consistent with other parameters,
      but is more readable in dialplan than one call with multiple
      headers.
      
      ASTERISK-28613
      
      Change-Id: I4dd68c3f4e25362ef941d73a3861f58348dcfbf9
      d257a089
  24. Sep 18, 2019
    • Joshua Colp's avatar
      func_jitterbuffer: Add audio/video sync support. · 7298a785
      Joshua Colp authored
      This change adds support to the JITTERBUFFER dialplan function
      for audio and video synchronization. When enabled the RTCP SR
      report is used to produce an NTP timestamp for both the audio and
      video streams. Using this information the video frames are queued
      until their NTP timestamp is equal to or behind the NTP timestamp
      of the audio. The audio jitterbuffer acts as the leader deciding
      when to shrink/grow the jitterbuffer when adaptive is in use. For
      both adaptive and fixed the video buffer follows the size of the
      audio jitterbuffer.
      
      ASTERISK-28533
      
      Change-Id: I3fd75160426465e6d46bb2e198c07b9d314a4492
      7298a785
  25. Sep 14, 2019
  26. Aug 01, 2019
    • Kevin Harwell's avatar
      various modules: json integer overflow · 3656c42c
      Kevin Harwell authored
      There were still a few places in the code that could overflow when "packing"
      a json object with a value outside the base type integer's range. For instance:
      
      unsigned int value = INT_MAX + 1
      ast_json_pack("{s: i}", value);
      
      would result in a negative number being "packed". In those situations this patch
      alters those values to a ast_json_int_t, which widens the value up to a long or
      long long.
      
      ASTERISK-28480
      
      Change-Id: Ied530780d83e6f1772adba0e28d8938ef30c49a1
      3656c42c
  27. Feb 07, 2019
    • Joshua Colp's avatar
      res_odbc: Add basic query logging. · 54a912b2
      Joshua Colp authored
      When Asterisk is connected and used with a database the response
      time of the database can cause problems in Asterisk if it is long.
      Normally the only way to see this problem would be to retrieve a
      backtrace from Asterisk and examine where things are blocked, or
      examine the database to see if there is any indication of a
      problem.
      
      This change adds some basic query logging to make it easier to
      investigate such a problem. When logging is enabled res_odbc will
      now keep track of the number of queries executed, as well as the
      query that has taken the longest time to execute. There is also
      an option which will cause a WARNING message to be output if a
      query takes longer than a configurable amount of time to execute.
      
      This makes it easier and clearer for users that their database may
      be experiencing a problem that could impact Asterisk.
      
      ASTERISK-28277
      
      Change-Id: I173cf4928b10754478a6a8c27dfa96ede0f058a6
      54a912b2
  28. Nov 21, 2018
  29. Nov 19, 2018
    • Kevin Harwell's avatar
      func_strings: HASHKEY - negative array index can cause corruption · 4b5d11ec
      Kevin Harwell authored
      This patch makes it so only matching non-empty key names, and keys created by
      the HASH function are eligible for inclusion in the comma separated string. It
      also fixes a bug where it was possible to write to a negative index if the
      result buffer was empty.
      
      ASTERISK-28159
      patches:
        ASTERISK-28159.diff submitted by Michael Walton (license 6502)
      
      Change-Id: I6e57fe7307dfd856271753aed5ba64c59b511487
      4b5d11ec
  30. Oct 24, 2018
  31. Oct 04, 2018
    • Richard Mudgett's avatar
      func_periodic_hook.c: Cleanup module resources on failure. · c6c3a636
      Richard Mudgett authored
      * Make load_module() cleanup if it failed to setup the module.
      
      * Make unload_module() always return 0.  It is silly to fail unloading if
      the hook function we try to unregister was not even registered.
      
      Change-Id: I280fc6e8ba2a7ee2588ca01d870eebaf74b4ffe6
      c6c3a636
  32. Jun 21, 2018
Loading