Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

an example of dialout #462

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

agordhandas
Copy link

This example of dialout is based on the dialin example, but does not include the twilio usecase

)
transport.start_dialout(
settings={
"phoneNumber": phone_number,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the latest pipecat (to be released), you can pass in a callerId, which is the id of the phone number that will be used to dial the phoneNumber.

For exmaple, if you have multiple phone numbers on Daily.co.
https://docs.daily.co/reference/rest-api/phone-numbers/purchased-phone-numbers (see the id in the 200 OK)

Copy link

@vr000m vr000m Sep 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might make sense to adapt the example to accept either
sipUri or phoneNumber (not both) depending on what was passed into the /outbound-call REST API.

raise HTTPException(
status_code=500, detail=f"Room not found: {room_url}")

# Give the agent a token to join the session
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Give the agent a token to join the session
# Give the agent a token to join the session,
# start_dialout needs a permissions of `canAdmin` of `participants`.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the default behaviour of daily_helper library is to set the is_owner=True. Which gives all capabilities to a participant in a room!

params = DailyRoomParams(
properties=DailyRoomProperties(
# Note: these are the default values, except for the display name
sip=DailyRoomSipParams(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for enable_dialout, sip is not need.
Although it does no harm in having it.

raise HTTPException(status_code=400, detail="Phone number is required")

# create callId
callId = str(uuid.uuid4())
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

callId and callDomain are not needed in the case of dialout.

It is only needed in the case of pinless dialin, because the callId and callDomain are SIP call legs that are not yet associated with a Daily Room. When the Daily room becomes ready to ingest the call, the two values are used to bridge the call

@transport.event_handler("on_dialout_answered")
async def on_dialout_answered(transport, participant):
logger.info(
f"dialout answered for callID: {callId}, callDomain: {callDomain}"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dialout does not need callId or callDomain.


@transport.event_handler("on_call_state_updated")
async def on_call_state_updated(transport, state):
logger.info(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#dialout should only be initiated when state is joined
if state == "joined":

@williamtran29
Copy link

@vr000m @agordhandas Could you add endpoints to get the transcription and recording from the call?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants