다음 파이썬코드에서 "max_call_duration" 이 왜 작동을 안하는거야? fro...
# ask-ai
l
다음 파이썬코드에서 "max_call_duration" 이 왜 작동을 안하는거야? from google.protobuf.duration_pb2 import Duration ... await ctx.api.sip.create_sip_participant( api.CreateSIPParticipantRequest( room_name=ctx.room.name, sip_trunk_id=config.trunk_id, sip_call_to=config.phone_number, participant_identity=config.participant_identity, participant_name=config.participant_name, # function blocks until user answers the call, or if the call fails wait_until_answered=True, krisp_enabled=True, ringing_timeout=timedelta(seconds=60), max_call_duration=Duration(seconds=30), ) )
👀 1
👋 1
t
Thanks for reaching out, Dan(송희웅). I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
It sounds like you're having some trouble with the
max_call_duration
not working as expected in your Python code. Let’s walk through a few steps together to help get this sorted out: 1. First, make sure you’re creating the
Duration
object correctly using the
google.protobuf.duration_pb2
module. Here’s a quick example:
Copy code
from google.protobuf import duration_pb2 as duration

max_duration = duration.Duration()
max_duration.FromSeconds(30)  # Set to 30 seconds
1. Next, use this
Duration
object in your
CreateSIPParticipantRequest
like this:
Copy code
await ctx.api.sip.create_sip_participant(
    api.CreateSIPParticipantRequest(
        ...
        max_call_duration=max_duration,
    )
)
1. It’s also important to apply
max_call_duration
in the right place. For outbound calls, it belongs in the
CreateSIPParticipantRequest
, while for inbound calls, you’ll want to configure it in the trunk settings. 2. Lastly, double-check your settings using the appropriate API methods to confirm everything is applied correctly. If you’ve tried all these steps and it’s still not working, the issue might be related to server-side configurations or your SIP provider’s settings. Don’t hesitate to reach out if you want to explore those possibilities together—I’m here to help! Sources: SIP APIs | LiveKit Docs | rpc/io.pb.go | livekit-protocol/livekit/protocol/sip.py
l
그럼 30초가 지나면 통화가 종료되어야 하는게 맞아?
t
The
max_call_duration
field is meant to set the maximum length for a call. I understand it can be a bit unclear since the documentation doesn’t explicitly say if LiveKit will automatically end the call once that time is up. A good way to find out is by trying it yourself—set a short duration, like 30 seconds, and see if the call ends on its own. If it doesn’t, no worries! It might just mean you’ll need to handle this on the server side or with some manual steps. I’m here to help if you want to explore those options together. Sources: rpc/io.pb.go | SIP APIs | LiveKit Docs
l
그런데 30초가 지나도 왜 통화종료가 안되지?
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!