Skip to content
Snippets Groups Projects
  1. Mar 02, 2023
  2. Mar 01, 2023
    • George Joseph's avatar
      res_pjsip: Replace invalid UTF-8 sequences in callerid name · ceda5a98
      George Joseph authored
      * Added a new function ast_utf8_replace_invalid_chars() to
        utf8.c that copies a string replacing any invalid UTF-8
        sequences with the Unicode specified U+FFFD replacement
        character.  For example:  "abc\xffdef" becomes "abc\uFFFDdef".
        Any UTF-8 compliant implementation will show that character
        as a � character.
      
      * Updated res_pjsip:set_id_from_hdr() to use
        ast_utf8_replace_invalid_chars and print a warning if any
        invalid sequences were found during the copy.
      
      * Updated stasis_channels:ast_channel_publish_varset to use
        ast_utf8_replace_invalid_chars and print a warning if any
        invalid sequences were found during the copy.
      
      ASTERISK-27830
      
      Change-Id: I4ffbdb19c80bf0efc675d40078a3ca4f85c567d8
      ceda5a98
  3. Feb 28, 2023
    • Sean Bright's avatar
      test.c: Avoid passing -1 to FD_* family of functions. · e5c5cd6e
      Sean Bright authored
      This avoids buffer overflow errors when running tests that capture
      output from child processes.
      
      This also corrects a copypasta in an off-nominal error message.
      
      Change-Id: Ib482847a3515364f14c7e7a0c0a4213851ddb10d
      e5c5cd6e
    • Naveen Albert's avatar
      chan_iax2: Fix jitterbuffer regression prior to receiving audio. · ede67a99
      Naveen Albert authored
      ASTERISK_29392 (a security fix) introduced a regression by
      not processing frames when we don't have an audio format.
      
      Currently, chan_iax2 only calls jb_get to read frames from
      the jitterbuffer when the voiceformat has been set on the pvt.
      However, this only happens when we receive a voice frame, which
      means that prior to receiving voice frames, other types of frames
      get stalled completely in the jitterbuffer.
      
      To fix this, we now fallback to using the format negotiated during
      call setup until we've actually received a voice frame with a format.
      This ensures we're always able to read from the jitterbuffer.
      
      ASTERISK-30354 #close
      ASTERISK-30162 #close
      
      Change-Id: Ie4fd1e8e088a145ad89e0427c2100a530e964fe9
      ede67a99
  4. Feb 27, 2023
    • Sean Bright's avatar
      test_crypto.c: Fix getcwd(…) build error. · 827222d6
      Sean Bright authored
      `getcwd(…)` is decorated with the `warn_unused_result` attribute and
      therefore needs its return value checked.
      
      Change-Id: Idcccb20a0abf293202c28633d0e9ee0f6a9dbe93
      827222d6
    • Nick French's avatar
      pjproject_bundled: Fix cross-compilation with SSL libs. · 200dc7d0
      Nick French authored
      Asterisk makefiles auto-detect SSL library availability,
      then they assume that pjproject makefiles will also autodetect
      an SSL library at the same time, so they do not pass on the
      autodetection result to pjproject.
      
      This normally works, except the pjproject makefiles disables
      autodetection when cross-compiling.
      
      Fix by explicitly configuring pjproject to use SSL if we
      have been told to use it or it was autodetected
      
      ASTERISK-30424 #close
      
      Change-Id: I8fe2999ea46710e21d1d55a1bed92769c6ebded9
      200dc7d0
    • Mike Bradeen's avatar
      app_read: Add an option to return terminator on empty digits. · 5c11d7ad
      Mike Bradeen authored
      Adds 'e' option to allow Read() to return the terminator as the
      dialed digits in the case where only the terminator is entered.
      
      ie; if "#" is entered, return "#" if the 'e' option is set and ""
      if it is not.
      
      ASTERISK-30411
      
      Change-Id: I49f3221824330a193a20c660f99da0f1fc2cbbc5
      5c11d7ad
    • cmaj's avatar
      res_phoneprov.c: Multihomed SERVER cache prevention · 5b0e3444
      cmaj authored
      Phones moving between subnets on multi-homed server have their
      initially connected interface IP cached in the SERVER variable,
      even when it is not specified in the configuration files. This
      prevents phones from obtaining the correct SERVER variable value
      when they move to another subnet.
      
      ASTERISK-30388 #close
      Reported-by: cmaj
      
      Change-Id: I1d18987a9d58e85556b4c4a6814ce7006524cc92
      5b0e3444
    • Mike Bradeen's avatar
      app_directory: Add a 'skip call' option. · 2308afed
      Mike Bradeen authored
      Adds 's' option to skip calling the extension and instead set the
      extension as DIRECTORY_EXTEN channel variable.
      
      ASTERISK-30405
      
      Change-Id: Ib9d9db1ba5b7524594c640461b4aa8f752db8299
      2308afed
    • Mike Bradeen's avatar
      app_senddtmf: Add option to answer target channel. · 98742388
      Mike Bradeen authored
      Adds a new option to SendDTMF() which will answer the specified
      channel if it is not already up. If no channel is specified, the
      current channel will be answered instead.
      
      ASTERISK-30422
      
      Change-Id: Iddcbd501fcdf9fef0f453b7a8115a90b11f1d085
      98742388
  5. Feb 23, 2023
    • Mike Bradeen's avatar
      res_pjsip: Prevent SEGV in pjsip_evsub_send_request · 37e558f6
      Mike Bradeen authored
      contributed pjproject - patch to check sub->pending_notify
      in evsub.c:on_tsx_state before calling
      pjsip_evsub_send_request()
      
      res_pjsip_pubsub - change post pjsip 2.13 behavior to use
      pubsub_on_refresh_timeout to avoid the ao2_cleanup call on
      the sub_tree. This is is because the final NOTIFY send is no
      longer the last place the sub_tree is referenced.
      
      ASTERISK-30419
      
      Change-Id: Ib5cc662ce578e9adcda312e16c58a10b6453e438
      37e558f6
  6. Feb 20, 2023
  7. Feb 13, 2023
    • Sean Bright's avatar
      app_queue: Reset all queue defaults before reload. · aef0c0ce
      Sean Bright authored
      Several queue fields were not being set to their default value during
      a reload.
      
      Additionally added some sample configuration options that were missing
      from queues.conf.sample.
      
      Change-Id: I3a88c7877af91752b1b46a0c087384f7eb9c47e4
      aef0c0ce
  8. Feb 07, 2023
    • Mike Bradeen's avatar
      res_pjsip: Upgraded bundled pjsip to 2.13 · 58636a6e
      Mike Bradeen authored
      Removed multiple patches.
      
      Code chages in res_pjsip_pubsub due to changes in evsub.
      
      Pjsip now calls on_evsub_state() before on_rx_refresh(),
      so the sub tree deletion that used to take place in
      on_evsub_state() now must take place in on_rx_refresh().
      
      Additionally, pjsip now requires that you send the NOTIFY
      from within on_rx_refresh(), otherwise it will assert
      when going to send the 200 OK. The idea is that it will
      look for this NOTIFY and cache it until after sending the
      response in order to deal with the self-imposed message
      mis-order. Asterisk previously dealt with this by pushing
      the NOTIFY in on_rx_refresh(), but pjsip now forces us
      to use it's method.
      
      Changes were required to configure in order to detect
      which way pjsip handles this as the two are not
      compatible for the reasons mentioned above.
      
      A corresponding change in testsuite is required in order
      to deal with the small interal timing changes caused by
      moving the NOTIFY send.
      
      ASTERISK-30325
      
      Change-Id: I50b00cac89d950d3511d7b250a1c641965d9fe7f
      58636a6e
  9. Jan 31, 2023
    • Sean Bright's avatar
      doxygen: Fix doxygen errors. · 96d9ad51
      Sean Bright authored
      Change-Id: Ic50e95b4fc10f74ab15416d908e8a87ee8ec2f85
      96d9ad51
    • Naveen Albert's avatar
      app_signal: Add signaling applications · 88b2c741
      Naveen Albert authored
      Adds the Signal and WaitForSignal
      applications, which can be used for inter-channel
      signaling in the dialplan.
      
      Signal supports sending a signal to other channels
      listening for a signal of the same name, with an
      optional data payload. The signal is received by
      all channels waiting for that named signal.
      
      ASTERISK-29810 #close
      
      Change-Id: Ic34439de3d60f8609357666a465c354d81f5fef3
      88b2c741
  10. Jan 30, 2023
    • Mike Bradeen's avatar
      app_directory: add ability to specify configuration file · 70856e86
      Mike Bradeen authored
      Adds option to app_directory to specify a filename from which to
      read configuration instead of voicemail.conf ie;
      
      same => n,Directory(,,c(directory.conf))
      
      This configuration should contain a list of extensions using the
      voicemail.conf format, ie;
      
      2020=2020,Dog Dog,,,,attach=no|saycid=no|envelope=no|delete=no
      
      ASTERISK-30404
      
      Change-Id: Id58ccb1344ad1e563fa10db12f172fbd104a9d13
      70856e86
    • Naveen Albert's avatar
      func_json: Enhance parsing capabilities of JSON_DECODE · 8a45cd7a
      Naveen Albert authored
      Adds support for arrays to JSON_DECODE by allowing the
      user to print out entire arrays or index a particular
      key or print the number of keys in a JSON array.
      
      Additionally, adds support for recursively iterating a
      JSON tree in a single function call, making it easier
      to parse JSON results with multiple levels. A maximum
      depth is imposed to prevent potentially blowing
      the stack.
      
      Also fixes a bug with the unit tests causing an empty
      string to be printed instead of the actual test result.
      
      ASTERISK-29913 #close
      
      Change-Id: I603940b216a3911b498fc6583b18934011ef5d5b
      8a45cd7a
    • sungtae kim's avatar
      res_stasis_snoop: Fix snoop crash · f99849f8
      sungtae kim authored
      Added NULL pointer check and channel lock to prevent resource release
      while the chanspy is processing.
      
      ASTERISK-29604
      
      Change-Id: Ibdc675f98052da32333b19685b1708a3751b6d24
      f99849f8
    • Sean Bright's avatar
      pbx_ael: Global variables are not expanded. · 56051d1a
      Sean Bright authored
      Variable references within global variable assignments are now
      expanded rather than being included literally.
      
      ASTERISK-30406 #close
      
      Change-Id: I136e8d6395e90a4c92d9777a46a7bc3edb08d05d
      56051d1a
  11. Jan 26, 2023
    • Naveen Albert's avatar
      res_pjsip_session: Add overlap_context option. · a1da8042
      Naveen Albert authored
      Adds the overlap_context option, which can be used
      to explicitly specify a context to use for overlap
      dialing extension matches, rather than forcibly
      using the context configured for the endpoint.
      
      ASTERISK-30262 #close
      
      Change-Id: Ibbcd4a8b11402428a187fb56b8d4e7408774a0db
      a1da8042
  12. Jan 13, 2023
    • Sean Bright's avatar
      app_playback.c: Fix PLAYBACKSTATUS regression. · ef16eaee
      Sean Bright authored
      In Asterisk 11, if a channel was redirected away during Playback(),
      the PLAYBACKSTATUS variable would be set to SUCCESS. In Asterisk 12
      (specifically commit 7d9871b3) that
      behavior was inadvertently changed and the same operation would result
      in the PLAYBACKSTATUS variable being set to FAILED. The Asterisk 11
      behavior has been restored.
      
      Partial fix for ASTERISK~25661.
      
      Change-Id: I53f54e56b59b61c99403a481b6cb8d88b5a559ff
      ef16eaee
  13. Jan 12, 2023
  14. Jan 10, 2023
  15. Jan 09, 2023
    • George Joseph's avatar
      res_rtp_asterisk: Asterisk Media Experience Score (MES) · 4710f37e
      George Joseph authored
      -----------------
      
      This commit reinstates MES with some casting fixes to the
      functions in time.h that convert between doubles and timeval
      structures.  The casting issues were causing incorrect
      timestamps to be calculated which caused transcoding from/to
      G722 to produce bad or no audio.
      
      ASTERISK-30391
      
      -----------------
      
      This module has been updated to provide additional
      quality statistics in the form of an Asterisk
      Media Experience Score.  The score is avilable using
      the same mechanisms you'd use to retrieve jitter, loss,
      and rtt statistics.  For more information about the
      score and how to retrieve it, see
      https://wiki.asterisk.org/wiki/display/AST/Media+Experience+Score
      
      * Updated chan_pjsip to set quality channel variables when a
        call ends.
      * Updated channels/pjsip/dialplan_functions.c to add the ability
        to retrieve the MES along with the existing rtcp stats when
        using the CHANNEL dialplan function.
      * Added the ast_debug_rtp_is_allowed and ast_debug_rtcp_is_allowed
        checks for debugging purposes.
      * Added several function to time.h for manipulating time-in-samples
        and times represented as double seconds.
      * Updated rtp_engine.c to pass through the MES when stats are
        requested.  Also debug output that dumps the stats when an
        rtp instance is destroyed.
      * Updated res_rtp_asterisk.c to implement the calculation of the
        MES.  In the process, also had to update the calculation of
        jitter.  Many debugging statements were also changed to be
        more informative.
      * Added a unit test for internal testing.  The test should not be
        run during normal operation and is disabled by default.
      
      Change-Id: I4fce265965e68c3fdfeca55e614371ee69c65038
      4710f37e
    • George Joseph's avatar
      Revert "res_rtp_asterisk: Asterisk Media Experience Score (MES)" · 62ca063f
      George Joseph authored
      This reverts commit d454801c.
      
      Reason for revert: Issue when transcoding to/from g722
      
      Change-Id: I09f49e171b1661548657a9ba7a978c29d0b5be86
      62ca063f
  16. Jan 05, 2023
    • Naveen Albert's avatar
      loader: Allow declined modules to be unloaded. · d33bd6d6
      Naveen Albert authored
      Currently, if a module declines to load, dlopen is called
      to register the module but dlclose never gets called.
      Furthermore, loader.c currently doesn't allow dlclose
      to ever get called on the module, since it declined to
      load and the unload function bails early in this case.
      
      This can be problematic if a module is updated, since the
      new module cannot be loaded into memory since we haven't
      closed all references to it. To fix this, we now allow
      modules to be unloaded, even if they never "loaded" in
      Asterisk itself, so that dlclose is called and the module
      can be properly cleaned up, allowing the updated module
      to be loaded from scratch next time.
      
      ASTERISK-30345 #close
      
      Change-Id: Ifc743aadfa85ebe3284e02a63e124dafa64988d5
      d33bd6d6
    • Naveen Albert's avatar
      app_broadcast: Add Broadcast application · e06fe8e3
      Naveen Albert authored
      Adds a new application, Broadcast, which can be used for
      one-to-many transmission and many-to-one reception of
      channel audio in Asterisk. This is similar to ChanSpy,
      except it is designed for multiple channel targets instead
      of a single one. This can make certain kinds of audio
      manipulation more efficient and streamlined. New kinds
      of audio injection impossible with ChanSpy are also made
      possible.
      
      ASTERISK-30180 #close
      
      Change-Id: I7ba72f765dbab9b58deeae028baca3f4f8377726
      e06fe8e3
    • Naveen Albert's avatar
      func_frame_trace: Print text for text frames. · 68e34528
      Naveen Albert authored
      Since text frames contain a text body, make FRAME_TRACE
      more useful for text frames by actually printing the text.
      
      ASTERISK-30353 #close
      
      Change-Id: Ia6ce3d15cecd7a673a528d34faac86854a2bab50
      68e34528
  17. Jan 04, 2023
    • Naveen Albert's avatar
      json.h: Add ast_json_object_real_get. · 3b3fef23
      Naveen Albert authored
      json.h contains macros to get a string and an integer
      from a JSON object. However, the macro to do this for
      JSON reals is missing. This adds that.
      
      ASTERISK-30361 #close
      
      Change-Id: I8d0e28d763febf27b05801cdc83b73282aa6ee7a
      3b3fef23
    • Naveen Albert's avatar
      manager: Fix appending variables. · 7b8f7428
      Naveen Albert authored
      The if statement here is always false after the for
      loop finishes, so variables are never appended.
      This removes that to properly append to the end
      of the variable list.
      
      ASTERISK-30351 #close
      Reported by: Sebastian Gutierrez
      
      Change-Id: I1b7f8b85a8918f6a814cb933a479d4278cf16199
      7b8f7428
  18. Jan 03, 2023
    • George Joseph's avatar
      res_pjsip_transport_websocket: Add remote port to transport · 24102ba2
      George Joseph authored
      When Asterisk receives a new websocket conenction, it creates a new
      pjsip transport for it and copies connection data into it.  The
      transport manager then uses the remote IP address and port on the
      transport to create a monitor for each connection.  However, the
      remote port wasn't being copied, only the IP address which meant
      that the transport manager was creating only 1 monitoring entry for
      all websocket connections from the same IP address. Therefore, if
      one of those connections failed, it deleted the transport taking
      all the the connections from that same IP address with it.
      
      * We now copy the remote port into the created transport and the
        transport manager behaves correctly.
      
      ASTERISK-30369
      
      Change-Id: Ib506d40897ea6286455ac0be4dfbb0ed43b727e1
      24102ba2
    • Boris P. Korzun's avatar
      http.c: Fix NULL pointer dereference bug · edc90c96
      Boris P. Korzun authored
      If native HTTP is disabled but HTTPS is enabled and status page enabled
      too, Core/HTTP crashes while loading. 'global_http_server' references
      to NULL, but the status page tries to dereference it.
      
      The patch adds a check for HTTP is enabled.
      
      ASTERISK-30379 #close
      
      Change-Id: I11b02fc920b72aaed9c809fc43210523ccfdc249
      edc90c96
    • Holger Hans Peter Freyther's avatar
      res_http_media_cache: Do not crash when there is no extension · 3d9b9a2b
      Holger Hans Peter Freyther authored
      Do not crash when a URL has no path component as in this case the
      ast_uri_path function will return NULL. Make the code cope with not
      having a path.
      
      The below would crash
      > media cache create http://google.com /tmp/foo.wav
      
      Thread 1 "asterisk" received signal SIGSEGV, Segmentation fault.
      0x0000ffff836616cc in strrchr () from /lib/aarch64-linux-gnu/libc.so.6
      (gdb) bt
       #0  0x0000ffff836616cc in strrchr () from /lib/aarch64-linux-gnu/libc.so.6
       #1  0x0000ffff43d43a78 in file_extension_from_string (str=<optimized out>, buffer=buffer@entry=0xffffca9973c0 "",
          capacity=capacity@entry=64) at res_http_media_cache.c:288
       #2  0x0000ffff43d43bac in file_extension_from_url_path (bucket_file=bucket_file@entry=0x3bf96568,
          buffer=buffer@entry=0xffffca9973c0 "", capacity=capacity@entry=64) at res_http_media_cache.c:378
       #3  0x0000ffff43d43c74 in bucket_file_set_extension (bucket_file=bucket_file@entry=0x3bf96568) at res_http_media_cache.c:392
       #4  0x0000ffff43d43d10 in bucket_file_run_curl (bucket_file=0x3bf96568) at res_http_media_cache.c:555
       #5  0x0000ffff43d43f74 in bucket_http_wizard_create (sorcery=<optimized out>, data=<optimized out>, object=<optimized out>)
          at res_http_media_cache.c:613
       #6  0x0000000000487638 in bucket_file_wizard_create (sorcery=<optimized out>, data=<optimized out>, object=<optimized out>)
          at bucket.c:191
       #7  0x0000000000554408 in sorcery_wizard_create (object_wizard=object_wizard@entry=0x3b9f0718,
          details=details@entry=0xffffca9974a8) at sorcery.c:2027
       #8  0x0000000000559698 in ast_sorcery_create (sorcery=<optimized out>, object=object@entry=0x3bf96568) at sorcery.c:2077
       #9  0x00000000004893a4 in ast_bucket_file_create (file=file@entry=0x3bf96568) at bucket.c:727
       #10 0x00000000004f877c in ast_media_cache_create_or_update (uri=0x3bfa1103 "https://google.com",
          file_path=0x3bfa1116 "/tmp/foo.wav", metadata=metadata@entry=0x0) at media_cache.c:335
       #11 0x00000000004f88ec in media_cache_handle_create_item (e=<optimized out>, cmd=<optimized out>, a=0xffffca9976b8)
          at media_cache.c:640
      
      ASTERISK-30375 #close
      
      Change-Id: I6a9433688cb5d3d4be8758b7642d923bdde6c273
      3d9b9a2b
    • George Joseph's avatar
      res_rtp_asterisk: Asterisk Media Experience Score (MES) · d454801c
      George Joseph authored
      This module has been updated to provide additional
      quality statistics in the form of an Asterisk
      Media Experience Score.  The score is avilable using
      the same mechanisms you'd use to retrieve jitter, loss,
      and rtt statistics.  For more information about the
      score and how to retrieve it, see
      https://wiki.asterisk.org/wiki/display/AST/Media+Experience+Score
      
      * Updated chan_pjsip to set quality channel variables when a
        call ends.
      * Updated channels/pjsip/dialplan_functions.c to add the ability
        to retrieve the MES along with the existing rtcp stats when
        using the CHANNEL dialplan function.
      * Added the ast_debug_rtp_is_allowed and ast_debug_rtcp_is_allowed
        checks for debugging purposes.
      * Added several function to time.h for manipulating time-in-samples
        and times represented as double seconds.
      * Updated rtp_engine.c to pass through the MES when stats are
        requested.  Also debug output that dumps the stats when an
        rtp instance is destroyed.
      * Updated res_rtp_asterisk.c to implement the calculation of the
        MES.  In the process, also had to update the calculation of
        jitter.  Many debugging statements were also changed to be
        more informative.
      * Added a unit test for internal testing.  The test should not be
        run during normal operation and is disabled by default.
      
      ASTERISK-30280
      
      Change-Id: I458cb9a311e8e5dc1db769b8babbcf2e093f107a
      d454801c
  19. Dec 22, 2022
    • Naveen Albert's avatar
      pbx_app: Update outdated pbx_exec channel snapshots. · cc8d9b94
      Naveen Albert authored
      pbx_exec makes a channel snapshot before executing applications.
      This doesn't cause an issue during normal dialplan execution
      where pbx_exec is called over and over again in succession.
      However, if pbx_exec is called "one off", e.g. using
      ast_pbx_exec_application, then a channel snapshot never ends
      up getting made after the executed application returns, and
      inaccurate snapshot information will linger for a while, causing
      "core show channels", etc. to show erroneous info.
      
      This is fixed by manually making a channel snapshot at the end
      of ast_pbx_exec_application, since we anticipate that pbx_exec
      might not get called again immediately.
      
      ASTERISK-30367 #close
      
      Change-Id: I2a5131053aa9d11badbc0ef2ef40b1f83d0af086
      cc8d9b94
  20. Dec 20, 2022
    • Naveen Albert's avatar
      res_pjsip_session: Use Caller ID for extension matching. · c7598ee9
      Naveen Albert authored
      Currently, there is no Caller ID available to us when
      checking for an extension match when handling INVITEs.
      As a result, extension patterns that depend on the Caller ID
      are not matched and calls may be incorrectly rejected.
      
      The Caller ID is not available because the supplement that
      adds Caller ID to the session does not execute until after
      this check. Supplement callbacks cannot yet be executed
      at this point since the session is not yet in the appropriate
      state.
      
      To fix this without impacting existing behavior, the Caller ID
      number is now retrieved before attempting to pattern match.
      This ensures pattern matching works correctly and there is
      no behavior change to the way supplements are called.
      
      ASTERISK-28767 #close
      
      Change-Id: Iec7f5a3b90e51b65ccf74342f96bf80314b7cfc7
      c7598ee9
    • Ben Ford's avatar
      res_pjsip_sdp_rtp.c: Use correct timeout when put on hold. · 881faf54
      Ben Ford authored
      When a call is put on hold and it has moh_passthrough and rtp_timeout
      set on the endpoint, the wrong timeout will be used. rtp_timeout_hold is
      expected to be used, but rtp_timeout is used instead. This change adds a
      couple of checks for locally_held to determine if rtp_timeout_hold needs
      to be used instead of rtp_timeout.
      
      ASTERISK-30350
      
      Change-Id: I7b106fc244332014216d12bba851cefe884cc25f
      881faf54
Loading