File tree Expand file tree Collapse file tree
wavefront/server/apps/call_processing/call_processing/services Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -523,10 +523,15 @@ async def run_conversation(
523523 # Register event handlers
524524 @llm .event_handler ('on_function_calls_started' )
525525 async def on_function_calls_started (service , function_calls ):
526+ # Skip filler phrase when language is switching — the TTS service's language
527+ # may change before the queued frame is processed, causing a language mismatch error.
528+ call_names = [fc .function_name for fc in function_calls ]
529+ if 'detect_and_switch_language' in call_names :
530+ return
526531 current_lang = language_state .get ('current_language' , 'en' )
527- phrases = FILLER_PHRASES .get (
528- current_lang , FILLER_PHRASES . get ( 'en' , [ 'Please wait a moment' ])
529- )
532+ phrases = FILLER_PHRASES .get (current_lang )
533+ if not phrases :
534+ return
530535 phrase = random .choice (phrases )
531536 await task .queue_frame (TTSSpeakFrame (phrase ))
532537
You can’t perform that action at this time.
0 commit comments