Passing media event from Twilio to Realtime
Closed this issue · 1 comments
themarcosf commented
I am using the reference API of Open AI with Twilio to make calls.
When I receive a media event from Twilio, do I need to change it somehow? I set the client input and output audio to G711-mulaw, but I received this error:
{
"object": "realtime.response",
"id": "resp_AIOz3Mq0Hs5NEU1a2TQBq",
"status": "failed",
"status_details": {
"type": "failed",
"error": {
"type": "server_error",
"code": null,
"message": "The server had an error while processing your request. Sorry about that! You can retry your request, or contact us through our help center at help.openai.com if the error persists. (Please include the session ID sess_AIOz3No52kTmjvuGUh6AM in your message.)"
}
},
"output": [],
"usage": {
"total_tokens": 0,
"input_tokens": 0,
"output_tokens": 0,
"input_token_details": {
"cached_tokens": 0,
"text_tokens": 0,
"audio_tokens": 0
},
"output_token_details": {
"text_tokens": 0,
"audio_tokens": 0
}
}
}This is my client:
{
type: 'session.updated',
event_id: 'event_AIOz30cXkggAi7KqFDbaX',
session: {
id: 'sess_AIOz3No52kTmjvuGUh6AM',
object: 'realtime.session',
model: 'gpt-4o-realtime-preview-2024-10-01',
expires_at: 1728950205,
modalities: [ 'text', 'audio' ],
instructions: 'O seu conhecimento é até 2023-10. Você é um assistente útil, espirituoso e amigável. Aja como um humano, mas lembre-se de que você não é um humano e que não pode fazer coisas humanas no mundo real. Sua voz e personalidade devem ser calorosas e envolventes. Você deve falar em português do Brasil e não usar sotaques ou dialetos regionais, apenas a linguagem padrão. Fale rapidamente.',
voice: 'alloy',
turn_detection: {
type: 'server_vad',
threshold: 0.4,
prefix_padding_ms: 300,
silence_duration_ms: 600
},
input_audio_format: 'g711_ulaw',
output_audio_format: 'g711_ulaw',
input_audio_transcription: { model: 'whisper-1' },
tool_choice: 'auto',
temperature: 0.8,
max_response_output_tokens: 'inf',
tools: []
}
}themarcosf commented
this video helped: https://www.youtube.com/watch?v=csoe8Gc4_RQ