50 Commits

Author SHA1 Message Date
cnderrauber
17875e94bb Verify nbf (#1345)
* return jwt.Claims when Verify token

* fix test
2025-12-22 11:19:42 +08:00
David Zhao
8b204ac683 add option to force webhooks to be made over IPv4 (#1296)
* add option to force webhooks to be made over IPv4

* include in test

* changeset
2025-11-09 15:22:14 -08:00
Raja Subramanian
aca9f5370a YAML tag webhook filters. (#1249)
* YAML tag webhook filters.

* generated protobuf

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-10-09 16:13:46 +05:30
Tyler Barrus
5552d643f8 filter webhook (#1243)
* add webhook filter to protobuf and ensure IsAllowed checked
* generated protobuf

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-10-08 15:12:15 -04:00
Raja Subramanian
fff85ca099 EventKey helper that can be provided. (#1231)
Useful to do project scoped keys in cloud.
2025-09-29 11:20:41 +05:30
Mathew Kamkar
ef2e9917fb compare webhook checksum using ConstantTimeCompare (#1187) 2025-09-03 10:13:53 -07:00
Raja Subramanian
2150d8ec31 Add webhook for aborted participant connection. (#1166)
* Add webhook for aborted participant connection.

Will be sent when the participant session is closed without participant
becoming active.

* generated protobuf

* analytics event

* generated protobuf

* Create famous-rivers-repeat.md

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: David Zhao <dz@livekit.io>
2025-08-13 10:20:55 +05:30
Raja Subramanian
a3f43340ec Use custom histogram buckets. (#1098)
Setting 4 buckets with exponential in range 1, 100 meant the boundaries
were at 1, 4.64, 21.53, 100. Because of that, the p99 looked
misleadingly large.
2025-06-07 23:01:33 -07:00
Raja Subramanian
7b3cb6db8d Log qLen when processing webhook. (#1096) 2025-06-05 18:37:05 -07:00
Raja Subramanian
2227c44329 Add prom metrics for webhook dispatch. (#1095)
* Add prom metrics for webhook dispatch.

1. success/failure/drop counter.
2. queue length histogram.
   - doing this only for resource_url_notifier which does a per room
     queue as queue length is easily available. This is the one
     currently in use.
   - worker pool based notifier will need a change in `core` package to
     return a queue length when enqueuing.

* promauto goodness
2025-06-04 13:57:15 -07:00
Raja Subramanian
d8f6ff55bb Webhook events stale after 30 seconds by default (#1092) 2025-06-03 02:55:53 -07:00
Benjamin Pracht
9c8b99db90 Allow specifying extra webhooks in egress start requests (#1040) 2025-04-09 15:50:25 -07:00
Paul Wells
9fce984fd0 allow calling promise.Resolve more than once (#1035)
* allow calling promise.Resolve more than once

* test

* Create blue-birds-add.md

* patch
2025-04-05 06:19:54 -07:00
Raja Subramanian
4035de5f7f YAML tags for config. (#1007)
Sorry folks, not having a good day. Making a 4th PR for something dead
simple. Apologies.
2025-03-11 13:42:27 +05:30
Raja Subramanian
56615aa7e6 Move WebHookConfig to use location (#1006)
* Move WebHookConfig to use location

* generate

* generated protobuf

* make URLNotifier config

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-11 12:34:00 +05:30
Raja Subramanian
d04fdeaed6 Add a default config for ReousrceURLNotifierConfig. (#1005)
* Add a default config for ReousrceURLNotifierConfig.

Forgot to add that in my previous PR :-()

* just set defaults in config directly
2025-03-11 11:28:38 +05:30
Raja Subramanian
9b34314a3d Make ResourceURLNotifier configurable. (#1004)
* Make ResourceURLNotifier configurable.

Also change default max age to 10s.

* generated protobuf

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-11 11:08:00 +05:30
Raja Subramanian
e586a23f4e Support filtering webhook events. (#1001)
* Support filtering webhook events.

* test

* set filter
2025-03-07 23:45:33 +05:30
Raja Subramanian
4102568c88 Per resource webhook queue. (#1000)
* Per resource webhook queue.

With a worker based approach, an event on a resource (like a room) not
being handled could affect other resources (other rooms or ingress or
egress).

To prevent that, do a per resource queue with two kinds of limits
- age of event: when queuing, if the event at the front of the queue
  exceeds a certain limit (default: 5 seconds), the event is dropped
- depth of queue: drop event if the number of queued events exceeds some
  level (default: 200)

To reap the per resource queue, specific end events are tracked and the
resource is added to the reap queue and reaped after a configurable
timeout (default: 5 min). This is to ensure that events happening just
after end event (for example: participant_left happening after
room_finished) are handled without re-creating a new resource.

Also, deprecating `num_dropped` from proto.

Some other bits of notes/challenges:
- Keeping the old URL notifier also. Also, the default notifier is that.
  Can change to the new one before merging this PR if this approach
  looks good.
- Using string compares of event name to detect end. Not great.
- Needs a sweeper to reap the resource queue. I think 5 min default
  timeout to reap should be okay, but maybe there are things that can
  cause re-creation of a resource queue after reaping and those could
  leak? Needs more analysis.
- Storing `context.Context` in resource queue so that it can be used
  during posting to webhook from resource queue go routine. Storing that
  is not great, but we need it for analytics key.

* generated protobuf

* missed files

* generated protobuf

* fix test in data race

* generate

* generated protobuf

* paul feedback

* fixes

* race

* more Paul feedback

* make resource notifier the default

* generated protobuf

* stop

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-07 22:39:59 +05:30
Raja Subramanian
9b6e5d703f Webhook analytics event. (#979)
* Webhook analytics event.

NOTE: Need a frostbyte73/core PR to merge and tag a release
PR pending: https://github.com/frostbyte73/core/pull/5

* sync submit

* generated protobuf

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-02-13 10:21:17 +05:30
David Zhao
f8005ea21c Use multiple workers for webhooks, while still ensuring order within a session (#784)
* Use multiple workers for webhooks, while still ensuring order within a session

* changeset
2024-08-08 13:45:44 -07:00
David Zhao
dac20160b3 Customizable retry parameters and improved logging (#776)
* Customizable retry parameters and improved logging

* consolidate into struct
2024-07-31 22:37:00 -07:00
Raja Subramanian
9e23fdbd08 Revert "Update to go/jose/v4 (#756)" (#759)
This reverts commit 73ece66d30.
2024-07-12 13:28:45 +05:30
David Zhao
73ece66d30 Update to go/jose/v4 (#756)
* Update to go/jose/v4

* changeset

* remove unused import

* use longer key for test
2024-07-10 10:12:29 -07:00
Raja Subramanian
7afb922269 Log webhook event details. (#518)
* Log webhook event details.

* generated protobuf

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-11-14 15:00:32 +05:30
David Colburn
6b455c1116 silence notifier http client (#445)
* notifier log error -> warn

* silence all
2023-08-10 12:29:58 -07:00
David Zhao
f3bba12b3e Component support for logger (#436)
* Component support for logger

With the ability to dynamically update log levels per component

* support hierarchical config

* consolidate pion logger to use components
2023-08-03 11:59:04 -07:00
David Zhao
c9e9ae555f Add license headers & NOTICE (#429)
* Add license headers & NOTICE

* generated protobuf

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-07-27 16:43:25 -07:00
David Zhao
dbea81ff07 Log adapter for retryablehttp (#389)
* Log adapter for retryablehttp

* call depth of 1
2023-05-29 10:38:45 -07:00
Raja Subramanian
c5dc103838 Add sample rate and drift to RTP stats (#378)
* Add sample rate and drift to RTP stats

* make tests a bit more robust

* generated protobuf

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-05-13 14:38:13 +05:30
David Colburn
cadccd5410 update notifier (#374)
* update notifier

* update drop test

* fix draining

* change webhookCheckInterval back
2023-05-09 17:21:13 -07:00
David Zhao
ac74d1e920 Periodically process webhooks queue, in case an event was not flushed (#372)
* Periodically process webhooks queue, in case an event was not flushed

* more resilient goroutines check

* added more logging
2023-05-05 16:35:07 -07:00
David Zhao
d2054890a6 Fix incorrectly wiping out dropped count (#351) 2023-04-16 09:33:59 -07:00
David Zhao
f54aaadb8c Revamped notifier to avoid out of order delivery (#350)
Moving to a structure where each URL occupies their own delivery goroutine.
This avoids blocking of notifications to other URLs.
2023-04-15 01:04:56 -07:00
David Zhao
2956c3424f Improve webhook resilience with retryablehttp (#345) 2023-04-12 16:28:35 -07:00
David Zhao
9a57a8c5b2 Fix support for Redis cluster mode, updated to v9 (#297)
* Fix support for Redis cluster mode, updated to v9

* update to Go 1.18
2023-02-12 21:48:01 -08:00
David Zhao
782f517a6e Use custom mime-type to avoid overeager JSON parsing. (#210)
Middlewares/server frameworks have a tendency of replacing req.body with
parsed JSON object. We do not want this behavior as our Webhook receiver
needs to validate the raw string body against the `Authorization` header
2022-09-19 21:03:55 -07:00
David Colburn
28c92d8f69 Stream status and egress updated (#196)
* stream status and egress updated

* generated protobuf

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2022-08-25 19:51:00 -07:00
David Colburn
f03f3734be Ingress updates (#143)
* ingress updates

* generated protobuf

* undo refactor

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2022-07-06 11:10:06 -07:00
David Colburn
137b876761 remove recording (#142)
* remove recording

* remove generated files

* generated protobuf

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2022-07-05 17:10:59 -07:00
David Zhao
54544c489c Helper method to receive WebhookEvent (#109) 2022-03-30 16:14:23 -07:00
David Zhao
8dff6f89d2 Webhook events for track published (#106)
* Webhook events for track published

* timeout for webhook notifications to avoid hang
2022-03-18 22:24:01 -07:00
David Colburn
ec6020d865 Egress (#92)
* egress

* generated protobuf

* remove ingress

* update egress package

* update optional enums

* generated protobuf

* updated proto

* add sent_at to start request

* generated protobuf

* default codecs

* remove extra codecs for now

* generated protobuf

* put recording back

* add connection options

* generated protobuf

* put recording back

* add sent_at and room_id

* generated protobuf

* add sent_at and room_id

* generated protobuf

* update egressInfo

* put recordingInfo back in webhooks

* egress events

* update analytics event

* egress status

* deprecate recording rpcs

* undo some changes

* key/secret -> token

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2022-02-22 00:21:29 -08:00
lukasIO
3280169f2d add content type header to webhook requests (#44) 2021-11-11 13:08:05 -08:00
David Colburn
4dede7984e Add recording_started webhook, add ctx to notifier (#39)
* add recording_started webhook, add ctx to notifier

* update test
2021-11-08 18:00:12 -06:00
David Zhao
bae8dd8bc5 use ioutil for Go 1.15 compat 2021-10-25 12:59:55 -07:00
David Colburn
e3e7ce0232 notifier interface, message bus queue (#25)
* notifier interface, message bus queue

* remove ctx

* change name
2021-09-22 15:32:51 -05:00
David Colburn
b60237c535 recording webhooks (#24)
* recording webhooks

* use token instead of api key+secret

* remove token
2021-09-21 17:18:30 -05:00
David Zhao
8d0a9538d3 refactor, removed recording-related webhooks 2021-08-08 22:53:23 -07:00
David Zhao
992c4b2da9 webhook support 2021-08-08 22:17:46 -07:00