TwiML™ Voice: <Leave>

<Leave> 動詞は、キューで待機している通話の制御を移し、発信者をキューから外し、元の <Enqueue> の次の動詞を実行します。

動詞の属性

<Leave> 動詞は属性をサポートしません。

例: キューを外れる

この例では、サポート電話のキューに複数の人が待機しています。サポート電話は午後 9 時で終了するため、発信者にはキューを外れたことを通知し、明日かけ直してもらわなければなりません。

最初の通話の TwiML は、次のようになります。

コードサンプルを読み込んでいます...
Language
SDKバージョン:
  • 5.x
SDKバージョン:
  • 7.x
SDKバージョン:
  • 3.x
SDKバージョン:
  • 5.x
SDKバージョン:
  • 6.x
SDKバージョン:
  • 5.x
形式:
  • TwiML
const VoiceResponse = require('twilio').twiml.VoiceResponse;

const response = new VoiceResponse();
response.enqueue(
  {
    waitUrl: 'wait.xml',
  },
  'support'
);
response.say(
  'Unfortunately, the support line has closed. Please call again tomorrow.'
);

console.log(response.toString());
using Twilio.TwiML;
using System;


class Example
{
    static void Main()
    {
        var response = new VoiceResponse();
        response.Enqueue("support", waitUrl: new Uri("wait.xml"));
        response
            .Say("Unfortunately, the support line has closed. Please call again tomorrow.");

        Console.WriteLine(response.ToString());;
    }
}
<?php
require_once './vendor/autoload.php';
use Twilio\Twiml;

$response = new Twiml();
$response->enqueue('support', ['waitUrl' => 'wait.xml']);
$response->say('Unfortunately, the support line has closed. Please call again tomorrow.');

echo $response;
require 'twilio-ruby'

response = Twilio::TwiML::VoiceResponse.new
response.enqueue(name: 'support', wait_url: 'wait.xml')
response
  .say('Unfortunately, the support line has closed. ' \
       'Please call again tomorrow.')

puts response
from twilio.twiml.voice_response import Enqueue, VoiceResponse, Say

response = VoiceResponse()
response.enqueue('support', wait_url='wait.xml')
response.say(
    'Unfortunately, the support line has closed. Please call again tomorrow.')

print(response)
import com.twilio.twiml.voice.Enqueue;
import com.twilio.twiml.VoiceResponse;
import com.twilio.twiml.voice.Say;
import com.twilio.twiml.TwiMLException;


public class Example {
    public static void main(String[] args) {
        Enqueue enqueue = new Enqueue.Builder().waitUrl("wait.xml")
            .name("support").build();
        Say say = new Say
            .Builder("Unfortunately, the support line has closed. Please call again tomorrow.").build();
        VoiceResponse response = new VoiceResponse.Builder().enqueue(enqueue)
            .say(say).build();

        try {
            System.out.println(response.toXml());
        } catch (TwiMLException e) {
            e.printStackTrace();
        }
    }
}
<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Enqueue waitUrl="wait.xml">support</Enqueue>
    <Say>Unfortunately, the support line has closed. Please call again tomorrow.</Say>
</Response>
終了した電話窓口で通話を待ち行列へ追加する

午後 9 時までは保留音を再生するよう、wait.xml を設定します。

コードサンプルを読み込んでいます...
Language
SDKバージョン:
  • 5.x
SDKバージョン:
  • 7.x
SDKバージョン:
  • 3.x
SDKバージョン:
  • 5.x
SDKバージョン:
  • 6.x
SDKバージョン:
  • 5.x
形式:
  • TwiML
const VoiceResponse = require('twilio').twiml.VoiceResponse;

const response = new VoiceResponse();
response.play('http://com.twilio.sounds.music.s3.amazonaws.com/MARKOVICHAMP-Borghestral.mp3');

console.log(response.toString());
using Twilio.TwiML;
using System;

class Example
{
    static void Main()
    {
        var response = new VoiceResponse();
        response
            .Play(new Uri("http://com.twilio.sounds.music.s3.amazonaws.com/MARKOVICHAMP-Borghestral.mp3"));

        Console.WriteLine(response.ToString());;
    }
}
<?php
require_once './vendor/autoload.php';
use Twilio\Twiml;

$response = new Twiml();
$response->play('http://com.twilio.sounds.music.s3.amazonaws.com/MARKOVICHAMP-Borghestral.mp3');

echo $response;
require 'twilio-ruby'

response = Twilio::TwiML::VoiceResponse.new
response.play(url: 'http://com.twilio.sounds.music.'\
                   's3.amazonaws.com/MARKOVICHAMP-Borghestral.mp3')

