メニュー

Expand
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?

TwiML™ for Programmable Fax

All Fax functionality with Twilio takes advantage of TwiML, the Twilio markup language. When Twilio reaches out to your application for instructions, you respond and instruct Twilio on how to proceed. You either do this directly by responding with TwiML, or you can use a Helper Library to manage your responses.

TwiMLとは何か

TwiML is a set of instructions you can use to tell Twilio what to do when you receive an incoming fax – or for that matter an SMS or phone call. For a full overview, feel free to read through the TwiML definition.

Twilio Programmable Fax and TwiML

When Twilio receives a call to an Incoming Phone Number that has been configured as a Fax number, you will receive an HTTP request to the FaxUrl configured for that number. Your server should respond with TwiML that then instructs Twilio how to proceed.

開発者のアプリケーションへのTwilioからのリクエスト

Twilio makes HTTP requests to your application just like a web browser form submission, in the format application/x-www-form-urlencoded. By including parameters and values in its requests, Twilio sends data to your application that you can parse and act upon before responding.

You can configure the URLs and HTTP Methods Twilio uses to make its requests via your account portal or using the REST API. By setting the 'Webhook' callback, you direct Twilio where to look when we receive an incoming fax. Merely set the 'A Fax Comes In' field on your desired phone number.

FAX用のWebhook設定

Twilio cannot cache POST requests we make to your application.

If you want Twilio to cache static TwiML pages from your app, have Twilio make requests to your application using GET.

Programmable Fax用のTwiMLリクエストには下記のリクエストパラメーターが含まれています:

パラメーター 説明
FaxSid Faxに対する34文字の一意な識別子です
AccountSid Faxの送信されたアカウント
From 発信者番号、またはSIP From表示名
To 宛先の電話番号またはSIP URI
ApiVersion Fax送信に使用されたAPIバージョンで、このAPIに対しては "v1" が返されます。

Responding to Twilio after an incoming fax

When a message comes into one of your Twilio numbers, Twilio makes an HTTP request to the Webhook URL configured for that number, as shown above.

そのリクエストへのレスポンスとして、Twilioに対してメッセージへの応答としてどんなことを行うのか伝えることができます。 番号のURLはこちらで構成できます。

You will want to receive or reject the fax after receiving a request.

Twilioはお行儀のよいHTTPクライアントです

Twilio は通常のウェブ ブラウザと同じように振る舞いますので、新しいことを覚える必要はありません。

  • Cookie: 通常のWebブラウザーと同様、TwilioはHTTP Cookieを受け入れ、これらを (Twilioからの) 各リクエストに追加します。
  • Redirects: Twilio follows HTTP Redirects (HTTP status codes 301, 307, etc.), just like a normal web browser.
  • Caching: Twilio will cache files when HTTP headers allow it (via ETag and Last-Modified headers) and when the HTTP method is GET, just like a normal web browser.

Cookie

Twilio will keep cookie state across multiple requests involving the same two phone numbers. This allows you to treat the separate messages as a conversation, and store data about the conversation, such as a session identifier, in the cookies for future reference. Twilio will expire the cookies for that conversation after four hours of inactivity.

TwiML Fax動詞

Most XML elements in a TwiML document are TwiML verbs. Verb names are case sensitive, as are their attribute names. There are only two TwiML fax verbs at this time:

  • <Receive>: receives an incoming fax, creating a new Fax instance リソース
  • <Reject>: rejects the fax and list its status as canceled.
Rate this page:

ヘルプが必要ですか?

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