Skip to content
Snippets Groups Projects
  1. 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
  2. Jun 21, 2018
  3. Jun 19, 2018
  4. Jun 08, 2018
  5. Jun 07, 2018
    • Alexei Gradinari's avatar
      func_odbc: NODATA if SQLNumResultCols returned 0 columns on readsql · 65ff2f05
      Alexei Gradinari authored
      The functions acf_odbc_read/cli_odbc_read ignore a number of columns
      returned by the SQLNumResultCols.
      If the number of columns is zero it means no data.
      In this case, a SQLFetch function has to be not called,
      because it will cause an error.
      
      ASTERISK-27888 #close
      
      Change-Id: Ie0f7bdac6c405aa5bbd38932c7b831f90729ee19
      65ff2f05
  6. May 11, 2018
    • Corey Farrell's avatar
      Fix GCC 8 build issues. · b5914d90
      Corey Farrell authored
      This fixes build warnings found by GCC 8.  In some cases format
      truncation is intentional so the warning is just suppressed.
      
      ASTERISK-27824 #close
      
      Change-Id: I724f146cbddba8b86619d4c4a9931ee877995c84
      b5914d90
  7. Apr 27, 2018
    • Joshua Colp's avatar
      pjsip: Rewrite OPTIONS support with new eyes. · 882e79b7
      Joshua Colp authored
      The OPTIONS support in PJSIP has organically grown, like many things in
      Asterisk.  It has been tweaked, changed, and adapted based on situations
      run into.  Unfortunately this has taken its toll.  Configuration file
      based objects have poor performance and even dynamic ones aren't that
      great.
      
      This change scraps the existing code and starts fresh with new eyes.  It
      leverages all of the APIs made available such as sorcery observers and
      serializers to provide a better implementation.
      
      1.  The state of contacts, AORs, and endpoints relevant to the qualify
      process is maintained.  This state can be updated by external forces (such
      as a device registering/unregistering) and also the reload process.  This
      state also includes the association between endpoints and AORs.
      
      2.  AORs are scheduled and not contacts.  This reduces the amount of work
      spent juggling scheduled items.
      
      3.  Manipulation of which AORs are being qualified and the endpoint states
      all occur within a serializer to reduce the conflict that can occur with
      multiple threads attempting to modify things.
      
      4.  Operations regarding an AOR use a serializer specific to that AOR.
      
      5.  AORs and endpoint state act as state compositors.  They take input
      from lower level objects (contacts feed AORs, AORs feed endpoint state)
      and determine if a sufficient enough change has occurred to be fed further
      up the chain.
      
      6.  Realtime is supported by using observers to know when a contact has
      been registered.  If state does not exist for the associated AOR then it
      is retrieved and becomes active as appropriate.
      
      The end result of all of this is best shown with a configuration file of
      3000 endpoints each with an AOR that has a static contact.  In the old
      code it would take over a minute to load and use all 8 of my cores.  This
      new code takes 2-3 seconds and barely touches the CPU even while dealing
      with all of the OPTIONS requests.
      
      ASTERISK-26806
      
      Change-Id: I6a5ebbfca9001dfe933eaeac4d3babd8d2e6f082
      882e79b7
  8. Apr 17, 2018
    • George Joseph's avatar
      bridge_softmix: Forward TEXT frames · 4fb7967c
      George Joseph authored
      Core bridging and, more specifically, bridge_softmix have been
      enhanced to relay received frames of type TEXT or TEXT_DATA to all
      participants in a softmix bridge.  res_pjsip_messaging and
      chan_pjsip have been enhanced to take advantage of this so when
      res_pjsip_messaging receives an in-dialog MESSAGE message from a
      user in a conference call, it's relayed to all other participants
      in the call.
      
      res_pjsip_messaging already queues TEXT frames to the channel when
      it receives an in-dialog MESSAGE from an endpoint and chan_pjsip
      will send an MESSAGE when it gets a TEXT frame.  On a normal
      point-to-point call, the frames are forwarded between the two
      correctly.  bridge_softmix was not though so messages weren't
      getting forwarded to conference bridge participants.  Even if they
      were, the bridging code had no way to tell the participants who
      sent the message so it would look like it came from the bridge
      itself.
      
      * The TEXT frame type doesn't allow storage of any meta data, such
      as sender, on the frame so a new TEXT_DATA frame type was added that
      uses the new ast_msg_data structure as its payload.  A channel
      driver can queue a frame of that type when it receives a message
      from outside.  A channel driver can use it for sending messages
      by implementing the new send_text_data channel tech callback and
      setting the new AST_CHAN_TP_SEND_TEXT_DATA flag in its tech
      properties.  If set, the bridging/channel core will use it instead
      of the original send_text callback and it will get the ast_msg_data
      structure. Channel drivers aren't required to implement this.  Even
      if a TEXT_DATA enabled driver uses it for incoming messages, an
      outgoing channel driver that doesn't will still have it's send_text
      callback called with only the message text just as before.
      
      * res_pjsip_messaging now creates a TEXT_DATA frame for incoming
      in-dialog messages and sets the "from" to the display name in the
      "From" header, or if that's empty, the caller id name from the
      channel.  This allows the chat client user to set a friendly name
      for the chat.
      
      * bridge_softmix now forwards TEXT and TEXT_DATA frames to all
      participants (except the sender).
      
      * A new function "ast_sendtext_data" was added to channel which
      takes an ast_msg_data structure and calls a channel's
      send_text_data callback, or if that's not defined, the original
      send_text callback.
      
      * bridge_channel now calls ast_sendtext_data for TEXT_DATA frame
      types and ast_sendtext for TEXT frame types.
      
      * chan_pjsip now uses the "from" name in the ast_msg_data structure
      (if it exists) to set the "From" header display name on outgoing text
      messages.
      
      Change-Id: Idacf5900bfd5f22ab8cd235aa56dfad090d18489
      4fb7967c
  9. Mar 20, 2018
  10. Mar 14, 2018
    • Corey Farrell's avatar
      loader: Convert reload_classes to built-in modules. · 572a508e
      Corey Farrell authored
      * acl (named_acl.c)
      * cdr
      * cel
      * ccss
      * dnsmgr
      * dsp
      * enum
      * extconfig (config.c)
      * features
      * http
      * indications
      * logger
      * manager
      * plc
      * sounds
      * udptl
      
      These modules are now loaded at appropriate time by the module loader.
      Unlike loadable modules these use AST_MODULE_LOAD_FAILURE on error so
      the module loader will abort startup on failure of these modules.
      
      Some of these modules are still initialized or shutdown from outside the
      module loader.  logger.c is initialized very early and shutdown very
      late, manager.c is initialized by the module loader but is shutdown by
      the Asterisk core (too much uses it without holding references).
      
      Change-Id: I371a9a45064f20026c492623ea8062d02a1ab97f
      572a508e
  11. Mar 06, 2018
  12. Feb 22, 2018
  13. Jan 24, 2018
    • Corey Farrell's avatar
      Remove redundant module checks and references. · 527cf5a5
      Corey Farrell authored
      This removes references that are no longer needed due to automatic
      references created by module dependencies.
      
      In addition this removes most calls to ast_module_check as they were
      checking modules which are listed as dependencies.
      
      Change-Id: I332a6e8383d4c72c8e89d988a184ab8320c4872e
      527cf5a5
  14. Jan 15, 2018
    • Corey Farrell's avatar
      loader: Add dependency fields to module structures. · 9cfdb81e
      Corey Farrell authored
      * Declare 'requires' and 'enhances' text fields on module info structure.
      * Rename 'nonoptreq' to 'optional_modules'.
      * Update doxygen comments.
      
      Still need to investigate dependencies among modules I cannot compile.
      
      Change-Id: I3ad9547a0a6442409ff4e352a6d897bef2cc04bf
      9cfdb81e
  15. Jan 04, 2018
  16. Dec 29, 2017
    • Corey Farrell's avatar
      datastore: Add automatic module references. · 0fe7df64
      Corey Farrell authored
      Add a reference to the calling module when it is active to protect
      access to datastore->info.  Remove module references done by
      func_periodic_hook as the datastore now handles it.
      
      ASTERISK-25128 #close
      
      Change-Id: I8357a3711e77591d0d1dd8ab4211a7eedd782c89
      0fe7df64
  17. Dec 28, 2017
  18. Dec 22, 2017
  19. Dec 19, 2017
  20. Dec 06, 2017
    • Richard Mudgett's avatar
      CDR: Fix deadlock setting some CDR values. · 3078b7ad
      Richard Mudgett authored
      Setting channel variables with the AMI Originate action caused a deadlock
      when you set CDR(amaflags) or CDR(accountcode).  This path has the channel
      locked when the CDR function is called.  The CDR function then
      synchronously passes the job to a stasis thread.  The stasis handling
      function then attempts to lock the channel.  Deadlock results.
      
      * Avoid deadlock by making the CDR function handle setting amaflags and
      accountcode directly on the channel rather than passing it off to the CDR
      processing code under a stasis thread to do it.
      
      * Made the CHANNEL function and the CDR function process amaflags the same
      way.
      
      * Fixed referencing the wrong message type in cdr_prop_write().
      
      ASTERISK-27460
      
      Change-Id: I5eacb47586bc0b8f8ff76a19bd92d1dc38b75e8f
      3078b7ad
  21. Nov 02, 2017
    • Corey Farrell's avatar
      Add missing menuselect dependencies. · 606ae348
      Corey Farrell authored
      This adds menuselect dependencies for modules that use symbols of other
      modules.
      
      ASTERISK-27390
      
      Change-Id: Ia2d2849f5b87a72af7324a82edc3f283eafb5385
      606ae348
    • Corey Farrell's avatar
      Prevent unload of modules which implement an Optional API. · 79f111e1
      Corey Farrell authored
      Once an Optional API module is loaded it should stay loaded.  Unloading
      an optional API module runs the risk of a crash if something else is
      using it.  This patch causes all optional API providers to tell the
      module loader not to unload except at shutdown.
      
      ASTERISK-27389
      
      Change-Id: Ia07786fe655681aec49cc8d3d96e06483b11f5e6
      79f111e1
  22. Sep 21, 2017
    • Joshua Colp's avatar
      bridge: Change participant SFU streams when source streams change. · f2985e31
      Joshua Colp authored
      Some endpoints do not like a stream being reused for a new
      media stream. The frame/jitterbuffer can rely on underlying
      attributes of the media stream in order to order the packets.
      When a new stream takes its place without any notice the
      buffer can get confused and the media ends up getting dropped.
      
      This change uses the SSRC change to determine that a new source
      is reusing an existing stream and then bridge_softmix renegotiates
      each participant such that they see a new media stream. This
      causes the frame/jitterbuffer to start fresh and work as expected.
      
      ASTERISK-27277
      
      Change-Id: I30ccbdba16ca073d7f31e0e59ab778c153afae07
      f2985e31
  23. Sep 07, 2017
  24. Aug 30, 2017
    • Corey Farrell's avatar
      AST-2017-006: Fix app_minivm application MinivmNotify command injection · 1bf3dfff
      Corey Farrell authored
      An admin can configure app_minivm with an externnotify program to be run
      when a voicemail is received.  The app_minivm application MinivmNotify
      uses ast_safe_system() for this purpose which is vulnerable to command
      injection since the Caller-ID name and number values given to externnotify
      can come from an external untrusted source.
      
      * Add ast_safe_execvp() function.  This gives modules the ability to run
      external commands with greater safety compared to ast_safe_system().
      Specifically when some parameters are filled by untrusted sources the new
      function does not allow malicious input to break argument encoding.  This
      may be of particular concern where CALLERID(name) or CALLERID(num) may be
      used as a parameter to a script run by ast_safe_system() which could
      potentially allow arbitrary command execution.
      
      * Changed app_minivm.c:run_externnotify() to use the new ast_safe_execvp()
      instead of ast_safe_system() to avoid command injection.
      
      * Document code injection potential from untrusted data sources for other
      shell commands that are under user control.
      
      ASTERISK-27103
      
      Change-Id: I7552472247a84cde24e1358aaf64af160107aef1
      1bf3dfff
  25. May 05, 2017
    • Joshua Colp's avatar
      func_cdr: Allow empty value for CDR dialplan function. · 4146facf
      Joshua Colp authored
      A regression was introduced in 12 where passing an empty value
      to the CDR dialplan function was not longer allowed. This
      change returns to the behavior of 11 where it is permitted.
      
      ASTERISK-26173
      
      Change-Id: I3f148203b54ec088007e29e30005a5de122e51c5
      4146facf
  26. Apr 12, 2017
    • George Joseph's avatar
      modules: change module LOAD_FAILUREs to LOAD_DECLINES · 747beb1e
      George Joseph authored
      In all non-pbx modules, AST_MODULE_LOAD_FAILURE has been changed
      to AST_MODULE_LOAD_DECLINE.  This prevents asterisk from exiting
      if a module can't be loaded.  If the user wishes to retain the
      FAILURE behavior for a specific module, they can use the "require"
      or "preload-require" keyword in modules.conf.
      
      A new API was added to logger: ast_is_logger_initialized().  This
      allows asterisk.c/check_init() to print to the error log once the
      logger subsystem is ready instead of just to stdout.  If something
      does fail before the logger is initialized, we now print to stderr
      instead of stdout.
      
      Change-Id: I5f4b50623d9b5a6cb7c5624a8c5c1274c13b2b25
      747beb1e
  27. Mar 17, 2017
    • Richard Mudgett's avatar
      CHANNEL(callid): Give dialplan access to the callid. · 8cb4f9ce
      Richard Mudgett authored
      * Added CHANNEL(callid) to retrieve the call identifier log tag associated
      with the channel.  Dialplan now has access to the call log search key
      associated with the channel so it can be saved in case there is a problem
      with the call.
      
      ASTERISK-26878
      
      Change-Id: I2c97ebd928b6f3c5bc80c5729e4d3c07f453049f
      8cb4f9ce
  28. Mar 14, 2017
    • Matt Jordan's avatar
      funcs/func_devstate: Remove new line in Device field of during module load · 0ded269b
      Matt Jordan authored
      During module loading of func_devstate, Asterisk emits the current
      device state of all Custom device states currently stored in the AstDB.
      This was erroneously including a new line character ('\n') to the end of
      the device state, causing two new lines to be emitted in
      DeviceStateChange AMI events.
      
      Note that this only happened for those device state changes that
      occurred during startup. Regular device state changes for Custom device
      states are handled elsewhere, and did not have the newline.
      
      ASTERISK-26643 #close
      Reported by: Roman Bedros
      Tested by: Matt Jordan
      patches:
        ami_devstate.diff uploaded by Roman Bedros (License 6842)
      
      Change-Id: I1f4c02fc79c448d43bf725f5039c83d9611d7d93
      0ded269b
  29. Mar 07, 2017
    • Joshua Colp's avatar
      core: Add stream topology changing primitives with tests. · 3ed05bad
      Joshua Colp authored
      This change adds a few things to facilitate stream topology changing:
      
      1. Control frame types have been added for use by the channel driver
      to notify the application that the channel wants to change the stream
      topology or that a stream topology change has been accepted. They are
      also used by the indicate interface to the channel that the application
      uses to indicate it wants to do the same.
      
      2. Legacy behavior has been adopted in ast_read() such that if a
      channel requests a stream topology change it is denied automatically
      and the current stream topology is preserved if the application is
      not capable of handling streams.
      
      Tests have also been written which confirm the multistream and
      non-multistream behavior.
      
      ASTERISK-26839
      
      Change-Id: Ia68ef22bca8e8457265ca4f0f9de600cbcc10bc9
      3ed05bad
  30. Feb 13, 2017
    • Sean Bright's avatar
      cli: Fix various CLI documentation and completion issues · 3f943737
      Sean Bright authored
      * app_minivm: Use built-in completion facilities to complete optional
      arguments.
      
      * app_voicemail: Use built-in completion facilities to complete
      optional arguments.
      
      * app_confbridge: Add missing colons after 'Usage' text.
      
      * chan_alsa: Use built-in completion facilities to complete optional
      arguments.
      
      * chan_sip: Use built-in completion facilities to complete optional
      arguments. Add completions for 'load' for 'sip show user', 'sip show
      peer', and 'sip qualify peer.'
      
      * chan_skinny: Correct and extend completions for 'skinny reset' and
      'skinny show line.'
      
      * func_odbc: Correct completions for 'odbc read' and 'odbc write'
      
      * main/astmm: Use built-in completion facilities to complete arguments
      for 'memory' commands.
      
      * main/bridge: Correct completions for 'bridge kick.'
      
      * main/ccss: Use built-in completion facilities to complete arguments
      for 'cc cancel' command.
      
      * main/cli: Add 'all' completion for 'channel request hangup.' Correct
      completions for 'core set debug channel.' Correct completions for 'core
      show calls.'
      
      * main/pbx_app: Remove redundant completions for 'core show
      applications.'
      
      * main/pbx_hangup_handler: Remove unused completions for 'core show
      hanguphandlers all.'
      
      * res_sorcery_memory_cache: Add completion for 'reload' argument of
      'sorcery memory cache stale' and properly implement.
      
      Change-Id: Iee58c7392f6fec34ad9d596109117af87697bbca
      3f943737
  31. Feb 10, 2017
    • Sean Bright's avatar
      manager: Restore Originate failure behavior from Asterisk 11 · 09107730
      Sean Bright authored
      In Asterisk 11, if the 'Originate' AMI command failed to connect the provided
      Channel while in extension mode, a 'failed' extension would be looked up and
      run. This was, I believe, unintentionally removed in 51b6c496. This patch
      restores that behavior.
      
      This also adds an enum for the various 'synchronous' modes in an attempt to
      make them meaningful.
      
      ASTERISK-26115 #close
      Reported by: Nasir Iqbal
      
      Change-Id: I8afbd06725e99610e02adb529137d4800c05345d
      09107730
  32. Jan 23, 2017
    • Lorenzo Miniero's avatar
      media: Add experimental support for RTCP feedback. · 1061539b
      Lorenzo Miniero authored
      This change adds experimental support for providing RTCP
      feedback information to codec modules so they can dynamically
      change themselves based on conditions.
      
      ASTERISK-26584
      
      Change-Id: Ifd6aa77fb4a7ff546c6025900fc2baf332c31857
      1061539b
  33. Jan 22, 2017
    • Richard Mudgett's avatar
      LISTFILTER: Remove outdated ERROR message. · cfe72c39
      Richard Mudgett authored
      Feeding LISTFILTER an empty variable results in an invalid ERROR message.
      Earlier changes made the message useless because we can no longer tell if
      the variable is empty or does not exist.  It is valid to try to remove a
      value from an empty list just as it is valid to try to remove a value that
      is not in a non-empty list.
      
      * Removed the outdated ERROR message.
      
      * Added more test cases to the LISTFILTER unit test.
      
      Change-Id: Ided9040e6359c44a335ef54e02ef5950a1863134
      cfe72c39
  34. Oct 27, 2016
    • Corey Farrell's avatar
      Remove ASTERISK_REGISTER_FILE. · a6e5bae3
      Corey Farrell authored
      ASTERISK_REGISTER_FILE no longer has any purpose so this commit removes
      all traces of it.
      
      Previously exported symbols removed:
      * __ast_register_file
      * __ast_unregister_file
      * ast_complete_source_filename
      
      This also removes the mtx_prof static variable that was declared when
      MTX_PROFILE was enabled.  This variable was only used in lock.c so it
      is now initialized in that file only.
      
      ASTERISK-26480 #close
      
      Change-Id: I1074af07d71f9e159c48ef36631aa432c86f9966
      a6e5bae3
  35. Aug 16, 2016
    • Corey Farrell's avatar
      Refactor usage pattern of xmldoc info tag. · 824a4e84
      Corey Farrell authored
      This updates func_channel.c and main/message.c to use a generic xpointer
      include instead of including info from each channel driver.  Now the
      name attribute of info is CHANNEL or CHANNEL_EXAMPLES to be included in
      documentation for func_channel.  Setting the name attribute of info to
      MessageToInfo or MessageFromInfo causes it to be included in the
      MessageSend application and AMI action.
      
      Change-Id: I89fd8276a3250824241a618009714267d3a8d1ea
      824a4e84
  36. Aug 15, 2016
    • Matt Jordan's avatar
      func_channel: Reorganize documentation · ddab42e2
      Matt Jordan authored
      * Following the example of the PJSIP channel driver, the channel
        technology specific documentation has been moved to the respective
        channel drivers that provide that functionality. This has the benefit
        of locating the documentation of items with those modules that provide
        it.
      
      * Examples of using the CHANNEL function for both standard items as well
        as for PJSIP have been added.
      
      * The 'max_forwards' standard item has been documented.
      
      Change-Id: Ifaa79a232c8ac99cf8da6ef6cc7815d398b1b79b
      ddab42e2
  37. Jul 27, 2016
    • David M. Lee's avatar
      Portably sscanf tv_usec · feb1a434
      David M. Lee authored
      In a timeval, tv_usec is defined as a suseconds_t, which could be
      different underlying types on different platforms. Instead of trying to
      scanf directly into the timeval, scanf into a long int, then copy that
      into the timeval.
      
      Change-Id: I29f22d049d3f7746b6c0cc23fbf4293bdaa5eb95
      feb1a434
  38. Jul 18, 2016
    • Corey Farrell's avatar
      Unit tests: Use AST_TEST_DEFINE in conditional code only. · cf1188a1
      Corey Farrell authored
      If AST_TEST_DEFINE is not conditional to TEST_FRAMEWORK it produces dead
      code.  This places all existing unit tests into a conditional block if
      they weren't already.
      
      ASTERISK-26211 #close
      
      Change-Id: I8ef83ee11cbc991b07b7a37ecb41433e8c734686
      cf1188a1
  39. Jul 12, 2016
    • Joshua Colp's avatar
      func_odbc: Fix connection deadlock. · 4ad333bb
      Joshua Colp authored
      The func_odbc module was modified to ensure that the
      previous behavior of using a single database connection
      was maintained. This was done by getting a single database
      connection and holding on to it. With the new multiple
      connection support in res_odbc this will actually starve
      every other thread from getting access to the database as
      it also maintains the previous behavior of having only
      a single database connection.
      
      This change disables the func_odbc specific behavior if
      the res_odbc module is running with only a single database
      connection active. The connection is only kept for the
      duration of the request.
      
      ASTERISK-26177 #close
      
      Change-Id: I9bdbd8a300fb3233877735ad3fd07bce38115b7f
      4ad333bb
Loading