Skip to content
Snippets Groups Projects
  1. Jun 24, 2015
    • Joshua Colp's avatar
      app_dial: Hold reference to calling channel formats when dialing outbound. · 3b2b004d
      Joshua Colp authored
      Currently when requesting a channel the native formats of the
      calling channel are provided to the core for usage when dialing
      the outbound channel. This occurs without holding the channel lock
      or keeping a reference to the formats. This is problematic as
      the channel driver may end up changing the formats during this time.
      In the case of chan_sip this happens when an SDP negotiation
      completes.
      
      This change makes it so app_dial keeps a reference to the native
      formats of the calling channel which guarantees that they will
      remain valid for the period of time needed.
      
      ASTERISK-25172 #close
      
      Change-Id: I2f0a67bd0d5d14c3bdbaae552b4b1613a283f0db
      3b2b004d
  2. Jun 23, 2015
  3. Jun 22, 2015
    • Richard Mudgett's avatar
      res_pjsip_outbound_registration.c: Fix whitespace conflict potential. · 096b27d9
      Richard Mudgett authored
      Change-Id: I82e6e388e3688aebe0783f16c9e0800a747584b5
      096b27d9
    • Alexander Traud's avatar
      chan_sip: Reload peer without its old capabilities. · 1ad9a6b6
      Alexander Traud authored
      On reload, previously allowed codecs were not removed. Therefore, it was not
      possible to remove codecs while Asterisk was running. Furthermore, newly added
      codecs got appended behind the previous codecs. Therefore, it was not possible
      to add a codec with a priority of #1. This change removes the old capabilities
      before the current ones are added.
      
      ASTERISK-25182 #close
      Reported by: Alexander Traud
      patches:
       asterisk_13_allow_codec_reload.patch uploaded by Alexander Traud (License 6520)
      
      Change-Id: I62a06bcf15e08e8c54a35612195f97179ebe5802
      1ad9a6b6
  4. Jun 21, 2015
    • Joshua Colp's avatar
      chan_sip: Destroy peers without holding peers container lock. · 5caefc98
      Joshua Colp authored
      Due to the use of stasis_unsubscribe_and_join in the peer destructor
      it is possible for a deadlock to occur when an event callback is
      occurring at the same time.
      
      This happens because the peer may be destroyed while holding the
      peers container lock. If this occurs the event callback will never
      be able to acquire the container lock and the unsubscribe will
      never complete.
      
      This change makes it so the peers that have been removed from the
      peers container are not destroyed with the container lock held.
      
      ASTERISK-25163 #close
      
      Change-Id: Ic6bf1d9da4310142a4d196c45ddefb99317d9a33
      5caefc98
  5. Jun 19, 2015
  6. Jun 18, 2015
    • Mark Michelson's avatar
      Resolve race conditions involving Stasis bridges. · d7a1e84a
      Mark Michelson authored
      This resolves two observed race conditions.
      
      First, a bit of background on what the Stasis application does:
      
      1a Creates a stasis_app_control structure. This structure is linked into
         a global container and can be looked up using a channel's unique ID.
      2a Puts the channel in an event loop. The event loop can exit either
         because the stasis_app_control structure has been marked done, or
         because of some other factor, such as a hangup. In the event loop, the
         stasis_app_control determines if any specific ARI commands need to be
         run on the channel and will run them from this thread.
      3a Checks if the channel is bridged. If the channel is bridged, then
         ast_bridge_depart() is called since channels that are added to Stasis
         bridges are always imparted as departable.
      4a Unlink the stasis_app_control from the container.
      
      When an ARI command is received by Asterisk, the following occurs
      1b A thread is spawned to handle the HTTP request
      2b The stasis_app_control(s) that corresponds to the channel(s) in the
         request is/are retrieved. If the stasis_app_control cannot be
         retrieved, then it is assumed that the channel in question has exited
         the Stasis app or perhaps was never in Stasis in the first place.
      3b A command is queued onto the stasis_app_control, and the channel's
         event loop thread is signaled to run the command.
      4b While most ARI commands do nothing further, some, such as adding or
         removing channels from a bridge, will block until the command they
         issued has been completed by the channel's event loop.
      
      The first race condition that is solved by this patch involves a crash
      that can occur due to faulty detection of the channel's bridged status
      in step 3a. What can happen is that in step 2a, the event loop may run
      the ast_bridge_impart() function to asynchronously place the channel
      into a bridge, then immediately exit the event loop because the channel
      has hung up. In step 3a, we would detect that the channel was not
      bridged and would not call ast_bridge_depart(). The reason that the
      channel did not appear to be bridged was that the depart_thread that is
      spawned by ast_bridge_impart() had not yet started. That is the thread
      where the channel is marked as being bridged. Since we did not call
      ast_bridge_depart(), the Stasis application would exit, and then the
      channel would be destroyed Then the depart_thread would start up and
      try to manipulate the destroyed channel, causing a crash.
      
      The fix for this is to switch from using ast_channel_is_bridged() to
      checking the NULLity of ast_channel_internal_bridge_channel() to
      determine if ast_bridge_depart() needs to be called. The channel's
      internal bridge_channel is set when ast_bridge_impart() is called and
      is NULLed by the call to ast_bridge_depart(). If the channel's internal
      bridge_channel is non-NULL, then the channel must have been imparted
      into the bridge and needs to be departed, even if the actual bridging
      operation has not yet started. By departing the channel when necessary,
      the thread that is running the Stasis application will block until the
      bridge gives the okay that the depart_thread has exited.
      
      The second race condition that is solved by this patch involves a leak
      of HTTP handler threads. The problem was that step 2b would successfully
      retrieve a stasis_app_control structure. Then step 2a would exit the
      channel from the event loop due to a hangup. Steps 3a and 4a would
      execute, and then finally steps 3b and 4b would. The problem is that at
      step 4b, when attempting to add a channel to a bridge, the thread would
      block forever since the channel would never execute the queued command
      since it was finished with the event loop. This meant that the HTTP
      handling thread would be leaked, along with any references that thread
      may have owned (in my case, I was seeing bridges leaked).
      
      The fix for this is to hone in better on when the channel has exited the
      event loop. The stasis_app_control structure has an is_done field that
      is now set at each point where the channel may exit the event loop. If
      step 2b retrieves a valid stasis_app_control structure but the control
      is marked as done, then the attempted operation exits immediately since
      there will be nothing to service the attempted command.
      
      ASTERISK-25091 #close
      Reported by Ilya Trikoz
      
      Change-Id: If66265b73b4c9f8f58599124d777fedc54576628
      d7a1e84a
  7. Jun 17, 2015
    • Joshua Colp's avatar
      res_sorcery_memory_cache: Remove 'prefetch' option. · 9668a1ac
      Joshua Colp authored
      To prevent confusion I am removing the prefetch option until such
      time as it is implemented. All other functionality, however, has
      been implemented.
      
      ASTERISK-25067
      
      Change-Id: I9ce6aa3e5c6c5bc3c5baa8ff90fa036d73939895
      9668a1ac
  8. Jun 16, 2015
  9. Jun 15, 2015
    • Corey Farrell's avatar
      func_pjsip_aor: Fix leaked contact from iterator. · ea9d5f15
      Corey Farrell authored
      ASTERISK-25162 #close
      
      Change-Id: Id79aa3c6fe490016ee98efc97ac4c1d3f461f97e
      ea9d5f15
    • Kevin Harwell's avatar
      res_pjsip: Add option to force G.726 to be treated as AAL2 packed. · 93ac45d3
      Kevin Harwell authored
      Some phones send g.726 audio packed for AAL2, which differs from what is
      recommended by RFC 3351. If Asterisk receives audio formatted as such when
      negotiating g.726 then it sounds a bit distorted. Added an option to
      res_pjsip_endpoint that allows g.726 negotiated audio to be treated as g.726
      AAL2 packed.
      
      ASTERISK-25158 #close
      Reported by: Steve Pitts
      
      Change-Id: Ie7e21f75493d7fe53e75e12c971e72f5afa33615
      93ac45d3
    • mjordan's avatar
      main/cdr: Carry over the disable flag when 'disable all' is specified · 15c22087
      mjordan authored
      The CDR_PROP function (as well as the NoCDR application) set the
      'disable all' flag (AST_CDR_FLAG_DISABLE_ALL) on the current CDR. This
      flag is supposed to be applied to all CDRs that are currently in the
      chain, as well as all CDRs that may be created in the future. Currently,
      however, the flag is only applied to the existing CDRs in the chain; new
      CDRs do not receive the 'disable all' flag. In particular, this affects
      parallel dials, which generate new CDRs for each pair of channels in
      the dial attempt.
      
      This patch carries over the 'disable all' flag when it is specified on a
      CDR and a new CDR is generated for the chain.
      
      ASTERISK-24344 #close
      
      Change-Id: I91a0f0031e4d147bdf8a68ecd08304d506fb6a0e
      15c22087
  10. Jun 13, 2015
    • Matt Jordan's avatar
      main/cdr: Copy context/exten on chained CDRs for parallel dials in subroutines · b8bc1528
      Matt Jordan authored
      When a parallel dial occurs, a new CDR will be created for each dial
      attempt that is made. In most circumstances, the act of creating each
      CDR in the chain will include a step that updates the Party A snapshot,
      which causes the context/extension of the Party A to be copied onto the
      CDR object.
      
      However, when the Party A is in a subroutine, we explicitly do *not*
      copy the context/extension onto the CDR. This prevents the Macro or
      GoSub routine name from blowing away the context/extension that the
      channel was originally executing in. For the original CDR, this is not a
      problem: the original CDR already recorded the last known 'good' state
      of the channel just prior to it going into the subroutine. However, for
      newly generated CDRs in a chain, there is no context/extension set on
      them. Since we are in a subroutine, we will never set the Party A's
      context/extension on the CDR, and we end up with a CDR with no
      destination recorded on it.
      
      This patch updates the creation of a chained CDR such that it copies
      over the original CDR's context/extension. This is the last known "good"
      state of the CDR, and is a reasonable starting point for the newly
      generated CDR. In the case where we are not in a subroutine, subsequent
      code will update the location of the CDR from the Party A information;
      in the case where we are in a subroutine, the context/extension on the
      original CDR is the correct information.
      
      ASTERISK-24443 #close
      
      Change-Id: I6a3ef0d6e458d3b9b30572feaec70f2964f3bc2a
      b8bc1528
    • Matt Jordan's avatar
  11. Jun 12, 2015
    • Mark Michelson's avatar
    • Mark Michelson's avatar
    • Damian Ivereigh's avatar
      chan_sip.c: Update dialog fromtag after request with auth · 19f60d94
      Damian Ivereigh authored
      If a client sends and INVITE which is 401 rejected, then subsequently
      sends a new INVITE with the auth info and uses a different fromtag
      from the first INVITE, Asterisk will accept the new INVITE as part of
      the original dialog - match_req_to_dialog() specifically ignores the
      fromtag. However it does not update the stored dialog with the new
      fromtag.
      
      This results in Asterisk being unable to match future packets that are
      part of this dialog (such as the ACK to the OK or the OK to the BYE),
      and the call is dropped.
      
      This problem was originally found when using an NEC-i SV8100-GE (NEC SIP
      Card).
      
      * After a successful match of a packet to the dialog, if the packet is
        not a SIP_RESPONSE, authentication is present and the fromtags are
        different, the stored fromtag is updated with the one from the recent
        INVITE.
      
      ASTERISK-25154 #close
      Reported by: Damian Ivereigh
      Tested by: Damian Ivereigh
      
      Change-Id: I5c16cf3b409e5ef9f2b2fe974b6bd2a45a6aa17e
      19f60d94
    • Matt Jordan's avatar
      chan_pjsip: Set the context and extension on the channel when created · bb00b26f
      Matt Jordan authored
      Prior to this patch, chan_pjsip was failing to pass the endpoint's
      context and the desired extension to the ast_channel_alloc_* routine.
      This caused a new channel snapshot to be issued without a context and
      extension, which can cause some reporting issues for users of AMI, CEL,
      and other APIs. The channel driver would later set the context and
      extension on the channel such that the channel would start in the
      correct location in the dialplan, but the information reported in the
      initial event would be incorrect.
      
      This patch modifies the channel driver such that it now passes the
      context and extension directly into the allocation routine. This
      provides the information in the new channel snapshot published over
      Stasis.
      
      ASTERISK-25156 #close
      Reported by: cloos
      
      Change-Id: Ic6f8542836e596db8f662071d118e8f934fdf25e
      bb00b26f
  12. Jun 11, 2015
    • Matt Jordan's avatar
    • Joshua Colp's avatar
      bridge: When performing a blonde transfer update connected line information. · 7230ee2e
      Joshua Colp authored
      When performing a blonde transfer the code uses the old masquerade
      mechanism to move a channel around. As a result of this certain information,
      such as connected line, is moved between the channels involved. Upon
      completion of the move a frame is queued which is supposed to update the
      connected line information on the channel. This does not occur as the
      code considers it a redundant update since the masquerade operation
      updated the channel (but did not inform it of the new connected line
      information). The code also does not queue a connected line update
      to be handled by the thread handling the channel. Without this any
      other channel that may be loosely involved does not know it is
      talking to a different caller.
      
      This change does the following to resolve this:
      
      1. The indicated connected line information is cleared upon
      completion of the masquerade operation when doing a blonde transfer.
      This prevents the connected line update from being considered
      redundant.
      
      2. A connected line update frame is now queued upon the completion
      of the masquerade operation so any other channel loosely involved
      knows that there is a different caller.
      
      ASTERISK-25157 #close
      Reported by: Joshua Colp
      
      Change-Id: Ibb8798184a1dab3ecd35299faecc420034adbf20
      7230ee2e
    • Richard Mudgett's avatar
      app_directory: Fix crash when using the alias option 'a'. · a657ab12
      Richard Mudgett authored
      The voicemail.conf mailbox key/value pair is defined as:
      <mailbox>=[<password>[,<full-name>[,<email>[,<pager>[,<options>]]]]]
      Where all fields in the value including the field values are optional.
      
      Since the parsing code for the mailbox key/value pair is sloppy, this
      patch tightens the parsing for the directory information.
      
      * Renamed the 'pos' and 'bufptr' variables to 'name' and 'options'
      respectively in search_directory_sub().  Those names make more sense.
      
      * Made sure that search_directory_sub() is dealing with the voicemail.conf
      mailbox options field if it even exists when looking for the 'hidefromdir'
      and 'alias' options.
      
      * Fix crash if a voicemail.conf mailbox is just
      <mailbox>=<password>,<name> when the 'a' option is used.  If there were no
      fields after the name then the 'options' pointer was not checked for NULL.
      
      * Fix users.conf alias processing if the 'a' option is used.  The wrong
      variable was used.
      
      ASTERISK-25087 #close
      Reported by: Chet Stevens
      
      Change-Id: I86052ea77307beddddba5279824d39dc0d593374
      a657ab12
    • Richard Mudgett's avatar
      DNS: Need to use the same serializer for a pjproject SIP transaction. · 30cd5593
      Richard Mudgett authored
      All send/receive processing for a SIP transaction needs to be done under
      the same threadpool serializer to prevent reentrancy problems inside
      pjproject when using an external DNS resolver to process messages for the
      transaction.
      
      * Add threadpool API call to get the current serializer associated with
      the worker thread.
      
      * Pick a serializer from a pool of default serializers if the caller of
      res_pjsip.c:ast_sip_push_task() does not provide one.
      
      This is a simple way to ensure that all outgoing SIP request messages are
      processed under a serializer.  Otherwise, any place where a pushed task is
      done that would result in an outgoing out-of-dialog request would need to
      be modified to supply a serializer.  Serializers from the default
      serializer pool are picked in a round robin sequence for simplicity.
      
      A side effect is that the default serializer pool will limit the growth of
      the thread pool from random tasks.  This is not necessarily a bad thing.
      
      * Made pjsip_resolver.c use the requesting thread's serializer to execute
      the async callback.
      
      * Made pjsip_distributor.c save the thread's serializer name on the
      outgoing request tdata struct so the response can be processed under the
      same serializer.
      
      ASTERISK-25115 #close
      Reported by: John Bigelow
      
      Change-Id: Iea71c16ce1132017b5791635e198b8c27973f40a
      30cd5593
  13. Jun 10, 2015
  14. Jun 09, 2015
Loading