Skip to content
Snippets Groups Projects
  1. Dec 03, 2015
    • Jonathan Rose's avatar
      Fix crash in audiohook translate to slin · 69457b8d
      Jonathan Rose authored
      This patch fixes a crash which would occur when an audiohook was
      applied to a channel using an audio codec that could not be translated
      to signed linear (such as when using pass-through codecs like OPUS or
      when the codec translator module for the format in use is not loaded).
      
      ASTERISK-25498 #close
      Reported by: Ben Langfeld
      
      Change-Id: Ib6ea7373fcc22e537cad373996136636201f4384
      69457b8d
  2. Nov 16, 2015
    • George Joseph's avatar
      dns: Fix pointer increment in dns_parse_answer_ex · 6919daab
      George Joseph authored
      When dns_parse_answer_ex was iterating over the answers it
      wasn't incrementing the answer pointer correctly after the first
      answer.  The result was that no answers after the first
      were being returned.  For results where multiple records should
      have been sorted by priority, weight, etc., there was nothing
      to sort so the only the first record was returned even if it
      wouldn't have been the correct record based on the sort.
      
      ASTERISK-25565 #close
      Reported-by: Daniel Tryba
      Tested-by George Joseph
      
      Change-Id: I8622604fefdcd3c11e2c5609a6382e53b1467b0b
      6919daab
  3. Nov 14, 2015
    • Joshua Colp's avatar
      hashtab: Add NULL check when destroying iterator. · a1fcf6f7
      Joshua Colp authored
      The hashtab API is pretty NULL tolerant which has resulted
      in remaining callers not doing much checks themselves.
      Unfortunately the function to destroy an iterator does not
      do a NULL check and will result in a crash if passed NULL.
      This change fixes that.
      
      ASTERISK-25552 #close
      
      Change-Id: Ic1bf8eec3639e5a440f1c941d3ae3893ac6ed619
      a1fcf6f7
  4. Nov 13, 2015
    • Mark Michelson's avatar
      Taskprocessors: Increase high-water mark · e8881e17
      Mark Michelson authored
      In practical tests, we have seen certain taskprocessors, specifically
      Stasis subscription taskprocessors, cross the recently-added high-water
      mark and emit a warning. This high-water mark warning is only intended
      to be emitted when things have tanked on the system and things are
      heading south quickly. In the practical tests, the Stasis taskprocessors
      sometimes had a max depth of 180 tasks in them, and Asterisk wasn't in
      any danger at all.
      
      As such, this ups the high-water mark to 500 tasks instead. It also
      redefines the SIP threadpool request denial number to be a multiple of
      the taskprocessor high-water mark.
      
      Change-Id: Ic8d3e9497452fecd768ac427bb6f58aa616eebce
      e8881e17
    • Alexander Traud's avatar
      format: Register format-attribute module with cached formats. · fd23d423
      Alexander Traud authored
      In Asterisk 13, cached formats are created before their corresponding format-
      attribute module is registered. Cached formats are involved when a local
      extension is called. Therefore, ast_format_generate_sdp_fmtp did not work
      on local extensions. This change affects the Opus Codec, H.263 (Plus), H.264,
      and format-attribute modules provided externally.
      
      ASTERISK-25160 #close
      
      Change-Id: I1ea1f0483e5261e2a050112e4ebdfc22057d1354
      fd23d423
  5. Nov 12, 2015
    • Mark Michelson's avatar
      res_pjsip: Deny requests when threadpool queue is backed up. · 264c74aa
      Mark Michelson authored
      We have observed situations where the SIP threadpool may become
      deadlocked. However, because incoming traffic is still arriving, the SIP
      threadpool's queue can continue to grow, eventually running the system
      out of memory.
      
      This change makes it so that incoming traffic gets rejected with a 503
      response if the queue is backed up too much.
      
      Change-Id: I4e736d48a2ba79fd1f8056c0dcd330e38e6a3816
      264c74aa
    • Joshua Colp's avatar
      format_cap: Don't append the 'none' format when appending all. · a1597476
      Joshua Colp authored
      When appending all formats of a type all the codecs are iterated
      and added. This operation was incorrectly adding the ast_format_none
      format which is special in that it is supposed to be used when no
      format is present. It shouldn't be appended.
      
      ASTERISK-25535
      
      Change-Id: I7b00f3bdf4a5f3022e483d6ece602b1e8b12827c
      a1597476
  6. Nov 11, 2015
    • Joshua Colp's avatar
      threadpool: Handle worker thread transitioning to dead when going active. · 29543544
      Joshua Colp authored
      This change adds handling of dead worker threads when moving them
      to be active. When this happens the worker thread is removed from
      both the active and idle threads container. If no threads are able
      to be moved to active then the pool grows as configured.
      
      A unit test has also been added which thrashes the idle timeout
      and thread activation to exploit any race conditions between the
      two.
      
      ASTERISK-25546 #close
      
      Change-Id: I6c455f9a40de60d9e86458d447b548fb52ba1143
      29543544
    • Alexander Traud's avatar
      rtp_engine: Init a format-attribute module to its RFC defaults. · 525c7ab7
      Alexander Traud authored
      Previously, format-attribute modules relied on an existing fmtp line in SDP
      negotiation. However, fmtp is optional for several formats like the Opus Codec.
      Now, the format-attribute module is called with an empty fmtp, which allows the
      module to initialise itself to RFC defaults. Furthermore now, Asterisk is able
      to differentiate between internally and externally created formats.
      
      ASTERISK-25537 #close
      
      Change-Id: I28f680cef7fdf51c0969ff8da71548edad72ec52
      525c7ab7
  7. Nov 10, 2015
  8. Nov 09, 2015
  9. Nov 06, 2015
    • George Joseph's avatar
      dns: Use ntohl for ans->ttl in dns_parse_answer_ex · d82a4b09
      George Joseph authored
      dns_parse_answer_ex was not converting ans->ttl from network
      by order to host byte order which was causing certain ttls
      it to go negative. In turn this was causing answer edit checks
      to fail.
      
      ASTERISK-25528 #close
      Reported-by: Daniel Tryba
      Tested-by: George Joseph
      
      Change-Id: I31505132d6321c46d2f39fd06c20ee808a864037
      d82a4b09
    • Walter Doekes's avatar
      xmldoc: Improve xmldoc wrapping of 'core show ...' output. · 74e73333
      Walter Doekes authored
      Previously, the wrapping did both lookahead and lookback, which,
      together with color escape sequences, caused some lines to be wrapped
      way earlier than other lines.  This led to inconsistent output.
      
      This simplifies the wrapping code and makes it more sane: if maxcolumns
      is hit, we simply jump back to the last space and wrap there.
      
      ASTERISK-25527 #close
      
      Change-Id: I56d01c6f9a812642b1b05535c98d4db48d17c957
      74e73333
  10. Nov 05, 2015
    • Jonathan Rose's avatar
      taskprocessor: Add high water mark warnings · a2c2a8e1
      Jonathan Rose authored
      If a taskprocessor's queue grows large, this can indicate that there
      may be a problem with tasks not leaving the processor or else that
      the number of available task processors for a given type of task is
      too low. This patch makes it so that if a taskprocessor's task queue
      grows above 100 queued tasks that it will emit a warning message.
      Warning messages are emitted only once per task processor.
      
      ASTERISK-25518 #close
      Reported by: Jonathan Rose
      
      Change-Id: Ib1607c35d18c1d6a0575b3f0e3ff5d932fd6600c
      a2c2a8e1
  11. Nov 04, 2015
    • Matt Jordan's avatar
      main/dial: Protect access to the format_cap structure of the requesting channel · 9c293b51
      Matt Jordan authored
      When a dial attempt is made that involves a requesting channel, we previously
      were not:
      a) Protecting access to the native format capabilities structure on the
         requesting channel. That is inherently unsafe.
      b) Reference bumping the lifetime of the format capabilities structure.
      
      In both cases, something else could sneak in, blow away the format
      capabilities, and we'd be holding onto an invalid format_cap structure. When
      the newly created channel attempts to construct its format capabilities, things
      go poorly.
      
      This patch:
      a) Ensures that we get a reference to the native format capabilities while
         the requesting channel is locked
      b) Holds a reference to the native format capabilities during the creation
         of the new channel.
      
      ASTERISK-25522 #close
      
      Change-Id: I0bfb7ba8b9711f4158cbeaae96edf9626e88a54f
      9c293b51
    • Corey Farrell's avatar
      Fix cli display of build options. · b0bf1899
      Corey Farrell authored
      A previous commit reduced the AST_BUILDOPTS compiler define to
      only include options that affected ABI.  This included some options
      that were previously displayed by cli "core show settings".  This
      change corrects the CLI display while still restricting buildopts.h
      to ABI effecting options only.
      
      ASTERISK-25434 #close
      Reported by: Rusty Newton
      
      Change-Id: Id07af6bedd1d7d325878023e403fbd9d3607e325
      b0bf1899
  12. Nov 03, 2015
    • Matt Jordan's avatar
      main/stasis_endpoints: Fix ContactStatusChange JSON for roundtrip_usec field · e26a06c1
      Matt Jordan authored
      The JSON packing for the ContactStatusChange event forgot to include the
      roundtrip_usec field. As a result, the field never showed up in any event,
      even when the data was available. This patch corrects that error by properly
      packing the JSON blob with the data.
      
      Change-Id: I8df80da659a44010afbd48f645967518ff5daa17
      e26a06c1
  13. Oct 22, 2015
    • Mark Michelson's avatar
      format_cap: Detect vector allocation failures. · 5dd9e193
      Mark Michelson authored
      A crash was seen on a system that ran out of memory due to Asterisk not
      checking for vector allocation failures in format_cap.c. With this
      change, if either of the AST_VECTOR_INIT calls fail, we will return a
      value indicating failure.
      
      Change-Id: Ieb9c59f39dfde6d11797a92b45e0cf8ac5722bc8
      5dd9e193
  14. Oct 21, 2015
  15. Oct 20, 2015
    • Jonh Wendell's avatar
      main/cdr: Allow modules to modify CDR fields before dispatching them · 77780790
      Jonh Wendell authored
      This patch adds the functions
      
      	ast_cdr_modifier_register()
      	ast_cdr_modifier_unregister()
      
      That work much like ast_cdr_register() and ast_cdr_unregister().
      
      Modules registered will be given a chance to modify (or to do whatever
      they want) CDR fields just before they are passed to registered engines.
      
      Thus, for instance, if a module change the "userfield" field of a CDR,
      the modified value will be passed to every registered CDR backend for
      logging.
      
      ASTERISK-25479 #close
      
      Change-Id: If11d8fd19ef89b1a66ecacf1201e10fcf86ccd56
      77780790
  16. Oct 12, 2015
    • Richard Mudgett's avatar
      config.c: Fix off-nominal memory leak. · 984f100d
      Richard Mudgett authored
      Change-Id: I06e346e9a5c63cc5071e7eda537310c4b43bffe0
      984f100d
    • Richard Mudgett's avatar
      config.c: Fix potential memory corruption after [section](+). · 99512557
      Richard Mudgett authored
      The memory corruption could happen if the [section](+) is the last section
      in the file with trailing comments.  In this case process_text_line() has
      left *last_cat is set to newcat and newcat is destroyed.
      
      Change-Id: I0d1d999f553986f591becd000e7cc6ddfb978d93
      99512557
    • Richard Mudgett's avatar
      config.c: Fix #include after [section](+). · c1ed11ee
      Richard Mudgett authored
      An #include right after a [section](+) would associate any variable
      assignments before a new section in the #include with the wrong section.
      
      * Fix section association by setting the current section to the appended
      section.
      
      * Fix '+' and '!' section flag interaction corner case depending upon
      which flag came first.  If the '!' came first then it would be ignored.
      If the '!' came after then it would affect the appended section.  The '!'
      will now no longer be ignored.
      
      ASTERISK-25461 #close
      Reported by: Sean Pimental
      
      Change-Id: Ic9d3191c8758048e2cbce6432f854b32531731c3
      c1ed11ee
  17. Oct 03, 2015
    • Ivan Poddubny's avatar
      manager: Fix GetConfigJSON returning invalid JSON · 89dec767
      Ivan Poddubny authored
      When GetConfigJSON was introduced back in 1.6, it returned each
      section as an array of strings: ["key=value", "key2=value2"].
      Afterwards, it was changed a few times and became
      ["key": "value", "key2": "value2"], which is not a correct JSON.
      This patch fixes that by constructing a JSON object {} instead of
      an array [].
      
      Also, the keys "istemplate" and "tempates" that are used to
      indicate templates and their inherited categories are now wrapped in
      quotes.
      
      ASTERISK-25391 #close
      Reported by: Bojan Nemčić
      
      Change-Id: Ibbe93c6a227dff14d4a54b0d152341857bcf6ad8
      89dec767
  18. Sep 30, 2015
  19. Sep 29, 2015
    • Matt Jordan's avatar
      main/logger: Add log formatters and JSON structured logs · 2d7a4a33
      Matt Jordan authored
      When Asterisk is part of a larger distributed system, log files are often
      gathered using tools (such as logstash) that prefer to consume information
      and have it rendered using other tools (such as Kibana) that prefer a
      structured format, e.g., JSON. This patch adds support for JSON formatted
      logs by adding support for an optional log format specifier in Asterisk's
      logging subsystem. By adding a format specifier of '[json]':
      
      full => [json]debug,verbose,notice,warning,error
      
      Log messages will be output to the 'full' channel in the following
      format:
      
      {
        "hostname": Hostname or name specified in asterisk.conf
        "timestamp": Date/Time
        "identifiers": {
          "lwp": Thread ID,
          "callid": Call Identifier
        }
        "logmsg": {
          "location": {
            "filename": Name of the file that generated the log statement
            "function": Function that generated the log statement
            "line": Line number that called the logging function
          }
          "level": Log level, e.g., DEBUG, VERBOSE, etc.
          "message": Actual text of the log message
        }
      }
      
      ASTERISK-25425 #close
      
      Change-Id: I8649bfedf3fb7bf3138008cc11565553209cc238
      2d7a4a33
  20. Sep 24, 2015
    • Mark Michelson's avatar
      logger: Prevent duplicate dynamic channels from being added. · 3eefa07a
      Mark Michelson authored
      There was a problem observed where the "logger add channel" CLI command
      would allow for a channel with the same name to be added multiple times.
      This would result in each message being written out to the same file
      multiple times.
      
      The problem was due to the difference in how logger channel filenames
      are stored versus the format they are allowed to be presented when they
      are added. For instance, if adding the logger channel "foo" through the
      CLI, the result would be a logger channel with the file name
      /var/log/asterisk/foo being stored. So when trying to add another "foo"
      channel, "foo" would not match "/var/log/asterisk/foo" so we'd happily
      add the duplicate channel.
      
      The fix presented here is to introduce two new methods in the logger
      code:
       * make_filename(): given a logger channel name, this creates the
         filename for that logger channel.
       * find_logchannel(): given a logger channel name, this calls
         make_filename() and then traverses the list of logchannels in order
         to find a match.
      
      This change has made use of make_filename() and find_logchannel()
      throughout to more consistently behave.
      
      ASTERISK-25305 #close
      Reported by Mark Michelson
      
      Change-Id: I892d52954d6007d8bc453c3cbdd9235dec9c4a36
      3eefa07a
    • Mark Michelson's avatar
      Do not swallow frames on channels leaving bridges. · f42084be
      Mark Michelson authored
      When leaving a bridge, indications on a channel could be swallowed by
      the internal indication logic because it appears that the channel is on
      its way to be hung up anyway. One such situation where this is
      detrimental is when channels on hold are redirected out of a bridge. The
      AST_CONTROL_UNHOLD indication from the bridging code is swallowed,
      leaving the channel in question to still appear to be on hold.
      
      The fix here is to modify the logic inside ast_indicate_data() to not
      drop the indication if the channel is simply leaving a bridge. This way,
      channels on hold redirected out of a bridge revert to their expected "in
      use" state after the redirection.
      
      ASTERISK-25418 #close
      Reported by Mark Michelson
      
      Change-Id: If6115204dfa0551c050974ee138fabd15f978949
      f42084be
  21. Sep 22, 2015
    • Richard Mudgett's avatar
      app_page.c: Fix crash when forwarding with a predial handler. · 06f4f80a
      Richard Mudgett authored
      Page uses the async method of dialing with the dial API.  When a call gets
      forwarded there is no calling channel available.  If the predial handler
      was set then the calling channel could not be put into auto-service
      for the forwarded call because it doesn't exist.  A crash is the result.
      
      * Moved the callee predial parameter string processing to before the
      string is passed to the dial API rather than having the dial API do it.
      There are a few benefits do doing this.  The first is the predial
      parameter string processing doesn't need to be done for each channel
      called by the dial API.  The second is in async mode and the forwarded
      channel is to have the predial handler executed on it then the
      non-existent calling channel does not need to be present to process the
      predial parameter string.
      
      * Don't start auto-service on a non-existent calling channel to execute
      the predial handler when the dial API is in async mode and forwarding a
      call.
      
      ASTERISK-25384 #close
      Reported by: Chet Stevens
      
      Change-Id: If53892b286d29f6cf955e2545b03dcffa2610981
      06f4f80a
  22. Sep 21, 2015
    • Elazar Broad's avatar
      core/logging: Fix logging to more than one syslog channel · a29cf45c
      Elazar Broad authored
      Currently, Asterisk will log to the last configured syslog
      channel in logger.conf. This is due to the fact that the
      final call to openlog() supersedes all of the previous calls.
      This commit removes the call to openlog() and passes the
      facility to ast_log_vsyslog(), along with utilizing the
      LOG_MAKEPRI macro to ensure that the message is routed to
      the correct facility and with the correct priority.
      
      ASTERISK-25407 #close
      Reported by: Elazar Broad
      Tested by: Elazar Broad
      
      Change-Id: Ie2a2416bc00cce1b04e99ef40917c2011953ddd2
      a29cf45c
    • Matt Jordan's avatar
      ARI: Add events for Contact and Peer Status changes · 5206aa9d
      Matt Jordan authored
      This patch adds support for receiving events regarding Peer status changes
      and Contact status changes. This is particularly useful in scenarios where
      we are subscribed to all endpoints and channels, where we often want to know
      more about the state of channel technology specific items than a single
      endpoint's state.
      
      ASTERISK-24870
      
      Change-Id: I6137459cdc25ce27efc134ad58abf065653da4e9
      5206aa9d
  23. Sep 19, 2015
    • Alexander Traud's avatar
      astfd: Adds a timestamp for each entry. · 9200ad03
      Alexander Traud authored
      Now with menuselect "DEBUG_FD_LEAKS" and CLI "core show fd", a timestamp is
      shown with each file descriptor. This helps to debug leaked UDP/TCP ports on
      long-lived servers, for example.
      
      ASTERISK-25405 #close
      
      Change-Id: I968339e5155a512eba1032a5263f1ec8b5e1f80b
      9200ad03
    • Joshua Colp's avatar
      pbx: Update device and presence state when changing a hint extension. · 42a897c4
      Joshua Colp authored
      When changing a hint extension without removing the hint first the
      device state and presence state is not updated. This causes the state
      of the hint to be that of the previous extension and not the current
      one. This state is kept until a state change occurs as a result of
      something (presence state change, device state change).
      
      This change updates the hint with the current device and presence
      state of the new extension when it is changed. Any state callbacks
      which may have been added before the hint extension is changed are
      also informed of the new device and presence state if either have
      changed.
      
      ASTERISK-25394 #close
      
      Change-Id: If268f1110290e502c73dd289c9e7e7b27bc8432f
      42a897c4
  24. Sep 17, 2015
    • Alexander Traud's avatar
      translate: Fix transcoding while different in frame size. · 077adf48
      Alexander Traud authored
      When Asterisk translates between codecs, each with a different frame size (for
      example between iLBC 30 and Speex-WB), too large frames were created by
      ast_trans_frameout. Now, ast_trans_frameout is called with the correct frame
      length, creating several frames when necessary. Affects all transcoding modules
      which used ast_trans_frameout: GSM, iLBC, LPC10, and Speex.
      
      ASTERISK-25353 #close
      
      Change-Id: I2e229569d73191d66a4e43fef35432db24000212
      077adf48
  25. Sep 15, 2015
    • Mark Michelson's avatar
      scheduler: Use queue for allocating sched IDs. · 0a74c803
      Mark Michelson authored
      It has been observed that on long-running busy systems, a scheduler
      context can eventually hit INT_MAX for its assigned IDs and end up
      overflowing into a very low negative number. When this occurs, this can
      result in odd behaviors, because a negative return is interpreted by
      callers as being a failure. However, the item actually was successfully
      scheduled. The result may be that a freed item remains in the scheduler,
      resulting in a crash at some point in the future.
      
      The scheduler can overflow because every time that an item is added to
      the scheduler, a counter is bumped and that counter's current value is
      assigned as the new item's ID.
      
      This patch introduces a new method for assigning scheduler IDs. Instead
      of assigning from a counter, a queue of available IDs is maintained.
      When assigning a new ID, an ID is pulled from the queue. When a
      scheduler item is released, its ID is pushed back onto the queue. This
      way, IDs may be reused when they become available, and the growth of ID
      numbers is directly related to concurrent activity within a scheduler
      context rather than the uptime of the system.
      
      Change-Id: I532708eef8f669d823457d7fefdad9a6078b99b2
      0a74c803
  26. Sep 11, 2015
    • Matt Jordan's avatar
      main/config_options: Check for existance of internal object before derefing · 45cf7966
      Matt Jordan authored
      Asterisk can load and register an object type while still having an invalid
      sorcery mapping. This can cause an issue when a creation call is invoked.
      For example, mis-configuring PJSIP's endpoint identifier by IP address mapping
      in sorcery.conf will cause the sorcery mechanism to be invalidated; however, a
      subsequent ARI invocation to create the object will cause a crash, as the
      internal type may not be registered as sorcery expects.
      
      Merely checking for a NULL pointer here solves the issue.
      
      Change-Id: I54079fb94a1440992f4735a9a1bbf1abb1c601ac
      45cf7966
Loading