Orchardcore ai realtime voice

From CrestApps/CrestApps.AgentSkills · View interactive version

Orchardcore ai realtime voice is an AI agent skill from the GitHub repository CrestApps/CrestApps.AgentSkills. Skill for realtime speech-to-speech voice in Orchard Core with the CrestApps AI Chat and AI Chat Interactions modules. Covers realtime-capable deployments, Conversation chat mode with the Conversation deployment (ConversationDeploymentName), the resolution order and the speech-to-text plus text-to-s

How to use this skill

Skill file

Orchard Core AI Realtime Voice - Prompt Templates

Configure Realtime Voice

You are an Orchard Core expert. Generate configuration and recipes for live spoken AI conversations in the CrestApps AI Chat and AI Chat Interactions surfaces.

Guidelines

Resolution Order

For a surface in Conversation mode:

  1. the conversation deployment named on the profile or interaction;
  2. otherwise the site's default realtime deployment (Settings → Artificial Intelligence → Default Deployments);
  3. otherwise the first deployment whose model declares realtime;
  4. otherwise the client-driven speech-to-text plus text-to-speech cascade, which needs both deployments;
  5. otherwise microphone dictation, then plain typing.

Because step 3 accepts any realtime-capable deployment, a site with one uses it even with nothing named. To keep the cascade, have no deployment declare realtime. A named conversation deployment that cannot run realtime is reported rather than silently replaced.

AI Profile in Conversation Mode

{
  "steps": [
    {
      "name": "AIDeployment",
      "Deployments": [
        {
          "Name": "gpt-realtime",
          "ClientName": "OpenAI",
          "ConnectionName": "openai",
          "Properties": {
            "AIDeploymentMetadata": {
              "Features": [ "realtime" ]
            }
          }
        }
      ]
    },
    {
      "name": "AIProfile",
      "Profiles": [
        {
          "Name": "voice-concierge",
          "DisplayText": "Voice Concierge",
          "Type": "Chat",
          "ChatDeploymentName": "gpt-4o",
          "Settings": {
            "ChatModeProfileSettings": {
              "ChatMode": "Conversation",
              "ConversationDeploymentName": "gpt-realtime",
              "VoiceName": "alloy"
            }
          }
        }
      ]
    }
  ]
}

Chat Interactions

An interaction has no chat mode. Set the Chat Interactions site setting ChatInteractionChatModeSettings.ChatMode to Conversation, then name a Conversation deployment on the interaction (ChatInteraction.ConversationDeploymentName); naming one is the opt-in to speak. See orchardcore-ai-chat-interactions.

Cascaded Realtime

When no provider ships a speech-to-speech model, create a deployment under the Cascaded Realtime provider (ClientName CascadedRealtime, registered by CrestApps.OrchardCore.AI) that chains three deployments, which may come from different providers:

mic -> speech-to-text -> chat (tools, data sources) -> text-to-speech -> speaker
{
  "steps": [
    {
      "name": "AIDeployment",
      "Deployments": [
        {
          "Name": "cascaded-voice",
          "ClientName": "CascadedRealtime",
          "Properties": {
            "AIDeploymentMetadata": {
              "Features": [ "realtime" ]
            },
            "CascadedRealtimeMetadata": {
              "SpeechToTextDeploymentName": "cartesia-ink",
              "ChatDeploymentName": "gpt-4o",
              "TextToSpeechDeploymentName": "elevenlabs-voice"
            }
          }
        }
      ]
    }
  ]
}

ElevenLabs and Cartesia

Enable CrestApps.OrchardCore.ElevenLabs or CrestApps.OrchardCore.Cartesia, then add a deployment of that provider with its model name (eleven_flash_v2_5, sonic-2, ...) and its API key (stored encrypted; an optional Endpoint for regional endpoints). See orchardcore-ai-providers.

Live AI Phone Calls

Profiles that answer or place calls (orchardcore-omnichannel-voice, orchardcore-contact-center) run on the same deployments:

Transport and Configuration

Audio uses WebRTC when available and falls back to WebSocket (PCM over SignalR) automatically at connect time. The browser peers with the application's hub, not the provider, so any realtime provider works. Transcripts and errors stay on SignalR.

