SIP INVITE Fails with 403 Forbidden on LiveKit
We're encountering an issue while setting up outbound SIP in LiveKit. The response to our INVITE request returns an unexpected status: SIP Status: 403 (FORBIDDEN).
Here are the connection details we're using:
SIP Address: a2east.sipregistration.com
Username: XXXXX
Password: XXXXXXX
Number: XXXXXX
We’ve verified these credentials using Zoiper, and both inbound and outbound calls work successfully there. Could you please help us debug this issue?
same problem, with 2 sip providers:
- Mango (RU)
- Belline (RU)
heeelp, please. How can i debug this case? all logging: debug is set, but no details in docker consoles, in sip container too. Just 403 Forbidden error
@davidzhao @dennwc
Answered in Slack. We'll need PCAP to debug this.
Got this issue too
When using the LiveKit SIP server with some providers (e.g. Sipgate), outbound calls may fail with a 403 error.
The issue is that LiveKit sets the From header user part to the caller number instead of the SIP username.
Wrong header:
From: "<number>" <sip:<number>@sipconnect.sipgate.de>
Expected Header:
From: "<username>" <sip:<username>@sipconnect.sipgate.de>
To fix this:
- Use the SIP username as the number when creating the SIP outbound trunk.
- Add a
P-Preferred-Identityheader to set the caller ID (phone number).
Correct trunk configuration:
{
"trunk": {
"name": "Sipgate",
"address": "sipconnect.sipgate.de",
"transport": "SIP_TRANSPORT_UDP",
"numbers": ["USERNAME"],
"authUsername": "USERNAME",
"authPassword": "PASSWORD",
"headers": {
"P-Preferred-Identity": "<sip:[email protected]>"
}
}
}