when I send a dtmf code with livekit, I do not hea...
# ask-ai
s
when I send a dtmf code with livekit, I do not hear the sound of the numbers.
t
Thanks for reaching out, Rida. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I’m glad you reached out! To hear the sound of DTMF numbers when sending codes in LiveKit, you'll want to enable the
audio_dtmf
setting in your SIP configuration. This helps generate those in-band audio tones along with the digital DTMF signals, making sure everything sounds just right. Here’s a simple way to get that set up: 1. Update your LiveKit SIP configuration file by adding this line:
audio_dtmf: true
. 2. Make sure you’re using the
publishDtmf
API on the
localParticipant
to send your DTMF codes. For example:
Copy code
await localParticipant.publishDtmf(1, '1');
await localParticipant.publishDtmf(2, '2');
await localParticipant.publishDtmf(11, '#');
Also, double-check that your audio output stream is active and set up correctly. If you still don’t hear the tones, it might help to verify that the SIP configuration file has been reloaded properly. I’m here if you need any more guidance! Sources: pkg/sip/media_port.go | Handling DTMF | LiveKit docs | dtmf/dtmf.go
s
you said: you'll want to enable the
audio_dtmf
setting in your SIP configuration. I do not have a SIP configuration. I am using livekit cloud. how can i enable there in livekit cloud?
t
Thanks for reaching out! In LiveKit Cloud, the
audio_dtmf
setting isn’t something you can adjust directly through the dashboard or SDKs—it’s usually handled on the backend side. If you’re looking to enable DTMF tones, I’d recommend taking a look at the SIP settings in your LiveKit Cloud dashboard to see if there are any options labeled "Audio DTMF" or "In-band DTMF." If those options aren’t visible, don’t worry! You can simply get in touch with LiveKit support, and they’ll be happy to help enable
audio_dtmf
for your project. Please feel free to reach out if you have any more questions or need a hand with anything else—I’m here to help! Sources: pkg/sip/media_port.go | packages/livekit-server-sdk/src/SipClient.ts | Handling DTMF | LiveKit docs
s
So I have my own livekit workers that connect to livekit cloud,. How can I enable that audio_dtmf in the worker?
t
To get
audio_dtmf
up and running in your LiveKit worker, you’ll want to update the worker's SIP configuration file. Just add or update this line in the configuration:
Copy code
audio_dtmf: true
After that, a quick restart of your LiveKit worker will do the trick to apply the changes. This will enable audio DTMF tones along with the digital signals for all calls managed by the worker. If you have any questions or need a hand with this, please don’t hesitate to reach out—I’m here to help! Sources: test/lktest/livekit.go
s
can you provide a full example regarding how to setup the worker's SIP configuration file, what should i put in it and how to make sure the worker is using it
t
Here’s a full example to help you set up a LiveKit SIP worker configuration file and make sure the worker uses it correctly: Step 1: Create the SIP Configuration File Start by creating a YAML file (for example,
config.yaml
) with the following content:
Copy code
# Required fields
api_key: your-livekit-api-key
api_secret: your-livekit-api-secret
ws_url: ws://your-livekit-server-url:7880
redis:
  address: your-redis-address:6379
  username: your-redis-username
  password: your-redis-password
  db: 0

# Optional fields
log_level: debug
sip_port: 5060
rtp_port: 10000-20000
health_port: 7980
prometheus_port: 7981
use_external_ip: true
Just be sure to replace the placeholders with your actual LiveKit and Redis details. Step 2: Use the Configuration with the SIP Service Next, start the SIP service using one of these options: • Option A: Using a Config File Simply run the service with the
--config
flag:
livekit-sip --config=config.yaml
• Option B: Using Environment Variable Or embed the config directly into the
SIP_CONFIG_BODY
environment variable:
docker run --rm -e SIP_CONFIG_BODY="$(cat config.yaml)" --network host livekit/sip
Step 3: Ensure the Worker Uses the Configuration The worker will automatically pick up the configuration when started with either method. It will connect to LiveKit, authenticate, and bind to the ports you specified. Step 4: Configure SIP Trunk and Dispatch Rule Once the worker is up and running, you can create SIP trunks and dispatch rules using the CLI or SDK. For example:
Copy code
livekit-cli create-sip-trunk --request ./trunk.json
livekit-cli create-sip-dispatch-rule --request ./dispatch_rule.json
If you have any questions or need a hand with any of these steps, please don’t hesitate to reach out. I’m here to help! Sources: README.md | Self-hosted SIP server | LiveKit docs