Skip to content
Snippets Groups Projects
  1. Jul 11, 2019
  2. Jul 01, 2019
  3. Jun 27, 2019
    • sungtae kim's avatar
      res/ari/resource_channels.c: Added hangup reason code for channels · 613a335d
      sungtae kim authored
      Currently, DELETE /ari/channels/<channelID> supports only few hangup reasons.
      It's good enough for simple use, but when it needs to set the detail reason,
      it comes challenges.
      Added reason_code query parameter for that.
      
      ASTERISK-28385
      
      Change-Id: I1cf1d991ffd759d0591b347445a55f416ddc3ff2
      613a335d
  4. Jun 20, 2019
    • Alexei Gradinari's avatar
      res_fax: gateway sends T.38 request to both endpoints if V.21 detected · f414ca06
      Alexei Gradinari authored
      According T.38 Gateway 'Use case 3'
      https://wiki.asterisk.org/wiki/display/AST/T.38+Gateway
      T.38 Gateway should send T.38 negotiation request to called endpoint
      if FAX preamble (using V.21 detector) generated by called endpoint.
      But it does not, because fax_gateway_detect_v21 constructs T.38
      negotiation request, but forwards it only to other channel,
      not to the channel on which FAX preamble is detected.
      
      Some SIP endpoints could be improperly configured to rely on the other side
      to initiate T.38 re-INVITEs.
      
      With this patch the T.38 Gateway tries to negotiate with both sides
      by sending T.38 negotiation request to both endpoints supported T.38.
      
      Change-Id: I73bb24799bfe1a48adae9c034a2edbae54cc2a39
      f414ca06
  5. Jun 13, 2019
    • Joshua Colp's avatar
      res_rtp_asterisk: Add support for DTLS packet fragmentation. · a8e5cf55
      Joshua Colp authored
      This change adds support for larger TLS certificates by allowing
      OpenSSL to fragment the DTLS packets according to the configured
      MTU. By default this is set to 1200.
      
      This is accomplished by implementing our own BIO method that
      supports MTU querying. The configured MTU is returned to OpenSSL
      which fragments the packet accordingly. When a packet is to be
      sent it is done directly out the RTP instance.
      
      ASTERISK-28018
      
      Change-Id: If2d5032019a28ffd48f43e9e93ed71dbdbf39c06
      a8e5cf55
  6. Jun 03, 2019
    • Alexei Gradinari's avatar
      res_fax: fix segfault on inactive "reserved" fax session · 1b62781b
      Alexei Gradinari authored
      The change #10017 "Handle fax gateway being started more than once"
      introdiced a bug which leads to segfault in res_fax_spandsp.
      
      The res_fax_spandsp module does not support reserving sessions, so
      fax_session_reserve returns a fax session with state AST_FAX_STATE_INACTIVE.
      
      The fax_gateway_start does not create a real fax session if the fax session
      is already present and the state is not AST_FAX_STATE_RESERVED.
      But the "reserved" session created for res_fax_spandsp has state
      AST_FAX_STATE_INACTIVE, so fax_gateway_start not starting.
      
      Then when fax_gateway_framehook is called and gateway T.38 state is
      NEGOTIATED the call of gateway->s->tech->write(gateway->s, f) leads to
      segfault, because session tech_pvt is not set, i.e. the tech session
      was not initialized/started.
      
      This patch adds check also on AST_FAX_STATE_INACTIVE to the "reserved"
      session created for res_fax_spandsp will start.
      
      This patch also adds extra check and log ERROR if tech_pvt is not set
      before call tech->write.
      
      ASTERISK-27981 #close
      
      Change-Id: Ife3e65e5f18c902db2ff0538fccf7d28f88fa803
      1b62781b
  7. May 29, 2019
  8. May 22, 2019
    • Matt Jordan's avatar
      res_prometheus: Add metrics for PJSIP outbound registrations · 0bb38796
      Matt Jordan authored
      When monitoring Asterisk instances, it's often useful to know when an
      outbound registration fails, as this often maps to the notion of a trunk
      and having a trunk fail is usually a "bad thing". As such, this patch
      adds monitoring metrics that track the state of PJSIP outbound registrations.
      It does this by looking for the Registry events coming across the Stasis
      system topic, and publishing those as metrics to Prometheus. Note that
      while this may support other outbound registration types (IAX2, SIP, etc.)
      those haven't been tested. Your mileage may vary.
      
      (And why are you still using IAX2 and SIP? It's 2019 folks. Get with the
      program.)
      
      This patch also adds Sorcery observers to handle modifications to the
      underlying PJSIP outbound registration objects. This is useful when a
      reload is triggered that modifies the properties of an outbound registration,
      or when ARI push configuration is used and an object is updated or
      deleted. Because we rely on properties of the registration object to
      define the metric (label key/value pairs), we delete the relevant metric when
      we notice that something has changed and wait for a new Stasis message to
      arrive to re-create the metric.
      
      ASTERISK-28403
      
      Change-Id: If01420e38530fc20b6dd4aa15cd281d94cd2b87e
      0bb38796
    • Matt Jordan's avatar
      res_prometheus: Add CLI commands · a2648b22
      Matt Jordan authored
      This patch adds a few CLI commands to the res_prometheus module to aid
      system administrators setting up and configuring the module. This includes:
      
      * prometheus show status: Display basic statistics about the Prometheus
        module, including its essential configuration, when it was last scraped,
        and how long the scrape took. The last two bits of information are useful
        when Prometheus isn't generating metrics appropriately, as it will at
        least tell you if Asterisk has had its HTTP route hit by the remote
        server.
      
      * prometheus show metrics: Dump the current metrics to the CLI. Useful for
        system administrators to see what metrics are currently available without
        having to cURL or go to Prometheus itself.
      
      ASTERISK-28403
      
      Change-Id: Ic09813e5e14b901571c5c96ebeae2a02566c5172
      a2648b22
    • Matt Jordan's avatar
      res_prometheus: Add Asterisk bridge metrics · 066280f0
      Matt Jordan authored
      This patch adds basic Asterisk bridge statistics to the res_prometheus
      module. This includes:
      
      * asterisk_bridges_count: The current number of bridges active on the
        system.
      
      * asterisk_bridges_channels_count: The number of channels active in a
        bridge.
      
      In all cases, enough information is provided with each bridge metric
      to determine a unique instance of Asterisk that provided the data, along
      with the technology, subclass, and creator of the bridge.
      
      ASTERISK-28403
      
      Change-Id: Ie27417dd72c5bc7624eb2a7a6a8829d7551788dc
      066280f0
    • Matt Jordan's avatar
      res_prometheus: Add Asterisk endpoint metrics · ed6cd13b
      Matt Jordan authored
      This patch adds basic Asterisk endpoint statistics to the res_prometheus
      module. This includes:
      
      * asterisk_endpoints_state: The current state (unknown, online, offline)
        for each defined endpoint.
      
      * asterisk_endpoints_channels_count: The current number of channels
        associated with a given endpoint.
      
      * asterisk_endpoints_count: The current number of defined endpoints.
      
      In all cases, enough information is provided with each endpoint metric
      to determine a unique instance of Asterisk that provided the data, as well
      as the underlying technology and resource definition.
      
      ASTERISK-28403
      
      Change-Id: I46443963330c206a7d12722d08dcaabef672310e
      ed6cd13b
  9. May 21, 2019
    • Morten Tryfoss's avatar
      res_rtp_asterisk: timestamp should be unsigned instead of signed int · 3224ac07
      Morten Tryfoss authored
      Using timestamp with signed int will cause timestamps exceeding max value
      to be negative.
      This causes the jitterbuffer to do passthrough of the packet.
      
      ASTERISK-28421
      
      Change-Id: I9dabd0718180f2978856c50f43aac4e52dc3cde9
      3224ac07
    • Matt Jordan's avatar
      res_prometheus: Add Asterisk channel metrics · 0760af71
      Matt Jordan authored
      This patch adds basic Asterisk channel statistics to the res_prometheus
      module. This includes:
      
      * asterisk_calls_sum: A running sum of the total number of
        processed calls
      
      * asterisk_calls_count: The current number of calls
      
      * asterisk_channels_count: The current number of channels
      
      * asterisk_channels_state: The state of any particular channel
      
      * asterisk_channels_duration_seconds: How long a channel has existed,
        in seconds
      
      In all cases, enough information is provided with each channel metric
      to determine a unique instance of Asterisk that provided the data, as
      well as the name, type, unique ID, and - if present - linked ID of each
      channel.
      
      ASTERISK-28403
      
      Change-Id: I0db306ec94205d4f58d1e7fbabfe04b185869f59
      0760af71
    • Matt Jordan's avatar
      Add core Prometheus support to Asterisk · c50f29df
      Matt Jordan authored
      Prometheus is the defacto monitoring tool for containerized applications.
      This patch adds native support to Asterisk for serving up Prometheus
      compatible metrics, such that a Prometheus server can scrape an Asterisk
      instance in the same fashion as it does other HTTP services.
      
      The core module in this patch provides an API that future work can build
      on top of. The API manages metrics in one of two ways:
      (1) Registered metrics. In this particular case, the API assumes that
          the metric (either allocated on the stack or on the heap) will have
          its value updated by the module registering it at will, and not
          just when Prometheus scrapes Asterisk. When a scrape does occur,
          the metrics are locked so that the current value can be retrieved.
      (2) Scrape callbacks. In this case, the API allows consumers to be
          called via a callback function when a Prometheus initiated scrape
          occurs. The consumers of the API are responsible for populating
          the response to Prometheus themselves, typically using stack
          allocated metrics that are then formatted properly into strings
          via this module's convenience functions.
      
      These two mechanisms balance the different ways in which information is
      generated within Asterisk: some information is generated in a fashion
      that makes it appropriate to update the relevant metrics immediately;
      some information is better to defer until a Prometheus server asks for
      it.
      
      Note that some care has been taken in how metrics are defined to
      minimize the impact on performance. Prometheus's metric definition
      and its support for nesting metrics based on labels - which are
      effectively key/value pairs - can make storage and managing of metrics
      somewhat tricky. While a naive approach, where we allow for any number
      of labels and perform a lot of heap allocations to manage the information,
      would absolutely have worked, this patch instead opts to try to place
      as much information in length limited arrays, stack allocations, and
      vectors to minimize the performance impacts of scrapes. The author of
      this patch has worked on enough systems that were driven to their knees
      by poor monitoring implementations to be a bit cautious.
      
      Additionally, this patch only adds support for gauges and counters.
      Additional work to add summaries, histograms, and other Prometheus
      metric types may add value in the future. This would be of particular
      interest if someone wanted to track SIP response types.
      
      Finally, this patch includes unit tests for the core APIs.
      
      ASTERISK-28403
      
      Change-Id: I891433a272c92fd11c705a2c36d65479a415ec42
      c50f29df
  10. May 17, 2019
    • George Joseph's avatar
      res_rtp_asterisk: Add ability to propose local address in ICE · be83591f
      George Joseph authored
      You can now add the "include_local_address" flag to an entry in
      rtp.conf "[ice_host_candidates]" to include both the advertized
      address and the local address in ICE negotiation:
      
      [ice_host_candidates]
      192.168.1.1 = 1.2.3.4,include_local_address
      
      This causes both 192.168.1.1 and 1.2.3.4 to be advertized.
      
      Change-Id: Ide492cd45ce84546175ca7d557de80d9770513db
      be83591f
  11. May 08, 2019
    • Joshua Colp's avatar
      res_rtp_asterisk: Fix sequence number cycling and packet loss count. · 7a6fd83a
      Joshua Colp authored
      This change fixes two bugs which both resulted in the packet loss
      count exceeding 65,000.
      
      The first issue is that the sequence number check to determine if
      cycling had occurred was using the wrong variable resulting in the
      check never seeing that cycling has occurred, throwing off the
      packet loss calculation. It now uses the correct variable.
      
      The second issue is that the packet loss calculation assumed that
      the received number of packets in an interval could never exceed
      the expected number. In practice this isn't true due to delayed
      or retransmitted packets. The expected will now be updated to
      the received number if the received exceeds it.
      
      ASTERISK-28379
      
      Change-Id: If888ebc194ab69ac3194113a808c414b014ce0f6
      7a6fd83a
  12. May 07, 2019
    • Ben Ford's avatar
      pjsip_options.c: Allow immediate qualifies for new contacts. · 86836e04
      Ben Ford authored
      When multiple endpoints try to register close together using the same
      AOR with qualify_frequency set, one contact would qualify immediately
      while the other contacts would have to wait out the duration of the
      timer before being able to qualify. Changing the conditional to check
      the contact container count for a non-zero value allows all contacts to
      qualify immediately.
      
      Change-Id: I79478118ee7e0d6e76af7c354d66684220db9415
      86836e04
  13. May 06, 2019
    • agupta's avatar
      stasis: Hangup channel for Local channel No such extension error · 85242a9b
      agupta authored
      When we use early bridge with create and dial from stasis using Local channel
      and the dialplan does not any entry the it is returned from core_local.c with
      No such extension .
      
      In such case asterisk locks up till the channel is not hangup with the error
      Exceptionally long voice queue length
      
      * Found that in such case app_control_dial fails on ast_call method and
        return -1
      * Since it is called from stasis_app_send_command_async and return -1 does
        not cause resources to be freed and since no PBX exist it is not able to
        read from channel causing exceptionally long queue
      * After putting this code found that the channel was releasing immediately
        and resources were freed.
      
      ASTERISK-28399
      Reported by: Abhay Gupta
      Tested by: Abhay Gupta
      
      Change-Id: I0a55c923fc6995559f808d63b9488762b4489318
      85242a9b
  14. May 02, 2019
    • George Joseph's avatar
      res_pjsip: Check return from pjsip_parse_uri calls · ef92c69f
      George Joseph authored
      Updated ast_sip_create_rdata_with_contact and registrar_find_contact
      to check the return from pjsip_parse_uri before attempting to
      use the uri returned.
      
      ASTERISK-28402
      Reported-by: Ross Beer
      
      Change-Id: I9810b3b163c45ed5a56ec743586e5ce107f13ba7
      ef92c69f
    • agupta's avatar
      stasis: Only place stasis created and dialed channels into dial bridge. · 71040078
      agupta authored
      The dial bridge is meant to hold channels which have been created
      and dialed in stasis. It handles the frames coming from them and raises
      the appropriate events.
      
      It was possible for the code to mistakenly place calls which came
      from the dialplan into the dial bridge if they were not in an
      answered state. These channels are not outgoing channels and
      should not be placed into the dial bridge.
      
      The code now checks to ensure that only stasis created channels are
      placed into the dial bridge by checking that a PBX does not exist
      on the channel.
      
      ASTERISK-27756
      
      Change-Id: Ideee69ff06c9a0b31f7ed61165f5c055f51d21b6
      71040078
  15. May 01, 2019
    • Joshua Colp's avatar
      rtp: Add support for transport-cc in receiver direction. · 6bb70c93
      Joshua Colp authored
      The transport-cc draft is a mechanism by which additional information
      about packet reception can be provided to the sender of packets so
      they can do sender side bandwidth estimation. This is accomplished
      by having a transport specific sequence number and an RTCP feedback
      message. This change implements this in the receiver direction.
      
      For each received RTP packet where transport-cc is negotiated we store
      the time at which the RTP packet was received and its sequence number.
      At a 1 second interval we go through all packets in that period of time
      and use the stored time of each in comparison to its preceding packet to
      calculate its delta. This delta information is placed in the RTCP
      feedback message, along with indicators for any packets which were not
      received.
      
      The browser then uses this information to better estimate available
      bandwidth and adjust accordingly. This may result in it lowering the
      available send bandwidth or adjusting how "bursty" it can be.
      
      ASTERISK-28400
      
      Change-Id: I654a2cff5bd5554ab94457a14f70adb71f574afc
      6bb70c93
  16. Apr 23, 2019
    • Kevin Harwell's avatar
      mwi core: Move core MWI functionality into its own files · ff0d0ac2
      Kevin Harwell authored
      There is enough MWI functionality to warrant it having its own 'c' and header
      files. This patch moves all current core MWI data structures, and functions
      into the following files:
      
      main/mwi.h
      main/mwi.c
      
      Note, code was simply moved, and not modified. However, this patch is also in
      preparation for core MWI changes, and additions to come.
      
      Change-Id: I9dde8bfae1e7ec254fa63166e090f77e4d3097e0
      ff0d0ac2
  17. Apr 18, 2019
  18. Apr 17, 2019
    • Dan Cropp's avatar
      res_pjsip: Added a norefersub configuration setting · cffa2a74
      Dan Cropp authored
      Added a new PJSIP global setting called norefersub.
      Default is true to keep support working as before.
      
      res_pjsip_refer:  Configures PJSIP norefersub capability accordingly.
      
      Checks the PJSIP global setting value.
      If it is true (default) it adds the norefersub capability to PJSIP.
      If it is false (disabled) it does not add the norefersub capability
      to PJSIP.
      
      This is useful for Cisco switches that do not follow RFC4488.
      
      ASTERISK-28375 #close
      Reported-by: Dan Cropp
      
      Change-Id: I0b1c28ebc905d881f4a16e752715487a688b30e9
      cffa2a74
  19. Apr 16, 2019
  20. Apr 12, 2019
    • George Joseph's avatar
      ARI: Run 'make ari-stubs' · 26cdf042
      George Joseph authored
      An earlier contributor apparently forgot to run 'make ari-stubs'
      before committing after making ARI model changes.
      
      Change-Id: I7813e5638e2821d11f4b968dc2aeab4f725190a6
      26cdf042
  21. Apr 11, 2019
    • Sean Bright's avatar
      res_ael: Create consistent label names across reloads · f8271934
      Sean Bright authored
      Reset the internal counter that the AEL2 compiler uses for unique label
      names before compiling. This keeps dialplan labels consistent across
      reloads assuming the AEL2 has not changed.
      
      ASTERISK-17799 #close
      Reported by: Kirill Katsnelson
      
      Change-Id: I30b3cc887d1ee0644d3f341e2fef16f525d7fae5
      f8271934
    • Sean Bright's avatar
      res_ael: Use Gosub in for loop expressions · f7f1a2cb
      Sean Bright authored
      In AEL2, if a 'for' statement contains macro* calls, like:
      
          for (&iterator(${TRY},A); "${A}" != ""; &iterate(A)) {
      
      The AEL2 parser will translate these into calls to the deprecated Macro
      dialplan application and use the antiquated pipe delimiter.
      
      Instead, convert these into calls to the Gosub dialplan application and
      use commas as argument separators.
      
      ASTERISK-18593 #close
      Reported by: Luke-Jr
      
      * 'macro' in this context means AEL2 macros, not the 'Macro' application
      
      Change-Id: I3d73716033b8e3e42e0209d355bf5f10c97045fc
      f7f1a2cb
    • Sean Bright's avatar
      res_ael: Fix pattern matching against literal '+' · 395c7ed5
      Sean Bright authored
      When generating the regular expression that matches against existing
      extensions, we need to escape literal characters that can also be
      regular expression metacharacters. This was already being done for '*'
      but we need to do the same for '+'.
      
      In passing, remove some unreachable code - strcmp() is already run
      immediately when entering extension_matches().
      
      ASTERISK-14939 #close
      Reported by: klaus3000
      
      Change-Id: I8d2cccb3479168fba1b0a6704c52198b396468f1
      395c7ed5
  22. Apr 10, 2019
  23. Apr 02, 2019
    • Kevin Harwell's avatar
      bridge_softmix: use a float type to store the internal REMB bitrate · d1d06928
      Kevin Harwell authored
      REMB's exponent is 6-bits (0..63) and has a mantissa of 18-bits. We were using
      an unsigned integer to represent the bitrate. However, that type is not large
      enough to hold all potential bitrate values. If the bitrate is large enough
      bits were being shifted off the "front" of the mantissa, which caused the
      wrong value to be sent to the browser.
      
      This patch makes it so it now uses a float type to hold the bitrate. Using a
      float allows for all bitrate values to be correctly represented.
      
      ASTERISK-28255
      
      Change-Id: Ice00fdd16693b16b41230664be5d9f0e465b239e
      d1d06928
  24. Mar 27, 2019
  25. Mar 26, 2019
    • sungtae kim's avatar
      main/json.c: Added app_name, app_data to channel type · 76768ad6
      sungtae kim authored
      It was difficult to check the channel's current application and
      parameters using ARI for current channels. Added app_name, app_data
      items to show the current application information.
      
      ASTERISK-28343
      
      Change-Id: Ia48972b3850e5099deab0faeaaf51223a1f2f38c
      76768ad6
  26. Mar 25, 2019
    • Alexei Gradinari's avatar
      res_config_odbc: set empty extended field as a single whitespace · e5d990d0
      Alexei Gradinari authored
      If Realtime @ variable value is NULL or empty or contains only whitespaces
      then when we try to retrieve it using PJSIP_ENDPOINT we get WARNING
      pjsip_endpoint_function_read: Unknown property @my_var for PJSIP endpoint.
      And the variable is missing in the result of CLI pjsip show endpoint.
      
      This patch keeps empty sorcery extended field.
      
      ASTERISK-28341 #close
      
      Change-Id: I221fccc04cbfa2be17ce971f64ae0e74e465eea0
      e5d990d0
  27. Mar 15, 2019
    • sungtae kim's avatar
      res/res_stasis: Fixed wrong StasisEnd timestamp · 629962d1
      sungtae kim authored
      Because StasisEnd's timestamp created it's own timestamp, it makes
      wrong timestamp, compare to other channel event(ChannelDestroyed).
      Fixed to getting a timestamp from the Channel's timestamp.
      
      ASTERISK-28333
      
      Change-Id: I5eb8380fc472f1100535a6bc4983c64767026116
      629962d1
  28. Mar 14, 2019
    • George Joseph's avatar
      app.c: Remove deletion of pool topic on mwi state delete · 63d90c38
      George Joseph authored
      As part of an earlier voicemail refactor, ast_delete_mwi_state_full
      was modified to remove the pool topic for a mailbox when the state
      was deleted.  This was an attempt to prevent stale topics from
      accumulating when app_voicemail was reloaded and a mailbox went
      away.  Unfortunately because of the fact that when app_voicemail
      reloads, ALL mailboxes are deleted then only current ones recreated,
      topics were being removed from the pool that still had subscribers
      on them, then recreated as new topics of the same name.  So now
      modules like res_pjsip_mwi are listening on a topic that will
      never receive any messages because app_voicemail is publishing on
      a different topic that happens to have the same name.  The solutiuon
      to this is not easy and given that accumulating topics for
      deleted mailboxes is less evil that not sending NOTIFYs...
      
      * Removed the call to stasis_topic_pool_delete_topic in
        ast_delete_mwi_state_full.
      
      Also:
      
      * Fixed a topic reference leak in res_pjsip_mwi
        mwi_stasis_subscription_alloc.
      
      * Added some debugging to mwi_stasis_subscription_alloc,
        stasis_topic_create, and topic_dtor.
      
      * Fixed a topic reference leak in an error path in
        internal_stasis_subscribe.
      
      ASTERISK-28306
      Reported-by: Jared Hull
      
      Change-Id: Id7da0990b3ac4be4b58491536b35f41291247b27
      63d90c38
  29. Mar 13, 2019
  30. Mar 11, 2019
    • sungtae kim's avatar
      res/res_ari: Added timestamp as a requirement for all ARI events · e2eb19b3
      sungtae kim authored
      Changed to requirement to having timestamp for all of ARI events.
      The below ARI events were changed to having timestamp.
      PlaybackStarted, PlaybackContinuing, PlaybackFinished,
      RecordingStarted, RecordingFinished, RecordingFailed,
      ApplicationReplaced, ApplicationMoveFailed
      
      ASTERISK-28326
      
      Change-Id: I382c2fef58f5fe107e1074869a6d05310accb41f
      e2eb19b3
    • Joshua Colp's avatar
      stasis: Improve topic/subscription names and statistics. · 0231dd6a
      Joshua Colp authored
      Topic names now follow: <subsystem>:<functionality>[/<object>]
      
      This ensures that they are all unique, and also provides better
      insight in to what each topic is for.
      
      Subscriber ids now also use the main topic name they are
      subscribed to and an incrementing integer as their identifier to
      make it easier to understand what the subscription is primarily
      responsible for.
      
      Both the CLI commands for listing topic and subscription statistics
      now sort to make it a bit easier to see what is going on.
      
      Subscriptions will now show all topics that they are receiving messages
      from, not just the main topic they were subscribed to.
      
      ASTERISK-28335
      
      Change-Id: I484e971a38c3640f2bd156282e532eed84bf220d
      0231dd6a
Loading