VoIP integration + analog phone + multiple assistants/languages

The new VoIP integration is really nice, but it’s kind of hard to switch the assistant you are talking to without going to the UI and changing the Assist Pipeline setting for the VoIP device.

…or is it?

Say you have 2 assistants, one in English and one in another language. Mine’s in Romanian.

Using the Conversation integration, you could add a new custom sentence in each language:

config/custom_sentences/en/voip.yaml

language: en
intents:
  ChangePhoneLanguageRo:
    data:
      - sentences:
          - "change [the] [phone] language to romanian"

config/custom_sentences/en/voip.yaml

language: ro
intents:
  ChangePhoneLanguageEn:
    data:
      - sentences:
          - "schimb(ă|a) limba [(de la telefon|telefonului)] (î|i)n englez(ă|a)"

Then, you have to handle those 2 new intents using the Intent Script integration.

config/configuration.yaml

intent_script:
  ChangePhoneLanguageEn:
    speech:
      text: De acum poți vorbi în engleză
    action:
      service: select.select_option
      target:
        entity_id: select.your_voip_phone_assist_pipeline
      data:
        option: "Name of EN assistant"

  ChangePhoneLanguageRo:
    speech:
      text: You can now talk in Romanian
    action:
      service: select.select_option
      target:
        entity_id: select.your_voip_phone_assist_pipeline
      data:
        option: "Name of RO assistant"

And there you have it! You can now pick up the phone, tell it to switch to the other language and start speaking away.

2 Likes