AWS、レストラン向け電話AIホストを公開
AWS は、Amazon Bedrock AgentCore と Nova 2 Sonic を活用したリアルタイム音声注文システムの実装ガイドを公開し、電話対応の自動化と顧客体験の向上を実現する具体的なアーキテクチャを示した。
キーポイント
業界課題の解決アプローチ
レストランが月平均150件の電話を見逃している現状に対し、現場スタッフを動員せずとも対応可能な音声 AI ホストシステムの構築方法を提示している。
AWS 技術スタックの統合構成
Amazon Bedrock AgentCore でエージェントをホストし、Nova 2 Sonic でリアルタイム音声処理を行い、MCP を介してバックエンドと連携する完全なフルスタック構成を解説している。
SIP ゲートウェイによる電話網接続
Amazon Chime SDK Voice Connector と ECS/Fargate 上の SIP ゲートウェイを活用し、従来の電話回線を WebSocket を介して AI エージェントに直接ストリーミングする実装手法を詳述している。
レイヤー分離と拡張性
電話層、エージェント層、バックエンド層を明確に分離し、MCP のオープン標準化により、新しいチャネル(アプリやキオスク)への展開も容易にする設計思想を示している。
重要な引用
Restaurants miss an average of 150 phone calls per location every month, and about 60 percent of those are customers trying to place an order or book a table.
The system uses Amazon Bedrock AgentCore to host and run the agent and Amazon Nova 2 Sonic for real-time speech, connected to a restaurant backend through the Model Context Protocol (MCP).
It also warms the agent session while the phone is still ringing, so the caller never hears dead air.
影響分析・編集コメントを表示
影響分析
この記事は、LLM を単なるテキストチャットボットから、実社会のインフラ(電話網)と密接に連携するリアルタイム音声エージェントへと進化させる具体的なロードマップを示しています。特に、MCP(Model Context Protocol)を標準プロトコルとして採用し、バックエンドロジックと AI エージェントを分離することで、業界全体での音声 AI の実装ハードルを下げ、小売・飲食業における業務効率化の加速に寄与する可能性があります。
編集コメント
電話対応の自動化は長年の課題でしたが、Nova 2 Sonic のような低遅延音声モデルと MCP を組み合わせたこのアプローチは、実運用レベルでの信頼性を担保する重要な一歩です。特に「通話待ち時間のゼロ化」を実現するセッションウォーミング技術は、顧客体験を損なわないための極めて実用的な知見と言えます。
日本の飲食店では、店舗あたり月平均約150件の電話が置き去りにされています。そのうち約6割は注文やテーブル予約を目的とした顧客からのものです。こうした電話の集中は、まさにディナータイムの最盛期に起こります。ホストが客を案内し、スタッフが席替えを行っている最中に、電話対応がおろそかになりがちです。
現場から誰かを呼び出して対応させるのは解決策になりません。むしろ、顧客体験とスタッフの業務効率の両方を悪化させるだけです。アプリやWebサイトの導入はオンライン注文を好む顧客には役立ちますが、「ただ電話をかけたい」という顧客にとっては何の解決にもなりません。
本稿では、電話番号に着信し、挨拶から注文確認まで一貫して対応する音声注文システムの構築方法をご紹介します。このシステムは、エージェントのホストと実行に Amazon Bedrock AgentCore を、リアルタイム音声処理には Amazon Nova 2 Sonic を使用します。また、飲食店のバックエンドシステムとの連携には Model Context Protocol (MCP) を採用しています。
解説では、AWS Cloud Development Kit (AWS CDK) を用いたフルスタックのデプロイ手順と、Amazon Elastic Container Service (Amazon ECS) や AWS Fargate 上の SIP ゲートウェイを介して電話回線をエージェントに接続する方法を詳しく説明します。さらに、通話開始前にエージェントセッションをウォームアップさせる仕組みも実装しており、通話者が待ち時間(デッドエア)を感じることはありません。
ソリューションの概要
本システムは、3 つのレイヤーで構成されています。まず「電話回線層」が通話特有の課題を処理します。ここでは音声データがブラウザ経由ではなく電話網を通じて届き、ユーザー認証もログイン情報ではなく電話番号によって行われます。この音声は、署名付き WebSocket 接続を介して「エージェント層」へストリーミングされます。ここで Amazon Nova 2 Sonic を実行するエージェントが会話を行います。
さらに、エージェントは MCP ツールを通じて「バックエンド層」にアクセスします。バックエンドにはメニュー情報、カート、注文履歴、店舗場所などのデータが保持されています。これらのレイヤーを分離することで、注文ロジックと通信チャネルを独立させることが可能です。例えば、モバイルアプリやキオスクといった新しいチャネルを追加する場合でも、バックエンドを書き換えることなく既存のエージェントに接続できます。また、MCP はエージェントと外部ツールを接続するためのオープン標準であるため、バックエンドを変更してもエージェント側への影響はありません。
このエージェントは、入力・出力ともにテキストと音声の両方に対応しており、文字起こし、ターン制の制御、会話中の割り込み処理などを、単一の双方向ストリーム上で一括して処理します。
本ソリューションでは、以下の構成要素を展開します:
電話回線側では、Amazon Chime SDK Voice Connector が SIP トランクとフリーダイヤル番号を提供し、着信通話を受け付けます。SIP ゲートウェイは AWS Fargate 上で動作する Amazon ECS で実行され、その背後には Network Load Balancer が配置されています。
エージェント層では、AgentCore Runtime が会話ロジックをホストし、各通話は分離のために個別のマイクロ VM 内で実行されます。音声対話(Speech-to-Speech)は Amazon Nova 2 Sonic が担当します。また、AgentCore Gateway はバックエンド API を MCP ツールとして公開しており、エージェントは名前を指定してこれらを検索・呼び出すことができます。
バックエンド層では、Amazon API Gateway が REST エンドポイントの前面に立ち、AWS Identity and Access Management (IAM) によるセキュリティで守られています。メニュー、カート、注文、店舗検索などのビジネスロジックは AWS Lambda で実行されます。データ保存には Amazon DynamoDB を使用し、住所変換(ジオコーディング)や経路計算は Amazon Location Service が担当します。
エージェントのコンテナイメージは、Amazon Elastic Container Registry (Amazon ECR) で管理され、AWS CodeBuild でビルドされ、Amazon Simple Storage Service (Amazon S3) に保存されます。
構成図
以下の図は、4 つのセクションに整理された本ソリューションを示しています。

