Voice API
TwilioのProgrammable Voice APIの詳細をご覧ください。音声認識、通話録音、電話会議を利用し、ビジネスに最適な通話サービスを構築することができます
今すぐ無料サインアップVoice APIから通話を発信する
通話を発信すると、このコードによりTwilio Voice APIにリクエストが送信され、発信先の電話番号とともに、サーバーの位置が提供されます。TwiMLにより通話のルーティング方法を指示します。
この通話ロジックでは、複数のTwiMLコマンドを使用しています。たとえば、通話者に音声を発する<Say>、ユーザーにキーパッドによる入力を促す<Gather>、ユーザーに対して音声を再生する<Play>などがあります。
このデモは、米国とカナダで利用可能です。
- PHP
- Node
- Python
- Ruby
- Java
- .NET (C#)
<?php
// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once '/path/to/vendor/autoload.php';
use Twilio\Rest\Client;
// Your Account Sid and Auth Token from twilio.com/console
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$twilio = new Client($sid, $token);
$call = $twilio->calls
->create("+15558675310", // to
"+15017122661", // from
array("url" => "http://demo.twilio.com/docs/voice.xml")
);
print($call->sid);
// Install the C# / .NET helper library from twilio.com/docs/csharp/install
using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account;
class Program
{
static void Main(string[] args)
{
// Find your Account Sid and Token at twilio.com/console
const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
const string authToken = "your_auth_token";
TwilioClient.Init(accountSid, authToken);
var call = CallResource.Create(
url: new Uri("http://demo.twilio.com/docs/voice.xml"),
to: new Twilio.Types.PhoneNumber("+15558675310"),
from: new Twilio.Types.PhoneNumber("+15017122661")
);
Console.WriteLine(call.Sid);
}
}
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.Call;
import com.twilio.type.PhoneNumber;
import java.net.URI;
public class Example {
// Find your Account Sid and Token at twilio.com/console
public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
public static final String AUTH_TOKEN = "your_auth_token";
public static void main(String[] args) {
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
Call call = Call.creator(
new com.twilio.type.PhoneNumber("+15558675310"),
new com.twilio.type.PhoneNumber("+15017122661"),
URI.create("http://demo.twilio.com/docs/voice.xml"))
.create();
System.out.println(call.getSid());
}
}
// Download the helper library from https://www.twilio.com/docs/node/install
// Your Account Sid and Auth Token from twilio.com/console
const accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
const authToken = "your_auth_token";
const client = require("twilio")(accountSid, authToken);
client.calls
.create({
url: "http://demo.twilio.com/docs/voice.xml",
to: "+15558675310",
from: "+15017122661",
})
.then((call) => console.log(call.sid))
.done();
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)
call = client.calls.create(
url='http://demo.twilio.com/docs/voice.xml',
to='+15558675310',
from_='+15017122661'
)
print(call.sid)
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'rubygems'
require 'twilio-ruby'
# Your Account Sid and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new(account_sid, auth_token)
call = @client.calls.create(
url: 'http://demo.twilio.com/docs/voice.xml',
to: '+15558675310',
from: '+15017122661'
)
puts call.sid
パワフルな音声APIプリミティブ
Programmatic call control
アプリからTwilioに対して、通話の進め方をリアルタイムで指示します。想定されるほぼすべてのワークフローを構築できます。
Voice APIのドキュメントを見る<Response> <Play>/ahoy.mp3</Play> <Dial action="/forward"> +15551234456 </Dial> </Response>
<Response> <Gather action="/process-keypad-input"> <Say language="en-gb"> Ahoy! Choose an option. For Sales press 1. For Support press 2. </Say> </Gather> </Response>
<Response> <Dial> <Client>jenny</Client> </Dial> </Response>
<Dial> WebRTCを採用した<Client>
Twilio Client SDKを使用し、通話をWebアプリやモバイルアプリに接続。TwiMLは通話に接続するクライアントユーザー名を指定します。
ドキュメントを見る<Response> <Say language="en-gb"> Ahoy! Please hold while we connect you to an agent. </Say> <Queue url="/support-hold"> support-wait-queue </Queue> </Response>
<Response> <Dial> <Number statusCallbackEvent="initiated ringing answered completed" statusCallback="https://myapp.com/calls/events" statusCallbackMethod="POST"> +14158675309 </Number> </Dial> </Response>
Twilioのメリット
信頼性の高い通信
自動フェイルオーバーを備え、メンテナンス期間がないことによる99.95%のアップタイムSLAをご体験ください。
大規模運用
ローカリゼーションとコンプライアンスを想定した構成可能な機能を備えており、作成済みのアプリを新規市場に拡大して展開できます。
多数のチャネル
音声、SMS、動画、チャット、2要素認証などで使い慣れた同じプラットフォームを活用できます。
公平・誠実なプラン
従量制の料金プランにより短期間で市場に参入できます。しかもサポートは無料。契約なしで自由に規模を調整できます。
もっと知りたい方は、 お問い合わせ