Невозможно вызвать Response.Say во время прямой трансляции вызова twilio websocket python ⇐ Python
Невозможно вызвать Response.Say во время прямой трансляции вызова twilio websocket python
In the if AcceptWaveform where print statement is taking place I want to call a sample message at bottom which will be spoken during the call.
But there is no message call.
But during start of calling, the message of Response Say works
def stream(ws): rec = KaldiRecognizer(model, 16000) response = VoiceResponse() while True: message = ws.receive() packet = json.loads(message) if packet['event'] == 'start': print('Streaming is starting') elif packet['event'] == 'stop': print('\nStreaming has stopped') elif packet['event'] == 'media': audio = base64.b64decode(packet['media']['payload']) audio = audioop.ulaw2lin(audio, 2) audio = audioop.ratecv(audio, 2, 1, 8000, 16000, None)[0] if rec.AcceptWaveform(audio): r = json.loads(rec.Result()) print(CL + r['text'] + '\n', end='', flush=True) response.say('Sample response message') else: r = json.loads(rec.PartialResult()) print(CL + r['partial'] + BS * len(r['partial']), end='', flush=True)``` Expectation was that the caller should hear sample response message during call
Источник: https://stackoverflow.com/questions/780 ... socket-pyt
In the if AcceptWaveform where print statement is taking place I want to call a sample message at bottom which will be spoken during the call.
But there is no message call.
But during start of calling, the message of Response Say works
def stream(ws): rec = KaldiRecognizer(model, 16000) response = VoiceResponse() while True: message = ws.receive() packet = json.loads(message) if packet['event'] == 'start': print('Streaming is starting') elif packet['event'] == 'stop': print('\nStreaming has stopped') elif packet['event'] == 'media': audio = base64.b64decode(packet['media']['payload']) audio = audioop.ulaw2lin(audio, 2) audio = audioop.ratecv(audio, 2, 1, 8000, 16000, None)[0] if rec.AcceptWaveform(audio): r = json.loads(rec.Result()) print(CL + r['text'] + '\n', end='', flush=True) response.say('Sample response message') else: r = json.loads(rec.PartialResult()) print(CL + r['partial'] + BS * len(r['partial']), end='', flush=True)``` Expectation was that the caller should hear sample response message during call
Источник: https://stackoverflow.com/questions/780 ... socket-pyt
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Как создать локальный сервер прямой трансляции аудио с помощью ffmpeg и python?
Anonymous » » в форуме Python - 0 Ответы
- 22 Просмотры
-
Последнее сообщение Anonymous
-