How to set a max call duration for an inbound call
# ask-ai
g
How to set a max call duration for an inbound call
t
Thanks for reaching out, Aumesh. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You're asking how to set a maximum call duration for an inbound call — you can do this on an inbound trunk by configuring its
max_call_duration
. Two ways to set it: • Dashboard a. Telephony → Configuration. b. Click +Create new → Trunk and choose Inbound. c. Fill trunk details (name, phone numbers). d. Under Optional settings, set Maximum call duration. e. Click Create. • API (Python example)
Copy code
from livekit import api
from google.protobuf.duration_pb2 import Duration

async def create_inbound_trunk():
    livekit_api = api.LiveKitAPI()

    max_duration = Duration()
    max_duration.FromSeconds(3600)  # e.g., 1 hour

    trunk = api.SIPInboundTrunkInfo(
        name="My Inbound Trunk",
        numbers=["+15105550100"],
        max_call_duration=max_duration,
    )

    request = api.CreateSIPInboundTrunkRequest(trunk=trunk)
    await livekit_api.sip.create_sip_inbound_trunk(request)
    await livekit_api.aclose()
Would you like an example in another language or help updating an existing trunk? Sources: SIP APIs | LiveKit docs | SIP inbound trunk | LiveKit docs