Answer SIP call
Closed this issue · 2 comments
Kedaqusa1604 commented
Hi there, I'd like to know how can I answer a SIP call using the sdk...
what I'd like to do is attach a "controller" to a room created by a SIP call, and listen to room events and then do some stuff, but I'm facing the problem that the call isn't answered.
this is some code, which I hope provides more context:
### main.py
from livekit.agents import AutoSubscribe, JobContext, WorkerOptions, cli
async def entrypoint(ctx: JobContext):
# Connect to the LiveKit room
# indicating that the agent will only subscribe to audio tracks
await ctx.connect(auto_subscribe=AutoSubscribe.AUDIO_ONLY)
agent = TestAgent()
await asyncio.sleep(1)
agent.start(ctx.room)
if __name__ == "__main__":
cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint))
### TestAgent.py
class TestAgent:
def start(self, room: rtc.Room):
print("Room: ", room)
@room.on("participant_connected")
def on_participant_connected(participant: RemoteParticipant):
self._on_participant_connected(participant)
@room.on("sip_dtmf_received")
def on_sip_dtmf(dtmf: rtc.SipDTMF):
self._on_sip_dtmf(dtmf)
Thanks in advance for any help.
davidzhao commented
what do you mean by answer a SIP call using the sdk
? for inbound calls, the agent gets dispatched automatically into the caller's room.
Kedaqusa1604 commented