Skip to content
Snippets Groups Projects
  1. Mar 30, 2016
    • George Joseph's avatar
      res_pjsip_mwi: Add voicemail extension and mwi_subscribe_replaces_unsolicited · e2524fce
      George Joseph authored
      res_pjsip_mwi was missing the chan_sip "vmexten" functionality which adds
      the Message-Account header to the MWI NOTIFY.  Also, specifying mailboxes
      on endpoints for unsolicited mwi and on aors for subscriptions required
      that the admin know in advance which the client wanted.  If you specified
      mailboxes on the endpoint, subscriptions were rejected even if you also
      specified mailboxes on the aor.
      
      Voicemail extension:
      * Added a global default_voicemail_extension which defaults to "".
      * Added voicemail_extension to both endpoint and aor.
      * Added ast_sip_subscription_get_dialog for support.
      * Added ast_sip_subscription_get_sip_uri for support.
      
      When an unsolicited NOTIFY is constructed, the From header is parsed, the
      voicemail extension from the endpoint is substituted for the user, and the
      result placed in the Message-Account field in the body.
      
      When a subscribed NOTIFY is constructed, the subscription dialog local uri
      is parsed, the voicemail_extension from the aor (looked up from the
      subscription resource name) is substituted for the user, and the result
      placed in the Message-Account field in the body.
      
      If no voicemail extension was defined, the Message-Account field is not added
      to the NOTIFY body.
      
      mwi_subscribe_replaces_unsolicited:
      * Added mwi_subscribe_replaces_unsolicited to endpoint.
      
      The previous behavior was to reject a subscribe if a previous internal
      subscription for unsolicited MWI was found for the mailbox.  That remains the
      default.  However, if there are mailboxes also set on the aor and the client
      subscribes and mwi_subscribe_replaces_unsolicited is set, the existing internal
      subscription is removed and replaced with the external subscription.  This
      allows an admin to configure mailboxes on both the endpoint and aor and allows
      the client to select which to use.
      
      ASTERISK-25865 #close
      Reported-by: Ross Beer
      
      Change-Id: Ic15a9415091760539c7134a5ba3dc4a6a1217cea
      e2524fce
  2. Oct 22, 2015
    • Mark Michelson's avatar
      res_pjsip_pubsub: Solidify lifetime and ownership of objects. · ac0194da
      Mark Michelson authored
      There have been crashes and general instability seen in the pubsub code,
      so this patch introduces three changes to increase the stability.
      
      First, the ownership model for subscriptions has been modified. Due to
      RLS, subscriptions are stored in memory as a tree structure. Prior to my
      patch, the PJSIP subscription was the owner of the subscription tree.
      When the PJSIP subscription told us that it was terminating, we started
      destroying the subscription tree along with all of the individual leaf
      subscriptions that belong to the tree. The problem with this model is
      that the two actors in play here, the PJSIP subscription and the
      individual leaf subscriptions, need to have joint ownership of the
      subscription tree. So now, the PJSIP subscription and the individual
      leaf subscriptions each have a reference to the subscription tree. This
      way, we will not actually free memory until no players are left that
      care. The PJSIP subscription is a bigger stakeholder, in that if the
      PJSIP subscription's reference to the subscription tree is removed, the
      subscription tree instructs the leaf subscriptions to shut down and drop
      their references to the subscription tree when possible. The individual
      leaf subscriptions, upon being told to shut down, can drop their stasis
      subscriptions or whatever they use to learn of new state, and then drop
      their reference to the subscription tree once they are ready to die.
      
      Second, the lifetime of a PJSIP subscription's reference to our
      subscription tree has been altered. As I learned from doing a deep dive,
      the PJSIP evsub code can tell Asterisk multiple times that the
      subscription has been terminated, and not all of these times
      are especially helpful. I have altered the message flow that we use for
      SIP subscriptions such that we will always drop the PJSIP subscription's
      reference to the subscription tree when we send the NOTIFY that
      terminates a SIP subscription. This also means that we will now queue
      NOTIFY requests to be sent after responding to incoming SUBSCRIBEs so
      that we can have predictable state changes from the PJSIP evsub code.
      
      Third, the synchronization of operations has been improved. PJSIP can
      call into our code from a serializer thread (e.g. upon receiving an
      incoming request) or from the monitor thread (e.g. when a subscription
      times out). Because of this, there is the possibility of competing
      threads stepping on each other. PJSIP attempts to do some
      synchronization on its own by always keeping the dialog lock held when
      it calls into us. However, since we end up pushing tasks into the
      serializer, the result was that serialized operations were not grabbing
      the dialog lock and could, as a result, step on something that was being
      attempted by a different thread. Now we ensure that serialized
      operations grab the dialog lock, then check for extenuating
      circumstances, then proceed with their operation if they can.
      
      Change-Id: Iff2990c40178dad9cc5f6a5c7f76932ec644b2e5
      ac0194da
  3. May 07, 2015
    • Joshua Colp's avatar
      res_pjsip_exten_state: Fix race condition between sending NOTIFY and termination · e33682ca
      Joshua Colp authored
      The res_pjsip_exten_state module currently has a race condition between
      processing the extension state callback from the PBX core and processing
      the subscription shutdown callback from res_pjsip_pubsub. There is currently
      no synchronization between the two. This can present a problem as while
      the SIP subscription will remain valid the tree it points to may not.
      This is in particular a problem as a task to send a NOTIFY may get queued
      which will try to use the tree that may no longer be valid.
      
      This change does the following to fix this problem:
      
      1. All access to the subscription tree is done within the task that
      sends the NOTIFY to ensure that no other thread is modifying or
      destroying the tree. This task executes on the serializer for the
      subscriptions.
      
      2. A reference to the subscription serializer is kept to ensure it
      remains valid for the lifetime of the extension state subscription.
      
      3. The NOTIFY task has been changed so it will no longer attempt
      to send a NOTIFY if the subscription has already been terminated.
      
      ASTERISK-25057 #close
      Reported by: Matt Jordan
      
      Change-Id: I0b3cd2fac5be8d9b3dc5e693aaa79846eeaf5643
      e33682ca
  4. Aug 07, 2014
  5. Jun 25, 2014
  6. Jun 12, 2014
  7. Jan 31, 2014
    • Mark Michelson's avatar
      Decouple subscription handling from NOTIFY/PUBLISH body generation. · f55abe9c
      Mark Michelson authored
      When the PJSIP pubsub framework was created, subscription handlers were required
      to state what event they handled along with what body types they knew how to
      generate. While this serves well when implementing a base RFC, it has problems
      when trying to extend the body to support non-standard or proprietary body
      elements. The code also was NOTIFY-specific, meaning that when the time comes
      that we start writing code to send out PUBLISH requests with MWI or presence
      bodies, we would likely find ourselves duplicating code that had previously been
      written.
      
      This changeset introduces the concept of body generators and body supplements. A
      body generator is responsible for allocating a native structure for a given body
      type, providing the primary body content, converting the native structure to a
      string, and deallocating resources. A body supplement takes the primary body
      content (the native structure, not a string) generated by the body generator and
      adds nonstandard elements to the body. With these elements living in their own
      module, it becomes easy to extend our support for body types and to re-use
      resources when sending a PUBLISH request.
      
      Body generators and body supplements register themselves with the pubsub core,
      similar to how subscription and publish handlers had done. Now, subscription
      handlers do not need to know what type of body content they generate, but they
      still need to inform the pubsub core about what the default body type for a
      given event package is. The pubsub core keeps track of what body generators and
      body supplements have been registered. When a SUBSCRIBE arrives, the pubsub core
      will check that there is a subscription handler for the event in the SUBSCRIBE,
      then it will check that there is a body generator that can provide the content
      specified in the Accept header(s).
      
      Because of the nature of body generators and supplements, it means
      res_pjsip_exten_state and res_pjsip_mwi have been completely gutted. They no
      longer worry about body types, instead calling
      ast_sip_pubsub_generate_body_content() when they need to generate a NOTIFY body.
      
      Review: https://reviewboard.asterisk.org/r/3150
      ........
      
      Merged revisions 407016 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407030 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      f55abe9c
  8. Jul 30, 2013
    • Mark Michelson's avatar
      The large GULP->PJSIP renaming effort. · 735b30ad
      Mark Michelson authored
      The general gist is to have a clear boundary between old SIP stuff
      and new SIP stuff by having the word "SIP" for old stuff and "PJSIP"
      for new stuff. Here's a brief rundown of the changes:
      
      * The word "Gulp" in dialstrings, functions, and CLI commands is now
        "PJSIP"
      * chan_gulp.c is now chan_pjsip.c
      * Function names in chan_gulp.c that were "gulp_*" are now "chan_pjsip_*"
      * All files that were "res_sip*" are now "res_pjsip*"
      * The "res_sip" directory is now "res_pjsip"
      * Files in the "res_pjsip" directory that began with "sip_*" are now "pjsip_*"
      * The configuration file is now "pjsip.conf" instead of "res_sip.conf"
      * The module info for all PJSIP-related files now uses "PJSIP" instead of "SIP"
      * CLI and AMI commands created by Asterisk's PJSIP modules now have "pjsip" as
      the starting word instead of "sip"
      
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@395764 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      735b30ad
  9. Jun 29, 2013
  10. Jun 22, 2013
    • Joshua Colp's avatar
      Merge in current pimp_my_sip work, including: · 77002bc3
      Joshua Colp authored
      1. Security events
      2. Websocket support
      3. Diversion header + redirecting support
      4. An anonymous endpoint identifier
      5. Inbound extension state subscription support
      6. PIDF notify generation
      7. One touch recording support (special thanks Sean Bright!)
      8. Blind and attended transfer support
      9. Automatic inbound registration expiration
      10. SRTP support
      11. Media offer control dialplan function
      12. Connected line support
      13. SendText() support
      14. Qualify support
      15. Inband DTMF detection
      16. Call and pickup groups
      17. Messaging support
      
      Thanks everyone!
      
      Side note: I'm reminded of the song "How Far We've Come" by Matchbox Twenty.
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392565 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      77002bc3
  11. Apr 25, 2013
    • Mark Michelson's avatar
      Merge the pimp_my_sip branch into trunk. · 74f23180
      Mark Michelson authored
      The pimp_my_sip branch is being merged at this point because
      it offers basic functionality, and from an API standpoint, things
      are complete.
      
      SIP work is *not* feature-complete; however, with the completion
      of the SUBSCRIBE/NOTIFY API, all APIs (except a PUBLISH API) have
      been created, and thus it is possible for developers to attempt
      to create new SIP work.
      
      API documentation can be found in the doxygen in the code, but
      usability documentation is still lacking.
      
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@386540 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      74f23180
Loading