Skip to content
Snippets Groups Projects
  1. Jan 11, 2022
    • Naveen Albert's avatar
      documentation: Document built-in system and channel vars · 707f3217
      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
      707f3217
  2. Dec 13, 2021
    • Naveen Albert's avatar
      func_json: Adds JSON_DECODE function · c0cdaf02
      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
      c0cdaf02
  3. Dec 02, 2021
  4. Nov 30, 2021
    • Naveen Albert's avatar
      documentation: Standardize examples · bcb7aee7
      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
      bcb7aee7
  5. Nov 18, 2021
  6. Nov 16, 2021
    • Josh Soref's avatar
      funcs: Spelling fixes · c0fafa18
      Josh Soref authored
      Correct typos of the following word families:
      
      effectively
      emitted
      expect
      anthony
      
      ASTERISK-29714
      
      Change-Id: Ic16f9ec855bb6d14ec8e170b90af9a36b06d488a
      c0fafa18
  7. Oct 19, 2021
    • Sean Bright's avatar
      func_talkdetect.c: Fix logical errors in silence detection. · 8c2720e5
      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
      8c2720e5
  8. Sep 22, 2021
  9. Sep 21, 2021
  10. Sep 10, 2021
    • Naveen Albert's avatar
      func_strings: Add STRBETWEEN function · 6198c1d2
      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
      6198c1d2
    • Naveen Albert's avatar
      func_env: Add DIRNAME and BASENAME functions · 19de228e
      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
      19de228e
    • Naveen Albert's avatar
      func_sayfiles: Retrieve say file names · b6b7b149
      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
      b6b7b149
  11. Aug 19, 2021
    • Naveen Albert's avatar
      func_math: Return integer instead of float if possible · c52ef4ac
      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
      c52ef4ac
    • Naveen Albert's avatar
      func_scramble: Audio scrambler function · 3eec5b8c
      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
      3eec5b8c
  12. Aug 09, 2021
    • Naveen Albert's avatar
      func_frame_drop: New function · 118d8482
      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
      118d8482
  13. Jun 11, 2021
    • Jaco Kroon's avatar
      func_lock: Prevent module unloading in-use module. · 6b678210
      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>
      6b678210
    • Jaco Kroon's avatar
      func_lock: Add "dialplan locks show" cli command. · 6f303335
      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>
      6f303335
    • Jaco Kroon's avatar
      func_lock: Fix memory corruption during unload. · a3df5d7d
      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>
      a3df5d7d
    • Jaco Kroon's avatar
      func_lock: Fix requesters counter in error paths. · 6bd741b7
      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>
      6bd741b7
  14. May 26, 2021
    • Naveen Albert's avatar
      func_math: Three new dialplan functions · 9106c9d1
      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
      9106c9d1
    • Naveen Albert's avatar
      func_volume: Add read capability to function. · 033c2a22
      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
      033c2a22
  15. Mar 16, 2021
    • Joshua C. Colp's avatar
      xml: Embed module information into core XML documentation. · 60800b03
      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
      60800b03
  16. Mar 10, 2021
  17. Feb 23, 2021
    • Jaco Kroon's avatar
      func_odbc: Introduce minargs config and expose ARGC in addition to ARGn. · bee35fe0
      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>
      bee35fe0
  18. Jan 06, 2021
    • Jaco Kroon's avatar
      func_lock: fix multiple-channel-grant problems. · 3a230cc6
      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>
      3a230cc6
  19. Nov 20, 2020
  20. Nov 06, 2020
    • Dovid Bender's avatar
      func_curl.c: Allow user to set what return codes constitute a failure. · c635c782
      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
      c635c782
  21. Nov 03, 2020
  22. Sep 23, 2020
    • Sean Bright's avatar
      func_curl.c: Prevent crash when using CURLOPT(httpheader) · 28c88e8f
      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
      28c88e8f
  23. Apr 20, 2020
  24. Apr 14, 2020
  25. Apr 08, 2020
  26. Mar 31, 2020
  27. Feb 10, 2020
  28. 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
  29. 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
  30. Nov 21, 2019
  31. 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
  32. 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
Loading