puts response
from twilio.twiml.voice_response import Play, VoiceResponse

response = VoiceResponse()
response.play(
    'http://com.twilio.sounds.music.s3.amazonaws.com/MARKOVICHAMP-Borghestral.mp3'
)

print(response)
import com.twilio.twiml.voice.Play;
import com.twilio.twiml.VoiceResponse;
import com.twilio.twiml.TwiMLException;


public class Example {
    public static void main(String[] args) {
        Play play = new Play
            .Builder("http://com.twilio.sounds.music.s3.amazonaws.com/MARKOVICHAMP-Borghestral.mp3").build();
        VoiceResponse response = new VoiceResponse.Builder().play(play).build();

        try {
            System.out.println(response.toXml());
        } catch (TwiMLException e) {
            e.printStackTrace();
        }
    }
}
<?xml version="1.0" encoding="UTF-8"?>
<Response>
     <Play>http://com.twilio.sounds.music.s3.amazonaws.com/MARKOVICHAMP-Borghestral.mp3</Play>
</Response>
オーディオをPlay(再生)する

午後 9 時以降は、wait.xml は発信者をキューから外し、制御を元の通話 TwiML の <Say> ブロックへ戻します。

コードサンプルを読み込んでいます...
Language
SDKバージョン:
  • 5.x
SDKバージョン:
  • 7.x
SDKバージョン:
  • 3.x
SDKバージョン:
  • 5.x
SDKバージョン:
  • 6.x
SDKバージョン:
  • 5.x
形式:
  • TwiML
const VoiceResponse = require('twilio').twiml.VoiceResponse;

const response = new VoiceResponse();
response.leave();

console.log(response.toString());
using Twilio.TwiML;
using System;


class Example
{
    static void Main()
    {
        var response = new VoiceResponse();
        response.Leave();

        Console.WriteLine(response.ToString());;
    }
}
<?php
require_once './vendor/autoload.php';
use Twilio\Twiml;

$response = new Twiml();
$response->leave();

echo $response;
require 'twilio-ruby'

response = Twilio::TwiML::VoiceResponse.new
response.leave

puts response
from twilio.twiml.voice_response import Leave, VoiceResponse

response = VoiceResponse()
response.leave()

print(response)
import com.twilio.twiml.voice.Leave;
import com.twilio.twiml.VoiceResponse;
import com.twilio.twiml.TwiMLException;


public class Example {
    public static void main(String[] args) {
        Leave leave = new Leave.Builder().build();
        VoiceResponse response = new VoiceResponse.Builder().leave(leave)
            .build();

        try {
            System.out.println(response.toXml());
        } catch (TwiMLException e) {
            e.printStackTrace();
        }
    }
}
<?xml version="1.0" encoding="UTF-8"?>
<Response>
     <Leave />
</Response>
待ち行列を離れる

ヘルプが必要ですか?

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

コードサンプルを読み込んでいます...
SDKバージョン:
  • 5.x
SDKバージョン:
  • 7.x
SDKバージョン:
  • 3.x
SDKバージョン:
  • 5.x
SDKバージョン:
  • 6.x
SDKバージョン:
  • 5.x
形式:
  • TwiML
const VoiceResponse = require('twilio').twiml.VoiceResponse;

const response = new VoiceResponse();
response.enqueue(
  {
    waitUrl: 'wait.xml',
  },
  'support'
);
response.say(
  'Unfortunately, the support line has closed. Please call again tomorrow.'
);

console.log(response.toString());
using Twilio.TwiML;
using System;


class Example
{
    static void Main()
    {
        var response = new VoiceResponse();
        response.Enqueue("support", waitUrl: new Uri("wait.xml"));
        response
            .Say("Unfortunately, the support line has closed. Please call again tomorrow.");

        Console.WriteLine(response.ToString());;
    }
}
<?php
require_once './vendor/autoload.php';
use Twilio\Twiml;

$response = new Twiml();
$response->enqueue('support', ['waitUrl' => 'wait.xml']);
$response->say('Unfortunately, the support line has closed. Please call again tomorrow.');

echo $response;
require 'twilio-ruby'

response = Twilio::TwiML::VoiceResponse.new
response.enqueue(name: 'support', wait_url: 'wait.xml')
response
  .say('Unfortunately, the support line has closed. ' \
       'Please call again tomorrow.')

puts response
from twilio.twiml.voice_response import Enqueue, VoiceResponse, Say

response = VoiceResponse()
response.enqueue('support', wait_url='wait.xml')
response.say(
    'Unfortunately, the support line has closed. Please call again tomorrow.')

print(response)
import com.twilio.twiml.voice.Enqueue;
import com.twilio.twiml.VoiceResponse;
import com.twilio.twiml.voice.Say;
import com.twilio.twiml.TwiMLException;


