Skip to content

twilio-jyoung/Signal2025AzureConversationRelay

Repository files navigation

Warning

We've observed inconsistent behavior in the Azure Durable Functions state management due to a combination of high frequency events from <ConversationRelay> and the way Durable Functions leverages queues and tables for state management. It also lacks proper CancellationToken support which is critical to be able to appropriately handle interrupts and cancel active LLM runs. This forced us to build in unnatural patterns for Azure Durable Functions which likely compounded the state management problem. We're actively looking to migrate away from Azure Durable Functions into Azure App Service. You can get a simple demo up and working quickly with this pattern, but we cannot recommend it for production use.

banner

Pre-requisites:

Deploy Azure Resources

Deploy to Azure

Create a new resource group for easy resource isolation

  • Manual Step - Setup Web PubSub to properly authenticate to the Function
    • Navigate to your new resource group and select the Function App type resource.
    • Select Functions, then select App Keys
    • Create a system key and note the value
    • Navigate back to your resource group and select the Web PubSub Service type resource.
    • Select Settings, the select Settings again
    • Edit the cr hub, then edit the provided Event Handler URL
    • Append the system key to the end of the URL after ?code=
    • Save

Run the Code

  • Setup a local.settings.json file (cp local.settings.json.sample local.settings.json)

    • Azure.OpenAI
      • Navigate to the new resource group and select the resource ending in -project then click Launch Studio
      • Select 'Models + Endpoints' in My assets section, then select a model, then set language to C#
      • Copy the DeploymentName, Endpoint, and APIKey into your settings file
    • Azure.WebPubSub
      • Navigate back to the new resource group and select the resource ending in -webpubsub
      • Select Settings, then select Keys
      • Copy the Primary > Connection String into your settings file
      • Set the HubName to cr if not already set.
    • Azure.KeyVault
      • Navigate back to the new resource group and select the resource ending in -kv
      • Copy the Vault URI from the top right of the page into you settings file
    • Twilio
  • Ensure SDKs are working

    • dotnet --version
      • You should see 9.*. If you don't you may need to add dotnet to your path.
    • azd auth login
      • You should be asked to login via the portal.
  • Start Azurite using the Azurite Extention from the Command Palette

    • >Azurite: Start
  • Run the app from the terminal

    • func start
  • Open a terminal and start ngrok

    • ngrok http 7071
    • make note of the forwarding URL
  • Configure your phone number

    • Open your Active Numbers on your Twilio Account
      • Set the incoming call handler (A call comes in)
        • webhook
        • {ngrok_url}/api/calls
        • HTTP POST
      • Set the call status handler (Call status changes)
        • {ngrok_url}/api/call-status-update
        • HTTP POST
  • Place a call to the number, and check out the Conversation Relay Docs

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published