Skip to content
Snippets Groups Projects
  1. Jul 19, 2021
    • Sean Bright's avatar
      res_http_media_cache.c: Parse media URLs to find extensions. · d5683268
      Sean Bright authored
      Use cURL's URL parsing API, falling back to the urlparser library, to
      parse playback URLs in order to find their file extensions.
      
      For backwards compatibility, we first look at the full URL, then at
      any Content-Type header, and finally at just the path portion of the
      URL.
      
      ASTERISK-27871 #close
      
      Change-Id: I16d0682f6d794be96539261b3e48f237909139cb
      d5683268
  2. Jul 16, 2021
  3. Jul 15, 2021
  4. Jul 08, 2021
    • Igor Goncharovsky's avatar
      res_ari: Fix audiosocket segfault · 99d44f0c
      Igor Goncharovsky authored
      Add check that data parameter specified when audiosocket used for externalMedia.
      
      ASTERISK-29514 #close
      
      Change-Id: Ie562f03c5d6c3835a3631f376b3d43e75b8f9617
      99d44f0c
    • Sean Bright's avatar
      res_pjsip_config_wizard.c: Add port matching support. · 0ac9c835
      Sean Bright authored
      In f8b0c2c9 we added support for port numbers in 'match' statements
      but neglected to include that support in the PJSIP config wizard.
      
      The removed code would have also prevented IPv6 addresses from being
      successfully used in the config wizard as well.
      
      ASTERISK-29503 #close
      
      Change-Id: Idd5bbfd48009e7a741757743dbaea68e2835a34d
      0ac9c835
    • Naveen Albert's avatar
      app_waitforcond: New application · c01b4e0d
      Naveen Albert authored
      While several applications exist to wait for
      a certain event to occur, none allow waiting
      for any generic expression to become true.
      This application allows for waiting for a condition
      to become true, with configurable timeout and
      checking interval.
      
      ASTERISK-29444
      
      Change-Id: I08adf2824b8bc63405778cf355963b5005612f41
      c01b4e0d
  5. Jun 24, 2021
    • Andre Barbosa's avatar
      res_stasis_playback: Send PlaybackFinish event only once for errors · a47308cc
      Andre Barbosa authored
      When we try to play a list of sound files in the same Play command,
      we get only one PlaybackFinish event, after all sounds are played.
      
      But in the case where the Play fails (because channel is destroyed
      for example), Asterisk will send one PlaybackFinish event for each
      sound file still to be played. If the list is big, Asterisk is
      sending many events.
      
      This patch adds a failed state so we can understand that the play
      failed. On that case we don't send the event, if we still have a
      list of sounds to be played.
      
      When we reach the last sound, we send the PlaybackFinish with
      the failed state.
      
      ASTERISK-29464 #close
      
      Change-Id: I4c2e5921cc597702513af0d7c6c2c982e1798322
      a47308cc
    • George Joseph's avatar
      jitterbuffer: Correct signed/unsigned mismatch causing assert · bc973bd7
      George Joseph authored
      If the system time has stepped backwards because of a time
      adjustment between the time a frame is timestamped and the
      time we check the timestamps in abstract_jb:hook_event_cb(),
      we get a negative interval, but we don't check for that there.
      abstract_jb:hook_event_cb() then calls
      fixedjitterbuffer:fixed_jb_get() (via abstract_jb:jb_get_fixed)
      and the first thing that does is assert(interval >= 0).
      
      There are several issues with this...
      
       * abstract_jb:hook_event_cb() saves the interval in a variable
         named "now" which is confusing in itself.
      
       * "now" is defined as an unsigned int which converts the negative
         value returned from ast_tvdiff_ms() to a large positive value.
      
       * fixed_jb_get()'s parameter is defined as a signed int so the
         interval gets converted back to a negative value.
      
       * fixed_jb_get()'s assert is NOT an ast_assert but a direct define
         that points to the system assert() so it triggers even in
         production mode.
      
      So...
      
       * hook_event_cb()'s "now" was renamed to "relative_frame_start" and
         changed to an int64_t.
       * hook_event_cb() now checks for a negative value right after
         retrieving both the current and framedata timestamps and just
         returns the frame if the difference is negative.
       * fixed_jb_get()'s local define of ASSERT() was changed to call
         ast_assert() instead of the system assert().
      
      ASTERISK-29480
      Reported by: Dan Cropp
      
      Change-Id: Ic469dec73c2edc3ba134cda6721a999a9714f3c9
      bc973bd7
  6. Jun 23, 2021
    • Naveen Albert's avatar
      app_dial: Expanded A option to add caller announcement · 1e5a2cfe
      Naveen Albert authored
      Hitherto, the A option has made it possible to play
      audio upon answer to the called party only. This option
      is expanded to allow for playback of an audio file to
      the caller instead of or in addition to the audio
      played to the answerer.
      
      ASTERISK-29442
      
      Change-Id: If6eed3ff5c341dc8c588c8210987f2571e891e5e
      1e5a2cfe
  7. Jun 22, 2021
    • Joshua C. Colp's avatar
      core: Don't play silence for Busy() and Congestion() applications. · 5382b9db
      Joshua C. Colp authored
      When using the Busy() and Congestion() applications the
      function ast_safe_sleep is used by wait_for_hangup to safely
      wait on the channel. This function may send silence if Asterisk
      is configured to do so using the transmit_silence option.
      
      In a scenario where an answered channel dials a Local channel
      either directly or through call forwarding and the Busy()
      or Congestion() dialplan applications were executed with the
      transmit_silence option enabled the busy or congestion
      tone would not be heard.
      
      This is because inband generation of tones (such as busy
      and congestion) is stopped when other audio is sent to
      the channel they are being played to. In the given
      scenario the transmit_silence option would result in
      silence being sent to the channel, thus stopping the
      inband generation.
      
      This change adds a variant of ast_safe_sleep which can be
      used when silence should not be played to the channel. The
      wait_for_hangup function has been updated to use this
      resulting in the tones being generated as expected.
      
      ASTERISK-29485
      
      Change-Id: I066bfc987a3ad6f0ccc88e0af4cd63f6a4729133
      5382b9db
  8. Jun 17, 2021
    • Bernd Zobl's avatar
      res_pjsip_sdp_rtp: Evaluate remotely held for Session Progress · c30f68a5
      Bernd Zobl authored
      With the fix for ASTERISK_28754 channels are no longer put on hold if an
      outbound INVITE is answered with a "Session Progress" containing
      "inactive" audio.
      
      The previous change moved the evaluation of the media attributes to
      `negotiate_incoming_sdp_stream()` to have the `remotely_held` status
      available when building the SDP in `create_outgoing_sdp_stream()`.
      This however means that an answer to an outbound INVITE, which does not
      traverse `negotiate_incoming_sdp_stream()`, cannot set the
      `remotely_held` status anymore.
      
      This change moves the check so that both, `negotiate_incoming_sdp_stream()` and
      `apply_negotiated_sdp_stream()` can do the checks.
      
      ASTERISK-29479
      
      Change-Id: Icde805a819399d5123b688e1ed1d2bcd9d5b0f75
      c30f68a5
  9. Jun 16, 2021
    • George Joseph's avatar
      res_pjsip_messaging: Overwrite user in existing contact URI · b7027de1
      George Joseph authored
      When the MessageSend destination is in the form
      PJSIP/<number>@<endpoint> and the endpoint's contact
      URI already has a user component, that user component
      will now be replaced with <number> when creating the
      request URI.
      
      ASTERISK_29404
      
      Change-Id: I80e5910fa25c803d1440da0594a0d6b34b6b4ad5
      b7027de1
  10. Jun 15, 2021
    • Bernd Zobl's avatar
      res_pjsip/pjsip_message_filter: set preferred transport in pjsip_message_filter · f160725f
      Bernd Zobl authored
      Set preferred transport when querying the local address to use in
      filter_on_tx_messages(). This prevents the module to erroneously select
      the wrong transport if more than one transports of the same type (TCP or
      TLS) are configured.
      
      ASTERISK-29241
      
      Change-Id: I598e60257a7f92b29efce1fb3e9a2fc06f1439b6
      f160725f
    • Naveen Albert's avatar
      pbx_builtins: Corrects SayNumber warning · f812c574
      Naveen Albert authored
      Previously, SayNumber always emitted a warning if the caller hung up
      during execution. Usually this isn't correct, so check if the channel
      hung up and, if so, don't emit a warning.
      
      ASTERISK-29475
      
      Change-Id: Ieea4a67301c6ea83bbc7690c1d4808d79a704594
      f812c574
  11. Jun 11, 2021
    • Jaco Kroon's avatar
      func_lock: Add "dialplan locks show" cli command. · 56c2cc47
      Jaco Kroon authored
      
      For example:
      
      arthur*CLI> dialplan locks show
      func_lock locks:
      Name                                     Requesters Owner
      uls-autoref                              0          (unlocked)
      1 total locks listed.
      
      Obviously other potentially useful stats could be added (eg, how many
      times there was contention, how many times it failed etc ... but that
      would require keeping the stats and I'm not convinced that's worth the
      effort.  This was useful to troubleshoot some other issues so submitting
      it.
      
      Change-Id: Ib875e56feb49d523300aec5f36c635ed74843a9f
      Signed-off-by: default avatarJaco Kroon <jaco@uls.co.za>
      56c2cc47
    • Jaco Kroon's avatar
      func_lock: Prevent module unloading in-use module. · 19a8383a
      Jaco Kroon authored
      
      The scenario where a channel still has an associated datastore we
      cannot unload since there is a function pointer to the destroy and fixup
      functions in play.  Thus increase the module ref count whenever we
      allocate a datastore, and decrease it during destroy.
      
      In order to tighten the race that still exists in spite of this (below)
      add some extra failure cases to prevent allocations in these cases.
      
      Race:
      
      If module ref is zero, an LOCK or TRYLOCK is invoked (near)
      simultaneously on a channel that has NOT PREVIOUSLY taken a lock, and if
      in such a case the datastore is created *prior* to unloading being set
      to true (first step in module unload) then it's possible that the module
      will unload with the destructor being called (and segfault) post the
      module being unloaded.  The module will however wait for such locks to
      release prior to unloading.
      
      If post that we can recheck the module ref before returning the we can
      (in theory, I think) eliminate the last of the race.  This race is
      mostly theoretical in nature.
      
      Change-Id: I21a514a0b56755c578a687f4867eacb8b59e23cf
      Signed-off-by: default avatarJaco Kroon <jaco@uls.co.za>
      19a8383a
    • Jaco Kroon's avatar
      func_lock: Fix memory corruption during unload. · e8875d5c
      Jaco Kroon authored
      
      AST_TRAVERSE accessess current as current = current->(field).next ...
      and since we free current (and ast_free poisons the memory) we either
      end up on a ast_mutex_lock to a non-existing lock that can never be
      obtained, or a segfault.
      
      Incidentally add logging in the "we have to wait for a lock to release"
      case, and remove an ineffective statement that sets memory that was just
      cleared by ast_calloc to zero.
      
      Change-Id: Id19ba3d9867b23d0e6783b97e6ecd8e62698b8c3
      Signed-off-by: default avatarJaco Kroon <jaco@uls.co.za>
      e8875d5c
    • Jaco Kroon's avatar
      func_lock: Fix requesters counter in error paths. · caceba79
      Jaco Kroon authored
      
      In two places we bail out with failure after we've already incremented
      the requesters counter, if this occured then it would effectively result
      in unload to wait indefinitely, thus preventing clean shutdown.
      
      Change-Id: I362a6c0dc424f736d4a9c733d818e72d19675283
      Signed-off-by: default avatarJaco Kroon <jaco@uls.co.za>
      caceba79
    • Naveen Albert's avatar
      app_originate: Allow setting Caller ID and variables · b7425145
      Naveen Albert authored
      Caller ID can now be set on the called channel and
      Variables can now be set on the destination
      using the Originate application, just as
      they can be currently using call files
      or the Manager Action.
      
      ASTERISK-29450
      
      Change-Id: Ia64cfe97d2792bcbf4775b3126cad662922a8b66
      b7425145
  12. Jun 10, 2021
  13. Jun 08, 2021
    • Naveen Albert's avatar
      app_confbridge: New ConfKick() application · 35437879
      Naveen Albert authored
      Adds a new ConfKick() application, which may
      be used to kick a specific channel, all channels,
      or all non-admin channels from a specified
      conference bridge, similar to existing CLI and
      AMI commands.
      
      ASTERISK-29446
      
      Change-Id: I5d96b683880bfdd27b2ab1c3f2e897c5046ded9b
      35437879
    • Naveen Albert's avatar
      res_pjsip_dtmf_info: Hook flash · 1b38e897
      Naveen Albert authored
      Adds hook flash recognition support
      for application/hook-flash.
      
      ASTERISK-29460
      
      Change-Id: I1d060fa89a7cf41244c98f892fff44eb1c9738ea
      1b38e897
    • Naveen Albert's avatar
      app_confbridge: New option to prevent answer supervision · 5f8cabc2
      Naveen Albert authored
      A new user option, answer_channel, adds the capability to
      prevent answering the channel if it hasn't already been
      answered yet.
      
      ASTERISK-29440
      
      Change-Id: I26642729d0345f178c7b8045506605c8402de54b
      5f8cabc2
    • Naveen Albert's avatar
      sip_to_pjsip: Fix missing cases · c8bf8a54
      Naveen Albert authored
      Adds the "auto" case which is valid with
      both chan_sip dtmfmode and chan_pjsip's
      dtmf_mode, adds subscribecontext to
      subscribe_context conversion, and accounts
      for cipher = ALL being invalid.
      
      ASTERISK-29459
      
      Change-Id: Ie27d6606efad3591038000e5f3c34fa94730f6f2
      c8bf8a54
  14. May 27, 2021
    • George Joseph's avatar
      res_pjsip_messaging: Refactor outgoing URI processing · c3654a99
      George Joseph authored
       * Implemented the new "to" parameter of the MessageSend()
         dialplan application.  This allows a user to specify
         a complete SIP "To" header separate from the Request URI.
      
       * Completely refactored the get_outbound_endpoint() function
         to actually handle all the destination combinations that
         we advertized as supporting.
      
       * We now also accept a destination in the same format
         as Dial()...  PJSIP/number@endpoint
      
       * Added lots of debugging.
      
      ASTERISK-29404
      Reported by Brian J. Murrell
      
      Change-Id: I67a485196d9199916468f7f98bfb9a0b993a4cce
      c3654a99
  15. May 26, 2021
    • Naveen Albert's avatar
      func_math: Three new dialplan functions · eeffad1b
      Naveen Albert authored
      Introduces three new dialplan functions, MIN and MAX,
      which can be used to calculate the minimum or
      maximum of up to two numbers, and ABS, an absolute
      value function.
      
      ASTERISK-29431
      
      Change-Id: I2bda9269d18f9d54833c85e48e41fce0e0ce4d8d
      eeffad1b
    • Ben Ford's avatar
      STIR/SHAKEN: Add Date header, dest->tn, and URL checking. · 12e86008
      Ben Ford authored
      STIR/SHAKEN requires a Date header alongside the Identity header, so
      that has been added. Still on the outgoing side, we were missing the
      dest->tn section of the JSON payload, so that has been added as well.
      Moving to the incoming side, URL checking has been added to the public
      cert URL to ensure that it starts with http.
      
      https://wiki.asterisk.org/wiki/display/AST/OpenSIPit+2021
      
      Change-Id: Idee5b1b5e45bc3b483b3070e46ce322dca5b3f1c
      12e86008
    • Joshua C. Colp's avatar
      res_pjsip: On partial transport reload also move factories. · 44fde9f4
      Joshua C. Colp authored
      For connection oriented transports PJSIP uses factories to
      produce transports. When doing a partial transport reload
      we need to also move the factory of the transport over so
      that anything referencing the transport (such as an endpoint)
      has the factory available.
      
      ASTERISK-29441
      
      Change-Id: Ieae0fb98eab2d9257cad996a1136e5a62d307161
      44fde9f4
    • Naveen Albert's avatar
      func_volume: Add read capability to function. · 19b5097d
      Naveen Albert authored
      Up until now, the VOLUME function has been write
      only, so that TX/RX values can be set but not
      read afterwards. Now, previously set TX/RX values
      can be read later.
      
      ASTERISK-29439
      
      Change-Id: Ia23e92fa2e755c36e9c8e69f2940d2703ccccb5f
      19b5097d
    • Evgenios_Greek's avatar
      stasis: Fix "FRACK!, Failed assertion bad magic number" when unsubscribing · 2193cf1b
      Evgenios_Greek authored
      When unsubscribing from an endpoint technology a FRACK
      would occur due to incorrect reference counting. This fixes
      that issue, along with some other issues.
      
      Fixed a typo in get_subscription when calling ao2_find as it
      needed to pass the endpoint ID and not the entire object.
      
      Fixed scenario where a subscription would get returned when
      it shouldn't have been when searching based on endpoint
      technology.
      
      A doulbe unreference has also been resolved by only explicitly
      releasing the reference held by tech_subscriptions.
      
      ASTERISK-28237 #close
      Reported by: Lucas Tardioli Silveira
      
      Change-Id: Ia91b15f8e5ea68f850c66889a6325d9575901729
      2193cf1b
    • Joseph Nadiv's avatar
      res_pjsip.c: Support endpoints with domain info in username · 98e41196
      Joseph Nadiv authored
      In multidomain environments, it is desirable to create
      PJSIP endpoints with the domain info in the endpoint name
      in pjsip_endpoint.conf.  This resulted in an error with
      registrations, NOTIFY, and OPTIONS packet generation.
      
      This commit will detect if there is an @ in the endpoint
      identifier and generate the URI accordingly so NOTIFY and
      OPTIONS From headers will generate correctly.
      
      ASTERISK-28393
      
      Change-Id: I96f8d01dfdd5573ba7a28299e46271dd4210b619
      98e41196
    • Joshua C. Colp's avatar
      res_rtp_asterisk: Set correct raddr port on RTCP srflx candidates. · a985e506
      Joshua C. Colp authored
      RTCP ICE candidates use a base address derived from the RTP
      candidate. The port on the base address was not being updated to
      the RTCP port.
      
      This change sets the base port to the RTCP port and all is well.
      
      ASTERISK-29433
      
      Change-Id: Ide2d2115b307bfd3c2dfbc4d187515d724519040
      a985e506
  16. May 25, 2021
  17. May 21, 2021
  18. May 20, 2021
    • George Joseph's avatar
      res_pjsip_outbound_authenticator_digest: Be tolerant of RFC8760 UASs · 9cc1d6fc
      George Joseph authored
      RFC7616 and RFC8760 allow more than one WWW-Authenticate or
      Proxy-Authenticate header per realm, each with different digest
      algorithms (including new ones like SHA-256 and SHA-512-256).
      Thankfully however a UAS can NOT send back multiple Authenticate
      headers for the same realm with the same digest algorithm.  The
      UAS is also supposed to send the headers in order of preference
      with the first one being the most preferred.  We're supposed to
      send an Authorization header for the first one we encounter for a
      realm that we can support.
      
      The UAS can also send multiple realms, especially when it's a
      proxy that has forked the request in which case the proxy will
      aggregate all of the Authenticate headers and then send them all
      back to the UAC.
      
      It doesn't stop there though... Each realm can require a
      different username from the others.  There's also nothing
      preventing each digest algorithm from having a unique password
      although I'm not sure if that adds any benefit.
      
      So now... For each Authenticate header we encounter, we have to
      determine if we support the digest algorithm and, if not, just
      skip the header.  We then have to find an auth object that
      matches the realm AND the digest algorithm or find a wildcard
      object that matches the digest algorithm. If we find one, we add
      it to the results vector and read the next Authenticate header.
      If the next header is for the same realm AND we already added an
      auth object for that realm, we skip the header. Otherwise we
      repeat the process for the next header.
      
      In the end, we'll have accumulated a list of credentials we can
      pass to pjproject that it can use to add Authentication headers
      to a request.
      
      NOTE: Neither we nor pjproject can currently handle digest
      algorithms other than MD5.  We don't even have a place for it in
      the ast_sip_auth object. For this reason, we just skip processing
      any Authenticate header that's not MD5.  When we support the
      others, we'll move the check into the loop that searches the
      objects.
      
      Changes:
      
       * Added a new API ast_sip_retrieve_auths_vector() that takes in
         a vector of auth ids (usually supplied on a call to
         ast_sip_create_request_with_auth()) and populates another
         vector with the actual objects.
      
       * Refactored res_pjsip_outbound_authenticator_digest to handle
         multiple Authenticate headers and set the stage for handling
         additional digest algorithms.
      
       * Added a pjproject patch that allows them to ignore digest
         algorithms they don't support.  This patch has already been
         merged upstream.
      
       * Updated documentation for auth objects in the XML and
         in pjsip.conf.sample.
      
       * Although res_pjsip_authenticator_digest isn't affected
         by this change, some debugging and a testsuite AMI event
         was added to facilitate testing.
      
      Discovered during OpenSIPit 2021.
      
      ASTERISK-29397
      
      Change-Id: I3aef5ce4fe1d27e48d61268520f284d15d650281
      9cc1d6fc
  19. May 19, 2021
    • Joseph Nadiv's avatar
      res_pjsip_dialog_info_body_generator: Add LOCAL/REMOTE tags in dialog-info+xml · 3cccdf6d
      Joseph Nadiv authored
      RFC 4235 Section 4.1.6 describes XML elements that should be
      sent to subscribed endpoints to identify the local and remote
      participants in the dialog.
      
      This patch adds this functionality to PJSIP by iterating through the
      ringing channels causing the NOTIFY, and inserts the channel info
      into the dialog so that information is properly passed to the endpoint
      in dialog-info+xml.
      
      ASTERISK-24601
      Patch submitted: Joshua Elson
      Modified by: Joseph Nadiv and Sean Bright
      Tested by: Joseph Nadiv
      
      Change-Id: I20c5cf5b45f34d7179df6573c5abf863eb72964b
      3cccdf6d
    • Naveen Albert's avatar
      AMI: Add AMI event to expose hook flash events · 04454fc2
      Naveen Albert authored
      Although Asterisk can receive and propogate flash events, it currently
      provides no mechanism for doing anything with them itself.
      
      This AMI event allows flash events to be processed by Asterisk.
      Additionally, AST_CONTROL_FLASH is included in a switch statement
      in channel.c to avoid throwing a warning when we shouldn't.
      
      ASTERISK-29380
      
      Change-Id: Ie17ffe65086e0282c88542e38eed6a461ec79e81
      04454fc2
    • Naveen Albert's avatar
      app_voicemail: Configurable voicemail beep · 567ea5ab
      Naveen Albert authored
      Hitherto, VoiceMail() played a non-customizable beep tone to indicate
      the caller could leave a message. In some cases, the beep may not
      be desired, or a different tone may be desired.
      
      To increase flexibility, a new option allows customization of the tone.
      If the t option is specified, the default beep will be overridden.
      Supplying an argument will cause it to use the specified file for the tone,
      and omitting it will cause it to skip the beep altogether. If the option
      is not used, the default behavior persists.
      
      ASTERISK-29349
      
      Change-Id: I1c439c0011497e28a28067fc1cf1e654c8843280
      567ea5ab
  20. May 17, 2021
    • Naveen Albert's avatar
      main/file.c: Don't throw error on flash event. · 0026aead
      Naveen Albert authored
      AST_CONTROL_FLASH isn't accounted for in a switch statement in file.c
      where it should be ignored. Adding this to the switch ensures a
      warning isn't thrown on RFC2833 flash events, since nothing's amiss.
      
      ASTERISK-29372
      
      Change-Id: I4fa549bfb7ba1894a4044de999ea124877422fbc
      0026aead
Loading