early-afternoon-97327
09/02/2025, 1:25 PMsip:user@host format
transfer_to=f"tel:{transfer_to}",
)
)
can add dtmf code in livekit.tall-airline-16756
09/02/2025, 1:25 PMtall-airline-16756
09/02/2025, 1:26 PMTransferSIPParticipant API. But no worries! You can send DTMF tones right after the transfer starts by using the publishDtmf method from a participant in the room.
Here’s a quick example of how to send those DTMF tones after the transfer:
await local_participant.publish_dtmf(code=1, digit='5') # Press '5' for IVR
await asyncio.sleep(1)
await local_participant.publish_dtmf(code=11, digit='#') # End input with '#'
If you want a hand setting this up or have any questions, just give me a shout!
Sources: lib/livekit/sip_service_client.rb | Company directory phone assistant | LiveKit Docs | rpc/sip.pb.go | livekit-protocol/src/livekit.rs | Handling DTMF | LiveKit Docsearly-afternoon-97327
09/02/2025, 2:24 PMtall-airline-16756
09/02/2025, 2:25 PMearly-afternoon-97327
09/02/2025, 2:25 PMtall-airline-16756
09/02/2025, 2:26 PMsip_dtmf_received event. Then, match the digits you get to the transfer destination you want.
2. Initiate Cold Transfer: Go ahead and use the TransferSIPParticipant API to move the SIP participant over to the new spot. This will wrap up the current session since it’s a cold transfer.
3. Provide Feedback: If you like, you can let the caller know what’s happening by using speech synthesis before you kick off the transfer.
4. Configure SIP Trunk: Make sure your SIP trunk is ready to handle transfers. For instance, with Twilio, you’d want to turn on transfer mode and set up caller ID properly.
If you’d like some detailed code examples or need a hand with this, just give me a shout—I’m here to help!
Sources: Transferring calls | LiveKit Docs | livekit-agents/livekit/agents/job.py | Handling DTMF | LiveKit Docs | ivr-nagivator/agent.py | Company directory phone assistant | LiveKit Docsearly-afternoon-97327
09/02/2025, 2:28 PMtall-airline-16756
09/02/2025, 2:29 PMpublish_dtmf method to send the DTMF tones you need. For example:
await room.local_participant.publish_dtmf(code=1, digit='1')
await room.local_participant.publish_dtmf(code=2, digit='2')
await room.local_participant.publish_dtmf(code=3, digit='3')
await room.local_participant.publish_dtmf(code=11, digit='#')
1. Timing: It’s a good idea to add a short delay (1-2 seconds) after sending the DTMF signals. This helps make sure they’re properly processed before you start the transfer.
2. Initiate Cold Transfer: Once the DTMF tones are sent, use the TransferSIPParticipant API to perform the transfer like this:
transfer_request = TransferSIPParticipantRequest(
participant_identity=participant_identity,
room_name=room_name,
transfer_to=transfer_number,
play_dialtone=True
)
await livekit_api.sip.transfer_sip_participant(transfer_request)
This way, the DTMF tones reach the participant before the session closes. If you have any questions or need a hand with anything else, just let me know—I’m here to help!
Sources: complex-agents/ivr-agent/agent.py | Company directory phone assistant | LiveKit Docs | livekit-android-sdk/src/main/java/io/livekit/android/room/participant/Local... | src/room/participant/LocalParticipant.ts | packages/livekit-rtc/src/proto/room_pb.tsearly-afternoon-97327
09/02/2025, 2:31 PMtall-airline-16756
09/02/2025, 2:32 PMwwwwwwww200#, in LiveKit, you can use the publish_dtmf method and add some delays between each tone to create those pauses. Each 'w' stands for a pause, which you can easily handle with a delay (for example, using asyncio.sleep() in Python).
Here’s a simple example to get you started:
# Sending '200#' with pauses represented by 'w'
import asyncio
# Simulate 'wwwwwwww' (8 pauses)
for _ in range(8):
await asyncio.sleep(0.5) # Feel free to tweak the pause length to what works best for you
# Now send '200#'
await room.local_participant.publish_dtmf(code=2, digit='2')
await asyncio.sleep(0.5)
await room.local_participant.publish_dtmf(code=0, digit='0')
await asyncio.sleep(0.5)
await room.local_participant.publish_dtmf(code=0, digit='0')
await asyncio.sleep(0.5)
await room.local_participant.publish_dtmf(code=11, digit='#')
Feel free to adjust the pause durations and timing between tones to fit your needs. If you have any questions or want me to walk you through it, just let me know—I’m here to help!