レストランのバックエンド基盤は、まずセクション A で構築されます。顧客情報、注文データ、メニュー、カート、店舗住所などは Amazon DynamoDB に保存され、住所検索や経路探索には Amazon Location Service を活用します。ビジネスロジックは AWS Lambda が実行し、外部からのアクセスには IAM 認証を付与した上で Amazon API Gateway が公開します。リソースのデプロイ順序も依存関係に合わせて設定されています。
セクション B では AgentCore Gateway の作成と IAM 権限の設定を行い、バックエンドのエンドポイントをエージェントが利用可能な MCP ツールとして公開する構成を行います。これはエージェントとバックエンドを分離するための重要なレイヤーです。この仕組みがなければ、ツールの追加や変更のたびにエージェント自体を再デプロイする必要が生じます。
セクション C ではエージェントのプロビジョニングを行います。まず Amazon ECR リポジトリを作成し、Amazon S3 と AWS CodeBuild を活用してコンテナイメージのビルドとプッシュを実行します。その後、AgentCore Runtime をデプロイします。さらに、通話ごとにパーソナライズされた対応を実現するための支援リソースも整えます。具体的には、プロンプトをレンダリングする Lambda 関数や、AWS Systems Manager Parameter Store に保存したプロンプトテンプレート、通話者の特定に使用するシークレット情報などが含まれます。
D セクションでは、電話回線の経路を構築します。具体的には、Amazon Chime SDK Voice Connector とフリーダイヤル番号のセットアップ、着信通話の処理内容を決定する SIP Media Application Lambda、共有の Amazon Virtual Private Cloud (VPC)、そしてネットワークロードバランサー背後で AWS Fargate 上で動作する Amazon ECS 上の SIP ゲートウェイ(drachtio-server)を構成します。このゲートウェイは、Chime SDK Voice Connector と AgentCore Runtime の間を中継して通話を繋ぎます。
上記の図にある番号付き注釈は、本ソリューションがエンドツーエンドでどのように動作するかを追跡しています。
顧客から、あるいは別の回線からの転送により、Amazon Chime SDK でプロビジョニングされた電話番号宛てに通話が発生します。
Amazon Chime SDK が入力された通話を応答し、AWS Lambda を呼び出してブリッジのセットアップを行います。Lambda はセッション識別子を生成し、AgentCore Runtime への接続を開いてマイクロ VM をウォームアップさせます。これにより、メディアストリーミング開始時のコールドスタートを回避できます。
Lambda からの応答が成功すると、Amazon Chime SDK は TCP ポート 5060 を介して SIP インバイテを送信し、ネットワークロードバランサに対してブリッジアクションを開始します。
AWS Fargate で稼働している SIP サービスがこのインバイテを受け取り、同じコンテナ内のリアルタイムトランスポートプロトコル(RTP)サービスで空きポートを確保します。これにより、割り当てられたパブリック IP アドレス上でメディアの受信が可能になります。
RTP サービスは Voice Connector から UDP ポートを通じてメディアを受信し、SIP メディアアプリケーションハンドラが作成した同じセッション識別子を使用して、AgentCore Runtime の WebSocket に接続します。これでメディアの変換処理が始まります。
AgentCore Runtime は、セッション識別子と顧客の Amazon DynamoDB レコードに基づき、AWS Systems Manager Parameter Store に保存されたシステムプロンプトを構築するために AWS Lambda 関数を呼び出します。
その後、AgentCore Runtime は Amazon Nova 2 Sonic とセッションを作成し、確立された接続を通じてシステムプロンプトの指示に従って顧客に挨拶を行います。
さらに AgentCore Runtime は、MCP プロトコルを使用して AgentCore Gateway から利用可能なツールの一覧を取得し、呼び出します。
AWS CDK がソリューションを Amazon S3 にデプロイすると、AWS CodeBuild がトリガーされてコンテナイメージがビルドされ、Amazon ECR に保存されます。AgentCore Runtime と AWS Fargate はこれらのイメージを使用して、エージェントおよび SIP サーバー、RTP サーバーを展開します。
Amazon CloudWatch により、すべてのサービスにわたる集中型の監視、ログ収集、アラート管理が行われます。また、保存されているすべてのデータは、AWS Key Management Service (AWS KMS) を用いて暗号化されています。
コールアウト 1〜9 は単一の通話中に発生するプロセスを説明しており、コールアウト 10 では SIP サーバーと AgentCore Runtime のデプロイ方法について、コールアウト 11 では監視とセキュリティの仕組みについて解説しています。次のセクションでは、デプロイや運用に関する記述は一旦脇に置き、通話そのものに焦点を当てていきます。
着信フロー
このセクションでは、通話者が最初に電話をかけた瞬間から応答までの一連の流れを追跡します。これは、前節のアーキテクチャ図で示した「1〜9 の発信コール」と同じ実行パスです。以下の図はイベントの順序をより明確に把握できるよう、シーケンス形式で描かれています。

