-
Notifications
You must be signed in to change notification settings - Fork 67
Open
Description
Hi,
I'm looking for an example to:
- Create a call
- Stream audio
From the docs, it seems plivo takes in an answer_url to create a call and for creating a stream I need call_uuid. But since I'm already creating a call, I'm not getting any call_uuid. Below is what I've tried as of now:
async def make_call():
plivo_client = plivo.RestClient('auth_id', 'auth_token')
response = plivo_client.calls.create(
from_='from_number',
to_='to_number',
answer_url=f"{app_callback_url}/plivo_callback?ws_url={websocket_url}",
answer_method='POST')
@app.post('/plivo_callback')
async plivo_callback(request: Request, ws_url: str, CallUUID: str):
websocket_plivo_route = f'{ws_url}/ws/'
response = plivo_client.calls.start_stream(call_uuid=CallUUID,
service_url=websocket_plivo_route, bidirectional=True)
I have a server running and listening to /ws/ websocket endpoint.
The initial call get created with the response:
{'api_id': '34e56af1-739d-4b54-9861-613a2db7546d',
'message': 'call queued',
'request_uuid': '1b08512d-3fff-4b4d-ada2-c956cdaa70b1'}
And I get Exception occurred in plivo_callback: Stream consumed as the exception and the call gets disconnected shortly.
Metadata
Metadata
Assignees
Labels
No labels