Dev.to AI 🤖 Ai 👁 0 📖 6 min read

Moving an ASP.NET Core SIP voice service off a retiring OpenAI realtime model with Azure App Configuration

This article was drafted with AI help and reviewed by the author. Say you run an ASP.NET Core service that answers phone calls through OpenAI's Realtime API over SIP. A call comes in, OpenAI sends your webhook an incomi

This article was drafted with AI help and reviewed by the author.

Say you run an ASP.NET Core service that answers phone calls through OpenAI's Realtime API over SIP. A call comes in, OpenAI sends your webhook an incoming call event, and your service accepts the call with the session settings it wants.

OpenAI's deprecations page now gives shutdown dates to the realtime models such a service is likely to use. gpt-realtime and gpt-realtime-mini end on 20 January 2027. gpt-realtime-2 ends on 1 June 2027. The recommended targets are gpt-realtime-2.1 and gpt-realtime-2.1-mini.

The edit itself is small. The work is in switching safely, one number at a time, with a way back that still exists on the day you need it. This post walks through one way to do that on Azure. It is based on OpenAI's SIP, deprecations and List models docs and on Microsoft Learn pages for App Configuration and ASP.NET Core health checks, read on 3 December 2026. None of it has been tried on a live phone line.

One request decides the model

OpenAI's SIP guide says the accept request accepts whatever you would put in a client secret request. So the model, voice, instructions and tools all go in there. It also says that when your service later opens a WebSocket to the call using the call id, any model argument on that connection is not used. The model was already fixed at accept time.

That simplifies the design. There is exactly one place per call where the model is chosen. Make that place read from configuration, and make the configuration easy to change.

Per-agent keys in App Configuration

Give each agent its own keys instead of one global model setting. A sample layout:

  • VoiceAgents:Billing:Model set to gpt-realtime-mini today
  • VoiceAgents:Billing:Voice set to marin
  • VoiceAgents:Booking:Model set to gpt-realtime-2
  • VoiceAgents:Sentinel, a value you bump after every change

Use labels for environments, so staging can run the new model while production stays put.

For refresh, Microsoft's guidance offers two choices. You can register all selected keys for refresh, or watch one sentinel key and reload everything when it changes. With several related keys, the sentinel is the safer choice. Change the model and voice first, then bump the sentinel, and the service reloads once with a consistent set.

Two refresh details matter for a voice service.

  • In ASP.NET Core, refresh is driven by incoming requests through the App Configuration middleware, with a default minimum interval of 30 seconds. An idle service does not refresh. After a quiet night, the first call after the gap may still be served from the cached values while the refresh happens.
  • A background worker that places outbound calls never passes through that middleware. Microsoft's provider reference shows injecting the refresher provider and calling TryRefreshAsync yourself in a hosted service. Do that, or the worker will keep dialing out on the old model.

Read the values through IOptionsMonitor or the configuration root at accept time, not into a field at startup.

Roll out by dialed number

A flag that flips every agent at once is not a staged rollout. App Configuration feature flags support a targeting filter with named users, groups and a default percentage. The ASP.NET Core docs note that targeting needs a targeting context, and that the default accessor takes the user from the HTTP context. A webhook from OpenAI has no signed-in user, so the default is no use here.

Write your own targeting context accessor instead. The incoming call event carries SIP headers, including the To header with the number that was dialed. Use that number as the user id and the agent name as the group.

A sample sequence, all made up:

  1. Monday. Flag UseNextRealtimeModel targets one test number only.
  2. Wednesday. Add the billing line's main number.
  3. The following Monday. Add the booking group.
  4. When every number is on, set the model keys to the new values and retire the flag.

OpenAI's guide says to treat SIP headers as untrusted caller data, not as proof of anything. That is fine for picking a model. Don't let the same header grant access to anything.

A snapshot as the rollback point

Before the first change, create an App Configuration snapshot of the VoiceAgents keys. Microsoft describes snapshots as immutable once created, and suited to controlled rollouts. Archived snapshots are kept for a retention period, which defaults to 30 days on Standard and Premium stores. Set a longer one when you create it if your rollout will run longer.

Rolling back means pointing the keys back at the snapshot's values and bumping the sentinel.

Know where that stops working. A rollback to gpt-realtime-mini only helps before 20 January 2027. After the shutdown, OpenAI says the model no longer accepts requests. From then on, your only options are a different model that is still live, or a transfer to a person. The SIP guide documents a refer call for transferring, so build and test that path before you need it.

A health check that reads shutdown dates

Each model in OpenAI's List models response can carry a shutdown date, or null when none is set. Use that in an ASP.NET Core health check.

  • Collect every model value from the VoiceAgents keys.
  • Call List models with the same project's key, and cache the result for a few hours.
  • Report Unhealthy if a configured model is missing from the list.
  • Report Degraded if a configured model has a shutdown date within 45 days.
  • Report Healthy otherwise.

The missing case matters. The reference describes the list as the models currently available, so a retired model may vanish instead of showing an old date.

Tag this check and expose it on its own endpoint through a predicate. Do not put it on the liveness probe that AKS uses to restart containers. A model date problem is not fixed by restarting a pod, and restarting every pod at once during business hours makes things worse. Point your monitoring at the tagged endpoint and alert on Degraded.

A sample timeline

Here is how it could play out for one service, with invented dates.

  • 6 December. Health check turns Degraded for the billing agent, 45 days before its model's shutdown.
  • 9 December. Snapshot taken. New model set in staging through a label.
  • 14 December. Flag targets one test number in production.
  • 6 January. All numbers moved. Model keys updated, flag retired.
  • 20 January. The old model shuts down. Nothing changes for callers.

Takeaways

  • For inbound SIP calls, the accept request fixes the model. Read it from configuration there.
  • Use per-agent keys with a sentinel, and remember that refresh is request-driven.
  • Refresh manually in background workers.
  • Target the rollout by dialed number with a custom targeting context.
  • Snapshot before the change, and plan a transfer to a person for the days after a shutdown.
  • Put the shutdown-date health check on a monitoring endpoint, not on liveness.

The guide to OpenAI's realtime model deprecations covers the rest of the migration, including which speech and transcription models are affected.

References

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.