Skip to content
Snippets Groups Projects
  1. Mar 05, 2016
    • George Joseph's avatar
      install_prereq: Add packages for bundled pjproject · 471ff375
      George Joseph authored
      RedHat/CentOS needs python-devel
      Debian/Ubuntu needs automake, libsrtp-dev and python-dev
      
      Ubuntu also needed libncurses5-dev for cmenuselect so while not
      needed for pjproject, I adedd it anyway.
      
      Change-Id: Idf5fa16e2d87c687439621507e122cb9461d7089
      471ff375
  2. Mar 04, 2016
  3. Mar 03, 2016
    • George Joseph's avatar
      third_party/Makefile.rules: Replace unsupported != operator with $(shell ...) · 37472f73
      George Joseph authored
      Apparently the != operator is fairly new so I've replaced it with
      the old $(shell ...) syntax.
      
      Change-Id: I16b2e1878a4f91e7e9740abd427f9639f933c479
      Reported-by: Richard Mudgett
      37472f73
    • zuul's avatar
    • George Joseph's avatar
      loader: Retry dlopen when loading fails · 195100e7
      George Joseph authored
      Although we use the RTLD_LAZY flag when calling dlopen
      the first time on a module, this only defers resolution
      for function calls.  Pointer references to functions are
      determined at link time so dlopen expects them to be there.
      Since we don't cross-module link, pointers to functions
      in other modules won't be available and dlopen will fail.
      
      Doing a "hardened" build also causes problems because it
      typically sets "-z now" on the ld command line which
      overrides RTLD_LAZY at run time.
      
      If the failing module isn't a GLOBAL_SYMBOLS module, then
      dlopen will be called again after all the GLOBAL_SYMBOLS
      modules have been loaded and they'll eventually resolve.
      
      If the calling module IS a GLOBAL_SYMBOLS module itself
      and a third module depends on it, then there's an issue
      because the second time through the dlopen loop,
      GLOBAL_SYMBOLS modules aren't given any special treatment
      and since the order in which dlopen is called isn't
      deterministic, the dependent may again be tried before the
      module it needs is loaded.
      
      Simple solution:  Save modules that fail load_resource
      because of a dlopen error in a list and retry them
      immediately after the first pass. Keep retrying until
      the failed list is empty or we reach a #defined max
      retries. Error messages are suppressed until the final
      pass which also gets rid of those confusing error messages
      about module failures that are later corrected.
      
      Change-Id: Iddae1d97cd2f00b94e61662447432765755f64bb
      195100e7
    • zuul's avatar
      6705f308
    • Kevin Harwell's avatar
      bridge.c: Crash during attended transfer when missing a local channel half · 15c5743a
      Kevin Harwell authored
      It's possible for the transferer channel to get hung up early during the
      attended transfer process. For instance, a phone may send a "bye" immediately
      upon receiving a sip notify that contains a sip frag 100 (I'm looking at you
      Jitsi). When this occurs a race begins between the transferer being hung up
      and completion of the transfer code.
      
      If the channel hangs up too early during a transfer involving stasis bridging
      for instance, then when the created local channel goes to look up its swap
      channel (and associated datastore) it can't find it (since it is no longer in
      the bridge) thus it fails to enter the stasis application. Consequently, the
      created local channel(s) hang up as well. If the timing is just right then the
      bridging code attempts to add the message link with missing local channel(s).
      Hence the crash.
      
      Unfortunately, there is no great way to solve the problem of the unexpected
      "bye". While we can't guarantee we won't receive an early hangup, and in this
      case still fail to enter the stasis application, we can make it so asterisk
      does not crash.
      
      This patch does just that by locking the local channel structure, checking
      that the local channel's peer has not been lost, and then continuing. This
      keeps the local channel's peer from being ripped out from underneath it by
      the local/unreal hangup code while attempting to set the stasis message link.
      
      ASTERISK-25771
      
      Change-Id: Ie6d6061e34c7c95f07116fffac9a09e5d225c880
      15c5743a
    • zuul's avatar
      7023055d
    • Joshua Colp's avatar
      res_pjsip_dtmf_info: NULL terminate the message body. · 6af7fc4c
      Joshua Colp authored
      PJSIP does not ensure that when printing the message body the
      buffer will be NULL terminated. This is problematic when searching
      for the signal and duration values of the DTMF.
      
      This change ensures the buffer is always NULL terminated.
      
      Change-Id: I52653a1a60c93092d06af31a27408d569cc98968
      6af7fc4c
    • Joshua Colp's avatar
    • Joshua Colp's avatar
    • Joshua Colp's avatar
    • zuul's avatar
    • zuul's avatar
  4. Mar 02, 2016
    • George Joseph's avatar
      alembic: Fix downgrade and tweak for sqlite · b8b7c2e4
      George Joseph authored
      Downgrade had a few issues.  First there was an errant 'update' statement in
      add_auto_dtmf_mode that looks like it was a copy/paste error.  Second, we
      weren't cleaning up the ENUMs so subsequent upgrades on postgres failed
      because the types already existed.
      
      For sqlite...  sqlite doesn't support ALTER or DROP COLUMN directly.
      Fortunately alembic batch_operations takes care of this for us if we
      use it so the alter and drops were converted to use batch operations.
      
      Here's an example downgrade:
      
          with op.batch_alter_table('ps_endpoints') as batch_op:
              batch_op.drop_column('tos_audio')
              batch_op.drop_column('tos_video')
              batch_op.add_column(sa.Column('tos_audio', yesno_values))
              batch_op.add_column(sa.Column('tos_video', yesno_values))
              batch_op.drop_column('cos_audio')
              batch_op.drop_column('cos_video')
              batch_op.add_column(sa.Column('cos_audio', yesno_values))
              batch_op.add_column(sa.Column('cos_video', yesno_values))
      
          with op.batch_alter_table('ps_transports') as batch_op:
              batch_op.drop_column('tos')
              batch_op.add_column(sa.Column('tos', yesno_values))
          # Can't cast integers to YESNO_VALUES, so dropping and adding is required
              batch_op.drop_column('cos')
              batch_op.add_column(sa.Column('cos', yesno_values))
      
      Upgrades from base to head and downgrades from head to base were tested
      repeatedly for postgresql, mysql/mariadb, and sqlite3.
      
      Change-Id: I862b0739eb3fd45ec3412dcc13c2340e1b7baef8
      b8b7c2e4
    • George Joseph's avatar
      config_transport: Fix objects returned by ast_sip_get_transport_states · 7b71bca8
      George Joseph authored
      ast_sip_get_transport_states was returning a container of internal_state
      objects instead of ast_sip_transport_state objects.  This was causing
      transport lookups to fail, most noticably in res_pjsip_nat, which
      couldn't find the correct external addresses.  This was causing contacts
      to go out with internal ip addresses.
      
      ASTERISK-25830 #close
      Reported-by: Sean Bright
      
      Change-Id: I1aee6a2fd46c42e8dd0af72498d17de459ac750e
      7b71bca8
    • Scott Griepentrog's avatar
      CHAOS: cleanup possible null vars on msg alloc failure · 0a3f0e85
      Scott Griepentrog authored
      In message.c, if msg_alloc fails to init the string field,
      vars may be null, so use a null tolerant cleanup.
      
      In res_pjsip_messaging.c, if msg_data_create fails, mdata
      will be null, so use a null tolerant cleanup.
      
      ASTERISK-25323
      
      Change-Id: Ic2d55c2c3750d5616e2a05ea92a19c717507ff56
      0a3f0e85
    • Scott Griepentrog's avatar
      CHAOS: prevent crash on failed strdup · 60aa871b
      Scott Griepentrog authored
      This patch avoids crashing on a null pointer
      if the strdup() allocation fails.
      
      ASTERISK-25323
      
      Change-Id: I3f67434820ba53b53663efd6cbb42749f4f6c0f5
      60aa871b
    • Richard Mudgett's avatar
      func_callerid.c: Update REDIRECTING reason documentation. · 0bdbf0d8
      Richard Mudgett authored
      Change-Id: I6e8d39b0711110a4bceafa652e58b30465e28386
      0bdbf0d8
    • Richard Mudgett's avatar
      SIP diversion: Fix REDIRECTING(reason) value inconsistencies. · 25de01f3
      Richard Mudgett authored
      Previous chan_sip behavior:
      
      Before this patch chan_sip would always strip any quotes from an incoming
      reason and pass that value up as the REDIRECTING(reason).  For an outgoing
      reason value, chan_sip would check the value against known values and
      quote any it didn't recognize.  Incoming 480 response message reason text
      was just assigned to the REDIRECTING(reason).
      
      Previous chan_pjsip behavior:
      
      Before this patch chan_pjsip would always pass the incoming reason value
      up as the REDIRECTING(reason).  For an outgoing reason value, chan_pjsip
      would send the reason value as passed down.
      
      With this patch:
      
      Both channel drivers match incoming reason values with values documented
      by REDIRECTING(reason) and values documented by RFC5806 regardless of
      whether they are quoted or not.  RFC5806 values are mapped to the
      equivalent REDIRECTING(reason) documented value and is set in
      REDIRECTING(reason).  e.g., an incoming RFC5806 'unconditional' value or a
      quoted string version ('"unconditional"') is converted to
      REDIRECTING(reason)'s 'cfu' value.  The user's dialplan only needs to deal
      with 'cfu' instead of any of the aliases.
      
      The incoming 480 response reason text supported by chan_sip checks for
      known reason values and if not matched then puts quotes around the reason
      string and assigns that to REDIRECTING(reason).
      
      Both channel drivers send outgoing known REDIRECTING(reason) values as the
      unquoted RFC5806 equivalent.  User custom values are either sent as is or
      with added quotes if SIP doesn't allow a character within the value as
      part of a RFC3261 Section 25.1 token.  Note that there are still
      limitations on what characters can be put in a custom user value.  e.g.,
      embedding quotes in the middle of the reason string is silly and just
      going to cause you grief.
      
      * Setting a REDIRECTING(reason) value now recognizes RFC5806 aliases.
      e.g., Setting REDIRECTING(reason) to 'unconditional' is converted to the
      'cfu' value.
      
      * Added missing malloc() NULL return check in res_pjsip_diversion.c
      set_redirecting_reason().
      
      * Fixed potential read from a stale pointer in res_pjsip_diversion.c
      add_diversion_header().  The reason string needed to be copied into the
      tdata memory pool to ensure that the string would always be available.
      Otherwise, if the reason string returned by reason_code_to_str() was a
      user's reason string then the string could be freed later by another
      thread.
      
      Change-Id: Ifba83d23a195a9f64d55b9c681d2e62476b68a87
      25de01f3
    • Richard Mudgett's avatar
      res_pjsip_send_to_voicemail.c: Allow either quoted or not send_to_vm reason. · 8c8ef4ef
      Richard Mudgett authored
      Change-Id: Id6350b3c7d4ec8df7ec89863566645e2b0f441fd
      8c8ef4ef
    • Richard Mudgett's avatar
      res_pjsip_send_to_voicemail.c: Fix off-nominal double channel unref. · 75ec137e
      Richard Mudgett authored
      * Fix double unref of other_party channel in off nominal path.
      
      * This is unlikely to be a real problem.  However, for safety,
      in handle_incoming_request() keep the datastore ref with the
      other_party channel ref until we are finished with the other_party
      channel.
      
      Change-Id: I78f22547bf0bb99fb20814ceab75952bd857f821
      75ec137e
  5. Mar 01, 2016
    • George Joseph's avatar
      build-system: Allow building with static pjproject · 3173e91b
      George Joseph authored
      Background here:
      http://lists.digium.com/pipermail/asterisk-dev/2016-January/075266.html
      
      From CHANGES:
       * To help insure that Asterisk is compiled and run with the same known
         version of pjproject, a new option (--with-pjproject-bundled) has been
         added to ./configure.  When specified, the version of pjproject specified
         in third-party/versions.mak will be downloaded and configured.  When you
         make Asterisk, the build process will also automatically build pjproject
         and Asterisk will be statically linked to it.  Once a particular version
         of pjproject is configured and built, it won't be configured or built
         again unless you run a 'make distclean'.
      
         To facilitate testing, when 'make install' is run, the pjsua and pjsystest
         utilities and the pjproject python bindings will be installed in
         ASTDATADIR/third-party/pjproject.
      
         The default behavior remains building with the shared pjproject
         installation, if any.
      
      Building:
      
         All you have to do is include the --with-pjproject-bundled option on
         the ./configure command line (and remove any existing --with-pjproject
         option if specified).  Everything else is automatic.
      
      Behind the scenes:
      
         The top-level Makefile was modified to include 'third-party' in the
         list of MOD_SUBDIRS.
      
         The third-party directory was created to contain any third party
         packages that may be needed in the future.  Its Makefile automatically
         iterates over any subdirectories passing on targets.
      
         The third-party/pjproject directory was created to house the pjproject
         source distribution.  Its Makefile contains targets to download, patch
         configure, generate dependencies, compile libs, apps and python bindings,
         sanitized build.mak and generate a symbols list.
      
         When bootstrap.sh is run, it automatically includes the configure.m4
         file in third-party/pjproject.  This file has a macro to download and
         conifgure pjproject and get and set PJPROJECT_INCLUDE, PJPROJECT_DIR
         and PJPROJECT_BUNDLED.  It also tests for the capabilities like
         PJ_TRANSACTION_GRP_LOCK by parsing preprocessor output as opposed to
         trying to compile.  Of course, bootstrap.sh is only run once and the
         configure file is incldued in the patch.
      
         When configure is run with the new options, the macro in configure.m4
         triggers the download, patch, conifgure and tests.  No compilation is
         performed at this time.  The downloaded tarball is cached in /tmp so
         it doesn't get downloaded again on a distclean.
      
         When make is run in the top-level Asterisk source directory, it will
         automatically descend all the subdirectories in third_party just as it
         does for addons, apps, etc.  The top-level Makefile makes sure that
         the 'third-party' is built before 'main' so that dependencies from the
         other directories are built first.
      
         When main does build, a new shared library (libasteriskpj) is created that
         links statically to the pjproject .a files and exports all their symbols.
         The asterisk binary links to that, just as it does with libasteriskssl.
      
         When Asterisk is installed, the pjsua and pjsystest apps, and the pjproject
         python bindings are installed in ASTDATADIR/third-party/pjproject.  This
         will facilitate testing, including running the testsuite which will be
         updated to check that directory for the pjsua module ahead of the system
         python library.
      
      Modules should continue to depend on pjproject if they use pjproject APIs
      directly.  They should not care about the implementation.  No changes to any
      res_pjsip modules were made.
      
      Change-Id: Ia7a60c28c2e9ba9537c5570f933c1ebcb20a3103
      3173e91b
    • Joshua Colp's avatar
    • Joshua Colp's avatar
    • Joshua Colp's avatar
    • Joshua Colp's avatar
    • Joshua Colp's avatar
    • Joshua Colp's avatar
  6. Feb 29, 2016
    • zuul's avatar
    • Richard Mudgett's avatar
      chan_sip.c: Fix T.38 issues caused by leaving a bridge. · 2dae4a1c
      Richard Mudgett authored
      chan_sip could not handle AST_T38_TERMINATED frames being sent to it when
      the channel left the bridge.  The action resulted in overlapping outgoing
      reINVITEs.  The testsuite tests/fax/sip/directmedia_reinvite_t38 was not
      happy.
      
      * Force T.38 to be remembered as locally bridged.  Now when the channel
      leaves the native RTP bridge after T.38, the channel remembers that it has
      already reINVITEed the media back to Asterisk.  It just needs to terminate
      T.38 when the AST_T38_TERMINATED arrives.
      
      * Prevent redundant AST_T38_TERMINATED from causing problems.  Redundant
      AST_T38_TERMINATED frames could cause overlapping outgoing reINVITEs if
      they happen before the T.38 state changes to disabled.  Now the T.38 state
      is set to disabled before the reINVITE is sent.
      
      ASTERISK-25582 #close
      
      Change-Id: I53f5c6ce7d90b3f322a942af1a9bcab6d967b7ce
      2dae4a1c
    • Richard Mudgett's avatar
      res_pjsip_t38.c: Back out part of an earlier fix attempt. · bf29a4e2
      Richard Mudgett authored
      This backs out item 4 of the 4875e5ac
      commit.  Item 4 added the t38_bye_supplement.  Unfortunately, the frame
      that it puts into the bridge may or may not be processed by the time the
      bridged peer is kicked out of the bridge.  If it is processed then all is
      well.  However, if it is not processed then that channel is stuck in fax
      mode until it hangs up or maybe if it joins another bridge for T.38
      faxing.
      
      ASTERISK-25582
      
      Change-Id: Ib20a03ecadf1bf8a0dcadfadf6c2f2e60919a9f7
      bf29a4e2
    • Richard Mudgett's avatar
      bridge core: Add owed T.38 terminate when channel leaves a bridge. · c7d45b84
      Richard Mudgett authored
      The channel is now going to get T.38 terminated when it leaves the
      bridging system and the bridged peers are going to get T.38 terminated as
      well.
      
      ASTERISK-25582
      
      Change-Id: I77a9205979910210e3068e1ddff400dbf35c4ca7
      c7d45b84
    • Richard Mudgett's avatar
      channel api: Create is_t38_active accessor functions. · 0e296563
      Richard Mudgett authored
      ASTERISK-25582
      
      Change-Id: I69451920b122de7ee18d15bb231c80ea7067a22b
      0e296563
    • Richard Mudgett's avatar
      bridge_channel: Don't settle owed events on an optimization. · 86f7336c
      Richard Mudgett authored
      Local channel optimization could cause DTMF digits to be duplicated.
      Pending DTMF end events would be posted to a bridge when the local channel
      optimizes out and is replaced by the channel further down the chain.  When
      the real digit ends, the channel would get another DTMF end posted to the
      bridge.
      
      A -- LocalA;1/n -- LocalA;2/n -- LocalB;1 -- LocalB;2 -- B
      
      1) LocalA has the /n flag to prevent optimization.
      2) B is sending DTMF to A through the local channel chain.
      3) When LocalB optimizes out it can move B to the position of LocalB;1
      4) Without this patch, when B swaps with LocalB;1 then LocalB;1 would
      settle an owed DTMF end to the bridge toward LocalA;2.
      5) When B finally ends its DTMF it sends the DTMF end down the chain.
      6) Without this patch, A would hear the DTMF digit end when LocalB
      optimizes out and when B ends the original digit.
      
      ASTERISK-25582
      
      Change-Id: I1bbd28b8b399c0fb54985a5747f330a4cd2aa251
      86f7336c
    • Richard Mudgett's avatar
      channel.c: Route all control frames to a channel through the same code. · 128c9645
      Richard Mudgett authored
      Frame hooks can conceivably return a control frame in exchange for an
      audio frame inside ast_write().  Those returned control frames were not
      handled quite the same as if they were sent to ast_indicate().  Now it
      doesn't matter if you use ast_write() to send an AST_FRAME_CONTROL to a
      channel or ast_indicate().
      
      ASTERISK-25582
      
      Change-Id: I5775f41421aca2b510128198e9b827bf9169629b
      128c9645
    • George Joseph's avatar
      sorcery: Refactor create, update and delete to better deal with caches · 44229052
      George Joseph authored
      The ast_sorcery_create, update and delete function have been refactored
      to better deal with caches and errors.
      
      The action is now called on all non-caching wizards first. If ANY succeed,
      the action is called on all caching wizards and the observers are notified.
      This way we don't put something in the cache (or update or delete) before
      knowing the action was performed in at least 1 backend and we only call the
      observers once even if there were multiple writable backends.
      
      ast_sorcery_create was never adding to caches in the first place which
      was preventing contacts from getting added to a memory_cache when they
      were created.  In turn this was causing memory_cache to emit errors if
      the contact was deleted before being retrieved (which would have
      populated the cache).
      
      ASTERISK-25811 #close
      Reported-by: Ross Beer
      
      Change-Id: Id5596ce691685a79886e57b0865888458d6e7b46
      44229052
Loading