Duplicated webhook received I am receiving the sam...
# telephony
f
Duplicated webhook received I am receiving the same webhook event
participant_joined
when receiving inbound call twice with the same payload. How is it possible ? 1. INFO 2025-08-05T104146.752714Z [httpRequest.requestMethod: POST] [httpRequest.status: 200] [httpRequest.responseSize: 256 B] [httpRequest.latency: 2.395 s] [httpRequest.userAgent: Go-http-client 2.0] https://.../api/webhooks/livekit 2. INFO 2025-08-05T104149.093482Z [httpRequest.requestMethod: POST] [httpRequest.status: 200] [httpRequest.responseSize: 256 B] [httpRequest.latency: 1.728 s] [httpRequest.userAgent: Go-http-client 2.0] https://.../api/webhooks/livekit
only 1 webhook is configured in livekit
this is happening in 1 livekit project but not in the other
a
Webhook logs dashboard is absolute necessity for Livekit Cloud
r
Can I get a call ID that you saw twice. It will start with
SCL_
But in generally if the webhook generator does not see a 200OK it will send it again.
f
Copy code
SCL_pVkDQixUrQSz
yep @refined-appointment-81829 , but as you see in my logs both times it was 200OK, and 2nd webhook arrived after first 200OK https://livekit-users.slack.com/archives/C07FRP66XGE/p1754414773098019?thread_ts=1754391506.861679&cid=C07FRP66XGE
another example
SCL_VMZGtpnhLEjc
this is happening almost every call for us now
r
I took a look at that call ID but did not see duplicate events. I do see similar events like: participant_left • EV_3nwvGo8TaNQu
agent-AJ_UXrkPeborBBa
• EV_7NnRwBzqMkTU
agent-AJ_rBYvynW3Yt6c
Those were for two different agents. Similar for track publish. You have an
EV_
ID that you received more than once?
f
2 webhooks came with teh same payload from livekit
https://livekit-users.slack.com/archives/C07FRP66XGE/p1754391506861679
Copy code
Processing LiveKit event: participant_joined for room: inbound-_2055578687_itreQHcPcLUD {"event":"participant_joined","room":{"sid":"RM_4MMo6muoSHRQ","name":"inbound-_2055578687_itreQHcPcLUD","emptyTimeout":300,"departureTimeout":20,"creationTime":"1754390505","creationTimeMs":"1754390505394","enabledCodecs":[{"mime":"video/H264"},{"mime":"video/VP8"},{"mime":"video/VP9"},{"mime":"video/AV1"},{"mime":"audio/red"},{"mime":"audio/opus"}],"version":{"unixMicro":"1754390505442144"}},"participant":{"sid":"PA_4fAK5vNERPjF","identity":"sip_2055578687","state":"ACTIVE","joinedAt":"1754390505","joinedAtMs":"1754390505442","name":"Phone ....","version":3,"permission":{"canSubscribe":true,"canPublish":true,"canPublishData":true,"canUpdateMetadata":true},"region":"ochicago1b","kind":"SIP","attributes":{"sip.callID":"SCL_pVkDQixUrQSz","sip.callIDFull":"e74247c2-9395-4877-b5ff-b4adb48f5295","sip.callStatus":"ringing","sip.callTag":"yv01rXHD037mS","sip.hostname":"sip.telnyx.com","sip.phoneNumber":"...","sip.ruleID":"SDR_mapTCsHENFru","sip.trunkID":"ST_LHisQgviWbRC","sip.trunkPhoneNumber":"...."}},"id":"EV_qoDbY6S6sPPo","createdAt":"1754390505"}
this is only reproducable in 1 project (prod) , stage works perfectly.
if you don't see 2 participant_joined calls to us - that's the problem
because we are receiving it
our infra is cloudflare -> cloud run domain -> cloud run
r
So you got
EV_qoDbY6S6sPPo
twice?
f
yes
r
One good practice is to duplicate reduce webhook events by event id. But I will look to see why that might have been sent twice.
f
it's happening every time and only in this project
we have noticed another difference between 2 projects: sip phone from comes without
+
in this project, whereas it comes with
+
in our staging project
idk , may be this gives you some hint
we are now implementing deduplication of event webhook via distributed locks , but this really never happened in stage and we expected exactly once in webhooks
r
I don't think it is related to the
+
. That is probably just how you have the trunk setup in the different projects. I will try and get some answer for why this is happening.
šŸ‘ 1
I spoke to the team on this. 3 seconds is the retransmit if we did not get a 200OK. I know your log reports 200OK but is it possible that is logged before it actually transmitted and does not actually get sent?
What does this mean in your log?
Copy code
httpRequest.latency: 2.395 s
f
this means our server responded in 2.395 sec
3 seconds is the retransmit if we did not get a 200OK.
understood
r
Generally speaking with webhooks (not just LiveKit) you don't want to block. You should just queue it and return 200OK that shows you take responsibility for it. Then have another processor. 2 seconds to process a webhook seems like a really long time.
šŸ™Œ 1
f
yes it helped