Node.jsで進行中 (In Progress) の通話を変更する
In this guide we’ll show you how to manipulate live phone calls using Node.js. We’ll also cover how to retrieve information about in progress and completed calls from your Twilio account. The code snippets in this guide are written using modern JavaScript language features in Node.js version 6 or higher, and make use of the Twilio Node.js SDK.
はじめましょう!
Node.jsで進行中 (In Progress) のTwilio通話を変更する
Twilio通話のフローを制御するもっとも簡単な方法は、TwiMLそれ自体を使うことです。
<Gather>や<Record>のような動詞の "action" パラメーターを使って、アプリケーションから通話の最中に新しい命令を取得するようTwilioに指示することができます。 さらに、<Redirect>動詞を使って新しいTwiMLをフェッチするよう明示的に指示することもできます。
But sometimes you need to change a live phone call outside of Twilio’s normal request-response cycle. For those cases you can update the Call to tell Twilio to immediately change the TwiML it’s using in a phone call.
In order to update the call you will need to use the CallSid. Twilio returns this when you initiate an outgoing call, and also includes the CallSid in its request to your application for an incoming call's initial TwiML.
As an alternative to updating your call with TwiML directly, you may also redirect a Call to a new URL that responds with your requested TwiML.
進行中 (In Progress) の通話を切断する
Twilio will end phone calls for you when it encounters a <Hangup> verb or when it runs out of TwiML to process. But you can also end phone calls whenever you like by passing a "completed" status to a CallSid in progress.
Check out Modifying Live Calls in the reference docs for more details.
関連トピック
That's how to modify a call in progress using Node.js. Check out our tutorials to see full implementations of Twilio Voice in Node.js with Express.
ヘルプが必要ですか?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.