Level up your Twilio API skills in TwilioQuest, an educational game for Mac, Windows, and Linux. Download Now


Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

IVR: Node.jsおよびExpressを使用したスクリーニングと録音

IVR Screening and Recording in Node & Express

この Express サンプルアプリケーションは、一般的なコールセンターのエクスペリエンスをモデルとしていますが、さらに多くの Reese's Pieces が点在しています。

Stranded aliens can call an agent and receive instructions on how to get off of Earth safely. In this tutorial, we'll show you the key bits of code that allow an agent to send a caller to voicemail, and later read transcripts and listen to voicemails.

このサンプルアプリを自分で実行するには、コードをダウンロードし、GitHub の指示に従ってください

Read how Hulu and IVR with scheduled callbacks on Twilio. Find more examples sample IVR code for many web frameworks on our IVR application page.



When our alien caller chooses a planet, we need to figure out where to route the call. Depending on their input, we will route this call to an extension. Extensions are used to look up an agent. Any string can be used to define an extension.

When our alien caller has made their choice we use the key-press to look up the requested Agent.



        Now that our user has chosen their agent, our next step is to connect the call to that agent.







              Our agent can now be called, but how does our agent interact with this feature? Let's dig into what is happening in the agent's screening call.



              When our agent picks up the phone, we use a <Gather> verb to ask them if they want to accept the call.

              If the agent responds by entering any digit, the response will be processed by our agents/connectmessage route. This will <Say> a quick message and continue with the original <Dial> command to connect the two parties.


                    これで、エージェントは通話を行えるようになりましたが、エージェントが外出中だった場合はどうなるでしょうか。 このような場合は留守録機能をセットアップすると便利です。

                    Set up the agent's voicemail


                    When Twilio makes a request to our Call action method, it will pass a DialCallStatus argument to tell us the call status. If the status was "completed", we hang up. Otherwise, we need to <Say> a quick prompt and then <Record> a voicemail from the alien caller.

                    また、<Record>actionを記述します。 このルートは通話および録音の終了後に呼び出されます。 ルートは「Goodbye」と読み上げ、そして電話を切り(<Hangup>)ます。


                          Now let's take a step back to see how to actually record the call.



                          When we tell Twilio to record, we have a few options we can pass to the <Record> verb.


                          Notice that we redirect to a URL that is specific to this agent. This is a convenient way to specify which agent was called to produce the voice message. This way we can also save the associated agent together with the voicemail.


                                Legal implications of call recording

                                If you choose to record voice or video calls, you need to comply with certain laws and regulations, including those regarding obtaining consent to record (such as California’s Invasion of Privacy Act and similar laws in other jurisdictions). Additional information on the legal implications of call recording can be found here.

                                Notice: Twilio recommends that you consult with your legal counsel to make sure that you are complying with all applicable laws in connection with communications you record or store using Twilio.

                                Finally, we will see how to view an agent's voicemail.



                                Once we look up the agent, all we need to do is display their recordings. We bind the agent, along with their recordings, to a View.

                                Twilio REST API を介して録音をルックアップできますが、必要なデータはすべて transcribeCallback リクエストにあるので、自分で簡単に格納し、ランドトリップを保存できます。


                                      一丁あがり! 実際の担当者、通話スクリーニング、ボイスメールを使って、IVR を実装できました。



                                      Twilio を使う Node.js 開発者であれば、他のチュートリアルも調べてみてください。

                                      このチュートリアルのパート 1:ET 電話ホームサービス - IVR 電話ツリー



                                      音声通話または SMS テキストメッセージを介して調査を実施し、ユーザーから構造化データを迅速に収集します。


                                      Thanks for checking out this tutorial! If you have any feedback to share with us, we'd love to hear it. Connect with us on Twitter and let us know what you build!

                                      Agustin Camino Jose Oliveros Andrew Baker Paul Kamp Kat King
                                      Rate this page:


                                      誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。