Skip to content
Examples Gallery/LiveKit Outbound Dispatcher

Outbound Campaign Dispatch Framework

Explore the Implementation

Clone RepositoryView on GitHub
Bash
git clone https://github.com/vobiz-ai/LiveKit-Vobiz-Outbound.git
cd LiveKit-Vobiz-Outbound

Opposite to inbound conversational loops, this module exposes the boilerplate architecture determining autonomous deployment strategies — dynamically commanding remote PSTN dialing bursts by leveraging LiveKit's api.CreateSIPParticipantRequest and efficiently funneling those synthetic trunk connections directly into a natively waiting AI worker.


How It Works

Programmatically commanding the analog phone array requires asynchronous delegation. The daemon does not wait for a user phone ring, but aggressively initiates an authorized SIP command across the Vobiz trunk boundary deterministically.

  • API Request Invocations: Utilizing the isolated make_call.py Python runner, standard REST logic initiates a structured api.CreateSIPParticipantRequest sequence directed securely towards the LiveKit upstream servers.
  • Outbound Trunk Addressing: Inside the parameter body request block, the module strictly defines the localized Vobiz sip_trunk_id (e.g. ST_xxxxxxxxxxx) pointer natively coupled with the exact E.164 mapped downstream recipient telephone string variable.
  • Analog Command Routing: LiveKit inherently ingests this mapping configuration string and broadcasts SIP signaling protocol packets natively targeting the active Vobiz boundary trunk environment, securely forcing the Vobiz infrastructure to dial out actively over global legacy PSTN networks.
  • Live Session Mounting: When the human accepts the call, LiveKit connects that active bridge mapping directly backward into your active Python worker (the agent.py daemon), immediately firing the on_enter() lifecycle hook gracefully to deliver the introductory speech string autonomously.

Implementation Code

Instantiating explicit outbound dial loops dictates leveraging explicit authenticated REST REST endpoints natively mapped directly outwards across bounded Vobiz boundaries deterministically:

Python
from livekit import api
import sys

async def dispatch_outbound_call(target_phone_number: str):
    """Hits the LiveKit REST API to instantiate an immediate outbound trunk action."""
    livekit_api = api.LiveKitAPI()
    
    trunk_sip_id = "ST_xxxxxxxxxxx"  # Matched precisely to your Vobiz Outbound SIP bindings
    room_name = f"outbound_session_{target_phone_number}"
    
    # LiveKit broadcasts signalling protocols straight towards Vobiz automatically
    await livekit_api.sip.create_sip_participant(
        api.CreateSIPParticipantRequest(
            sip_trunk_id=trunk_sip_id,
            sip_call_to=target_phone_number,
            room_name=room_name,
            participant_identity=f"sip_{target_phone_number}"
        )
    )