-
Notifications
You must be signed in to change notification settings - Fork 325
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
base: main
Are you sure you want to change the base?
Conversation
) | ||
transport.start_dialout( | ||
settings={ | ||
"phoneNumber": phone_number, |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# 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`. |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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()) |
There was a problem hiding this comment.
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}" |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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":
@vr000m @agordhandas Could you add endpoints to get the transcription and recording from the call? |
This example of dialout is based on the dialin example, but does not include the twilio usecase