Skip to content
Snippets Groups Projects
  1. Jul 23, 2020
    • Joshua C. Colp's avatar
      websocket / pjsip: Increase maximum packet size. · 9f641483
      Joshua C. Colp authored
      When dealing with a lot of video streams on WebRTC
      the resulting SDPs can grow to be quite large. This
      effectively doubles the maximum size to allow more
      streams to exist.
      
      The res_http_websocket module has also been changed
      to use a buffer on the session for reading in packets
      to ensure that the stack space usage is not excessive.
      
      Change-Id: I31d4351d70c8e2c11564807a7528b984f3fbdd01
      9f641483
  2. Jul 21, 2020
  3. Jul 20, 2020
    • Sean Bright's avatar
      acl.c: Coerce a NULL pointer into the empty string · c3588d9c
      Sean Bright authored
      If an ACL is misconfigured in the realtime database (for instance, the
      "rule" is blank) and Asterisk attempts to read the ACL, Asterisk will
      crash.
      
      ASTERISK-28978 #close
      
      Change-Id: Ic1536c4df856231bfd2da00128f7822224d77610
      c3588d9c
    • Joshua C. Colp's avatar
      pjsip: Include timer patch to prevent cancelling timer 0. · f1d7de12
      Joshua C. Colp authored
      I noticed this while looking at another issue and brought
      it up with Teluu. It was possible for an uninitialized timer
      to be cancelled, resulting in the invalid timer id of 0
      being placed into the timer heap causing issues.
      
      This change is a backport from the pjproject repository
      preventing this from happening.
      
      Change-Id: I1ba318b1f153a6dd7458846396e2867282b428e7
      f1d7de12
  4. Jul 15, 2020
  5. Jul 13, 2020
    • Nickolay Shmyrev's avatar
      res_http_websocket: Avoid reading past end of string · e4d24f51
      Nickolay Shmyrev authored
      We read beyond the end of the buffer when copying the string out of the
      buffer when we used ast_copy_string() because the original string was
      not null terminated. Instead switch to ast_strndup() which does not
      exhibit the same behavior.
      
      ASTERISK-28975 #close
      
      Change-Id: Ib4a75cffeb1eb8cf01136ef30306bd623e531a2a
      e4d24f51
  6. 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
  7. Jul 09, 2020
  8. 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
  9. Jul 07, 2020
    • sungtae kim's avatar
      res_pjsip.c: Added disable_rport option for pjsip.conf · 81b5e4a7
      sungtae kim authored
      Currently when the pjsip making an outgoing request, it keep adding the
      rport parameter in a request message as a default.
      
      This causes unexpected rport handle at the other end.
      
      Added option for disable this behaviour in the pjsip.conf.
      
      This is a system option, but working as a gloabl option.
      
      ASTERISK-28959
      
      Change-Id: I9596675e52a742774738b5aad5d1fec32f477abc
      81b5e4a7
    • 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
    • Nickolay Shmyrev's avatar
      res_http_websocket.c: Continue reading after ping/pong · 7163efd9
      Nickolay Shmyrev authored
      Do not return error if the client received ping frame
      while looking for a string and just wait for another frame.
      
      ASTERISK-28958 #close
      
      Change-Id: I4d06b4827bd71e56cbaafc011ffdcef9f0332922
      7163efd9
  10. Jul 06, 2020
    • Kevin Harwell's avatar
      PJSIP_MEDIA_OFFER: override configuration on refresh · 4eba6b9e
      Kevin Harwell authored
      When using the PSJIP_MEDIA_OFFER dialplan function it was not
      overriding an endpoint's configured codecs on refresh unless
      they had a shared codec between the two.
      
      This patch makes it so whatever is set using PJSIP_MEDIA_OFFER
      is used when creating the SDP for a refresh no matter what.
      
      ASTERISK-28878 #close
      
      Change-Id: I0f7dc86fd0fb607c308e6f98ede303c54d1eacb6
      4eba6b9e
    • 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
  11. Jul 01, 2020
    • George Joseph's avatar
      Streams: Add features for Advanced Codec Negotiation · 8d1064ea
      George Joseph authored
      The Streams API becomes the home for the core ACN capabilities.
      These include...
      
       * Parsing and formatting of codec negotation preferences.
       * Resolving pending streams and topologies with those configured
         using configured preferences.
       * Utility functions for creating string representations of
         streams, topologies, and negotiation preferences.
      
      For codec negotiation preferences:
       * Added ast_stream_codec_prefs_parse() which takes a string
         representation of codec negotiation preferences, which
         may come from a pjsip endpoint for example, and populates
         a ast_stream_codec_negotiation_prefs structure.
       * Added ast_stream_codec_prefs_to_str() which does the reverse.
       * Added many functions to parse individual parameter name
         and value strings to their respectrive enum values, and the
         reverse.
      
      For streams:
       * Added ast_stream_create_resolved() which takes a "live" stream
         and resolves it with a configured stream and the negotiation
         preferences to create a new stream.
       * Added ast_stream_to_str() which create a string representation
         of a stream suitable for debug or display purposes.
      
      For topology:
       * Added ast_stream_topology_create_resolved() which takes a "live"
         topology and resolves it, stream by stream, with a configured
         topology stream and the negotiation preferences to create a new
         topology.
       * Added ast_stream_topology_to_str() which create a string
         representation of a topology suitable for debug or display
         purposes.
       * Renamed ast_format_caps_from_topology() to
         ast_stream_topology_get_formats() to be more consistent with
         the existing ast_stream_get_formats().
      
      Additional changes:
       * A new function ast_format_cap_append_names() appends the results
         to the ast_str buffer instead of replacing buffer contents.
      
      Change-Id: I2df77dedd0c72c52deb6e329effe057a8e06cd56
      8d1064ea
  12. Jun 30, 2020
    • George Joseph's avatar
      Scope Trace: Add some new tracing macros and an ast_str helper · 7440fd03
      George Joseph authored
      Created new SCOPE_ functions that don't depend on RAII_VAR.  Besides
      generating less code, the use of the explicit SCOPE_EXIT macros
      capture the line number where the scope exited.  The RAII_VAR
      versions can't do that.
      
       * SCOPE_ENTER(level, ...): Like SCOPE_TRACE but doesn't use
         RAII_VAR and therefore needs needs one of...
      
       * SCOPE_EXIT(...): Decrements the trace stack counter and optionally
         prints a message.
      
       * SCOPE_EXIT_EXPR(__expr, ...): Decrements the trace stack counter,
         optionally prints a message, then executes the expression.
         SCOPE_EXIT_EXPR(break, "My while got broken\n");
      
       * SCOPE_EXIT_RTN(, ...): Decrements the trace stack counter,
         optionally prints a message, then returns without a value.
         SCOPE_EXIT_RTN("Bye\n");
      
       * SCOPE_EXIT_RTN_VALUE(__return_value, ...): Decrements the trace
         stack counter, optionally prints a message, then returns the value
         specified.
         SCOPE_EXIT_RTN_VALUE(rc, "Returning with RC: %d\n", rc);
      
      Create an ast_str helper ast_str_tmp() that allocates a temporary
      ast_str that can be passed to a function that needs it, then frees
      it.  This makes using the above macros easier.  Example:
      
         SCOPE_ENTER(1, Format Caps 1: %s  Format Caps 2: %s\n",
             ast_str_tmp(32, ast_format_cap_get_names(cap1, &STR_TMP),
             ast_str_tmp(32, ast_format_cap_get_names(cap2, &STR_TMP));
      
      The calls to ast_str_tmp create an ast_str of the specified initial
      length which can be referenced as STR_TMP.  It then calls the
      expression, which must return a char *, ast_strdupa's it, frees
      STR_TMP, then returns the ast_strdupa'd string.  That string is
      freed when the function returns.
      
      Change-Id: I44059b20d55a889aa91440d2f8a590865998be51
      7440fd03
  13. Jun 26, 2020
    • Joshua C. Colp's avatar
      res_pjsip: Apply AOR outbound proxy to static contacts. · 4f86118b
      Joshua C. Colp authored
      The outbound proxy for an AOR was not being applied to
      any statically configured Contacts. This resulted in the
      OPTIONS requests being sent to the wrong target.
      
      This change sets the outbound proxy on statically configured
      contacts once the AOR configuration is done being
      applied.
      
      ASTERISK-28965
      
      Change-Id: Ia60f3e93ea63f819c5a46bc8b54be2e588dfa9e0
      4f86118b
  14. Jun 25, 2020
    • Joshua C. Colp's avatar
      menuselect: Resolve infinite loop in dependency scenario. · 9b504243
      Joshua C. Colp authored
      Given a scenario where a module has a dependency on both
      an external library and a module if the external library was
      available and the module was not an infinite loop would
      occur. This happened due to the code changing the dependecy
      status to no failure on each dependency checking loop
      iteration, resulting in the code thinking that it had
      gone from no failure to failure each time triggering another
      dependency check.
      
      This change makes it so that the old dependency status is
      preserved throughout the dependency checking allowing it to
      determine that after the first iteration the dependency
      status does not transition from no failure to failure.
      
      ASTERISK-28930
      
      Change-Id: Iea06d45d9fd6d8bfd068882a0bb7e23a53ec3e84
      9b504243
    • Frederic LE FOLL's avatar
      chan_sip: chan_sip does not process 400 response to an INVITE. · a423f935
      Frederic LE FOLL authored
      chan_sip handle_response() function, for a 400 response to an INVITE,
      calls handle_response_invite() and does not generate ACK.
      handle_response_invite() does not recognize 400 response and has no
      default response processing for unexpected responses, thus it does not
      generate ACK either.
      The ACK on response repetition comes from handle_response() mechanism
      "We must re-send ACKs to re-transmitted final responses".
      
      According to code history, 400 response specific processing was
      introduced with commit
      "channels/chan_sip: Add improved support for 4xx error codes"
      This commit added support for :
      - 400/414/493 in handle_response_subscribe() handle_response_register()
        and handle_response().
      - 414/493 only in handle_response_invite().
      
      This fix adds 400 response support in handle_response_invite().
      
      ASTERISK-28957
      
      Change-Id: Ic71a087e5398dfc7273946b9ec6f9a36960218ad
      a423f935
  15. Jun 22, 2020
    • Kevin Harwell's avatar
      chan_pjsip: don't use PJSIP_SC_NULL as it only exists pjproject 2.8+ · 8b925fbd
      Kevin Harwell authored
      A patch made a reference to the PJSIP_SC_NULL enumeration value, which
      was added to pjproject 2.8 and above thus making it so Asterisk would
      fail to compile with prior versions of pjproject.
      
      This patch removes the reference, and instead initializes the value
      to '0'.
      
      ASTERISK-28886 #close
      
      Change-Id: I68491c80da1a0154b2286c9458440141c98db9d7
      8b925fbd
    • Università di Bologna - CESIA VoIP's avatar
      res_corosync: Fix crash in huge distributed environment. · 0c1c3866
      1) Fix memory-leaks
         Added code to release ast_events extracted from corosync and stasis messages
      
      2) Clean stasis cache when a member of the corosync cluster leaves the group
         Added code to remove from the stasis cache of the members remained on the
         group all the messages with the EID of the left member.
         If the device states of the left member remain in the stasis cache of other
         members, they will not be updated anymore and high priority cached values,
         like BUSY, will take precedence over current device states.
      
      3) Stop corosync event propagation when node is not joined to the group
         Updated dispatch_thread_handler code to detect when asterisk is not joined
         to the corosync group and added some condition in publish_event_to_corosync
         code to send corosync messages only when joined.
         When a node is not joined its corosync daemon can't send messages:
         the cpg_mcast_joined function append new messages to the FIFO buffer until
         it's full and then it blocks indefinitely.
         In this scenario if the stasis_message_cb callback, registered by
         res_corosync to handle stasis messages, try to send a corosync messages,
         the thread of the stasis thread-pool will be blocked until the node join
         the corosync cluster.
      
      ASTERISK-28888
      Reported by: Università di Bologna - CESIA VoIP
      
      Change-Id: Ie8e99bc23f141a73c13ae6fb1948d148d4de17f2
      0c1c3866
    • Moises Silva's avatar
      res_http_websocket: Add payload masking to the websocket client · 9445dac4
      Moises Silva authored
      ASTERISK-28949
      
      Change-Id: Id465030f2b1997b83d408933fdbabe01827469ca
      9445dac4
  16. Jun 19, 2020
    • Joshua C. Colp's avatar
      app_stream_echo: Fix state of added streams. · 00a52b47
      Joshua C. Colp authored
      When stream support was added to Asterisk the stream state
      was used inconsistently, resulting in odd behavior. This
      was then standardized to be the state of a stream from the
      perspective of Asterisk.
      
      This change updates the StreamEcho dialplan application
      to use the correct state, send only, since we are only
      sending to the endpoint and not expecting them to send us
      multiple video streams.
      
      ASTERISK-28954
      
      Change-Id: I35bfd533ef1184ffe62586b22bbd253c82872a56
      00a52b47
    • Guido Falsi's avatar
      chan_dadhi: Fix setvar in dahdi channels · d88e2300
      Guido Falsi authored
      The change to how setvar works for various channels performed in
      ASTERISK~23756 missed some required change in the dahdi channel,
      where the variables are actually set while reading configuration.
      This change should fix the issue.
      
      ASTERISK-28955
      
      Change-Id: Ibfeb7f8cbdd735346dc4028de6a265f24f9df274
      d88e2300
    • Joshua C. Colp's avatar
      res_pjsip_session: Preserve label on incoming re-INVITE. · ee8ea927
      Joshua C. Colp authored
      When a re-INVITE is received we create a new set of
      streams that are then swapped in as the active streams.
      We did not preserve the SDP label from the previous
      streams, resulting in the label getting lost.
      
      This change ensures that if an SDP label is present
      on the previous stream then it is set on the new stream.
      
      ASTERISK-28953
      
      Change-Id: I9dd63b88b562fe96ce5c791a3dae5bcaca258445
      ee8ea927
  17. Jun 18, 2020
    • Joshua C. Colp's avatar
      res_sorcery_memory_cache: Disallow per-object expire with full backend. · a143c3a7
      Joshua C. Colp authored
      The AMI action and CLI command did not take into account the properties
      of full backend caching. This resulted in an expired object remaining
      removed until a full backend update occurred, instead of having the
      object updated when needed.
      
      This change makes it so that the AMI action and CLI command for object
      expire will now fail instead of putting the cache into an undesired
      state. If full backend caching is enabled then only operations
      which act on the entire cache are available.
      
      ASTERISK-28942
      
      Change-Id: Id662d888f177ab566c8e802ad583083b742d21f4
      a143c3a7
    • Ben Ford's avatar
      res_stir_shaken: Add outbound INVITE support. · 12741171
      Ben Ford authored
      Integrated STIR/SHAKEN support with outgoing INVITEs. When an INVITE is
      sent, the caller ID will be checked to see if there is a certificate
      that corresponds to it. If so, that information will be retrieved and an
      Identity header will be added to the SIP message. The format is:
      
      header.payload.signature;info=<public_key_url>alg=ES256;ppt=shaken
      
      Header, payload, and signature are all BASE64 encoded. The public key
      URL is retrieved from the certificate. Currently the algorithm and ppt
      are ES256 and shaken, respectively. This message is signed and can be
      used for verification on the receiving end.
      
      Two new configuration options have been added to the certificate object:
      attestation and origid. The attestation is required and must be A, B, or
      C. origid is the origination identifier.
      
      A new utility function has been added as well that takes a string,
      allocates space, BASE64 encodes it, then returns it, eliminating the
      need to calculate the size yourself.
      
      Change-Id: I1f84d6a5839cb2ed152ef4255b380cfc2de662b4
      12741171
  18. Jun 17, 2020
  19. Jun 16, 2020
    • Walter Doekes's avatar
      app_queue: Read latest wrapuptime instead of (possibly stale) copy · 0fb67383
      Walter Doekes authored
      Before this changeset, it was possible that a queue member (agent) was
      called even though they just got out of a call, and wrapuptime seconds
      hadn't passed yet.
      
      This could happen if a member ended a call _between_ a new call attempt
      and asterisk trying that particular member for a new call.
      
      In that case, Asterisk would check the hangup time of the
      call-before-the-last-call instead of the hangup time of the-last-call.
      
      ASTERISK-28952
      
      Change-Id: Ie0cab8f0e8d639c01cba633d4968ba19873d80b3
      0fb67383
    • Kevin Harwell's avatar
      pjproject: Upgrade bundled version to pjproject 2.10 · 415b55af
      Kevin Harwell authored
      This patch makes the usual necessary changes when upgrading to a new
      version pjproject. For instance, version number bump, patches removed
      from third-party, new *.md5 file added, etc..
      
      This patch also includes a change to the Asterisk pjproject Makefile to
      explicitly create the 'source/pjsip-apps/lib' directory. This directory
      is no longer there by default so needs to be added so the Asterisk
      malloc debug can be built.
      
      This patch also includes some minor changes to Asterisk that were a result
      of the upgrade. Specifically, there was a backward incompatibility change
      made in 2.10 that modified the "expires header" variable field from a
      signed to an unsigned value. This potentially effects comparison. Namely,
      those check for a value less than zero. This patch modified a few locations
      in the Asterisk code that may have been affected.
      
      Lastly, this patch adds a new macro PJSIP_MINVERSION that can be used to
      check a minimum version of pjproject at compile time.
      
      ASTERISK-28899 #close
      
      Change-Id: Iec8821c6cbbc08c369d0e3cd2f14e691b41d0c81
      415b55af
  20. Jun 15, 2020
    • Joshua C. Colp's avatar
      core_unreal / core_local: Add multistream and re-negotiation. · de2813cf
      Joshua C. Colp authored
      When requesting a Local channel the requested stream topology
      or a converted stream topology will now be placed onto the
      resulting channels.
      
      Frames written in on streams will now also preserve the stream
      identifier as they are queued on the opposite channel.
      
      Finally when a stream topology change is requested it is
      immediately accepted and reflected on both channels. Each
      channel also receives a queued frame to indicate that the
      topology has changed.
      
      ASTERISK-28938
      
      Change-Id: I4e9d94da5230d4bd046dc755651493fce1d87186
      de2813cf
  21. Jun 12, 2020
  22. Jun 11, 2020
    • Joshua C. Colp's avatar
      res_rtp_asterisk: Don't assume setting retrans props means to enable. · c84d962e
      Joshua C. Colp authored
      The "value" passed in when setting an RTP property determines
      whether it should be enabled or disabled. The RTP send and
      receive retrans props did not examine this to know if the
      buffers should be enabled. They assumed they always should be.
      
      This change makes it so that the "value" passed in is
      respected.
      
      ASTERISK-28939
      
      Change-Id: I9244cdbdc5fd065c7f6b02cbfa572bc55c7123dc
      c84d962e
    • Joshua C. Colp's avatar
      bridge_softmix: Add additional old states for adding new source. · 8ad06394
      Joshua C. Colp authored
      There are three states that an old stream can be in to allow
      becoming a source stream in a new stream:
      
      1. Removed
      2. Inactive
      3. Sendonly
      
      This change adds the two missing ones, inactive and sendonly,
      so if a stream transitions from those to a state where they are
      providing video to Asterisk we properly re-negotiate the other
      participants.
      
      ASTERISK-28944
      
      Change-Id: Id8256b9b254b403411586284bbaedbf50452de01
      8ad06394
  23. Jun 10, 2020
    • George Joseph's avatar
      res_fax: Don't start a gateway if either channel is hung up · 41f3a7da
      George Joseph authored
      When fax_gateway_framehook is called and a gateway hasn't already
      been started, the framehook gets the t38 state for both the current
      channel and the peer.  That call trickles down to the channel
      driver which determines the state.  If either channel is hung up
      (or in the process of being hung up), the channel driver's tech_pvt
      is going to be NULL which, in the case of chan_pjsip, will cause a
      segfault.
      
      * Added a hangup check for both the channel and peer channel
        before starting a fax gateway.
      
      * Added a check for NULL tech_pvt to chan_pjsip_queryoption
        so we don't attempt to reference a tech_pvt that's already
        gone.
      
      ASTERISK-28923
      Reported by: Yury Kirsanov
      
      Change-Id: I4e10e63b667bbb68c1c8623f977488f5d807897c
      41f3a7da
    • George Joseph's avatar
      app_confbridge: Plug ref leak of bridge channel with send_events · b9f42a71
      George Joseph authored
      When send_events is enabled for a user, we were leaking a reference
      to the bridge channel in confbridge_manager.c:send_message().  This
      also caused the bridge snapshot to not be destroyed.
      
      Change-Id: I87a7ae9175e3cd29f6d6a8750e0ec5427bd98e97
      b9f42a71
Loading