pkg/sip/outbound.go: allow overwriting autogenerated SIP headers with ones suppiled by the user
This allows users to override generated SIP headers and enables to achieve custom compatibility with a wide range of SIP-Servers/PBX-Systems.
For us this is a blocker for using LiveKit Cloud because it does not work with our existing telephony infrastructure.
Running livekip/sip locally with this change, we are able to place calls with our proprietary PBX system by constructing the From header ourselves.
Codecov Report
:x: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 64.36%. Comparing base (0460b40) to head (fe8b102).
:warning: Report is 182 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| pkg/sip/outbound.go | 0.00% | 1 Missing and 1 partial :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #518 +/- ##
==========================================
- Coverage 65.25% 64.36% -0.89%
==========================================
Files 51 32 -19
Lines 6588 6076 -512
==========================================
- Hits 4299 3911 -388
+ Misses 1915 1771 -144
- Partials 374 394 +20
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
@dennwc Thanks for the direct reply! A patch in our fork is what we obviously have but if i get it correctly, we cannot use LiveKit cloud with a local livekip-sip component, right?
How would you imagine this "optional flag" variant to be implemented? A flag in sipOutboundConfig that enables header overwriting or a second set of (unsupported) header modifications being passed down? We'd be happy to implement it :)
In our specific case, the PBX expects the From Header Address to be <extension_number@pbx_fqdn> while livekit-sip sends <configured_phone_number@host_ip>.
So what would also work for us, were if livekit-sip would not add @host_ip if configured_phone_number already contains an @, as we can configure the phone number to be extension_number@pbx_fqdn (which currently ends up as <extension_number@pbx_fqdn@host_ip>
From our experience with hundreds of quirky implementations and thousands of quirky setups of SIP out there, we'd suggest that a general "customize everything and be unsupported, because you know what you are doing"-solution would be preferable over adding more and more options trying to reach compatibility for specific details and situations. :)
... we cannot use LiveKit cloud with a local livekip-sip component, right?
That's correct. We could enable it for inbound pretty quickly, but the outbound part will require a more significant work on our side.
How would you imagine this "optional flag" variant to be implemented?
I was assuming you want this in OSS, in which case it would be in the SIP config file. But for Cloud, we just cannot add it, since that assumes a certain level of support.
In our specific case, the PBX expects the From Header Address to be
<extension_number@pbx_fqdn>while livekit-sip sends<configured_phone_number@host_ip>.
You may have noticed that if you put configured_phone_number=extension_number and host_ip=pbx_fqdn it may just work as-is :wink:
There's nothing forcing you to use an IP instead of FQDN and nothing preventing you from putting some extension number in the number field. If that's all you need - it's possible in Cloud right now.
customize everything and be unsupported, because you know what you are doing
Sure, for OSS that's what we are trying to do. But for the Cloud, we might be a bit more opinionated than that :slightly_smiling_face:
Partially understanding your opinion on the cloud, although it will force us out of using it. Why not say "customizing SIP headers only works when using your own, external PBX + you loose support for that"? :grin:
You may have noticed that if you put
configured_phone_number=extension_numberandhost_ip=pbx_fqdnit may just work as-is 😉 There's nothing forcing you to use an IP instead of FQDN and nothing preventing you from putting some extension number in the number field. If that's all you need - it's possible in Cloud right now.
Not completely sure what you mean, maybe i'm blind at the moment...
livekip-sip always adds @host_ip (local or external address of the server/container running livekit-sip) which breaks our neck.
Otherwise we'd be fine setting phone_number to our desired extension_number@pbx_fqdn.
We're not aware how to influence the host_ip part of the From-Header. By a quick look at the code it looks like that comes from ServiceConfig.SignalingIP which we could only override by config.Config.NAT1To1IP. But since it in our case would point to a totally different host/ip that does not seem right, is it?
If it's only used for the from header but not for actual networking it could work, though...
Ah, okay, I see now. I assume you do not own that FQDN, right? Cloud does support custom domain names for SIP and will populate From based on it.
No, we do not own pbx_fqdn :pensive: It's maintained by our provider and only has an A record pointing to the on-premise PBX server IPv4 (or one of it's failovers) at any time.
Cloud does support custom domain names for SIP and will populate From based on it.
We're trying to figure out how to use a "custom domain name" in LiveKit cloud but we cannot find any options or docs for it. Can you give us a hint?
Cloud does support custom domain names for SIP and will populate From based on it.
We're trying to figure out how to use a "custom domain name" in LiveKit cloud but we cannot find any options or docs for it. Can you give us a hint?
please contact me at dz at livekit dot io. this is an enterprise feature that we've enabled for some customers