How can I get the full config yaml for sip-server?
# ask-ai
b
How can I get the full config yaml for sip-server?
t
Thanks for reaching out, Carlos. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm happy to help you get the full configuration YAML set up for your LiveKit SIP server! You can create a
config.yaml
file with the following structure to get started:
Copy code
# Required fields
api_key: your_livekit_api_key
api_secret: your_livekit_api_secret
ws_url: <ws://your-livekit-server-url>
redis:
  address: your_redis_address
  username: your_redis_username  # Optional
  password: your_redis_password  # Optional
  db: your_redis_db              # Optional

# Optional fields
health_port: 7980                # Port for health checks
prometheus_port: 7981            # Port for Prometheus metrics
log_level: debug                 # Log level: debug, info, warn, or error
sip_port: 5060                   # SIP signaling port (default: 5060)
sip_port_listen: 5060            # Port to listen on for SIP signaling
sip_hostname: <http://sip.example.com|sip.example.com>    # Hostname for SIP signaling
sip_ringing_interval: 1s         # Ringing interval (1s to 60s)
rtp_port: 10000-20000            # RTP media port range (default: 10000-20000)
tls:
  port: 5061                     # TLS SIP signaling port
  port_listen: 5061              # TLS port to listen on
  cert_file: /path/to/cert.pem   # Path to TLS certificate
  key_file: /path/to/key.pem     # Path to TLS key
  key_log: /path/to/keylog.log   # Optional key log file for debugging
use_external_ip: true            # Use external IP for SIP signaling
local_net: 192.168.0.0/24        # Local IP net to use
nat_1_to_1_ip: 203.0.113.1       # NAT 1:1 IP mapping
listen_ip: 192.168.1.100         # IP to listen on
media_use_external_ip: true      # Use external IP for media
media_nat_1_to_1_ip: 203.0.113.2 # NAT 1:1 IP mapping for media
media_timeout: 30s               # Media timeout duration
media_timeout_initial: 60s       # Initial media timeout duration
codecs:                          # Enable/disable codecs
  opus: true
  g722: false
  PCMU: true
  PCMA: true
hide_inbound_port: false         # Hide inbound port from scanners
add_record_route: false          # Add Record-Route headers
audio_dtmf: false                # Generate audio DTMF tones
enable_jitter_buffer: true       # Enable jitter buffer
enable_jitter_buffer_prob: 0.1   # Probability to enable jitter buffer
cluster_id: my-cluster           # Cluster ID
max_cpu_utilization: 0.9         # Maximum CPU utilization (0.0 to 1.0)
logging:
  level: debug                   # Logging level
Once you have your
config.yaml
ready, you can run the SIP server with this command:
Copy code
livekit-sip --config=config.yaml
If you prefer, you can also pass the configuration via environment variables like this:
Copy code
export SIP_CONFIG_BODY="$(cat config.yaml)"
livekit-sip
And if you're using Docker, here’s a simple way to run it:
Copy code
docker run --rm \
  -e SIP_CONFIG_BODY="$(cat config.yaml)" \
  --network host \
  livekit/sip