{
  "OrchardCore": {
    "CrestApps": {
      "AI": {
        "RealtimeTransport": {
          "EnableWebRtc": true,
          "TurnDetectionType": "semantic_vad",
          "TurnDetectionEagerness": "auto",
          "IdleTimeoutSeconds": 30,
          "MaxSessionDurationSeconds": 300,
          "EnableKnowledgeGrounding": true,
          "StunUrls": [ "stun:stun.l.google.com:19302" ],
          "TurnUrls": [ "turns:turn.example.com:5349" ],
          "TurnSecret": "<coturn-shared-secret>",
          "TurnCredentialTtlSeconds": 3600,
          "IceTransportPolicy": "All"
        }
      }
    }
  }
}

| Key | Purpose |

|---|---|

| EnableWebRtc | Offer WebRTC (default true). Turn off on hosts with no inbound UDP and no TURN, or every session waits out the connect timeout |

| TurnDetectionType | semantic_vad (default) or server_vad; a deployment that rejects semantic detection is switched automatically |

| TurnDetectionEagerness | low, medium, high or auto (default) |

| IdleTimeoutSeconds | End a session with no user speech (default 30) |

| MaxSessionDurationSeconds | Hard session ceiling (default 300); the chat UI shows a distinct "limit reached" message |

| EnableKnowledgeGrounding | Retrieve knowledge before the model replies (default true) |

| GroundingAcknowledgementDelayMs | Delay before one spoken filler while retrieval runs (default 700) |

| GroundingResponseWatchdogSeconds | Answer anyway after this wait (default 15) |

| StunUrls, TurnUrls | ICE servers; TURN is needed behind strict NATs or blocked UDP |

| TurnSecret, TurnCredentialTtlSeconds | coturn use-auth-secret ephemeral credentials (recommended) |

| TurnUsername, TurnCredential | Static TURN credentials, used only without TurnSecret |

| IceTransportPolicy | All (default) or Relay |

The section is read through IShellConfiguration, so each tenant can set its own values. A tenant that declares nothing inherits the host's values; one that declares StunUrls or TurnUrls replaces the host list instead of appending. In a tenant's own App_Data/Sites/{tenant}/appsettings.json, start at CrestApps without the OrchardCore wrapper.

Cloudflare Realtime TURN

{
  "OrchardCore": {
    "CrestApps": {
      "AI": {
        "RealtimeTransport": {
          "Cloudflare": {
            "TokenId": "<turn-token-id>",
            "ApiToken": "<api-token>",
            "TtlSeconds": 86400
          }
        }
      }
    }
  }
}

Cloudflare issues short-lived TURN credentials through an API (CloudflareTurnOptions, section CrestApps:AI:RealtimeTransport:Cloudflare). Credentials are refreshed halfway through TtlSeconds (default 86400), which is not a session limit. Each tenant can use its own Cloudflare account. Without a token, or during a Cloudflare outage, the configured StunUrls and TurnUrls are used.

Hub Methods and Endpoints

| Method | AIChatHub | ChatInteractionHub |

|---|---|---|

| Start over WebSocket | StartRealtimeConversation(profileId, sessionId, audioChunks, voice, language, ...) | StartRealtimeConversation(itemId, audioChunks, voice, language, ...) |

| Start over WebRTC | StartRealtimeWebRtc(profileId, sessionId, offerSdp, ...) | StartRealtimeWebRtc(itemId, offerSdp, ...) |

| ICE | GetRealtimeIceServers, AddRealtimeIceCandidate | Same |

| Live settings | UpdateRealtimeSettings(allowInterruption, ...), UpdateRealtimeSpeechSpeed(speed) | Same |

| Stop | StopConversation | Same |

~/CrestApps.OrchardCore.AI.Chat/Realtime/Voices?deploymentName= returns the voices of a realtime deployment (empty name resolves the site default). The browser side is the vendored realtime-audio script from @crestapps/ai-chat-ui; its settings popover holds only per-device preferences (microphone, speaker, volume, language, Allow interruptions, Push-to-talk).

Upgrading from 2.x

Troubleshooting

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.