Skip to content
Snippets Groups Projects
  1. Mar 10, 2021
  2. Mar 05, 2021
    • Joshua C. Colp's avatar
      sorcery: Add support for more intelligent reloading. · 304f8ddf
      Joshua C. Colp authored
      Some sorcery objects actually contain dynamic content
      that can change despite the underlying configuration
      itself not changing. A good example of this is the
      res_pjsip_endpoint_identifier_ip module which allows
      specifying hostnames. While the configuration may not
      change between reloads the DNS information of the
      hostnames can.
      
      This change adds the ability for a sorcery object to be
      marked as having dynamic contents which is then taken
      into account when reloading by the sorcery file based
      config module. If there is an object with dynamic content
      then a reload will be forced while if there are none
      then the existing behavior of not reloading occurs.
      
      ASTERISK-29321
      
      Change-Id: I9342dc55be46cc00204533c266a68d972760a0b1
      304f8ddf
  3. Feb 23, 2021
  4. Feb 16, 2021
    • Ben Ford's avatar
      core_unreal: Fix T.38 faxing when using local channels. · 00b229c6
      Ben Ford authored
      After some changes to streams and topologies, receiving fax through
      local channels stopped working. This change adds a stream topology with
      a stream of type IMAGE to the local channel pair and allows fax to be
      received.
      
      ASTERISK-29035 #close
      
      Change-Id: Id103cc5c9295295d8e68d5628e76220f8f17e9fb
      00b229c6
  5. Jan 27, 2021
    • Dan Cropp's avatar
      chan_pjsip, app_transfer: Add TRANSFERSTATUSPROTOCOL variable · 55891227
      Dan Cropp authored
      When a Transfer/REFER is executed, TRANSFERSTATUSPROTOCOL variable is
      0 when no protocl specific error
      SIP example of failure, 3xx-6xx for the SIP error code received
      
      This allows applications to perform actions based on the failure
      reason.
      
      ASTERISK-29252 #close
      Reported-by: Dan Cropp
      
      Change-Id: Ia6a94784b4925628af122409cdd733c9f29abfc4
      55891227
  6. Jan 06, 2021
    • Sean Bright's avatar
      asterisk: Export additional manager functions · 1b74555f
      Sean Bright authored
      Rename check_manager_enabled() and check_webmanager_enabled() to begin
      with ast_ so that the symbols are automatically exported by the
      linker.
      
      ASTERISK~29184
      
      Change-Id: I85762b9a5d14500c15f6bad6507138c8858644c9
      1b74555f
  7. Jan 04, 2021
    • Alexander Traud's avatar
      codecs: Remove test-law. · 80c14f74
      Alexander Traud authored
      This was dead code, test code introduced with Asterisk 13. This was
      found while analyzing ASTERISK_28416 and ASTERISK_29185. This change
      partly fixes, not closes those two issues.
      
      Change-Id: I42d0daa37f6f334c7d86672f06f085858a3f3940
      80c14f74
  8. Dec 09, 2020
    • lvl's avatar
      Introduce astcachedir, to be used for temporary bucket files · b0842713
      lvl authored
      As described in the issue, /tmp is not a suitable location for a
      large amount of cached media files, since most distributions make
      /tmp a RAM-based tmpfs mount with limited capacity.
      
      I opted for a location that can be configured separately, as opposed
      to using a subdirectory of spooldir, given the different storage
      profile (transient files vs files that might stay there indefinitely).
      
      This commit just makes the cache directory configurable, and changes
      the default location from /tmp to /var/cache/asterisk.
      
      ASTERISK-29143
      
      Change-Id: Ic54e95199405abacd9e509cef5f08fa14c510b5d
      b0842713
  9. Nov 09, 2020
    • George Joseph's avatar
      pjsip_scheduler.c: Add type ONESHOT and enhance cli show command · 5a4640d2
      George Joseph authored
      * Added a ONESHOT type that never reschedules.
      
      * Added "like" capability to "pjsip show scheduled_tasks" so you can do
        the following:
      
        CLI> pjsip show scheduled_tasks like outreg
        PJSIP Scheduled Tasks:
      
        Task Name                                     Interval  Times Run ...
        ============================================= ========= ========= ...
        pjsip/outreg/testtrunk-reg-0-00000074            50.000   oneshot ...
        pjsip/outreg/voipms-reg-0-00000073              110.000   oneshot ...
      
      * Fixed incorrect display of "Next Start".
      
      * Compacted the displays of times in the CLI.
      
      * Added two new functions (ast_sip_sched_task_get_times2,
        ast_sip_sched_task_get_times_by_name2) that retrieve the interval,
        next start time, and next run time in addition to the times already
        returned by ast_sip_sched_task_get_times().
      
      Change-Id: Ie718ca9fd30490b8a167bedf6b0b06d619dc52f3
      5a4640d2
    • Alexei Gradinari's avatar
      sched: AST_SCHED_REPLACE_UNREF can lead to use after free of data · cc7eb72f
      Alexei Gradinari authored
      The data can be freed if the old object '_data' is the same object as
      new 'data'. Because at first the object is unreferenced which can lead
      to destroying it.
      
      This could happened in res_pjsip_pubsub when the publication is updated
      which could lead to segfault in function publish_expire.
      
      Change-Id: I0164f57c387243510bdbd2f8dcf33377b6c202da
      cc7eb72f
    • Alexander Traud's avatar
      res_stir_shaken: Include OpenSSL headers where used actually. · 64d2de19
      Alexander Traud authored
      This avoids the inclusion of the OpenSSL headers in the public header,
      which avoids one external library dependency in res_pjsip_stir_shaken.
      
      Change-Id: I6a07e2d81d2b5442e24e99b8cc733a99f881dcf4
      64d2de19
  10. Nov 05, 2020
    • Kevin Harwell's avatar
      AST-2020-001 - res_pjsip: Return dialog locked and referenced · b82f8806
      Kevin Harwell authored
      pjproject returns the dialog locked and with a reference. However,
      in Asterisk the method that handles this decrements the reference
      and removes the lock prior to returning. This makes it possible,
      under some circumstances, for another thread to free said dialog
      before the thread that created it attempts to use it again. Of
      course when the thread that created it tries to use a freed dialog
      a crash can occur.
      
      This patch makes it so Asterisk now returns the newly created
      dialog both locked, and with an added reference. This allows the
      caller to de-reference, and unlock the dialog when it is safe to
      do so.
      
      In the case of a new SIP Invite the lock, and reference are now
      held for the entirety of the new invite handling process.
      Otherwise it's possible for the dialog, or its dependent objects,
      like the transaction, to disappear. For example if there is a TCP
      transport error.
      
      ASTERISK-29057 #close
      
      Change-Id: I5ef645a47829596f402cf383dc02c629c618969e
      (cherry picked from commit 6baa4b53)
      b82f8806
    • Ben Ford's avatar
      AST-2020-002 - res_pjsip: Stop sending INVITEs after challenge limit. · cd8f8b94
      Ben Ford authored
      If Asterisk sends out and INVITE and receives a challenge with a
      different nonce value each time, it will continually send out INVITEs,
      even if the call is hung up. The endpoint must be configured for
      outbound authentication in order for this to occur. A limit has been set
      on outbound INVITEs so that, once reached, Asterisk will stop sending
      INVITEs and the transaction will terminate.
      
      ASTERISK-29013
      
      Change-Id: I2d001ca745b00ca8aa12030f2240cd72363b46f7
      cd8f8b94
  11. Oct 02, 2020
    • Kevin Harwell's avatar
      Logging: Add debug logging categories · 56028426
      Kevin Harwell authored
      Added debug logging categories that allow a user to output debug
      information based on a specified category. This lets the user limit,
      and filter debug output to data relevant to a particular context,
      or topic. For instance the following categories are now available for
      debug logging purposes:
      
        dtls, dtls_packet, ice, rtcp, rtcp_packet, rtp, rtp_packet,
        stun, stun_packet
      
      These debug categories can be enable/disable via an Asterisk CLI command.
      
      While this overrides, and outputs debug data, core system debugging is
      not affected by this patch. Statements still output at their appropriate
      debug level. As well backwards compatibility has been maintained with
      past debug groups that could be enabled using the CLI (e.g. rtpdebug,
      stundebug, etc.).
      
      ASTERISK-29054 #close
      
      Change-Id: I6e6cb247bb1f01dbf34750b2cd98e5b5b41a1849
      56028426
    • Sean Bright's avatar
      pbx.c: On error, ast_add_extension2_lockopt should always free 'data' · 51cba591
      Sean Bright authored
      In the event that the desired extension already exists,
      ast_add_extension2_lockopt() will free the 'data' it is passed before
      returning an error, so we should not be freeing it ourselves.
      
      Additionally, there were two places where ast_add_extension2_lockopt()
      could return an error without also freeing the 'data' pointer, so we
      add that.
      
      ASTERISK-29097 #close
      
      Change-Id: I904707aae55169feda050a5ed7c6793b53fe6eae
      51cba591
    • George Joseph's avatar
      app_confbridge/bridge_softmix: Add ability to force estimated bitrate · 773f424c
      George Joseph authored
      app_confbridge now has the ability to set the estimated bitrate on an
      SFU bridge.  To use it, set a bridge profile's remb_behavior to "force"
      and set remb_estimated_bitrate to a rate in bits per second.  The
      remb_estimated_bitrate parameter is ignored if remb_behavior is something
      other than "force".
      
      Change-Id: Idce6464ff014a37ea3b82944452e56cc4d75ab0a
      773f424c
  12. Sep 22, 2020
  13. Sep 16, 2020
  14. Sep 15, 2020
  15. Sep 14, 2020
    • George Joseph's avatar
      debugging: Add enough to choke a mule · 44bb0858
      George Joseph authored
      Added to:
       * bridges/bridge_softmix.c
       * channels/chan_pjsip.c
       * include/asterisk/res_pjsip_session.h
       * main/channel.c
       * res/res_pjsip_session.c
      
      There NO functional changes in this commit.
      
      Change-Id: I06af034d1ff3ea1feb56596fd7bd6d7939dfdcc3
      44bb0858
    • George Joseph's avatar
      res_pjsip_session: Handle multi-stream re-invites better · 86f1bce1
      George Joseph authored
      When both Asterisk and a UA send re-invites at the same time, both
      send 491 "Transaction in progress" responses to each other and back
      off a specified amount of time before retrying. When Asterisk
      prepares to send its re-invite, it sets up the session's pending
      media state with the new topology it wants, then sends the
      re-invite.  Unfortunately, when it received the re-invite from the
      UA, it partially processed the media in the re-invite and reset
      the pending media state before sending the 491 losing the state it
      set in its own re-invite.
      
      Asterisk also was not tracking re-invites received while an existing
      re-invite was queued resulting in sending stale SDP with missing
      or duplicated streams, or no re-invite at all because we erroneously
      determined that a re-invite wasn't needed.
      
      There was also an issue in bridge_softmix where we were using a stream
      from the wrong topology to determine if a stream was added.  This also
      caused us to erroneously determine that a re-invite wasn't needed.
      
      Regardless of how the delayed re-invite was triggered, we need to
      reconcile the topology that was active at the time the delayed
      request was queued, the pending topology of the queued request,
      and the topology currently active on the session.  To do this we
      need a topology resolver AND we need to make stream named unique
      so we can accurately tell what a stream has been added or removed
      and if we can re-use a slot in the topology.
      
      Summary of changes:
      
       * bridge_softmix:
         * We no longer reset the stream name to "removed" in
           remove_all_original_streams().  That was causing  multiple streams
           to have the same name and wrecked the checks for duplicate streams.
      
         * softmix_bridge_stream_sources_update() was checking the old_stream
           to see if it had the softmix prefix and not considering the stream
           as "new" if it did.  If the stream in that slot has something in it
           because another re-invite happened, then that slot in old might
           have a softmix stream but the same stream in new might actually
           be a new one.  Now we check the new_stream's name instead of
           the old_stream's.
      
       * stream:
         * Instead of using plain media type name ("audio", "video", etc) as
           the default stream name, we now append the stream position to it
           to make it unique.  We need to do this so we can distinguish multiple
           streams of the same type from each other.
      
         * When we set a stream's state to REMOVED, we no longer reset its
           name to "removed" or destroy its metadata.  Again, we need to
           do this so we can distinguish multiple streams of the same
           type from each other.
      
       * res_pjsip_session:
         * Added resolve_refresh_media_states() that takes in 3 media states
           and creates an up-to-date pending media state that includes the changes
           that might have happened while a delayed session refresh was in the
           delayed queue.
      
         * Added is_media_state_valid() that checks the consistency of
           a media state and returns a true/false value. A valid state has:
           * The same number of stream entries as media session entries.
               Some media session entries can be NULL however.
           * No duplicate streams.
           * A valid stream for each non-NULL media session.
           * A stream that matches each media session's stream_num
             and media type.
      
         * Updated handle_incoming_sdp() to set the stream name to include the
           stream position number in the name to make it unique.
      
         * Updated the ast_sip_session_delayed_request structure to include both
           the pending and active media states and updated the associated delay
           functions to process them.
      
         * Updated sip_session_refresh() to accept both the pending and active
           media states that were in effect when the request was originally queued
           and to pass them on should the request need to be delayed again.
      
         * Updated sip_session_refresh() to call resolve_refresh_media_states()
           and substitute its results for the pending state passed in.
      
         * Updated sip_session_refresh() with additional debugging.
      
         * Updated session_reinvite_on_rx_request() to simply return PJ_FALSE
           to pjproject if a transaction is in progress.  This stops us from
           creating a partial pending media state that would be invalid later on.
      
         * Updated reschedule_reinvite() to clone both the current pending and
           active media states and pass them to delay_request() so the resolver
           can tell what the original intention of the re-invite was.
      
         * Added a large unit test for the resolver.
      
      ASTERISK-29014
      
      Change-Id: Id3440972943c611a15f652c6c569fa0e4536bfcb
      86f1bce1
  16. Sep 10, 2020
    • Ben Ford's avatar
      Bridging: Use a ref to bridge_channel's channel to prevent crash. · 80a609fc
      Ben Ford authored
      There's a race condition with bridging where a bridge can be torn down
      causing the bridge_channel's ast_channel to become NULL when it's still
      needed. This particular case happened with attended transfers, but the
      crash occurred when trying to publish a stasis message. Now, the
      bridge_channel is locked, a ref to the ast_channel is obtained, and that
      ref is passed down the chain.
      
      Change-Id: Ic48715c0c041615d17d286790ae3e8c61bb28814
      80a609fc
  17. Sep 02, 2020
  18. Aug 25, 2020
    • Sean Bright's avatar
      bridge_channel: Ensure text messages are zero terminated · 35531929
      Sean Bright authored
      T.140 data in RTP is not zero terminated, so when we are queuing a text
      frame on a bridge we need to ensure that we are passing a zero
      terminated string.
      
      ASTERISK-28974 #close
      
      Change-Id: Ic10057387ce30b2094613ea67e3ae8c5c431dda3
      35531929
  19. Aug 24, 2020
    • George Joseph's avatar
      scope_trace: Added debug messages and added additional macros · 64ca2d48
      George Joseph authored
      The SCOPE_ENTER and SCOPE_EXIT* macros now print debug messages
      at the same level as the scope level.  This allows the same
      messages to be printed to the debug log when AST_DEVMODE
      isn't enabled.
      
      Also added a few variants of the SCOPE_EXIT macros that will
      also call ast_log instead of ast_debug to make it easier to
      use scope tracing and still print error messages.
      
      Change-Id: I7fe55f7ec28069919a0fc0b11a82235ce904cc21
      64ca2d48
  20. Aug 20, 2020
    • George Joseph's avatar
      stream.c: Added 2 more debugging utils and added pos to stream string · 118cb3f0
      George Joseph authored
       * Added ast_stream_to_stra and ast_stream_topology_to_stra() macros
         which are shortcuts for
            ast_str_tmp(256, ast_stream_to_str(stream, &STR_TMP))
      
       * Added the stream position to the string representation of the
         stream.
      
       * Fixed some formatting in ast_stream_to_str().
      
      Change-Id: Idaf4cb0affa46d4dce58a73a111f35435331cc4b
      118cb3f0
  21. Aug 18, 2020
    • George Joseph's avatar
      ACN: Changes specific to the core · 647c53c4
      George Joseph authored
      Allow passing a topology from the called channel back to the
      calling channel.
      
       * Added a new function ast_queue_answer() that accepts a stream
         topology and queues an ANSWER CONTROL frame with it as the
         data.  This allows the called channel to indicate its resolved
         topology.
      
       * Added a new virtual function to the channel tech structure
         answer_with_stream_topology() that allows the calling channel
         to receive the called channel's topology.  Added
         ast_raw_answer_with_stream_topology() that invokes that virtual
         function.
      
       * Modified app_dial.c and features.c to grab the topology from the
         ANSWER frame queued by the answering channel and send it to
         the calling channel with ast_raw_answer_with_stream_topology().
      
       * Modified frame.c to automatically cleanup the reference
         to the topology on ANSWER frames.
      
      Added a few debugging messages to stream.c.
      
      Change-Id: I0115d2ed68d6bae0f87e85abcf16c771bdaf992c
      647c53c4
  22. Aug 10, 2020
    • Sean Bright's avatar
      vector.h: Fix implementation of AST_VECTOR_COMPACT() for empty vectors · 048b12b5
      Sean Bright authored
      The assumed behavior of realloc() - that it was effectively a free() if
      its second argument was 0 - is Linux specific behavior and is not
      guaranteed by either POSIX or the C specification.
      
      Instead, if we want to resize a vector to 0, do it explicitly.
      
      Change-Id: Ife31d4b510ebab41cb5477fdc7ea4e3138ca8b4f
      048b12b5
  23. Aug 06, 2020
    • Ben Ford's avatar
      utils.c: NULL terminate ast_base64decode_string. · 9ed6387c
      Ben Ford authored
      With the addition of STIR/SHAKEN, the function ast_base64decode_string
      was added for convenience since there is a lot of converting done during
      the STIR/SHAKEN process. This function returned the decoded string for
      you, but did not NULL terminate it, causing some issues (specifically
      with MALLOC_DEBUG). Now, the returned string is NULL terminated, and the
      documentation has been updated to reflect this.
      
      Change-Id: Icdd7d05b323b0c47ff6ed43492937a03641bdcf5
      9ed6387c
    • George Joseph's avatar
      ACN: Configuration renaming for pjsip endpoint · a15e64aa
      George Joseph authored
      This change renames the codec preference endpoint options.
      incoming_offer_codec_prefs becomes codec_prefs_incoming_offer
      to keep the options together when showing an endpoint.
      
      Change-Id: I6202965b4723777f22a83afcbbafcdafb1d11c8d
      a15e64aa
  24. Jul 28, 2020
    • Sean Bright's avatar
      utf8.c: Add UTF-8 validation and utility functions · 7d96b3e4
      Sean Bright authored
      There are various places in Asterisk - specifically in regards to
      database integration - where having some kind of UTF-8 validation would
      be beneficial. This patch adds:
      
      * Functions to validate that a given string contains only valid UTF-8
        sequences.
      
      * A function to copy a string (similar to ast_copy_string) stopping when
        an invalid UTF-8 sequence is encountered.
      
      * A UTF-8 validator that allows for progressive validation.
      
      All of this is based on the excellent UTF-8 decoder by Björn Höhrmann.
      More information is available here:
      
          https://bjoern.hoehrmann.de/utf-8/decoder/dfa/
      
      The API was written in such a way that should allow us to replace the
      implementation later should we determine that we need something more
      comprehensive.
      
      Change-Id: I3555d787a79e7c780a7800cd26e0b5056368abf9
      7d96b3e4
  25. Jul 24, 2020
  26. Jul 21, 2020
  27. Jul 10, 2020
    • Ben Ford's avatar
      res_stir_shaken: Add stir_shaken option and general improvements. · 5fbed5af
      Ben Ford authored
      Added a new configuration option for PJSIP endpoints - stir_shaken. If
      set to yes, then STIR/SHAKEN support will be added to inbound and
      outbound INVITEs. The default is no. Alembic has been updated to include
      this option.
      
      Previously the dialplan function was not trimming the whitespace from
      the parameters it recieved. Now it does.
      
      Also added a conditional that, when TEST_FRAMEWORK is enabled, the
      timestamp in the identity header will be overlooked. This is just for
      testing, since the testsuite will rely on a SIPp scenario with a preset
      identity header to trigger the MISMATCH result.
      
      Change-Id: I43d67f1489b8c1c5729ed3ca8d71e35ddf438df1
      5fbed5af
  28. Jul 08, 2020
    • George Joseph's avatar
      ACN: Add tracing to existing code · 9bd1d686
      George Joseph authored
      Prior to making any modifications to the pjsip infrastructure
      for ACN, I've added the tracing functions to the existing code.
      This should make the final commit easier to review, but we can also
      now run a "before and after" trace.
      
      No functional changes were made with this commit.
      
      Change-Id: Ia83a1a2687ccb96f2bc8a2a3928a5214c4be775c
      9bd1d686
    • George Joseph's avatar
      ACN: res_pjsip endpoint options · 2d22e342
      George Joseph authored
      This commit adds the endpoint options required to control
      Advanced Codec Negotiation.
      
      incoming_offer_codec_prefs
      outgoing_offer_codec_prefs
      incoming_answer_codec_prefs
      outgoing_answer_codec_prefs
      
      The documentation may need tweaking and some additional edits
      added, especially for the "answer" prefs.  That'll be handled
      when things finalize.
      
      This commit is safe to merge as it doens't alter any existing
      functionality nor does it alter the previous codec negotiation
      work which may now be obsolete.
      
      Change-Id: I920ba925d7dd36430dfd2ebd9d82d23f123d0e11
      2d22e342
  29. Jul 07, 2020
    • George Joseph's avatar
      frame.c: Make debugging easier · d093e44b
      George Joseph authored
       * ast_frame_subclass2str() and ast_frame_type2str() now return
         a pointer to the buffer that was passed in instead of void.
         This makes it easier to use these functions inline in
         printf-style debugging statements.
      
       * Added many missing control frame entries in
         ast_frame_subclass2str.
      
      Change-Id: Ifd0d6578e758cd644c96d17a5383ff2128c572fc
      d093e44b
    • George Joseph's avatar
      Scope Trace: Make it easier to trace through synchronous tasks · 955b7b4f
      George Joseph authored
      Tracing through synchronous tasks was a little troublesome because
      the new thread's stack counter reset to 0.  This change allows
      a synchronous task to set its trace level to be the same as the
      thread that pushed the task.  For now, the task's level has to be
      passed in the task's data structure but a future enhancement to the
      taskprocessor subsystem could automatically set the trace level
      of the servant to be that of the caller.
      
      This doesn't really make sense for async tasks because you never
      know when they're going to run anyway.
      
      Change-Id: Ib8049c0b815063a45d8c7b0cb4e30b7b87b1d825
      955b7b4f
  30. Jul 06, 2020
    • Kevin Harwell's avatar
      manager - Add Content-Type parameter to the SendText action · cfed0ea0
      Kevin Harwell authored
      This patch allows a user of AMI to now specify the type of message
      content contained within by setting the 'Content-Type' parameter.
      
      Note, the AMI version has been bumped for this change.
      
      ASTERISK-28945 #close
      
      Change-Id: Ibb5315702532c6b954e1498beddc8855fabdf4bb
      cfed0ea0
Loading