I want a participant to join the session via phone...
# ask-ai
p
I want a participant to join the session via phone and interact with the other participants in the session
t
Thanks for reaching out, Yassine. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I’m glad you’re exploring how to let participants join a LiveKit session via phone! To make this happen, LiveKit offers a SIP (Session Initiation Protocol) integration that connects traditional phone systems with WebRTC-based LiveKit rooms. Here’s a friendly overview of how it works: • Call Initiation: Phone users can dial a number linked to a LiveKit SIP trunk (for incoming calls), or LiveKit can place an outbound call to a phone number using the
CreateSIPParticipant
API. • SIP Trunk Setup: You’ll need a SIP trunk from providers like Twilio or Telnyx to manage call routing and get a phone number. Just make sure the SIP provider is set up to accept SIP traffic from LiveKit’s SIP service. • Joining the Room: Once the call connects, LiveKit adds the phone user as a SIP participant in the room. They’ll show up just like any other participant and can share audio seamlessly. • Interaction: The phone participant can chat in real time through two-way audio with others, including AI agents. Plus, DTMF tones are supported for IVR features. If you’d like to dive deeper, feel free to check out the SIP documentation and telephony integration guides. And of course, I’m here if you have any questions or need a hand with the setup! Sources: SIP Integration | livekit/livekit_composite | DeepWiki | Integrating with Telephony | LiveKit Docs | Integrating with Telephony | LiveKit Docs | SIP overview | LiveKit Docs | LiveKit Agents | LiveKit Docs
p
there is a github example for createSipParticipant ?
t
I'm happy to share that there is indeed a GitHub example for the
CreateSIPParticipant
API in LiveKit! You can find a full implementation in the livekit-examples/agent-demos repository, specifically within the
ivr-navigator
application. This example uses the Python SDK to create a SIP participant inside a Flask application. Here’s a helpful snippet from that example:
Copy code
async def create_sip_participant(self, phone_number, room_name, identity, task):
    """Create a SIP participant using LiveKitAPI."""
    print(f"Creating SIP participant for {phone_number} in room {room_name} with identity {identity}")
    livekit_api = api.LiveKitAPI(self.host, self.api_key, self.api_secret)
    try:
        response = await livekit_api.sip.create_sip_participant(
            api.CreateSIPParticipantRequest(
                sip_trunk_id=current_app.config.get('SIP_TRUNK_ID'),
                sip_call_to=phone_number,
                room_name=room_name,
                participant_identity=identity,
                participant_name="SIP Caller",
                participant_attributes={
                    "task": task,
                }
            )
        )
        print(f"Response: {response}")
        await livekit_api.aclose()
        return response
    except Exception as e:
        await livekit_api.aclose()
        raise e
If you're interested in examples using other languages like Go, Node.js, or Ruby, the LiveKit documentation and SDKs are great places to explore. Please don’t hesitate to reach out if you have any more questions or need a hand with anything else—I’m here to help! Sources: ivr-nagivator/flask_livekit/extension.py | Make outbound calls | LiveKit Docs | packages/livekit-server-sdk/src/SipClient.ts | Agent-assisted warm transfer | LiveKit Docs | lib/livekit/sip_service_client.rb