Skip to content
Snippets Groups Projects
  1. Jan 23, 2017
    • George Joseph's avatar
      pjproject_bundled: Fix setting max log level · 96e7291c
      George Joseph authored
      An earlier attempt to prevent pjsua from spitting out an extra 6795
      lines of debug output every time the testsuite called it was also
      turning off the ability for asterisk to output debug info when it
      needed to.  This patch reverts the earlier fix and instead adds
      a pjproject patch that sets the startup log level to 1 for pjsua
      pjsystest and the pjsua python binding.  This is an asterisk-only
      patch that does not affect pjproject functionality and will not be
      submitted upstream.
      
      Change-Id: I347a8b58b2626f2906ccfc1d339e907627a0c9e8
      96e7291c
  2. Jan 08, 2017
  3. Jan 03, 2017
    • George Joseph's avatar
      pjproject_bundled: Compile pjsua with max log level = 2 · ceb9dae5
      George Joseph authored
      A while back, we changed config_site.h to set PJ_LOG_MAX_LEVEL = 6.
      This allowed us to control the log level better from inside Asterisk.
      An unfortunate side effect of this was that the pjsua binary and
      python bindings were also compiled with log level set to 6 so whenever
      a testsuite test that uses pjsua runs, it spits out 6795 lines of
      debug in an instant even before the test starts.  I believe this
      overruns the Jenkins capture buffer and prevents the test from
      properly terminating.  In turn, this results in the testsuite just
      hanging until the job is killed.  It's more frequent on the higher
      end agents because they can spit out the messages faster.
      
      Unfortunately, the messages are all spit out before we have control
      of the python pj.Lib instance where we can set logging levels so the
      only alternative was to actually compile pjsua and _pjsua.so with an
      overridden PJ_LOG_MAX_LEVEL.  Although defining a lower max level was
      done in the Makefile, the define in config_site.h had to be wrapped
      with "#ifndef" so the change would take effect.
      
      Change-Id: I2af9e7d48dde1927279c586c9c725d868fe6f3ff
      ceb9dae5
  4. Dec 18, 2016
    • George Joseph's avatar
      pjproject_bundled: Make build single threaded · d29eb3b9
      George Joseph authored
      There were just too many issues in various environments with
      multi threaded building of pjproject.  It doesn't really speed
      things up anyway since asterisk is already being compiled in
      parallel.
      
      Change-Id: Ie5648fb91bb89b4224b6bf43a0daa1af793c4ce1
      d29eb3b9
  5. Dec 09, 2016
    • George Joseph's avatar
      pjproject_bundled: Retry download if previously saved tarball is bad · 31268e0a
      George Joseph authored
      If a tarball is corrupted during download, the makefile will attempt to
      download it again. If the tarball somehow gets corrupted after it's
      downloaded however, the makefile was just failing.  We now
      retry the download.
      
      ASTERISK-26653 #close
      
      Change-Id: I1b24d454852d80186f60c5a65dc4624ea8a1c359
      31268e0a
  6. Dec 07, 2016
    • Richard Mudgett's avatar
      Bundled pjproject: Fix finding SIP transactions. · 76d52dc2
      Richard Mudgett authored
      Occasionally SIP message transactions are not found when they should be.
      In the particular case an incoming INVITE transaction is CANCELed but the
      INVITE transaction cannot be found so a 481 response is returned for the
      CANCEL.  The problematic calls have a '_' character in the Via branch
      parameter.
      
      The problem is in the pjproject PJ_HASH_USE_OWN_TOLOWER feature's code.
      The problem with the "own tolower" code is that it does not calculate the
      same hash value as when the pj_tolower() function is used.  The "own
      tolower" code will erroneously modify the ASCII characters '@', '[', '\\',
      ']', '^', and '_'.  Calls to pj_hash_calc_tolower() can use the
      PJ_HASH_USE_OWN_TOLOWER substitute algorithm when enabled.  Calls to
      pj_hash_get_lower(), pj_hash_set_lower(), and pj_hash_set_np_lower() call
      find_entry() which never uses the PJ_HASH_USE_OWN_TOLOWER algorithm.  As a
      result you may not be able to find a hash tabled entry because the
      calculated hash values would differ.
      
      * Simply disable PJ_HASH_USE_OWN_TOLOWER.
      
      ASTERISK-26490 #close
      
      Change-Id: If89bfdb5f301b8b685881a9a2a6e0c3c5af32253
      76d52dc2
  7. Dec 06, 2016
    • George Joseph's avatar
      pjproject_bundled: Fix missing inclusion of symbols · fe9f0708
      George Joseph authored
      Added back in a -g3, and an -O3 when DONT_OPTIMIZE is not set, to
      the CFLAGS.  Not sure how they went missing.
      
      Also fixed an uninstall problem where we weren't removing the
      symlink from libasteriskpj.so.2 to libasteriskpj.so.  While I was
      there, I fixed it for libasteriskssl as well.
      
      Change-Id: I9e00873b1e9082d05b5549d974534b48a2142556
      fe9f0708
  8. Nov 30, 2016
    • Richard Mudgett's avatar
      PJPROJECT logging: Made easier to get available logging levels. · 1dfa11b6
      Richard Mudgett authored
      Use of the new logging is as simple as issuing the new CLI command or
      setting the new pjproject.conf option.
      
      Other options that can affect the logging are how you have the pjproject
      log levels mapped to Asterisk log types in pjproject.conf and if you have
      configured Asterisk to log the DEBUG type messages.  Altering the
      pjproject.conf level mapping shouldn't be necessary for most installations
      as the default mapping is sensible.  Configuring Asterisk to log the DEBUG
      message type is standard practice for collecting debug information.
      
      * Added CLI "pjproject set log level" command to dynamically adjust the
      maximum pjproject log message level.
      
      * Added CLI "pjproject show log level" command to see the currently set
      maximum pjproject log message level.
      
      * Added pjproject.conf startup section "log_level" option to set the
      initial maximum pjproject log message level so all messages could be
      captured from initialization.
      
      * Set PJ_LOG_MAX_LEVEL to 6 to compile in all defined logging levels into
      bundled pjproject.  Pjproject will use the currently set run time log
      level to determine if a log message is generated just like Asterisk
      verbose and debug logging levels.
      
      * In log_forwarder(), made always log enabled and mapped pjproject log
      messages.  DEBUG mapped log messages are no longer gated by the current
      Asterisk debug logging level.
      
      * Removed RAII_VAR() from res_pjproject.c:get_log_level().
      
      ASTERISK-26630 #close
      
      Change-Id: I6dca12979f482ffb0450aaf58db0fe0f6d2e5389
      1dfa11b6
  9. Nov 18, 2016
    • George Joseph's avatar
      pjproject_bundled: Improve reliability of pjproject download · d3f070c7
      George Joseph authored
      The download process now has a timeout which will cause wget to retry
      if it stops retrieving data for 5 seconds and fetch and curl to timeout
      if the whole retrieval take smore than 30 seconds.
      
      If the tarball retrieval works, the MD5SUM file is retrieved from
      the downloads site and the md5 checksum is verified.
      
      If either the tarball retrieval or MD5SUM retrieval fails, or the
      checksums don't match, the entire process is retried once.  If it
      fails again, any incomplete tarball is deleted.
      
      .DELETE_ON_ERROR: was also added to the Makefile.  Not only does
      this delete the tarball on failure, it till also delete corrupted
      library files from the pjproject source directory should they
      fail to build correctly.
      
      Tested all the way back to FreeBSD 9, CentOS 6, Debian 6 and
      Ubuntu 14.
      
      Change-Id: Iea7d33b96a31622ab1b6e54baebaf271959514e1
      d3f070c7
  10. Nov 17, 2016
    • George Joseph's avatar
      build: Various OpenBSD issues · 935f5d00
      George Joseph authored
      OpenBSD's 'find' doesn't take the -delete argument so you have to pipe
      through 'xargs rm -rf'.
      
      'echo -e' doesn't like \t starting a line. It just prints 't' which
      causes the libasteriskpj.exports file to be garbage.  They were just
      cosmetic so they were removed.
      
      librt doesn't exist so the link of libasteriskpj.so fails. It's not
      actually needed for linux anyway so -lrt was removed from the link.
      
      res_rtp_asterisk was failing to load because of an undefined
      DTLS_method. '|| defined(LIBRESSL_VERSION_NUMBER)' was added to the #if
      so DTLSv1_method is used instead.
      
      ASTERISK-26608
      
      Change-Id: I926ec95b0b69633231e3ad1d6e803b977272c49c
      935f5d00
  11. Nov 16, 2016
  12. Nov 14, 2016
    • Matt Jordan's avatar
      pjproject: Use a much higher limit for PJ_ICE_MAX_CHECKS · edd7ae85
      Matt Jordan authored
      The PJ_ICE_MAX_CHECKS constant is used by pjproject to determine how
      many pairs of local/remote candidates will be made. If for some reason
      we reach this upper bound, ICE will generally fail and no media will
      flow between the browser and Asterisk.
      
      This patch makes PJ_ICE_MAX_CHECKS set to the total possible number of
      pairs of candidates we'd theoretically allow, which is
      PJ_ICE_MAX_CAND^2. Prior to this patch, we simply multiplied
      PJ_ICE_MAX_CAND by two; on systems with multiple interfaces (I blame
      Docker), this is far too low to allow WebRTC calls to succeed.
      
      Setting this to be PJ_ICE_MAX_CAND^2 allowed WebRTC calls to succeed
      even when the system Asterisk was running on had quite a few virtual
      interfaces.
      
      Change-Id: Icd4f17de0ac9d3a83dddfc8bf1cb7616bc107d55
      edd7ae85
  13. Nov 03, 2016
    • George Joseph's avatar
      pjproject_bundled: Fix issue with libasteriskpj needing libresample · 78dc6cea
      George Joseph authored
      libresample is only needed by pjproject if we're building pjsua, which
      we only do if TEST_FRAMEWORK is selected.  It's required by pjsua to
      process audio which is needed by some testsuite tests.  Unfortunately,
      pjproject relies on a newer version of libresample than the version
      that ships by most distros so we need to compile the version that's
      bundled with pjproject.  Since we only need it for pjsua, we DON'T want
      it's symbols exposed when we actually build asterisk.
      
      There was a problem however... TEST_FRAMEWORK is only known AFTER we've
      already run ./configure on both asterisk and pjproject but pjproject's
      ./configure needs to test it to know whether to set up to build
      libresample or not.  The previous way of figuring this out was to
      always tell ./configure "yes" but not actually build the library.  This
      caused an issue where building libasteriskpj was being told to include
      libresample but it wasn't actually there.
      
      The solution is to still do a default pjproject configure during an
      asterisk ./configure but if makeopts or menuselect.makeopts changes
      subsequently, we now reconfigure pjproject, taking into account the
      current state of TEST_FRAMEWORK.  Previously, if makeopts or
      menuselect.makeopts changed, only a recompile of pjproject was done.
      
      Change-Id: I9b5d84c61384a3ae07fe30e85c49698378cc4685
      78dc6cea
  14. Nov 01, 2016
    • Richard Mudgett's avatar
      bundled pjproject: Fix DNS write to freed memory. · f29b8d62
      Richard Mudgett authored
      PJPROJECT 2.5.5 introduced a race condition with the -r5349 IPv6 DNS
      patch.
      
      The patch below fixes a write to freed memory under cartain DNS lookup
      conditions.
      
      0006-r5477-svn-backport-Fix-DNS-write-on-freed-memory.patch
      
      ASTERISK-26516
      Reported by:  Richard Mudgett
      
      Change-Id: Ifdfae9ecf1e41b53080f33aab44ce1a220f349c5
      f29b8d62
    • Joshua Colp's avatar
      res_pjsip_sdp_rtp: Limit number of formats to defined maximum. · 6233e146
      Joshua Colp authored
      The res_pjsip_sdp_rtp module did not restrict the number of
      formats added to a media stream in the SDP to the defined
      limit. If allow=all was used with additional loaded codecs this
      could result in the next media stream being overwritten some.
      
      This change restricts the module to limit it to the defined
      maximum and also increases the maximum in our bundled pjproject.
      
      ASTERISK-26541 #close
      
      Change-Id: I0dc5f59d3891246cafa2f3df5ec406f088559ee8
      6233e146
  15. Oct 31, 2016
    • George Joseph's avatar
      pjproject_bundled: Fix compile of pjsua so it handles audio · f27f837a
      George Joseph authored
      In order for pjsua and its python binding to actually negotiate
      audio for the testsuite tests, it needs g711 and resample.  The
      pj* libraries themselves do not.  Unfortunately, pjproject relies
      on a brand new libresample that most distros don't ship so we need
      to use the libresample already bundled with pjproject.  Only the pjsua
      executable and the _pjsua.so python library are linked with it so it
      shouldn't interfere with asterisk itself.
      
      Also it was pointed out that apply_patches couldn't handle multiple
      patches that depended on each other during the dry-run, so the
      dry-run was removed.
      
      Change-Id: I24f397462b486dcdde0dcafe40e6c55a6593f098
      f27f837a
  16. Oct 28, 2016
    • Richard Mudgett's avatar
      bundled pjproject: Crashes while resolving DNS names. · 6feee22e
      Richard Mudgett authored
      PJPROJECT 2.5.5 introduced a race condition with the -r5349 IPv6 DNS
      patch.
      
      The patches below fix the DNS lookup race condition crash caused by
      attempting to send the same message twice for the single DNS lookup.
      
      0006-r5471-svn-backport-Various-fixes-for-DNS-IPv6.patch
      0006-r5473-svn-backport-Fix-pending-query.patch
      
      The patch below removes a cached DNS response from the hash table when
      another thread is referencing the old entry.  The table still contained
      the entry when it was destroyed which can result in inexplicable crashes.
      
      0006-r5475-svn-backport-Remove-DNS-cache-entry.patch
      
      ASTERISK-26344 #close
      Reported by: Ian Gilmour
      
      ASTERISK-26387 #close
      Reported by: Harley Peters
      
      Change-Id: I17fde80359e66f65a91341ceca58d914d0f61cc4
      6feee22e
  17. Oct 27, 2016
    • George Joseph's avatar
      pjproject_bundled: Remove usage of tar's --strip-components option · 4f45d626
      George Joseph authored
      Older versions of tar don't support the --strip-components option so
      instead of doing 'tar --strip-components=1 -C source', we now just
      untar to the tarball's root directory (pjproject-<version>) and
      rename that directory to 'source'.
      
      Also fixed an issue where the pjproject source directory is a hard
      coded absolute pathname.
      
      ASTERISK-26510 #close
      ASTERISK-22480 #close
      
      Change-Id: I9ec92952507a91ff4e4d01e0149e09fd8e8f32b0
      4f45d626
  18. Oct 24, 2016
    • George Joseph's avatar
      pjproject_bundled: Fixed various build issues · 16c23b57
      George Joseph authored
      * CFLAGS is now properly set when using older gcc.
      * All third-party pjproject targets have been removed.  This fixes
        an issue with older libsrtp in some distros.
      * Manually removing the source directory now causes a rebuild.
      * EXTERNALS_CACHE_DIR is now properly checked.
      * Whitespace fixes.
      
      Change-Id: I98fec6847efc5602a9f41cb95096fd660a49fa60
      16c23b57
  19. Oct 17, 2016
  20. Oct 14, 2016
    • Corey Farrell's avatar
      Fix issues with bundled pjproject cached download. · aa39a876
      Corey Farrell authored
      Previously when testing I had a preexisting makeopts in ASTTOPDIR.  The
      ordering of configure.ac causes --with-externals-cache to be processed
      after third-party configure.  In cases where the Asterisk clone is
      cleaned it would cause pjproject to be downloaded to /tmp.  This
      moves processing of the externals cache and sounds cache to happen
      before third-party configure.
      
      This also addresses a possible issue with the third-party Makefile.  If
      TMPDIR is set by the environment it would override the path given to
      --with-externals-cache.
      
      ASTERISK-26416
      
      Change-Id: Ifab7f35bfcd5a31a31a3a4353cc26a68c8c6592d
      aa39a876
  21. Oct 10, 2016
    • George Joseph's avatar
      bundled_pjproject: Add tests for programs used by the Makefile, et al. · 5fb848ee
      George Joseph authored
      Added tests for bzip2, tar, patch, sed and nm to configure.ac.
      
      Set DOWNLOAD_TO_STDOUT to a working command line regardless of
      whether the download program is wget, curl or fetch.
      
      Added a 'configure.m4' file to the third-party directory which takes
      care of calling any third-party project setup.  Had to move some
      pjproject_bundled stuff up in configure.ac so it was called before
      the third-party configure macro.
      
      The pjproject tarball is now downloaded to the externals_cache_dir if
      it was specified on the ./configure command line
      
      Removed regeneration of the pjproject aconfigure file.  It was only
      needed for an old patch that no longer applies.
      
      Converted the tests for symbols to explicit tests since we know that
      they're now available in the bundled version.  Saves a little time
      during configure.
      
      ASTERISK-26416 #close
      Reported-by: Corey Farrell
      
      Change-Id: Id1d94251c0155f8dd41b7de7067f35cfbaafbb9b
      (cherry picked from commit e6b0053d)
      (cherry picked from commit a0d02f38)
      5fb848ee
  22. Oct 09, 2016
    • George Joseph's avatar
      pjproject_bundled: Add MALLOC_DEBUG capability · c5e8f501
      George Joseph authored
      pjproject_bundled will now use the asterisk memory debugging APIs
      if MALLOC_DEBUG is turned on in menuselect.
      
      Because this required stubs for the executable programs and the python
      bindings, some Makefile reorganization was needed to properly handle
      the dependencies.  As a result, the makefile now individually makes
      each of the pjproject libraries separately instead of making them all
      in 1 shot.  The only visible change is that there are separate status
      lines printed for each library instead oif 1 for all libs.  Also, the
      making of the pjproject dependency files was eliminated.  They're not
      needed for building unless you're actively modifying pjproject source
      files and it makes the build process faster.  Finally, any issues with
      parallel builds should be resolved again making the build faster.
      
      Change-Id: Icc5e3d658fbfb00e0a46b44c66dcc2522d5171b0
      c5e8f501
  23. Sep 15, 2016
    • George Joseph's avatar
      pjproject_bundled: Prevent SERVFAIL from marking name server bad · 47c527df
      George Joseph authored
      A name server that returns "Server Failure" is indicating only that
      the server couldn't process that particular request.  We should NOT
      assume that the name server is incapable of serving other requests.
      
      Here's the scenario we've been encountering...
      
      * 2 local name servers configured in resolv.conf.
      * An OPTIONS request causes a request for A and AAAA records to go out
        to both nameservers.
      * The A responses both come back successfully resolved.
      * Because of an issue at some upstream nameserver, the AAAA responses
        for that particular query come back as "SERVFAIL" from both local
        name servers.
      * Both local servers are marked as bad and no further queries can be
        sent until the 60 second ttl expires.  Only previously cached results
        can be used.
      * In this case, 60 seconds is just enough time for another OPTIONS
        request to go out to the same host so the cycle repeats.
      
      We could set the bad ttl really low but that also affects REFUSED and
      NOTAUTH which probably DO signal a real server issue.  Besides, even
      a really low bad ttl would be an issue on a pbx.
      
      Although we use our own resolver in 14 and master and don't have this
      issue there, Teluu has merged this patch upstream so it's appropriate
      to cherry-pick to 14 and master to keep pjproject consistent.
      
      
      Change-Id: Ie03ba902288e274aff23f9b9bb2786e1e8be09e0
      47c527df
  24. Sep 06, 2016
    • Alexei Gradinari's avatar
      res_pjsip_session: segfault on already disconnected session · 7bb7f7b9
      Alexei Gradinari authored
      On heavy loaded system the TCP/TLS incoming calls could be
      disconnected by pjproject while these calls are being
      processed by asterisk which could use the session's memory pools.
      If the session in the disconnected state then the session memory
      pools were already freed, so we get segfault.
      
      This patch adds a lifetime control on an INVITE session to pjproject.
      The lifetime of the session is manipulated by calling
      pjsip_inv_add_ref/pjsip_inv_dec_ref.
      This patch uses these functions to inform pjproject that the
      session is in use.
      
      This patch adds check if the session state is not disconnected
      and also checks if the memory pool is not NULL.
      
      This patch also places tasks 'session_end' and 'session_end_completion'
      into session's serializer to avoid race condition.
      
      ASTERISK-26291 #close
      
      Change-Id: I4d28b1fb3b91f0492a911d110049d670fdc3c8d7
      7bb7f7b9
  25. Aug 26, 2016
    • George Joseph's avatar
      pjproject_bundled: Disable srtp use by pjmedia · a7487e92
      George Joseph authored
      The reason for the disable is that while Asterisk works fine with older
      libsrtp versions, newer versions of pjproject won't compile with them.
      Debian 6 for instance, has libsrtp 1.4.4 which is older than what
      pjproject is expecting.
      
      We don't use most of pjmedia but we DO use it for SDP negotiation.
      Luckily disabling srtp in pjmedia doesn't interfere with it's ability
      to negitiate a secure channel.  The proper crypto attributes are
      negotiated in both directions.
      
      ASTERISK-26279 #close
      
      Change-Id: Id25a92cdf3df97a26c53cffae65b6b82de33c8e2
      a7487e92
  26. Aug 20, 2016
    • Alexander Traud's avatar
      pjproject_bundled: Allow IPv4/IPv6 (Dual Stack) configurations. · 12752c64
      Alexander Traud authored
      PJProject supports a lot of platforms even Windows, some with different defaults
      when it comes to IPv6. In many Linux platforms like Ubuntu 16.04 LTS,
      "/proc/sys/net/ipv6/bindv6only" is set to 0 (false). Different than in Windows.
      
      Because of this, if configured with just an IPv6 address/transport, PJProject
      listens to both IPv4 and IPv6. However, this is not supported by the PJProject
      team. As consequence, you end-up with IPv4-mapped IPv6 addresses in SDP,
      incompatible with IPv4-only clients. Technically, you end-up with an IPv6-only
      server which accepts incoming connections on IPv4.
      
      If you try to configure two transports, one with IPv4 and one with IPv6 on the
      same interface, as expected by the PJProject team, the IPv4 transport is not
      able to bind because the IPv6 transport listens to both already.
      
      One solution would be to change "/proc/sys/net/ipv6/bindv6only" system-wide.
      Then, you are able to configure two transports, one for each IP version on the
      same interface. That way, you get a server which works with IPv4 clients and
      IPv6 clients at the same time over the same interface.
      
      Here, this change sets this parameter directly within PJProject to match the
      expectations of the PJProject team in any case. This allows IPv4/IPv6 Dual Stack
      servers out of the box like in chan_sip. This change was accepted by the
      PJProject team as <http://trac.pjsip.org/repos/changeset/5403> and is expected
      to arrive in the next version, PJProject 2.6.0. Until then, this change is
      incorporated in the bundled PJProject of Asterisk.
      
      ASTERISK-26309
      
      Change-Id: I3335d8718f79f4b2feae91b5b005a3ce684a63ae
      12752c64
  27. Jul 28, 2016
    • Alexei Gradinari's avatar
      pjproject: fixed a few bugs · b5bc2fdd
      Alexei Gradinari authored
      This patch fixes the issue in pjsip_tx_data_dec_ref()
      when tx_data_destroy can be called more than once,
      and checks if invalid value (e.g. NULL) is passed to.
      
      This patch updates array limit checks and docs
      in pjsip_evsub_register_pkg() and pjsip_endpt_add_capability().
      
      Change-Id: I4c7a132b9664afaecbd6bf5ea4c951e43e273e40
      b5bc2fdd
    • George Joseph's avatar
      pjproject_bundled: Update for pjproject 2.5.5 · b4f1c638
      George Joseph authored
      Add more --disable-* switches to Makefile.rules including
      --disable-opus which was causing bundled pjproject to fail with
      "undefined reference" errors in libasteriskpj.
      
      Changed PJ_ENABLE_EXTRA_CHECK to 1.
      
      Removed 2 obsolete patches and added a new one.
      The new one was merged by Teluu on 6/27/2016.
      
      ASTERISK-26148 #close
      
      Change-Id: Ib8af6c6a9d31f7238ce65b336134c2efdc855063
      b4f1c638
  28. Jun 29, 2016
    • Matt Jordan's avatar
      pjproject/patches/config_site: Increase the max number of ICE candidates · 9129ac8e
      Matt Jordan authored
      When negotiating ICE candidates with WebRTC capable endpoints, many
      networks will result in a browser offering ICE candidates that exceeds
      the default number of max candidates, 16. This patch bumps the max
      candidates to 32, with the max checks at twice the number of candidates.
      In practice, this has shown to be sufficient for browser/WebRTC
      negotiation.
      
      Change-Id: Ifd8da8b315f5ae14814d4ce20e10d2e6355020e5
      9129ac8e
  29. Jun 21, 2016
    • George Joseph's avatar
      res_pjsip_pubsub: Address SEGV when attempting to terminate a subscription · b57cd014
      George Joseph authored
      Occasionally under load we'll attempt to send a final NOTIFY on a
      subscription that's already been terminated and a SEGV will occur
      down in pjproject's evsub_destroy function.  This is a result of a
      race condition between all the paths that can generate a notify
      and/or destroy the underlying pjproject evsub object:
      
       * The client can send a SUBSCRIBE with Expires: 0.
       * The client can send a SUBSCRIBE/refresh.
       * The subscription timer can expire.
       * An extension state can change.
       * An MWI event can be generated.
       * The pjproject transaction timer (timer_b) can expire.
      
      Normally when our pubsub_on_evsub_state is called with a terminate,
      we push a task to the serializer and return at which point the dialog
      is unlocked.  This is usually not a problem because the task runs
      immediately and locks the dialog again.  When the system is heavily
      loaded though, there may be a delay between the unlock and relock
      during which another event may occur such as the subscription timer
      or timer_b expiring, an extension state change, etc.  These may also
      cause a terminate to be processed and if so, we could cause pjproject
      to try to destroy the evsub structure twice.  There's no way for us to
      tell that the evsub was already destroyed and the evsub's group lock
      can't tolerate this and SEGVs.
      
      The remedy is twofold.
      
       * A patch has been submitted to Teluu and added to the bundled
         pjproject which adds add/decrement operations on evsub's group lock.
      
       * In res_pjsip_pubsub:
         * configure.ac and pjproject-bundled's configure.m4 were updated
           to check for the new evsub group lock APIs.
         * We now add a reference to the evsub group lock when we create
           the subscription and remove the reference when we clean up the
           subscription.  This prevents evsub from being destroyed before
           we're done with it.
         * A state has been added to the subscription tree structure so
           termination progress can be tracked through the asyncronous tasks.
         * The pubsub_on_evsub_state callback has been split so it's not doing
           double duty.  It now only handles the final cleanup of the
           subscription tree.  pubsub_on_rx_refresh now handles both client
           refreshes and client terminates.  It was always being called for
           both anyway.
         * The serialized_on_server_timeout task was removed since
           serialized_pubsub_on_rx_refresh was almost identical.
         * Missing state checks and ao2_cleanups were added.
         * Some debug levels were adjusted to make seeing only off-nominal
           things at level 1 and nominal or progress things at level 2+.
      
      ASTERISK-26099 #close
      Reported-by: Ross Beer.
      
      Change-Id: I779d11802cf672a51392e62a74a1216596075ba1
      b57cd014
  30. May 30, 2016
    • George Joseph's avatar
      pjproject_bundled: Move to pjproject 2.5 · 7fa57667
      George Joseph authored
      Although all the patches we had against 2.4.5 were applied by Teluu,
      a new bug was introduced preventing re-use of tcp and tls transports
      This patch removes all the previous patches against 2.4.5, updates
      the version to 2.5, and adds a new patch to correct the transport
      re-use problem.
      
      Change-Id: I0dc6c438c3910f7887418a5832ca186aea23d068
      7fa57667
  31. May 09, 2016
    • George Joseph's avatar
      pjproject_bundled: Check for python-dev and TEST_FRAMEWORK · facce6f6
      George Joseph authored
      The pjsua and pjsystest apps are now built only if TEST_FRAMEWORK is set.
      The python bindings are now built only if TEST_FRAMEWORK is set and a
      python development package is installed.
      
      libresample was also disabled.
      
      ASTERISK-25993 #close
      Reported-by: Joshua Colp
      
      Change-Id: If4e91c503a02f113d5b71bc8b972081fa3ff6f03
      facce6f6
  32. May 03, 2016
    • George Joseph's avatar
      pjproject_bundled: Various fixes discovered during testing of OSes · e61716b7
      George Joseph authored
      For all OSes:
      * Disabled third-party codecs in pjproject and added
        '--disable-speex-codec --disable-speex-aec --disable-gsm-codec' to the
        configure options since we don't use the pjsip codec capability.
      
      FreeBSD:
      * Added FreeBSD support to install_prereq.
      * Changed pjproject/configure.m4 to use $GNU_MAKE instead of hardcoding "make".
      * Added __progname and environ to asterisk.exports.in.
      * Reverted the use of ldconfig to create shared library symlinks to ln.
      * Only enable epoll in pjproject if `uname -s` is Linux.
      * Added a patch to pjproject to take the name of the 'make' command from
        an environment variable if supplied.  This is needed for the python bindings.
        (merged by Teluu into pjproject trunk 5/3/2016)
      FreeBSD support isn't complete.  Still some general issues regarding
      make/gmake having nothing to do with pjproject.  With some handholding it DOES
      build successfully.
      
      CentOS:
      Added 'patch' and 'bzip2' to install_prereq PACKAGES_RH.
      CentOS 6/7 32/64 build and run the pjsip testsuite successfully.
      
      Ubuntu:
      No changes required.
      Ubuntu 15/16 32/64 build and run the pjsip testsuite successfully.
      
      Debian:
      No changes required.
      Debian 6/7/8 32/64 build and run the pjsip testsuite successfully.
      
      There will utimately be a follow-up patch to create an install_prereq for
      the testsuite as I've discovered a few missing requirements.
      
      ASTERISK-25968 #close
      
      Change-Id: I5756a07facfc63798115a5e73a8709382fe9259c
      e61716b7
  33. Apr 28, 2016
    • George Joseph's avatar
      pjproject_bundled: Disable PJSIP_UNESCAPE_IN_PLACE · 30415944
      George Joseph authored
      When pjsip_parse_uri is called with PJSIP_UNESCAPE_IN_PLACE enabled,
      the input uri string will become corrupted if it contains escape sequences.
      It's not possible to automatically strdup or strdupa the input string because
      the output uri pj_str_t's will have pointers to chunks of the input string.
      Getting around this would require more memory management code and wouldn't
      be worth the savings of doing the unescape in place.
      
      ASTERISK-25970 #close
      Reported-by: Dmitriy Serov
      
      Change-Id: I28dc0e599b5108f7959b9c46dc8278371b372f88
      30415944
  34. Apr 12, 2016
    • George Joseph's avatar
      pjproject: Add patch for removing strip of '[]' from header params · bd3671b3
      George Joseph authored
      From the patch submitted to Teluu on 4/12/2016
      <<<<<<<<<
      The wholesale stripping of '[]' from header parameters causes issues if
      something (like a port) occurs after the final ']'.
      
      '[2001:a::b]' will correctly parse to '2001:a::b'
      '[2001:a::b]:8080' will correctly parse to '2001:a::b' but the scanner is left
      with ':8080' and parsing stops with a syntax error.
      
      I can't even find a case where stripping the '[]' is a good thing anyway.  Even
      if you continued to parse and resulted in a string that looks like this...
      '2001:a::b:8080', it's not valid.
      
      This came up in Asterisk because Kamailio sends us a Contact with an alias
      URI parameter that has an IPv6 address in it like this:
      Contact: <sip:1171@127.0.0.1:5080;alias=[2001:1:2::3]~43691~6>
      which should be legal but causes a syntax error because of the characters
      after the final ']'.  Even if it didn't, the '[]' should still not be stripped.
      
      I've run the Asterisk Test Suite for PJSIP (252 tests) many of which are IPv6
      enabled.  No issues were caused by removing the code that strips the '[]'.
      >>>>>>>>>>>
      
      ASTERISK-25123 #close
      Reported-by: Anthony Messina
      
      Change-Id: I5cb33f4ebf07ee1f2b26d07caae715e2ec65595a
      bd3671b3
  35. Apr 10, 2016
    • George Joseph's avatar
      pjproject: Add patch to fix Via IPv6 parsing · 8637f29d
      George Joseph authored
      There's a bug in pjproject's sip_parser where the ":" wasn't correctly
      interpreted. This is causing IPv6 addresses in the "received" parameter of the
      Via header to cause a syntax check failure.
      
      This patch was submitted to Teluu on 4/10/2016.
      
      ASTERISK-25910 #close
      Reported-by: Anthony Messina
      
      Change-Id: Ic7e4c4aa14ded61860401ec349f5177568c4d922
      8637f29d
  36. Mar 23, 2016
  37. Mar 14, 2016
  38. Mar 12, 2016
    • George Joseph's avatar
      pjproject: Pass (dont_)optimize flags to pjproject and fix pjsua · 63813313
      George Joseph authored
      The pjproject Makefile now uses the Asterisk optimization flags which
      are determined by the setting of the DONT_OPTMIZE menuselect flag.
      The Makefile was also restructured so a change to the top level
      menuselect.makeopts will result in a rebuild of pjproject.
      
      Also, "--disable-resample" was removed from the pjproject configure
      options.  Without resample, pjsua (which is used by the testsuite)
      can't make audio calls.  When it can't, it segfaults.
      
      Change-Id: I24b0a4d0872acef00ed89b3c527a713ee4c2ccd4
      63813313
Loading