Please feel free to reach out if you have any questions or need further assistance setting this up. I'm here to help! Sources: pkg/sip/service.go
b
Why have
log_level: debug
and
logging.level: debug
?
t
Thanks for reaching out! Just to make sure I understand you correctly, are you asking about the difference between
log_level
and
logging.level
, or are you having trouble using both in your configuration? Let me know, so I can help you better!
b
I’m asking about the difference between
log_level
and
logging.level
t
Thanks for reaching out! Let me help clarify the difference between
log_level
and
logging.level
for you: •
logging.level
: This setting is part of the overall LiveKit server configuration (so, it’s not specific to the SIP service). You’ll find it nested under a
logging
block, and it controls the log level for the entire LiveKit server. It also supports some cool extra features like JSON formatting and sampling. •
log_level
: This one is specific to the LiveKit SIP service configuration. It’s a top-level field in the SIP server’s YAML config and manages the logging output just for the SIP service. Unlike the other, it’s not inside a
logging
block. So, to sum it up:
logging.level
is your go-to for the main LiveKit server, while
log_level
is tailored for the SIP service. They both help control how much logging detail you see, but they’re used in different parts of your setup. I hope this clears things up! If you have any more questions, feel free to ask—I’m here to help. Sources: pkg/config/config.go | README.md
b
Could you explain more in detail this configuration?
Copy code
use_external_ip: true            # Use external IP for SIP signaling
local_net: 192.168.0.0/24        # Local IP net to use
nat_1_to_1_ip: 203.0.113.1       # NAT 1:1 IP mapping
listen_ip: 192.168.1.100         # IP to listen on
media_use_external_ip: true      # Use external IP for media
media_nat_1_to_1_ip: 203.0.113.2 # NAT 1:1 IP mapping for media
t
I'd love to help you understand the configuration options you mentioned in more detail: •
use_external_ip
: When you set this to
true
, the SIP server uses STUN to find its public IP address. This IP is then shared in SIP signaling messages so external peers know how to reach the server. This is especially handy in cloud environments where the server has a private internal IP but is accessible via a public IP through NAT. •
local_net
: This lets you specify a subnet (like
192.168.0.0/24
) from which the server picks its local IP address. It helps keep the IP selection consistent when there are multiple network interfaces. •
nat_1_to_1_ip
: This option allows you to manually set a 1:1 NAT mapping. The IP you provide here will be the one announced in SIP signaling messages. Just a heads-up—it can’t be used together with
use_external_ip
. •
listen_ip
: This defines the local IP address where the SIP server listens for UDP and TCP SIP signaling. If you don’t specify it, the server listens on all available interfaces by default (
0.0.0.0
). •
media_use_external_ip
: This controls whether the external IP found via STUN is used for media traffic (RTP/RTCP). Keep in mind, it can’t be used alongside
media_nat_1_to_1_ip
. •
media_nat_1_to_1_ip
: This lets you specify a different public IP for media traffic than the one used for signaling. It’s useful if signaling and media take different network routes. If you don’t set this, media will use the same IP as signaling. Here’s a quick summary of how these interact: • The signaling IP is chosen in this order: a. STUN-discovered IP if
use_external_ip: true
. b. Manually specified
nat_1_to_1_ip
if you’ve set it. c. Otherwise, a local IP from
local_net
or any available interface. • The media IP follows a similar logic: a. Use STUN if
media_use_external_ip: true
and
use_external_ip: false
. b. Use
media_nat_1_to_1_ip
if you’ve specified it. c. If neither applies, media uses the signaling IP. Please don’t hesitate to reach out if you’d like me to clarify anything further or if you want guidance on specific deployment scenarios. I’m here to help! Sources: README.md
b
This is for livekit SIP server, right? Could I do the same for livekit server?
t
I'm glad you're looking into the LiveKit server's IP configuration options! It supports similar settings to the SIP server, though there are a few differences worth noting: •
use_external_ip
: You'll find this option in the LiveKit server under the
rtc
section. It helps advertise the server's public-facing IP address for ICE connections, much like how it works in the SIP server. •
nat_1_to_1_ip
: In LiveKit, this is handled through the
node_ip
configuration option. It tells the server which IP address to advertise to clients, serving a similar role to
nat_1_to_1_ip
in the SIP server. •
media_nat_1_to_1_ip
: LiveKit doesn’t have a direct equivalent for this one. Instead, media and signaling IP configurations are managed together through the general WebRTC settings. You can set these options either in your YAML configuration file or as command-line flags when you start the LiveKit server. If you'd like, I’m here to help you walk through setting these up or answer any questions you might have! Sources: test/integration/sip_test.go | pkg/rtcconfig/config.go | cmd/server/main.go
b
Can I set the load balancer IP on
node_ip
?
t
I'd love to help you with this! Could you please let me know if your load balancer is set up to forward traffic directly to the LiveKit server? Understanding this will make it easier for us to see if using the load balancer IP for
node_ip
is the best fit for your setup.
b
Yes, the load balancer is set up to forward traffic directly to the LiveKit server
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!
b
How can I get the full config yaml for livekit server?