Skip to content
Snippets Groups Projects
  1. 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
  2. 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
  3. 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
  4. Mar 13, 2019
  5. 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
    • sungtae kim's avatar
      res/res_rtp_asterisk.c: Fixing possible divide by zero · 8641fd97
      sungtae kim authored
      Currently, when the Asterisk calculates rtp statistics, it uses
      sample_count as a unsigned integer parameter. This would be fine
      for most of cases, but in case of large enough number of sample_count,
      this might be causing the divide by zero error.
      
      ASTERISK-28321
      
      Change-Id: If7e0629abaceddd2166eb012456c53033ea26249
      8641fd97
  6. Mar 08, 2019
  7. Mar 07, 2019
    • Sean Bright's avatar
      Replace calls to strtok() with strtok_r() · 2473b791
      Sean Bright authored
      strtok() uses a static buffer, making it not thread safe.
      
      Also add a #define to cause a compile failure if strtok is used.
      
      Change-Id: Icce265153e1e65adafa8849334438ab6d190e541
      2473b791
    • Ben Ford's avatar
      res_stasis: Add ability to switch applications. · 6626df58
      Ben Ford authored
      Added the ability to move between Stasis applications within Stasis.
      This can be done by calling 'move' in an application, providing (at
      minimum) the channel's id and the application to switch to. If the
      application is not registered or active, nothing will happen and the
      channel will remain in the current application, and an event will be
      triggered to let the application know that the move failed. The event
      name is "ApplicationMoveFailed", and provides the "destination" that the
      channel was attempting to move to, as well as the usual channel
      information. Optionally, a list of arguments can be passed to the
      function call for the receiving application. A full example of a 'move'
      call would look like this:
      
      client.channels.move(channelId, app, appArgs)
      
      The control object used to control the channel in Stasis can now switch
      which application it belongs to, rather than belonging to one Stasis
      application for its lifetime. This allows us to use the same control
      object instead of having to tear down the current one and create
      another.
      
      ASTERISK-28267 #close
      
      Change-Id: I43d12b10045a98a8d42541889b85695be26f288a
      6626df58
  8. Mar 03, 2019
    • sungtae kim's avatar
      bridging: Add creation timestamps · 3638c433
      sungtae kim authored
      This small feature will help to checking the bridge's status to
      figure out which bridge is in old/zombie or not. Also added
      detail items for the 'bridge show *' cli to provide more detail
      info. And added creation item to the ARI as well.
      
      ASTERISK-28279
      
      Change-Id: I460238c488eca4d216b9176576211cb03286e040
      3638c433
  9. Mar 01, 2019
    • Sean Bright's avatar
      res_pjsip_diversion: Use static pj_str_t for Diversion header names · 106a8ff0
      Sean Bright authored
      PJSIP assumes that these header names are not allocated, and does not
      clone the name strings when reusing headers.
      
      Block unload of res_pjsip_diversion until shutdown to ensure static
      memory stays valid.
      
      ASTERISK-28312 #close
      
      Change-Id: Ibd6ea55ec4a604bbd43ac07f8d0b54da2c39b8b9
      106a8ff0
  10. Feb 28, 2019
    • Sean Bright's avatar
      res_config_odbc: Avoid deadlock when max_connections = 1 · 719a4643
      Sean Bright authored
      Rather than calling ast_odbc_find_table() in the prepare callback, call
      it beforehand and pass it in to the callback to avoid the need for a
      second connection.
      
      ASTERISK-28166 #close
      
      Change-Id: I6f8a0b9990d636fd6bc1a92ed70f7050d2436202
      719a4643
    • George Joseph's avatar
      res_pjsip_sdp_rtp: Fix return code from apply_negotiated_sdp_stream · 8f9ffe59
      George Joseph authored
      apply_negotiated_sdp_stream was returning a "1" when no joint
      capabilities were found on an outgoing call instead of a "-1".
      This indicated to res_pjsip_session that the handler DID handle
      the sdp when in fact it didn't.  Without the appropriate setup,
      a subsequent media frame coming in would have an invalid stream_num
      and cause a seg fault when the stream was attempted to be retrieved.
      
      apply_negotiated_sdp_stream now returns the correct "-1" and any
      media is now discarded before it reaches the core stream processing.
      
      ASTERISK-28260
      Reported by: Sotiris Ganouris
      
      Change-Id: Ia095cb16b4862f2f6ad6d2d2a77453fa2542371f
      8f9ffe59
    • Sean Bright's avatar
      Revert "pjsip_message_filter: Only do interface lookup for wildcard addresses." · 101272d0
      Sean Bright authored
      This reverts commit d524ad52.
      
      Reason for revert: This causes Contact and Via headers to have the wrong
      transport address.
      
      ASTERISK-28309 #close
      
      Change-Id: Ibba4d6176f68e39279fcd9a545f81d56e747bed8
      101272d0
    • Sean Bright's avatar
      res_pjsip_config_wizard: Don't crash if misconfigured · 82a43394
      Sean Bright authored
      If both send_registrations and send_auth are both set to yes,
      outbound_auth/username must be set or we crash.
      
      ASTERISK-27992 #close
      
      Change-Id: I6418d56de1ae53f80393b314c2584048fbf7f11d
      82a43394
  11. Feb 27, 2019
    • Kevin Harwell's avatar
      res_pjsip_registrar: blocked threads on reliable transport shutdown take 3 · 930a7fe9
      Kevin Harwell authored
      When a contact was removed by the registrar it did not always check to see if
      the circumstances involved a monitored reliable transport. For instance, if the
      'remove_existing' option was set to 'true' then when existing contacts were
      removed due to 'max_contacts' being reached, those existing contacts being
      removed did not unregister the transport monitor.
      
      Also, it was possible to add more than one monitor on a reliable transport for
      a given aor and contact.
      
      This patch makes it so all contact removals done by the registrar also remove
      any associated transport monitors if necessary. It also makes it so duplicate
      monitors cannot be added for a given transport.
      
      ASTERISK-28213
      
      Change-Id: I94b06f9026ed177d6adfd538317c784a42c1b17a
      930a7fe9
  12. Feb 26, 2019
  13. Feb 25, 2019
  14. Feb 21, 2019
    • Joshua Colp's avatar
      res_pjsip_sdp_rtp: Allow only single ssrc attribute. · e6b67b2a
      Joshua Colp authored
      When processing SSRC attributes we were iterating through
      all of them, even though we only need to know the remote
      SSRC once. This was problematic because some browsers group
      SSRCs together on a stream, and due to our negotiation only
      end up using the first one. Since we set the second one as
      the remote SSRC we would drop the received media from them
      instead of allowing it through.
      
      In the future this may be extended to allow SSRC groups
      and to use information from the attributes.
      
      Change-Id: I4dc87087dbe56a83aa65f0f897bbd4ca75ec1270
      e6b67b2a
  15. Feb 20, 2019
    • George Joseph's avatar
      taskprocessor: Enable subsystems and overload by subsystem · c2adeb9d
      George Joseph authored
      To prevent one subsystem's taskprocessors from causing others
      to stall, new capabilities have been added to taskprocessors.
      
      * Any taskprocessor name that has a '/' will have the part
        before the '/' saved as its "subsystem".
        Examples:
        "sorcery/acl-0000006a" and "sorcery/aor-00000019"
        will be grouped to subsystem "sorcery".
        "pjsip/distributor-00000025" and "pjsip/distributor-00000026"
        will bn grouped to subsystem "pjsip".
        Taskprocessors with no '/' have an empty subsystem.
      
      * When a taskprocessor enters high-water alert status and it
        has a non-empty subsystem, the subsystem alert count will
        be incremented.
      
      * When a taskprocessor leaves high-water alert status and it
        has a non-empty subsystem, the subsystem alert count will be
        decremented.
      
      * A new api ast_taskprocessor_get_subsystem_alert() has been
        added that returns the number of taskprocessors in alert for
        the subsystem.
      
      * A new CLI command "core show taskprocessor alerted subsystems"
        has been added.
      
      * A new unit test was addded.
      
      REMINDER: The taskprocessor code itself doesn't take any action
      based on high-water alerts or overloading.  It's up to taskprocessor
      users to check and take action themselves.  Currently only the pjsip
      distributor does this.
      
      * A new pjsip/global option "taskprocessor_overload_trigger"
        has been added that allows the user to select the trigger
        mechanism the distributor uses to pause accepting new requests.
        "none": Don't pause on any overload condition.
        "global": Pause on ANY taskprocessor overload (the default and
        current behavior)
        "pjsip_only": Pause only on pjsip taskprocessor overloads.
      
      * The core pjsip pool was renamed from "SIP" to "pjsip" so it can
        be properly grouped into the "pjsip" subsystem.
      
      * stasis taskprocessor names were changed to "stasis" as the
        subsystem.
      
      * Sorcery core taskprocessor names were changed to "sorcery" to
        match the object taskprocessors.
      
      Change-Id: I8c19068bb2fc26610a9f0b8624bdf577a04fcd56
      c2adeb9d
    • Kevin Harwell's avatar
      ARI event type filtering · 8681fc9d
      Kevin Harwell authored
      Event type filtering is now enabled, and configurable per application. An app is
      now able to specify which events are sent to the application by configuring an
      allowed and/or disallowed list(s). This can be done by issuing the following:
      
      PUT /applications/{applicationName}/eventFilter
      
      And then enumerating the allowed/disallowed event types as a body parameter.
      
      ASTERISK-28106
      
      Change-Id: I9671ba1fcdb3b6c830b553d4c5365aed5d588d5b
      8681fc9d
  16. Feb 19, 2019
    • Torrey Searle's avatar
      res/res_rtp_asterisk: clear smoother when local bridging · 8ea9608e
      Torrey Searle authored
      p2p_write updates txformat but doesn't require a smoother.  If a smoother
      was created by another bridge type the smoother could fall out of date causing
      one way audio issues.  To prevent this the smoother is now destroyed on the
      start of native bridge.
      
      ASTERISK-28284 #close
      
      Change-Id: I84e67f144963787fff9b4d79ac500514fb40cdc6
      8ea9608e
  17. Feb 13, 2019
    • Sungtae Kim's avatar
      res_pjsip_session Added rtcp stats result vector into the session · 7e1d881d
      Sungtae Kim authored
      Currently, the Asterisk's pjsip_session module does not keeping the
      rtcp's stats info after it was removed. But by adding the results
      vector and keeping it until session is destroying, it can give more
      useful information for other modules.
      
      ASTERISK-28253
      
      Change-Id: Ib25c2d3fc4da084aecfde2a82c1b1d733bd64fa5
      7e1d881d
  18. Feb 07, 2019
    • Kevin Harwell's avatar
      res_pjsip_registrar: lock transport monitor when setting 'removing' flag · 61a8f79a
      Kevin Harwell authored
      A previous patch attempt to mitigate blocked threads on transport shutdown for
      a given contact. It was thought that a second lock could be avoided by checking
      the 'removing' flag on the transport monitor twice (once before and once after
      the normal named aor locking). However as with usual threading issues if the
      timing was right the original problem still occured.
      
      This patch adds locking around the first 'removing' flag check and set, thus
      nullifying the secondary check, so it was removed.
      
      ASTERISK-28213
      
      Change-Id: Iaa8e36e5311789549b76d8de42dfcea96013b2ed
      61a8f79a
    • Joshua Colp's avatar
      res_odbc: Add basic query logging. · 54a912b2
      Joshua Colp authored
      When Asterisk is connected and used with a database the response
      time of the database can cause problems in Asterisk if it is long.
      Normally the only way to see this problem would be to retrieve a
      backtrace from Asterisk and examine where things are blocked, or
      examine the database to see if there is any indication of a
      problem.
      
      This change adds some basic query logging to make it easier to
      investigate such a problem. When logging is enabled res_odbc will
      now keep track of the number of queries executed, as well as the
      query that has taken the longest time to execute. There is also
      an option which will cause a WARNING message to be output if a
      query takes longer than a configurable amount of time to execute.
      
      This makes it easier and clearer for users that their database may
      be experiencing a problem that could impact Asterisk.
      
      ASTERISK-28277
      
      Change-Id: I173cf4928b10754478a6a8c27dfa96ede0f058a6
      54a912b2
  19. Feb 04, 2019
    • Ben Ford's avatar
      res_stasis: Auto-create context and extens on Stasis app launch. · 3f9c5fba
      Ben Ford authored
      At AstriCon, there was a strong desire for the ability to completely
      bypass dialplan when using ARI. This is possible through the automatic
      creation of a context and a couple of extensions whenever an application
      is started.
      
      For example, if you have an application named 'ari-example', a context
      named 'stasis-ari-example' will be automatically created whenever this
      application is started as long as one does not already exist. Two
      extensions (a match-all extension for Stasis and a 'h' extension) are
      created within this context. Any endpoint that registers to Asterisk
      within this context will send all calls to the corresponding Stasis
      application. When the application is destroyed, the context is removed.
      
      ASTERISK-28104 #close
      
      Change-Id: Ie35bd93075e05b05e3ae129a83c9426931b7ebac
      3f9c5fba
  20. Jan 30, 2019
    • sungtae kim's avatar
      Added ARI resource /ari/asterisk/ping · ac90968a
      sungtae kim authored
      Added ARI resource.
      GET /ari/asterisk/ping : It returns "pong" message with timestamp
      and asterisk id. It would be useful for simple heath check.
      
      Change-Id: I8d24e1dcc96f60f73437c68d9463ed746f688b29
      ac90968a
  21. Jan 29, 2019
    • Kevin Harwell's avatar
      pjsip/config_global: regcontext context not created · f668db9b
      Kevin Harwell authored
      The context specified by 'regcontext' was not being created, so when Asterisk
      attempted to later dynamically add an extension it would fail. This patch now
      creates the context if a 'regcontext' is specified.
      
      ASTERISK-28238
      
      Change-Id: I0f36cf4ab0a93ff4b1cc5548d617ecfd45e09265
      f668db9b
  22. Jan 28, 2019
    • George Joseph's avatar
      media_index.c: Refactored so it doesn't cache the index · 7071e9d6
      George Joseph authored
      Testing revealed that the cache added no benefit but that it could
      consume excessive memory.
      
      Two new index related functions were created:
      ast_sounds_get_index_for_file() and ast_media_index_update_for_file()
      which restrict index updating to specific sound files.
      
      The original ast_sounds_get_index() and ast_media_index_update()
      calls are still available but since they no longer cache the results
      internally, developers should re-use an index they may already have
      instead of calling ast_sounds_get_index() repeatedly.  If information
      for only a single file is needed, ast_sounds_get_index_for_file()
      should be called instead of ast_sounds_get_index().
      
      The media_index directory scan code was elimininated in favor of
      using the existing ast_file_read_dirs() function.
      
      Since there's no more cache, ast_sounds_index_init now only
      registers the sounds cli commands instead of generating the
      initial index and subscribing to stasis format register/unregister
      messages.
      
      "sounds" is no longer a valid target for the "module reload"
      command.
      
      Both the sounds cli commands and the sounds ari resources were
      refactored to only call ast_sounds_get_index() once per invocation
      and to use ast_sounds_get_index_for_file() when a specific sound
      file is requested.
      
      Change-Id: I1cef327ba1b0648d85d218b70ce469ad07f4aa8d
      7071e9d6
  23. Jan 23, 2019
    • Jeremy Lainé's avatar
      res_http_websocket: ensure control frames do not interfere with data · 69e9fd63
      Jeremy Lainé authored
      Control frames (PING / PONG / CLOSE) can be received in the middle of a
      fragmented message. In order to ensure they do not interfere with the
      reassembly buffer, we exit early and do not return the payload to the
      caller.
      
      ASTERISK-28257 #close
      
      Change-Id: Ia5367144fe08ac6141bba3309517a48ec7f013bc
      69e9fd63
  24. Jan 22, 2019
    • Kevin Harwell's avatar
      res_pjsip_registrar: mitigate blocked threads on reliable transport shutdown · b82d2856
      Kevin Harwell authored
      When a reliable transport is shutdown it's possible for the pjsip registrar
      resource shutdown handler to get called multiple times. If this happens and one
      of the threads is taking "too long" (slow database call for instance) then the
      others get blocked waiting to delete.
      
      Since it only takes one to delete the contact then the other threads should be
      able to continue on if one of the threads is currently "deleting". This patch
      makes it so now when a thread enters the shutdown handler it checks to see if a
      thread is currently already "deleting". If so, then the thread does not attempt
      to get the lock, and instead continues on thus avoiding the blockage.
      
      ASTERISK-28213 #close
      
      Change-Id: I7563ca596312b1dff4f3ab41483e89fe2862328a
      b82d2856
    • Xiemin Chen's avatar
      bridge_softmix: Use MSID:LABEL metadata as the cloned stream's appendix · a5266768
      Xiemin Chen authored
      To avoid the stream name collide if there're more than one video track
      in one client. If client has multi video tracks, the name of ast_stream
      which represents each video track may be the same. Use the MSID:LABEL
      here because it's identifiable.
      
      ASTERISK-28196 #close
      Reported-by: xiemchen
      
      Change-Id: Ib62b2886e8d3a30e481d94616b0ceaeab68a870b
      a5266768
  25. Jan 21, 2019
    • Jeremy Lainé's avatar
      res_http_websocket: respond to CLOSE opcode · 0b8867f7
      Jeremy Lainé authored
      This ensures that Asterisk responds properly to frames received from a
      client with opcode 8 (CLOSE) by echoing back the status code in its own
      CLOSE frame.
      
      Handling of the CLOSE opcode is moved up with the rest of the opcodes so
      that unmasking gets applied. The payload is no longer returned to the
      caller, but neither ARI nor the chan_sip nor pjsip made use of the
      payload, which is a good thing since it was masked.
      
      ASTERISK-28231 #close
      
      Change-Id: Icb1b60205fc77ee970ddc91d1f545671781344cf
      0b8867f7
    • Sean Bright's avatar
      pjsip_transport_management: Shutdown transport immediately on disconnect · 20f67253
      Sean Bright authored
      The transport management code that checks for idle connections keeps a
      reference to PJSIP's transport for IDLE_TIMEOUT milliseconds (32000 by
      default). Because of this, if the transport is closed before this
      timeout, the idle checking code will keep the transport from actually
      being shutdown until the timeout expires.
      
      Rather than passing the AO2 object to the scheduler task, we just pass
      its key and look it up when it is time to potentially close the idle
      connection. The other transport management code handles cleaning up
      everything else for us.
      
      Additionally, because we use the address of the transport when
      generating its name, we concatenate an incrementing ID to the end of the
      name to guarantee uniqueness.
      
      Related to ASTERISK~28231
      
      Change-Id: I02ee9f4073b6abca9169d30c47aa69b5e8ae9afb
      20f67253
  26. Jan 17, 2019
    • Joshua C. Colp's avatar
      stasis / manager / ari: Better filter messages. · 1323730f
      Joshua C. Colp authored
      Previously both AMI and ARI used a default route on
      their stasis message router to handle some of the
      messages for publishing out their respective
      connection. This caused messages to be given to
      their subscription that could not be formatted
      into AMI or JSON.
      
      This change adds an API call to the stasis message
      router which allows a default route to be set as well
      as formatters that the default route is expecting.
      This allows both AMI and ARI to specify that their
      default route only wants messages of their given
      formatter. By doing so stasis can more intelligently
      filter at publishing time so that they do not receive
      messages which will not be turned into AMI or JSON.
      
      ASTERISK-28244
      
      Change-Id: I65272819a53ce99f869181d1d370da559a7d1703
      1323730f
  27. Jan 14, 2019
  28. Jan 11, 2019
    • Alexei Gradinari's avatar
      res_pjsip: add option to enable ContactStatus event when contact is updated · f0546d1d
      Alexei Gradinari authored
      The commit I2f97ebfa79969a36a97bb7b9afd5b6268cf1a07d removed sending out
      the ContactStatus AMI event when a contact is updated.
      Thist change broke things which rely on old behavior.
      
      This patch adds a new PJSIP global configuration option
      'send_contact_status_on_update_registration' to be able to preserve old
      ContactStatus behavior.
      By default new behavior, i.e. the ContactStatus event will not be sent when a
      device refreshes its registration.
      
      Change-Id: I706adf7584e7077eb6bde6d9799ca408bc82ce46
      f0546d1d
Loading