Hello LiveKit team, We are integrating with a new ...
# telephony
p
Hello LiveKit team, We are integrating with a new dialer over SIP trunk. Can anyone please help answer the below questions: 1. The 200 OK from livekit is being sourced from a different IP address than the one sending the 100 Trying and 180 Ringing messages. (See attached PCAP and SS) a. The dialer is not able to send back a ACK to the 200 OK as the IP Address changes because of strict firewall rules. b. Why is 200 OK being sent from a different IP and port though? Is that expected because of the nature of distributed system livekit operates on? c. Is the solution to whitelist the IP Addresses of LiveKit? Is there a list of CIDR IP ranges that we should ask the dialer to whitelist to receive inbound traffic from? I did not see anything in the documentation around IP address that we can share to whitelist. 2. The CreateSIPInboundTrunk API does not have a
transport
protocol option to enable TLS. So what needs to be done to enable TLS for Inbound trunk - do we just need to enable
media_encryption
as
SIP_MEDIA_ENCRYPT_ALLOW
?
@alert-easter-19258 - would appreciate your help here. Thank you
g
@proud-match-31207 LiveKit is a dynamic routing platform, as such, their front-end SIP signalling gateway is mainly a "router", which then passes the control to the relevant SIP Media Server that will process the call audio and perform the control. This is a normal practice for platforms like LiveKit, VAPI, etc. Actually, it is a common practice when you want to "offload" your signalling to the media server, after the initial SIP dialog had been created. The primary reason for the above is simple - scalability. LiveKit needs to scale up and down their instances during the day, in order to provide their services and scale up and down as required. If you want to ensure "IP Address Pinning" and multi-transport support, you can use a platform like Cloudonix (cloudonix.com) or Jambonz in order to front-end LiveKit and provide you with an SBC layer to it.
p
Thanks for responding @gorgeous-insurance-84392
after the initial SIP dialog had been created.
Yes I understand that the media server will be offloaded to a different server But I am talking about the initial SIP dialog itself where LiveKit needs to send back a 200 OK response. That itself is coming from a different server / ip address. I understand that after the initial SIP dialog, the media path is offloaded to a media server. So wanted to check why the initial SIP dialog itself happens on different servers and is that an expected behavior.
g
Well, I can accept your confusion, but it is fairly normal in SIP for the 200 OK to come from a different server, as long as the
Contact
,
Call-ID
and of course
to/from tags
are properly kept - which will ensure that the signalling doesn't break. If you require signaling to always be pinned to the same IP, due to a limitation on your PBX, than an SBC (either software or service) will be the correct solution for you.
* I really need to stop writing like a knowledge base, people start thinking I'm an AI agent *
🤣 1
p
Thanks for explaining @gorgeous-insurance-84392 - The
Contact
,
Call-ID
and other tags are correct from LiveKit. I will check back with the dialer team once. Also - possible for you to answer how we can enable TLS support for the inbound trunk? There is NO
transport
option for Inbound trunk creation. There is however
media_encryption
flag that encrypts media. The basic question is how can I enable TLS as the transport for the inbound trunk and what would be the URL of the TLS supported trunk - will the URL now become
sips:<username>@subdomain.sip.livekit.cloud
instead of the
sip
protocol
g
Well, I'm not sure about that one - as I know that LiveKit uses SIP TCP. I suspect that when they refer to
media_encryption
they may refer to passing signalling over normal TCP, while passing the SDP payload with an SAVP media type. But again, as I said, if TLS and IP Pinning is a requirement - I highly recommend to front-end your PBX with an SBC.
Question, you see to be head strong about TLS and SRTP - any chance you are trying to establish services in the UAE ?
r
The originating server defines the transport. So aslong as you setup TCP/TLS on the SIP provider LiveKit Will follow. And as you see there is additional setting for media encryption if you need it.
g
@refined-appointment-81829 So LiveKit will accept both TCP and TLS signalling over the same endpoint ?
I'm not familiar with that kind of signalling capability
r
Yes, we can handle UDP, TCP, TLS
g
But, on different ports - I mean, TCP and TLS will require different port numbers
you can do TCP over 5060 and TLS over 5061, for sure
r
@proud-match-31207 one tip is try and make sure everything else is working well before turning on TLS otherwise it will be harder to debug.
✅ 1
g
that's a given
r
I will double check but for Twilio for instance I just enable TLS and it starts working.
Also, sound like this is a good place to enhance our docs. I will pass this along to the docs team
p
one tip is try and make sure everything else is working well before turning on TLS otherwise it will be harder to debug
Yes - that is why I have put this on hold till we are able to atleast make a call. Also - Can you please help how to enable the TLS for the inbound just for me to be aware ahead of time? Is it just enabling the media encryption to
SIP_MEDIA_ENCRYPT_ALLOW
? Does the SIP Address change if we allow tls? The port is also a valid question from Nir that I was about to ask.
g
@refined-appointment-81829 speaking of which, I've been trying to "wrap my head" around your trunking APIs - I have to admit, they are very confusing.
👍 1
r
Port is 5060. To enable TLS inbound you will configure that at your SIP provider. For outbound you configure it in LiveKit.
g
@proud-match-31207 you didn't answer my question regarding the UAE, are you trying to establish services there? or maybe in India?
p
No @gorgeous-insurance-84392 - this is in the US itself. Not specific to UAE.
g
ok, just checking. I'm asking due to regulatory issues. For example, in the UAE, providers can not connect to SIP systems outside of the UAE for local services, so it's a challenge as well.
👍 1
And TLS over there is mandatory - so I was under the impression this was the issue.
r
For UAE, India, Saudi. and others where that countries compliance requires in region handling we have region based DNS you can use. See SIP cloud and region pinning
p
@refined-appointment-81829 - so if I understood it correctly. I need to enable
media_encryption
to
SIP_MEDIA_ENCRYPT_ALLOW
on the inbound trunk and then ask the dialer team to send the streams over -
sip:+18998009999@4sen7zyruwn.sip.livekit.cloud:5061;transport=tls
Can you pls help if my understanding and URI configuration is correct?
r
That looks correct to me
That will cause the starttls etc
p
Can you help confirm the port is
5061
for TLS on livekit - just being extra careful here. Sorry if this is causing multiple back and forths
r
I belive 5060
👍 1
where does 5061 come from?
g
@proud-match-31207 you previously mentioned the
sips
decorator. For a few year,
sips
became a de-facto standard for UA SIP signalling, while using the abbreviated
;transport=tls
decorator became the standard for b2b (gateway to gateway) signalling. Today, most platforms will no longer support
sips
for some reason - I'm not sure why that is.
🙌 1
p
I believe 5060
Thanks I updated my message to reflect 5060 as the port. But all traffic being received on the same port. Does TLS negotiation happen before reaching to this port then?
g
@refined-appointment-81829 You can't have both TCP signalling and TLS signalling running on the same IP port, you just can't. TLS stands for Transport Layer Security, which means that the STARTTLS request happens right at the beginning, and you can't have both non-TLS and TLS traffic running on the same port.
r
There is a TLS negotiation (starttls) handshake
g
of course there is - but I've never seen a server to implements both TLS and non-TLS on the same port
r
I will double check with our SIP team on it. But pretty sure that is how it works.
🙏 1
and more importantly I will have the docs team enhance this bit of the docs.
🙌 2
p
Yes pls check and let us know the port once. I am also a little skeptical on serving traffic for both TCP and TLS on the same port. Thank you
r
@proud-match-31207 I misled you a little bit and @gorgeous-insurance-84392 was correct.
;transport=tls
to enable TLS encryption and the port is
5061
p
No worries - Thank you for checking with the team and correcting. Will use 5061 as the port for TLS
👍 1
r
Here is an updated doc on secure trunking https://docs.livekit.io/sip/secure-trunking/
🙌 1