Skip to content
Snippets Groups Projects
  1. Jun 16, 2014
    • Kevin Harwell's avatar
      res_http_websocket: read/write string fixup · bd0aa4fb
      Kevin Harwell authored
      There was a problem when reading a string from the websocket. It assumed the
      received data had a null terminator and tried to write the data to an ast_str.
      This of course could/would read past the end of the given buffer while
      writing the data to the internal buffer of ast_str. Modified the the code to
      correctly place a null terminator on the result string.
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416394 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      bd0aa4fb
  2. Jun 13, 2014
    • Matthew Jordan's avatar
      stasis: Reduce creation of channel snapshots to improve performance · 9cc1a8e8
      Matthew Jordan authored
      During some performance testing of Asterisk with AGI, ARI, and lots of Local
      channels, we noticed that there's quite a hit in performance during channel
      creation and releasing to the dialplan (ARI continue). After investigating
      the performance spike that occurs during channel creation, we discovered
      that we create a lot of channel snapshots that are technically unnecessary.
      This includes creating snapshots during:
       * AGI execution
       * Returning objects for ARI commands
       * During some Local channel operations
       * During some dialling operations
       * During variable setting
       * During some bridging operations
      And more.
      
      This patch does the following:
       - It removes a number of fields from channel snapshots. These fields were
         rarely used, were expensive to have on the snapshot, and hurt performance.
         This included formats, translation paths, Log Call ID, callgroup, pickup
         group, and all channel variables. As a result, AMI Status,
         "core show channel", "core show channelvar", and "pjsip show channel" were
         modified to either hit the live channel or not show certain pieces of data.
         While this is unfortunate, the performance gain from this patch is worth
         the loss in behaviour.
       - It adds a mechanism to publish a cached snapshot + blob. A large number of
         publications were changed to use this, including:
         - During Dial begin
         - During Variable assignment (if no AMI variables are emitted - if AMI
           variables are set, we have to make snapshots when a variable is changed)
         - During channel pickup
         - When a channel is put on hold/unhold
         - When a DTMF digit is begun/ended
         - When creating a bridge snapshot
         - When an AOC event is raised
         - During Local channel optimization/Local bridging
         - When endpoint snapshots are generated
         - All AGI events
         - All ARI responses that return a channel
         - Events in the AgentPool, MeetMe, and some in Queue
       - Additionally, some extraneous channel snapshots were being made that were
         unnecessary. These were removed.
       - The result of ast_hashtab_hash_string is now cached in stasis_cache. This
         reduces a large number of calls to ast_hashtab_hash_string, which reduced
         the amount of time spent in this function in gprof by around 50%.
      
      #ASTERISK-23811 #close
      Reported by: Matt Jordan
      
      Review: https://reviewboard.asterisk.org/r/3568/
      ........
      
      Merged revisions 416211 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416216 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      9cc1a8e8
    • Richard Mudgett's avatar
      AST-2014-007: Fix of fix to allow AMI and SIP TCP to send messages. · 13e697f8
      Richard Mudgett authored
      ASTERISK-23673 #close
      Reported by: Richard Mudgett
      
      Review: https://reviewboard.asterisk.org/r/3617/
      ........
      
      Merged revisions 416066 from http://svn.asterisk.org/svn/asterisk/branches/1.8
      ........
      
      Merged revisions 416067 from http://svn.asterisk.org/svn/asterisk/branches/11
      ........
      
      Merged revisions 416070 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416071 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      13e697f8
  3. Jun 12, 2014
    • Richard Mudgett's avatar
      AST-2014-007: Fix DOS by consuming the number of allowed HTTP connections. · 4ca5745d
      Richard Mudgett authored
      Simply establishing a TCP connection and never sending anything to the
      configured HTTP port in http.conf will tie up a HTTP connection.  Since
      there is a maximum number of open HTTP sessions allowed at a time you can
      block legitimate connections.
      
      A similar problem exists if a HTTP request is started but never finished.
      
      * Added http.conf session_inactivity timer option to close HTTP
      connections that aren't doing anything.  Defaults to 30000 ms.
      
      * Removed the undocumented manager.conf block-sockets option.  It
      interferes with TCP/TLS inactivity timeouts.
      
      * AMI and SIP TLS connections now have better authentication timeout
      protection.  Though I didn't remove the bizzare TLS timeout polling code
      from chan_sip.
      
      * chan_sip can now handle SSL certificate renegotiations in the middle of
      a session.  It couldn't do that before because the socket was non-blocking
      and the SSL calls were not restarted as documented by the OpenSSL
      documentation.
      
      * Fixed an off nominal leak of the ssl struct in
      handle_tcptls_connection() if the FILE stream failed to open and the SSL
      certificate negotiations failed.
      
      The patch creates a custom FILE stream handler to give the created FILE
      streams inactivity timeout and timeout after a specific moment in time
      capability.  This approach eliminates the need for code using the FILE
      stream to be redesigned to deal with the timeouts.
      
      This patch indirectly fixes most of ASTERISK-18345 by fixing the usage of
      the SSL_read/SSL_write operations.
      
      ASTERISK-23673 #close
      Reported by: Richard Mudgett
      ........
      
      Merged revisions 415841 from http://svn.asterisk.org/svn/asterisk/branches/1.8
      ........
      
      Merged revisions 415854 from http://svn.asterisk.org/svn/asterisk/branches/11
      ........
      
      Merged revisions 415896 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415907 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      4ca5745d
    • Joshua Colp's avatar
      res_pjsip_pubsub: Persist subscriptions in sorcery so they are recreated on startup. · 58f4c18a
      Joshua Colp authored
      This change makes res_pjsip_pubsub persist inbound subscriptions in sorcery. By default
      this uses the local astdb but it can also be configured to store within an outside
      database. When Asterisk is started these subscriptions are recreated if they have not
      expired. Notifications are sent to the devices which have subscribed and they are none
      the wiser that the system has restarted.
      
      Review: https://reviewboard.asterisk.org/r/3598/
      ........
      
      Merged revisions 415766 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415767 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      58f4c18a
  4. Jun 08, 2014
  5. Jun 07, 2014
  6. Jun 06, 2014
  7. Jun 05, 2014
    • Kevin Harwell's avatar
      res_http_websocket: Create a websocket client · e763d704
      Kevin Harwell authored
      Added a websocket server client in Asterisk. Asterisk has a websocket server,
      but not a client. The ability to have Asterisk be able to connect to a websocket
      server can potentially be useful for future work (for instance this could allow
      ARI to connect back to some external system, although more work would be needed
      in order to incorporate that).
      
      Also a couple of things to note - proxy connection support has not been
      implemented and there is limited http response code handling (basically, it is
      connect or not).
      
      Also added an initial new URI handling mechanism to core.  Internet type URI's
      are parsed into a data structure that contains pointers to the various parts of
      the URI.
      
      (closes issue ASTERISK-23742)
      Reported by: Kevin Harwell
      Review: https://reviewboard.asterisk.org/r/3541/
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415223 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      e763d704
  8. May 30, 2014
  9. May 28, 2014
    • Matthew Jordan's avatar
      Logger/CLI/etc.: Fix some aesthetic issues; reduce chatty verbose messages · fb5690ce
      Matthew Jordan authored
      This patch addresses some aesthetic issues in Asterisk. These are all just
      minor tweaks to improve the look of the CLI when used in a variety of
      settings. Specifically:
       * A number of chatty verbose messages were removed or demoted to DEBUG
         messages. Verbose messages with a verbosity level of 5 or higher were -
         if kept as verbose messages - demoted to level 4. Several messages
         that were emitted at verbose level 3 were demoted to 4, as announcement
         of dialplan applications being executed occur at level 3 (and so the
         effects of those applications should generally be less).
       * Some verbose messages that only appear when their respective 'debug'
         options are enabled were bumped up to always be displayed.
       * Prefix/timestamping of verbose messages were moved to the verboser
         handlers. This was done to prevent duplication of prefixes when the
         timestamp option (-T) is used with the CLI.
       * Verbose magic is removed from messages before being emitted to
         non-verboser handlers. This prevents the magic in multi-line verbose
         messages (such as SIP debug traces or the output of DumpChan) from
         being written to files.
       * _Slightly_ better support for the "light background" option (-W) was
         added. This includes using ast_term_quit in the output of XML
         documentation help, as well as changing the "Asterisk Ready" prompt to
         bright green on the default background (which stands a better chance of
         being displayed properly than bright white).
      
      Review: https://reviewboard.asterisk.org/r/3547/
      
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414798 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      fb5690ce
    • Matthew Jordan's avatar
      AMI/ARI: Update version numbers · 61077128
      Matthew Jordan authored
      Update the semantic versioning of ARI to 1.3.0 and AMI to 2.3.0 to account for
      backwards compatible changes going from 12.2.0 to 12.3.0.
      ........
      
      Merged revisions 414765 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414766 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      61077128
    • Richard Mudgett's avatar
      res_pjsip_session: Fix leaked video RTP ports. · 69125a7a
      Richard Mudgett authored
      Simply enabling PJSIP to negotiage a video codec (e.g., h264) would leak
      video RTP ports if the codec were not negotiated by an incoming call.
      
      * Made add_sdp_streams() associate the handler with the media stream if
      the handler handled the media stream.  Otherwise, when the
      ast_sip_session_media object was destroyed it didn't know how to clean up
      the RTP resources.
      
      * Fixed sdp_requires_deferral() associating the handler with the media
      stream when deciding if the SDP processing needs to be deferred for T.38.
      Like the leaked video RTP ports, the T.38 handler needs to clean up
      allocated resources from deciding if SDP processing needs to be deffered.
      
      * Cleaned up some dead code in handle_incoming_sdp() and
      sdp_requires_deferral().
      
      ASTERISK-23721 #close
      Reported by: cervajs
      
      Review: https://reviewboard.asterisk.org/r/3571/
      ........
      
      Merged revisions 414749 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414750 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      69125a7a
  10. May 22, 2014
    • Scott Griepentrog's avatar
      ARI: Add ability to raise arbitrary User Events · cf21644d
      Scott Griepentrog authored
      User events can now be generated from ARI.  Events can be signalled with
      arbitrary json variables, and include one or more of channel, bridge, or
      endpoint snapshots.  An application must be specified which will receive
      the event message (other applications can subscribe to it).  The message
      will also be delivered via AMI provided a channel is attached.  Dialplan
      generated user event messages are still transmitted via the channel, and
      will only be received by a stasis application they are attached to or if
      the channel is subscribed to.
      
      This change also introduces the multi object blob mechanism used to send
      multiple snapshot types in a single message.  The dialplan app UserEvent
      was also changed to use multi object blob, and a new stasis message type
      created to handle them.
      
      ASTERISK-22697 #close
      Review: https://reviewboard.asterisk.org/r/3494/
      ........
      
      Merged revisions 414405 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414406 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      cf21644d
    • Jonathan Rose's avatar
      res_pjsip_refer: Fix bugs involving Parking/PJSIP/transfers · d0088210
      Jonathan Rose authored
      PJSIP would never send the final 200 Notify for a blind transfer
      when transferring to parking. This patch fixes that. In addition,
      it fixes a reference leak when performing blind transfers to
      non-bridging extensions.
      
      Review: https://reviewboard.asterisk.org/r/3485/
      ........
      
      Merged revisions 414400 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414403 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      d0088210
    • Matthew Jordan's avatar
      res_corosync: Update module to work with Stasis (and compile) · 9cee08f5
      Matthew Jordan authored
      This patch fixes res_corosync such that it works with Asterisk 12. This
      restores the functionality that was present in previous versions of
      Asterisk, and ensures compatibility with those versions by restoring the
      binary message format needed to pass information from/to them.
      
      The following changes were made in the core to support this:
       * The event system has been partially restored. All event definition and
         event types in this patch were pulled from Asterisk 11. Previously, we had
         hoped that this information would live in res_corosync; however, the
         approach in this patch seems to be better for a few reasons:
         (1) Theoretically, ast_events can be used by any module as a binary
             representation of a Stasis message. Given the structure of an ast_event
             object, that information has to live in the core to be used universally.
             For example, defining the payload of a device state ast_event in
             res_corosync could result in an incompatible device state representation
             in another module.
         (2) Much of this representation already lived in the core, and was not
             easily extensible.
         (3) The code already existed. :-)
       * Stasis message types now have a message formatter that converts their
         payload to an ast_event object.
       * Stasis message forwarders now handle forwarding to themselves. Previously
         this would result in an infinite recursive call. Now, this simply creates a
         new forwarding object with no forwards set up (as it is the thing it is
         forwarding to). This is advantageous for res_corosync, as returning NULL
         would also imply an unrecoverable error. Returning a subscription in this
         case allows for easier handling of message types that are published directly
         to an aggregate topic that has forwarders.
      
      Review: https://reviewboard.asterisk.org/r/3486/
      
      ASTERISK-22912 #close
      ASTERISK-22372 #close
      ........
      
      Merged revisions 414330 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414331 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      9cee08f5
  11. May 19, 2014
  12. May 18, 2014
    • Matthew Jordan's avatar
      bridge_native_rtp/bridge_channel: Fix direct media issues due to frame hook · 17ff4d92
      Matthew Jordan authored
      This patch fixes issues with direct media bridges that occur after a blind
      transfer. These issues were caught by the (currently failing)
      pjsip/transfers/blind_transfer/caller_direct_media test.
      
      The test currently fails primarily for two reasons:
      (1) When Bob and Charlie (the transfer target and the transfer destination)
          enter a bridge together, the framehook remains on the transfer target
          channel until both channels are in the bridge. As it consumes voice frames,
          the initial bridge type is a simple bridge. The framehook is removed when
          both channels are in the bridge; however, this does not currently cause the
          bridging framework to re-evaluate the bridge. This patch adds a
          AST_SOFTHANGUP_UNBRIDGE poke to the transfer target channel when a
          framehook is removed so the bridge can re-evaluate itself.
      
      (2) When a channel leaves a native RTP bridge, it may be leaving due to being
          hung up. Sending a re-INVITE to a channel that is about to be hung up is
          not nice - in fact, there's a good chance we'll send the BYE request before
          the channel has had a chance to send back a 200 OK. To be somewhat nicer,
          this patch adds a function to channel.h that allows the bridging framework
          to query for exactly why a channel is leaving a bridge via the channel's
          soft hangup flags. This allows it to only send the re-INVITE if there's a
          chance the channel will survive the native bridging experience.
      
      Review: https://reviewboard.asterisk.org/r/3535/
      ........
      
      Merged revisions 414122 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414123 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      17ff4d92
  13. May 13, 2014
  14. May 11, 2014
  15. May 10, 2014
  16. May 09, 2014
  17. Apr 30, 2014
  18. Apr 29, 2014
  19. Apr 23, 2014
    • George Joseph's avatar
      This patch adds support for spinlocks in Asterisk. · 64045f0b
      George Joseph authored
      There are cases in Asterisk where it might be desirable to lock
      a short critical code section but not incur the context switch
      and yield penalty of a mutex or rwlock.  The primary spinlock
      implementations execute exclusively in userspace and therefore
      don't incur those penalties.  Spinlocks are NOT meant to be a
      general replacement for mutexes.  They should be used only for
      protecting short blocks of critical code such as simple compares
      and assignments.  Operations that may block, hold a lock, or
      cause the thread to give up it's timeslice should NEVER be
      attempted in a spinlock.
      
      The first use case for spinlocks is in astobj2 - internal_ao2_ref.
      Currently the manipulation of the reference counter is done with
      an ast_atomic_fetchadd_int which works fine.  When weak reference
      containers are introduced however, there's an additional comparison
      and assignment that'll need to be done while the lock is held.
      A mutex would be way too expensive here, hence the spinlock.
      Given that lock contention in this situation would be infrequent,
      the overhead of the spinlock is only a few more machine instructions
      than the current ast_atomic_fetchadd_int call.
      
      ASTERISK-23553 #close
      Review: https://reviewboard.asterisk.org/r/3405/
      ........
      
      Merged revisions 412976 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412977 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      64045f0b
  20. Apr 18, 2014
  21. Apr 17, 2014
  22. Apr 16, 2014
  23. Apr 15, 2014
    • Russell Bryant's avatar
      (mix)monitor: Add options to enable a periodic beep · 5b7a769f
      Russell Bryant authored
      Add an option to enable a periodic beep to be played into a call if it
      is being recorded.  If enabled, it uses the PERIODIC_HOOK() function
      internally to play the 'beep' prompt into the call at a specified
      interval.  This option is provided for both Monitor() and
      MixMonitor().
      
      Review: https://reviewboard.asterisk.org/r/3424/
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412427 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      5b7a769f
    • Richard Mudgett's avatar
      chan_sip.c: Fix channel staging assertion failure. · d28af99e
      Richard Mudgett authored
      The failing assertion ensures that the final snapshot gets generated so
      CDR records can get finalized.  The only place where a channel staging
      snapshot flag could be left set is in chan_sip.c:handle_request_bye().
      The function could return before clearing the flag because the channel
      could dissappear while the function had to have the channel unlocked.
      
      * Fixed handle_request_bye() channel snapshot staging coverage area to not
      have a return in the middle of it and be unable to clear the staging flag.
      
      * Pushed the channel snapshot staging coverage area into
      ast_rtp_instance_set_stats_vars() to ensure that the staging is not
      interrutped.
      
      * Made callers of ast_rtp_instance_set_stats_vars() not call it with any
      channels or channel driver private locks held to eliminate the deadlock
      potential.  The callers must hold references to the passed in channel and
      rtp objects.
      
      * Eliminated sip_hangup() trying to get the bridge peer.  It is futile at
      this point because the channel could never be in a bridge.
      
      Review: https://reviewboard.asterisk.org/r/3431/
      ........
      
      Merged revisions 412385 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412386 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      d28af99e
  24. Apr 11, 2014
  25. Apr 04, 2014
    • Richard Mudgett's avatar
      internal_timing: Remove the option and always make it enabled if a timing module is loaded. · 03beadb6
      Richard Mudgett authored
      The masquerade supertest frequently fails because either the local channel
      chain doesn't completely optimize out or the DTMF handshake doesn't
      completely get accross.  Local channel optimization requires frames
      flowing to trigger when optimization can happen.  When optimization
      happens the media frame that triggered the optimization is dropped.
      Sending DTMF requires frames to flow in the other direction for timing
      purposes while sending nothing.  If internal timing is not enabled when
      MOH is playing, Asterisk switches to received timing when an audio frame
      is received.  With optimization dropping media frames and MOH not sending
      frames unless it receives frames, occasionaly there are no more frames
      being passed and the test fails.
      
      * The asterisk command line -I option and the asterisk.conf
      internal_timing option are removed.  Asterisk now always uses internal
      timing when needed if any timing module is loaded.  The issue
      ASTERISK-14861 did this quite awhile ago in v1.4 but effectively is broken
      if other internal timing modules besides DAHDI are used.  The
      ast_read_generator_actions() now only does received timing if it has no
      choice for frame generators like MOH, silence, and playback streaming.
      
      * Cleaned up some code dealing with frame generators in
      ast_deactivate_generator(), generator_write_format_change(),
      ast_activate_generator(), and ast_channel_stop_silence_generator().
      
      * Removed ast_internal_timing_enabled(), AST_OPT_FLAG_INTERNAL_TIMING, and
      ast_opt_internal_timing.
      
      ASTERISK-22846 #close
      Reported by: Matt Jordan
      
      Review: https://reviewboard.asterisk.org/r/3414/
      ........
      
      Merged revisions 411715 from http://svn.asterisk.org/svn/asterisk/branches/1.8
      ........
      
      Merged revisions 411716 from http://svn.asterisk.org/svn/asterisk/branches/11
      ........
      
      Merged revisions 411717 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411724 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      03beadb6
  26. Apr 02, 2014
  27. Mar 28, 2014
Loading