public class Example {
    public static void main(String[] args) {
        Enqueue enqueue = new Enqueue.Builder().waitUrl("wait.xml")
            .name("support").build();
        Say say = new Say
            .Builder("Unfortunately, the support line has closed. Please call again tomorrow.").build();
        VoiceResponse response = new VoiceResponse.Builder().enqueue(enqueue)
            .say(say).build();

        try {
            System.out.println(response.toXml());
        } catch (TwiMLException e) {
            e.printStackTrace();
        }
    }
}
<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Enqueue waitUrl="wait.xml">support</Enqueue>
    <Say>Unfortunately, the support line has closed. Please call again tomorrow.</Say>
</Response>
SDKバージョン:
  • 5.x
SDKバージョン:
  • 7.x
SDKバージョン:
  • 3.x
SDKバージョン:
  • 5.x
SDKバージョン:
  • 6.x
SDKバージョン:
  • 5.x
形式:
  • TwiML
const VoiceResponse = require('twilio').twiml.VoiceResponse;

const response = new VoiceResponse();
response.play('http://com.twilio.sounds.music.s3.amazonaws.com/MARKOVICHAMP-Borghestral.mp3');

console.log(response.toString());
using Twilio.TwiML;
using System;

class Example
{
    static void Main()
    {
        var response = new VoiceResponse();
        response
            .Play(new Uri("http://com.twilio.sounds.music.s3.amazonaws.com/MARKOVICHAMP-Borghestral.mp3"));

        Console.WriteLine(response.ToString());;
    }
}
<?php
require_once './vendor/autoload.php';
use Twilio\Twiml;

$response = new Twiml();
$response->play('http://com.twilio.sounds.music.s3.amazonaws.com/MARKOVICHAMP-Borghestral.mp3');

echo $response;
require 'twilio-ruby'

response = Twilio::TwiML::VoiceResponse.new
response.play(url: 'http://com.twilio.sounds.music.'\
                   's3.amazonaws.com/MARKOVICHAMP-Borghestral.mp3')

puts response
from twilio.twiml.voice_response import Play, VoiceResponse

response = VoiceResponse()
response.play(
    'http://com.twilio.sounds.music.s3.amazonaws.com/MARKOVICHAMP-Borghestral.mp3'
)

print(response)
import com.twilio.twiml.voice.Play;
import com.twilio.twiml.VoiceResponse;
import com.twilio.twiml.TwiMLException;


public class Example {
    public static void main(String[] args) {
        Play play = new Play
            .Builder("http://com.twilio.sounds.music.s3.amazonaws.com/MARKOVICHAMP-Borghestral.mp3").build();
        VoiceResponse response = new VoiceResponse.Builder().play(play).build();

        try {
            System.out.println(response.toXml());
        } catch (TwiMLException e) {
            e.printStackTrace();
        }
    }
}
<?xml version="1.0" encoding="UTF-8"?>
<Response>
     <Play>http://com.twilio.sounds.music.s3.amazonaws.com/MARKOVICHAMP-Borghestral.mp3</Play>
</Response>
SDKバージョン:
  • 5.x
SDKバージョン:
  • 7.x
SDKバージョン:
  • 3.x
SDKバージョン:
  • 5.x
SDKバージョン:
  • 6.x
SDKバージョン:
  • 5.x
形式:
  • TwiML
const VoiceResponse = require('twilio').twiml.VoiceResponse;

const response = new VoiceResponse();
response.leave();

console.log(response.toString());
using Twilio.TwiML;
using System;


class Example
{
    static void Main()
    {
        var response = new VoiceResponse();
        response.Leave();

        Console.WriteLine(response.ToString());;
    }
}
<?php
require_once './vendor/autoload.php';
use Twilio\Twiml;

$response = new Twiml();
$response->leave();

echo $response;
require 'twilio-ruby'

response = Twilio::TwiML::VoiceResponse.new
response.leave

puts response
from twilio.twiml.voice_response import Leave, VoiceResponse

response = VoiceResponse()
response.leave()

print(response)
import com.twilio.twiml.voice.Leave;
import com.twilio.twiml.VoiceResponse;
import com.twilio.twiml.TwiMLException;


public class Example {
    public static void main(String[] args) {
        Leave leave = new Leave.Builder().build();
        VoiceResponse response = new VoiceResponse.Builder().leave(leave)
            .build();

        try {
            System.out.println(response.toXml());
        } catch (TwiMLException e) {
            e.printStackTrace();
        }
    }
}
<?xml version="1.0" encoding="UTF-8"?>
<Response>
     <Leave />
</Response>