Azure-Samples / Azure-Samples/communication-services-python-quickstarts

"callautomation-azure-openai-voice" RuntimeWarning: coroutine 'CallMediaOperations.start_media_streaming' was never awaited self._call_media_client.start_media_streaming(

Đang mở
#59 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
44
Fork
53
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

> Please provide us with the following information:
> ---------------------------------------------------------------

### This issue is for a: (mark with an `x`)
```
- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [x] regression (a behavior that used to work and stopped in a new release)
```

### Minimal steps to reproduce
>call_connection_client = acs_client.get_call_connection(call_connection_id)
await call_connection_client.start_media_streaming(
operation_callback_url=callback_uri,
operation_context="startMediaStreamingContext"
)

### Any log messages given by the failure
>

### Expected/desired behavior
> I have played an audio source to the user once the call has been connected I started the media streaming so that I can send the audio to AI for assistance . but it is not happeing. this is my main code
<<<@app.route("/api/incomingCall", methods=['POST'])
async def incoming_call_handler():
app.logger.info("incoming event data")
for event_dict in await request.json:
global callback_uri,caller_id_latest
event = EventGridEvent.from_dict(event_dict)
app.logger.info("incoming event data --> %s", event.data)
if event.event_type == SystemEventNames.EventGridSubscriptionValidationEventName:
app.logger.info("Validating subscription")
validation_code = event.data['validationCode']
validation_response = {'validationResponse': validation_code}
return Response(response=json.dumps(validation_response), status=200)
elif event.event_type =="Microsoft.Communication.IncomingCall":
app.logger.info("Incoming call received: data=%s",
event.data)
if event.data['from']['kind'] =="phoneNumber":
caller_id = event.data['from']["phoneNumber"]["value"]
else :
caller_id = event.data['from']['rawId']
caller_id_latest = str(caller_id)
app.logger.info("incoming call handler caller id: %s",
caller_id)
incoming_call_context=event.data['incomingCallContext']
guid =uuid.uuid4()
query_parameters = urlencode({"callerId": caller_id})
callback_uri = f"{CALLBACK_EVENTS_URI}/{guid}?{query_parameters}"

parsed_url = urlparse(CALLBACK_EVENTS_URI)
websocket_url = urlunparse(('wss',parsed_url.netloc,'/ws','', '', ''))

app.logger.info("callback url: %s", callback_uri)
app.logger.info("websocket url: %s", websocket_url)

media_streaming_options = MediaStreamingOptions(
transport_url=websocket_url,
transport_type=MediaStreamingTransportType.WEBSOCKET,
content_type=MediaStreamingContentType.AUDIO,
audio_channel_type=MediaStreamingAudioChannelType.MIXED,
start_media_streaming=False,
enable_bidirectional=True,
audio_format=AudioFormat.PCM24_K_MONO)

answer_call_result = await acs_client.answer_call(incoming_call_context=incoming_call_context,
operation_context="incomingCall",
callback_url=callback_uri, media_streaming=media_streaming_options,cognitive_services_endpoint=cognitiveservices_endpoint_playmsg)
app.logger.info("Answered call for connection id: %s",
answer_call_result.call_connection_id)
return Response(status=200)

@app.route('/api/callbacks/', methods=['POST'])
async def callbacks(contextId):
for event in await request.json:
# Parsing callback events
global call_connection_id,transfer_call_agent,callback_uri
event_data = event['data']
call_connection_id = event_data["callConnectionId"]
app.logger.info(f"Received Event:-> {event['type']}, Correlation Id:-> {event_data['correlationId']}, CallConnectionId:-> {call_connection_id}")
if event['type'] == "Microsoft.Communication.CallConnected":
await handle_play(
call_connection_id=call_connection_id,
text_to_play="Hello how can i help you today?",
context="GetFreeFormText"
)
elif event['type'] == "Microsoft.Communication.PlayCompleted":
call_automation_client.get_call_connection(call_connection_id=event.data['callConnectionId'])
# # await call_connection_client.transfer_call_to_participant(target_participant=transfer_destination)
# # app.logger.info(f"Transfer call initiated: {context}")
call_connection_properties = await acs_client.get_call_connection(call_connection_id).get_call_properties()
call_connection_client = acs_client.get_call_connection(call_connection_id)
await call_connection_client.start_media_streaming(
operation_callback_url=callback_uri,
operation_context="startMediaStreamingContext"
) >>>

### OS and Version?
> Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)
windows 10 using the devtunnels

### Versions
>I am using "azure-communication-callautomation==1.4.0b1" version
### Mention any other details that might be useful
> ---------------------------------------------------------------
> Thanks! We'll be in touch soon.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.