上記の図にある番号付きステップは、通話の各段階に対応しています。
- 通話者がフリーダイヤルへ発信し、Amazon Chime SDK Voice Connector が応答します。
- Voice Connector は SIP Media Application Lambda を呼び出し、通話用のセッション ID を計算します。
- Lambda は AgentCore Runtime に対してウォームアップリクエストを送信します。これにより、電話が鳴っている間にエージェント側でセッションの準備が進みます。
- Lambda は Voice Connector に、AWS Fargate 上で動作する ECS の SIP ゲートウェイへ通話をブリッジするよう指示し、セッション ID を引き渡します。
- SIP ゲートウェイは、そのセッション ID を使用して AgentCore Runtime に対して SigV4 で署名された WebSocket を開きます。通話はウォームアップ済みのセッションに接続され、通話者の音声はエージェントへ、エージェントの応答音は通話者へと流れます。
- エージェントは Amazon Nova 2 Sonic と会話を進めながら、メニュー、カート、注文情報、店舗位置などのデータが必要な際は AgentCore Gateway を介してバックエンドツールを呼び出します。
必要な環境と前提条件
AWS アカウントを用意してください。また、デプロイ先の AWS リージョンにおいて Amazon Nova 2 Sonic のモデルアクセス権限を Amazon Bedrock コンソールの「モデルアクセス」ページから申請しておく必要があります。
さらに、Amazon Chime SDK の PSTN(公衆交換電話網)オーディオ機能を利用するには、同コンソールで電話番号のクォータ増額をリクエストしてください。過去にこのアカウントで電話番号を発注したことがない場合は特に必要です。
開発環境としては、Node.js 24.x 以降と、認証情報を設定済みの AWS CLI 2.x を用意します。また、Git でリポジトリをクローンできる状態にしておきましょう。
最後に、対象の AWS アカウントとリージョンで AWS CDK のブートストラップ(npx cdk bootstrap aws:///)を実行してください。
なお、エージェントコンテナは Python で構築されていますが、ビルド処理は AWS CodeBuild 上で実行されるため、ローカルマシンに Python をインストールする必要はありません。デプロイ先には、Amazon Nova 2 Sonic、Amazon Chime SDK の PSTN オーディオ機能、そして AgentCore Runtime がすべて利用可能なリージョンを選んでください。まずは US East (N. Virginia) リージョン(us-east-1)から始めるのがおすすめです。
AWS CDK を使ってソリューションをデプロイする
本稿の完全なソリューションは、GitHub の サンプルリポジトリ で公開されています。まずはリポジトリをクローンし、プロジェクトディレクトリに移動してください。
git clone https://github.com/aws-samples/sample-restaurant-telephony-ai-host-using-amazon-bedrock-agentcore-nova-sonic.git
cd sample-restaurant-telephony-ai-host-using-amazon-bedrock-agentcore-nova-sonicまず、事前チェックを実行します。これにより、Node.js、AWS CLI、git、AWS CDK のブートストラップ設定、そして Amazon Bedrock モデルへのアクセス権限がすべて準備されているか確認され、不足しているものがあれば報告されます。
./scripts/preflight-check.sh
次に、デプロイ接頭辞を指定してデプロイスクリプトを実行します。この接頭辞はすべてのリソース名に付与されるため、同じ AWS アカウント内で複数回ソリューションを展開する際に識別子として利用できます。
./scripts/deploy-all.sh --deploymentPrefix qsr-tel
このスクリプトは、AWS CDK スack を順番にデプロイし、前のスタックの出力を次のスタックへ引き継ぎます。まずバックエンドを構築し、その背後に AgentCore Gateway を配置して API に接続します。続いて、AWS CodeBuild でエージェントのコンテナイメージをビルド・プッシュし、AgentCore Runtime 上にデプロイします。最後に、AWS Fargate 上で Amazon ECS を使って SIP ゲートウェイを起動し、Amazon Chime SDK Voice Connector とフリーダイヤル番号のプロビジョニングを行います。また、完了後にすぐに実機での注文テストができるよう、サンプルのメニューや店舗情報も初期データとして読み込まれます。なお、エージェントコンテナのビルドは初回実行時に数分かかるため、AWS CodeBuild が処理を行っている間はスクリプトの実行が一時的に停止する場合があります。
スクリプトが完了すると、通話先の電話番号が表示されます。
Your telephony agent is live at +1XXXXXXXXXX. Dial to test.
SIP ゲートウェイの仕組み
電話回線層には、たった一つの役割しかありません。それは通話を、エージェントが読み書きできるメディアストリームに変換することです。なぜこれが重要なのかというと、電話網とエージェントでは使われているプロトコルが異なるからです。
電話網は音声データを UDP 上の RTP パケットとして配信しますが、エージェント側は Amazon Nova 2 Sonic が理解する形式のフレームを WebSocket で受け取ることを前提としています。この間に翻訳層が存在しなければ、エージェント自身が SIP やコーデックネゴシエーション、ネットワークレベルのメディアルーティングについて理解している必要があり、結果的に単一のチャネルに縛り付けられてしまうことになります。
この変換処理を担当するのは、2 つのコンポーネントです。
Amazon Chime SDK の Voice Connector が着信通話を受け取り、SIP Media Application Lambda を呼び出します。Lambda 内で通話の経路が制御され、「SIP ゲートウェイに通話をブリッジする」という指示が返されます。同時にセッション識別子が付与されるため、次のステップで「この通話がどのセッションに属するか」を正しく認識できるようになっています。
SIP ゲートウェイは、AWS Fargate 上で動作する Amazon ECS 上に構築されています。SIP シグナリングには drachtio-server を使用し、音声のブリッジングには Node.js を活用しています。
このゲートウェイは通話に応答し、電話回線が使用する音声フォーマットと、Amazon Nova 2 Sonic が想定するフォーマットの間で変換を行います。高可用性(HA)を実現するため、2 つのタスクを異なるアベイラビリティゾーン(AZ)Availability Zones (AZs) に分散して実行しています。これにより冗長性が確保され、同時に Amazon CloudWatch への通話数メトリクスの公開先としても機能し、スケーリングの判断材料となります。
通話のシグナリングはネットワークロードバランサーを経由しますが、音声データそのものは Voice Connector と Fargate タスクの間で直接やり取りされます。これにより、メディアパスにロードバランサーを介在させる必要がなくなり、負荷分散の最適化を図っています。
通話中にエージェントをウォーミングアップする
音声通話は沈黙に対して非常に厳しいものです。通話者が接続して数秒間何も聞こえないと、システムは正常に動作しているにもかかわらず、通話が切断されたような不具合を感じさせてしまいます。
通話開始時の遅延要因となるのは、一度きりのセットアップ処理です。エージェントはこの通話者のためのシステムプロンプトを解決し、Amazon Nova 2 Sonic のストリームを開き、利用可能な MCP ツールを検出する必要があります。
通話者が待たされるのを避けるため、SIP メディアアプリケーションの Lambda は電話が鳴っている間に処理を開始します。着信と同時に、Lambda は通話用のセッション識別子を含むウォームアップリクエストを AgentCore Runtime へ送信します。これにより、AgentCore Runtime はマイクロ VM を割り当て、通話中の待ち時間(リングングウィンドウ)にセットアップを実行します。
数秒後、SIP ゲートウェイが同じセッション識別子を使って WebSocket 接続を開くと、AgentCore Runtime はそのリクエストを既にウォームアップ済みのマイクロ VM にルーティングし、エージェントは通話の準備が整います。
このセッション識別子が二つのリクエストをつなぐ鍵となります。Lambda は通話情報自体から識別子を計算するため、ウォームアップ要求と後の音声接続が追加の状態管理なしに同じマイクロ VM へ解決されます。以下の図は、通話が接続された時点でエージェントが準備完了しているように、この処理がリングングウィンドウとどのように重なるかを示しています。

メニューやカート、注文情報の保存
注文ワークフローを支えるのは、5 つの Amazon DynamoDB テーブルです。"Customers" テーブルには顧客のプロファイル(氏名、電話番号、ロイヤリティ情報など)を格納し、エージェントが通話者の再帰を識別できるようにしています。"Orders" テーブルでは注文履歴と受け取り場所を管理します。"Menu" テーブルには商品名、価格、在庫状況などを保存しており、店舗によって内容が異なる点も反映されます。"Carts" テーブルは進行中のカート情報を保持し、有効期限(TTL)を設定することで、放置されたカートを自動的に削除する仕組みになっています。また、"Locations" テーブルには座標や営業時間、税率といった店舗詳細を格納しており、エージェントが合計金額の計算や推奨を行う際に参照します。DynamoDB のオンデマンド容量モードを選んだため、トラフィックに応じて自動でスケールし、スループット管理の手間もありません。
受け取り場所の検索
Amazon Location Service を活用すれば、通話者は何も入力する手間なく、便利な受け取りスポットを見つけることができます。電話ではブラウザを使って位置情報を共有できないため、エージェントは ZIP コードや交差点名を聞き取り、それを Amazon Location Service で座標に変換します。取得した座標をもとに、バックエンドではいくつかの処理が可能です。まず、最寄りの店舗を検索したり、直線距離ではなく走行時間に基づいてランキング付けたりできます。これにより、通話者のルートに沿ったわずかな迂回を優先し、効率的なルートを提案できます。また、特定の住所を座標に変換するジオコーディングも可能です。
この仕組みのおかげで、エージェントは内部コードを読み上げるのではなく、「メインストリートにある店舗が最寄りで、約 5 分です」といったように、通話者がすぐに行動に移せる具体的な情報を伝えることができます。
Amazon Bedrock AgentCore と Amazon Nova 2 Sonic を活用した音声処理
エージェントは AgentCore Runtime 上で動作します。各通話は独立したマイクロ VM で実行されるため、ある利用者のセッションが他の利用者に影響を及ぼすことはありません。AgentCore Runtime がスケーリングを担当し、双方向のオーディオデータを伝送する WebSocket 接続も提供します。
エージェント内部では、エージェントフレーム
原文を表示
Restaurants miss an average of 150 phone calls per location every month, and about 60 percent of those are customers trying to place an order or book a table. Most of these calls come in during dinner service, exactly when the host is seating guests, servers are turning tables, and the phone becomes an afterthought. Pulling someone off the floor to answer doesn’t fix the problem. It only makes two experiences worse. Adding an app or a website helps customers who prefer to order online, but it does nothing for the person who only wants to call.
In this post, we show you how to build a voice ordering system that answers a phone number and takes the order from greeting to confirmation. The system uses Amazon Bedrock AgentCore to host and run the agent and Amazon Nova 2 Sonic for real-time speech, connected to a restaurant backend through the Model Context Protocol (MCP). The walkthrough covers deploying the full stack with AWS Cloud Development Kit (AWS CDK) and bridging a phone call into the agent through a Session Initiation Protocol (SIP) gateway on Amazon Elastic Container Service (Amazon ECS) and AWS Fargate. It also warms the agent session while the phone is still ringing, so the caller never hears dead air.
Solution overview
The system has three layers. The telephony layer handles phone-specific concerns. Audio arrives over the phone network rather than a browser, and the system identifies the caller by phone number rather than by a login. A SIP gateway streams that audio to the agent layer over a signed WebSocket connection, where the agent runs the conversation with Amazon Nova 2 Sonic. The agent reaches the backend layer through MCP tools. The backend holds the menu, carts, orders, and locations. Keeping these layers apart means the ordering logic stays independent from the channel that calls it. A new channel like a mobile app or a kiosk can connect to the same agent without rewriting the backend. And because MCP is an open standard for connecting an agent to external tools, the backend can change without touching the agent. The agent supports both text and audio as input and output, handling transcription, turn-taking, and interruptions in a single bidirectional stream.
The solution deploys the following:
On the telephony side, Amazon Chime SDK Voice Connector provides the SIP trunk and toll-free number that accepts inbound calls. Amazon ECS on AWS Fargate runs the SIP gateway behind a Network Load Balancer. For the agent layer, AgentCore Runtime hosts the conversation logic, with each call running in its own microVM for isolation. Amazon Nova 2 Sonic handles the speech-to-speech interaction. AgentCore Gateway exposes the backend APIs as MCP tools the agent can discover and call by name. The backend layer uses Amazon API Gateway to front REST endpoints secured by AWS Identity and Access Management (IAM). AWS Lambda runs the business logic for menus, carts, orders, and location lookups. Amazon DynamoDB stores the data, and Amazon Location Service handles geocoding and route calculation. Amazon Elastic Container Registry (Amazon ECR), AWS CodeBuild, and Amazon Simple Storage Service (Amazon S3) build and store the agent container image.
Architecture diagram
The following diagram shows the solution, which is organized into four sections.

The restaurant’s backend infrastructure deploys first in Section A. Amazon DynamoDB holds the customer, order, menu, cart, and location data, and Amazon Location Service handles addresses and routing. AWS Lambda runs the business logic, and Amazon API Gateway exposes it externally with IAM authorization. Resources deploy in dependency order.
Section B creates the AgentCore Gateway, sets up its IAM permissions, and configures the gateway to expose the backend endpoints as agent-accessible MCP tools. This is the layer that decouples the agent from the backend. Without it, adding or changing a tool would require redeploying the agent itself.
Section C provisions the agent. It creates the Amazon ECR repository and uses Amazon S3 and AWS CodeBuild to build and push the container image. It then deploys AgentCore Runtime. It also deploys the supporting pieces that let the agent personalize each call, including a prompt-renderer Lambda function and a set of AWS Systems Manager Parameter Store entries that hold the prompt templates and a secret used for caller identification.
Section D provisions the phone path. It sets up the Amazon Chime SDK Voice Connector and a toll-free number, a SIP Media Application Lambda that decides what to do with an incoming call, a shared Amazon Virtual Private Cloud (Amazon VPC), and the SIP gateway (drachtio-server), which runs on Amazon ECS on AWS Fargate behind a Network Load Balancer. The gateway bridges the calls between the Chime SDK Voice Connector and AgentCore Runtime.
The numbered callouts in the preceding diagram trace the solution end to end:
- A call is initiated to the phone number provisioned by Amazon Chime SDK, either by a customer or forwarded from another line.
- Amazon Chime SDK answers the call and invokes AWS Lambda to set up the bridge.
- The Lambda creates a session identifier and opens a connection to AgentCore Runtime to warm up the microVM, which avoids a cold start when media streaming begins.
- After a successful response from the Lambda, Amazon Chime SDK initiates a bridge action against the Network Load Balancer by sending a SIP invite over TCP port 5060.
- The SIP service running on AWS Fargate accepts the invite and allocates a free port in the Real-time Transport Protocol (RTP) service on the same container to receive media on the assigned public IP address.
- The RTP service receives the media on the UDP port from the Voice Connector and connects to the AgentCore Runtime WebSocket to begin media translation, using the same session identifier created by the SIP Media Application handler.
- AgentCore Runtime invokes an AWS Lambda function to build the system prompt, stored on AWS Systems Manager Parameter Store, based on the session identifier and the customer’s Amazon DynamoDB record.
- AgentCore Runtime creates a session with Amazon Nova 2 Sonic and greets the customer over the established connection, following the system prompt instructions.
- AgentCore Runtime lists and calls the available tools from AgentCore Gateway using the MCP protocol.
- AWS CDK deploys the solution to Amazon S3, triggering AWS CodeBuild to build the container images and store them in Amazon ECR. AgentCore Runtime and AWS Fargate use these images to deploy the agent and the SIP and RTP servers.
- Amazon CloudWatch provides centralized monitoring, logging, and alerting across all services, and all data at rest is encrypted using AWS Key Management Service (AWS KMS).
Callouts 1–9 happen during a single phone call, callout 10 covers how the solution deploys the SIP server and AgentCore Runtime, and callout 11 covers how it’s monitored and secured. The following section sets deployment and operations aside and gets closer to the call itself.
Inbound call flow
This section follows one call from the caller’s side from the first ring to the spoken reply. It is the same runtime path as callouts 1–9 in the preceding architecture diagram. The following diagram shows it as a sequence so the order of events is more straightforward to see.

The numbered steps in the preceding diagram correspond to these stages of the call:
- The caller dials the toll-free number and Amazon Chime SDK Voice Connector answers.
- The Voice Connector invokes the SIP Media Application Lambda, which computes a session identifier for the call.
- The Lambda sends a warmup request to AgentCore Runtime, so the agent prepares its session while the phone is still ringing.
- The Lambda tells the Voice Connector to bridge the call to the SIP gateway on Amazon ECS on AWS Fargate, passing the session identifier along.
- The SIP gateway opens a SigV4-signed WebSocket to AgentCore Runtime using that same session identifier. The call attaches to the warmed session, caller audio flows to the agent, and the agent’s audio flows back to the caller.
- The agent runs the conversation with Amazon Nova 2 Sonic and calls backend tools through AgentCore Gateway when it needs menu, cart, order, or location data.
Prerequisites
Before you begin, verify that you have the following in place:
- An AWS account.
- Amazon Bedrock model access for Amazon Nova 2 Sonic in the AWS Region where you deploy, requested on the model access page in the Amazon Bedrock console.
- Amazon Chime SDK PSTN Audio access, with a phone-number quota increase requested in the Amazon Chime SDK console if you have never ordered a number in this account.
- Node.js 24.x or later.
- AWS Command Line Interface (AWS CLI) 2.x configured with credentials.
- git to clone the repository.
- AWS CDK bootstrapped in your target account and Region (npx cdk bootstrap aws:///).
The agent container is built with Python, but the build runs inside AWS CodeBuild, so you do not need Python on your own machine. Deploy in a Region where Amazon Nova 2 Sonic, Amazon Chime SDK PSTN Audio, and AgentCore Runtime are all available. US East (N. Virginia), us-east-1, is a good place to start.
Deploy the solution with AWS CDK
The full solution is available in the sample repository on GitHub. Clone the repository and change into the project directory.
git clone https://github.com/aws-samples/sample-restaurant-telephony-ai-host-using-amazon-bedrock-agentcore-nova-sonic.git
cd sample-restaurant-telephony-ai-host-using-amazon-bedrock-agentcore-nova-sonicRun the preflight check. It confirms that Node.js, the AWS CLI, git, the AWS CDK bootstrap, and Amazon Bedrock model access are all in place and reports anything missing.
./scripts/preflight-check.shThen run the deployment script with a deployment prefix. The prefix is added to every resource name, which you can use to deploy the solution more than once in the same account.
./scripts/deploy-all.sh --deploymentPrefix qsr-telThe script deploys each AWS CDK stack in order and passes the outputs of one stack to the subsequent stack. It builds the backend first, then adds the AgentCore Gateway in front of the backend APIs. Next, it builds and pushes the agent container image with AWS CodeBuild and deploys the agent on AgentCore Runtime. Finally, it brings up the SIP gateway on Amazon ECS on AWS Fargate and provisions the Amazon Chime SDK Voice Connector and toll-free number. It also seeds sample menu and location data so you can place a real order as soon as it finishes. The build of the agent container takes several minutes the first time, so expect the run to pause while AWS CodeBuild works.
When the script completes, it prints the number to dial:
Your telephony agent is live at +1XXXXXXXXXX. Dial to test.How the SIP gateway works
The telephony layer has one job. It turns a phone call into a media stream the agent can read and write. This matters because the phone network and the agent speak different protocols. The phone delivers audio as RTP packets over UDP. The agent expects a WebSocket carrying frames in the format Amazon Nova 2 Sonic understands. Without a translation layer in between, the agent would need to know about SIP, codec negotiation, and network-level media routing, all of which would couple it to a single channel. Two components handle that translation.
The Amazon Chime SDK Voice Connector accepts the inbound call and invokes the SIP Media Application Lambda. That Lambda is where the call is steered. It returns an instruction to bridge the call to the SIP gateway and carries the session identifier along so the next hop knows which session this call belongs to.
The SIP gateway runs on Amazon ECS on AWS Fargate. It uses drachtio-server for SIP signaling, with a Node.js bridge for the audio. The gateway answers the call and converts between the audio format the phone network uses and the format Amazon Nova 2 Sonic expects. For high availability (HA), it runs as two tasks across two Availability Zones (AZs), which gives it redundancy and a place to publish a call-count metric to Amazon CloudWatch for scaling. The signaling for the call passes through the Network Load Balancer, but the audio itself flows directly between the Voice Connector and the Fargate task, which keeps the load balancer off the media path.
Warming the agent while the phone rings
A voice call is unforgiving about silence. If a caller connects and hears nothing for a few seconds, the call feels broken even though the system is working. The slow part of starting a call is the one-time setup. The agent has to resolve the system prompt for this caller, open the Amazon Nova 2 Sonic stream, and discover the available MCP tools.
Rather than make the caller wait through that, the SIP Media Application Lambda kicks it off while the phone is still ringing. As soon as the call arrives, the Lambda sends a warmup request to AgentCore Runtime with a session identifier for the call. AgentCore Runtime allocates a microVM and runs the setup during the ringing window. A moment later, when the SIP gateway opens its WebSocket connection using the same session identifier, AgentCore Runtime routes it to that already-warm microVM, and the agent is ready to talk.
The session identifier is what connects the two requests. The Lambda computes it from the call itself, so the warmup request and the later audio connection resolve to the same microVM without any extra state to track. The following diagram shows how this overlaps with the ringing window so the agent is ready when the call connects.

Storing menus, carts, and orders
Five Amazon DynamoDB tables cover the ordering workflow. The Customers table stores profiles, including name, phone, and loyalty information, which the agent uses to recognize a returning caller. The *Orders* table keeps order history along with the pickup location. The *Menu* table holds items, prices, and availability, which can differ by location. The *Carts* table holds in-progress carts and uses a time-to-live value so abandoned carts clean themselves up. The *Locations* table holds restaurant details such as coordinates, hours, and tax rates that the agent uses for totals and recommendations. DynamoDB on-demand capacity scales with traffic, so there’s no throughput to manage.
Finding a pickup location
Amazon Location Service helps a caller find a convenient pickup spot without typing anything. A phone caller has no browser to share a location, so the agent asks for a ZIP code or a cross-street and uses Amazon Location Service to turn that into coordinates. From there, the backend can do a few things with those coordinates. It can find the nearest restaurants, rank them by driving time rather than straight-line distance so it favors a short detour along the caller’s route, or geocode a specific address. That lets the agent say something a caller can act on, such as “the closest location is on Main Street, about five minutes away,” instead of reading back an internal code.
Processing voice with Amazon Bedrock AgentCore and Amazon Nova 2 Sonic
The agent runs on AgentCore Runtime. Each call runs in its own microVM, so one caller’s session can’t affect another’s. AgentCore Runtime handles scaling and provides the WebSocket connection that carries audio both ways.
Within the agent, the agent frame
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み