標準的なIVRツリーを網羅した、いくつかのIVR例をご用意しました。

重要: play コマンド内のファイルへのリンクは無効であり、あくまで例として記載しています。実際のリンクは、ご自身の録音を追加・挿入すると自動的に生成されます。

基本例

online:
  - play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=connect-first-available-agent.mp3
  - ring
queue:
  - play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=next-in-queue.mp3
offline:
  - play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=we-are-currently-not-available-check-website.mp3
  - voicemail

エージェントがオンラインの場合、connect-first-available-agent.mp3 が再生され、対応可能な最初のエージェントに着信が鳴ります。すべてのエージェントが対応中の場合、着信はキューに入れられ、キュー音楽として next-in-queue.mp3 が再生されます。着信に対応できるエージェントが誰もオンラインでない場合、オフラインアナウンス we-are-currently-not-available-check-website.mp3 が再生され、発信者はボイスメールを残すことができます。

応用例

start:
  - play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=connect-first-available-agent.mp3
  - choice:
      1:
        name: Sales department
        play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=press-one-for-sales.mp3
        do:
          - transfer:
              to: salesDepartmentID
              if:
                online:
                  - play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=connect-first-available-agent.mp3
                  - ring
                offline:
                  - goto: voicemail
      2:
        name: Technical department
        play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=press-two-for-technical-support.mp3
        do:
          - transfer:
              to: techDepID
              if:
                online:
                  - ring
                offline:
                  - goto: offline
      3:
        name: Request calback
        play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=press_2_to_request_callback.mp3
        do:
          - callback
voicemail:
  - play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=leave-a-voicemail.mp3
  - voicemail
offline:
  - play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=we-are-currently-not-available-check-website.mp3
queue:
  - play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=next-in-queue.mp3
  - choice:
      0:
        name: Wait
        play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=press-zero-to-wait-in-queue.mp3
        goto: queue
      1:
        name: Leave voicemail
        play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=press-one-to-leave-a-voicemail.mp3
        goto: voicemail

IVRは start セクションから始まり、ウェルカムメッセージ connect-first-available-agent.mp3 を再生します。その後、選択肢メッセージ press-one-for-sales.mp3、press-two-for-technical-support.mp3、press_2_to_request_callback.mp3 がループで再生されます。発信者は、これらの選択肢が再生されている間、いつでもキーを押すことができます。

発信者が1を押すと、着信は Sales department(営業部門)に転送されます。salesDepartmentID はご自身の部門のIDに置き換えてください。Sales department のエージェントがオンラインの場合、connect-first-available-agent.mp3 が再生され、着信が鳴ります。その部門の誰もオンラインでない場合、着信は voicemail セクションに進み、leave-a-voicemail.mp3 が再生され、発信者はボイスメールを録音できます。

発信者が2を押すと、着信は Technical department(技術サポート部門)に転送されます。techDepID はご自身の部門のIDに置き換えてください。Technical department のエージェントがオンラインの場合、着信が鳴ります。その部門の誰もオンラインでない場合、着信は offline セクションに進み、we-are-currently-not-available-check-website.mp3 が再生されます。

発信者が3を押すと、着信は切断され、コールバックリクエストが着信キューに入れられ、対応可能なエージェントが対応するまで待機します。詳しくは自動コールバックリクエストをご覧ください。

すべてのエージェントが対応中の場合、発信者は queue セクションに置かれます。next-in-queue.mp3 が再生された後、発信者は0を押して待機を続けるか、1を押してボイスメールを残すことができます。

注意: choice コマンドは2通りの方法で記述できます。start セクションでは、各選択肢は do の下にあるコマンドのリストを実行します。queue セクションでは、各選択肢は goto で直接別のセクションにジャンプします。どちらでも使いやすい方を選んでご利用いただけます。

通話録音の同意に関する例

(例えばGDPR準拠のために)通話が録音される前に発信者の同意が必要な場合、通話を録音するかどうかをIVR内で発信者に選択させることができます。これには、2つのIVRコマンドが利用可能です:

  • recording_on – 通話が録音されます。
  • recording_off – 通話は録音されません。

これらのコマンドは、現在の通話に限り、電話番号のRecord incoming calls(着信を録音する)設定を上書きします。パラメータは取りません。通常の使用方法は choice の中で使用し、発信者がキーを押して録音を許可または拒否できるようにします:

start:
  - play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=welcome-call-recording-consent.mp3
  - choice:
      1:
        name: Allow recording
        play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=press-one-to-allow-recording.mp3
        do:
          - recording_on
          - goto: connect
      2:
        name: Do not record
        play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=press-two-to-not-allow-recording.mp3
        do:
          - recording_off
          - goto: connect
connect:
  - play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=connect-first-available-agent.mp3
  - ring
offline:
  - play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=we-are-currently-not-available-check-website.mp3
  - voicemail
queue:
  - play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=next-in-queue.mp3

IVRは start セクションから始まり、welcome-call-recording-consent.mp3 のメッセージを再生します。例えば、「お電話ありがとうございます。サービスの品質向上のため、この通話を録音させていただきたく存じます。」といった内容です。その後、発信者がキーを押すまで、選択肢メッセージ press-one-to-allow-recording.mp3 と press-two-to-not-allow-recording.mp3 がループで再生されます。

発信者が1を押すと、通話録音がオンになります。発信者が2を押すと、通話録音がオフになります。どちらの場合も、着信は connect セクションに進み、connect-first-available-agent.mp3 が再生され、対応可能な最初のエージェントに着信が鳴ります。通話は、発信者が1を押した場合にのみ録音されます。

発信者の選択は、通話チケットにシステムメッセージ「Turning on call recording」または「Turning off call recording」として表示されるため、エージェントは発信者が録音に同意したかどうかを確認できます。

注意: recording_on または recording_off は、発信者をエージェントに接続するステップ(ring または transfer)より前に配置してください。これらのコマンドは、すでに実行中の録音を開始または停止するものではなく、通話に応答した際に録音されるかどうかを設定するものです。

ヒント: 特定の部門に対してのみ同意を求めたい場合は、その部門の transfer コマンドの直前、do リスト内に recording_on または recording_off を配置してください。

動的IVRの例

start:
  - fetch:
      url: https://my.dynamic.script
      onError: offline
      params:
        from: {$from_number}
        to: {$to_number}
        ticket: {$conv_code}
offline:
  - play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=leave-a-voicemail.mp3
  - voicemail
queue:
  - play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=next-in-queue.mp3

例えば発信者が誰であるかに基づいてIVRスクリプトを動的に生成したい場合は、fetch コマンドを使用します。上記の例では、start セクションには1つのステップしかありません。これは https://my.dynamic.script へPOSTリクエストを送信し、着信はご自身のスクリプトから返されたIVRの start セクションで継続されます。

params の下に列挙されたパラメータは、HTMLフォームが送信される場合と同様に、標準フォームデータ(application/x-www-form-urlencoded)としてリクエストボディで送信されます。この例では、ボディは from=421900123456&to=421233000000&ticket=ABC-DEFGH-123 のようになります。{$from_number} のようなプレースホルダーは、リクエストが送信される前に現在の通話の値に置き換えられます。必要なだけパラメータを追加でき、送信されるのはこれらのパラメータのみです。

ヒント: 発信者の連絡先情報やチケットフィールドなど、利用可能なすべての変数を確認するには、IVRエディターの右下隅にある小さな**ⓘ**アイコンをクリックしてください。変数は電話番号のIVRスクリプト内のどこでも使用できますが、ご自身のスクリプトから返されたIVR内では置き換えられません。

返されたIVRは goto を使用してメインスクリプトの任意のセクション(この例では start、offline、queue)にジャンプできるため、offline や queue のようなセクションをスクリプト内で繰り返す必要はありません。

例えば、ご自身のスクリプトが発信者の番号を認識し、以下のIVRを返す場合、パーソナライズされたウェルカムメッセージを再生した後、エージェントに着信を鳴らします:

start:
  - play: https://hello.john
  - ring

ご自身のスクリプトは、HTTPステータス200で応答し、正しいフォーマットとインデントでIVRスクリプトをレスポンスボディに返す必要があります。レスポンスのコンテンツタイプは問わないため、例えば text/plain や application/yaml を使用できます。

注意: ご自身のスクリプトへのリクエストが失敗した場合、またはスクリプトが有効なIVRを返さない場合、着信は onError に設定されたセクションで継続されます。onError が設定されていない場合、fetch ステップはスキップされます。

DTMF入力の例

start:
  - play: https://enter.your.dtmf.input.and.press.#.to.confirm
  - dtmf:
      url: https://my.dynamic.script
      onError: offline
      params:
        ticket: {$conv_code}
        value: DTMF_VALUE
offline:
  - play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=we-are-currently-not-available-check-website.mp3
queue:
  - play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=next-in-queue.mp3

発信者に、例えば注文番号などの入力を求めたい場合は、dtmf コマンドを使用します。上記の例では、メッセージにより発信者に入力を求め、#キーで確定するよう案内します。dtmf コマンドは、発信者が#を押すまで押されたキーを収集します。

入力は、動的IVRの例と同じ方法でご自身のスクリプトに送信されます。params 内の DTMF_VALUE プレースホルダーは入力された数字に置き換えられ、ご自身のスクリプトが着信の続きとなるIVRを返します。リクエストが失敗した場合、または返されたIVRが無効な場合、着信は onError に設定されたセクションで継続されます。

注意: dtmf コマンドは、発信者が#を押すまで待機します。そのため、発信者には必ず#キーで入力を確定するよう案内してください。

キーを押さずにキューで待機する例

発信者にキューで待機し続けるためのキー押下を求めず、ボイスメールを残すための1の押下のみを提供したい場合、queue セクションを以下のように記述します:

queue:
  - play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=next_in_queue.mp3
  - choice:
      0:
        name: Hidden option with music file
        play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=queue_music.mp3
        goto: queue
      1:
        name: Leave voicemail
        play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=press_one_to_leave_a_voicemail.mp3
        goto: voicemail

発信者がキューに入れられると、next_in_queue.mp3 が再生され、その後選択肢がループします: queue_music.mp3、press_one_to_leave_a_voicemail.mp3、再び queue_music.mp3、というように続きます。発信者には0を押すよう促されることはなく、キュー音楽を再生するだけなので、選択肢0は隠されています。発信者は、1を押してボイスメールを残すか、対応可能なエージェントが着信に対応するまでキューに留まります。

注意: 応用例と同様に、voicemail セクションをIVR内で定義する必要があります。

多言語IVRの例

英語とドイツ語など、複数の言語でIVRを提供したい場合、以下のような例になります:

start:
  - play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=connect-first-available-agent.mp3
  - choice:
      1:
        name: English
        play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=press-one-for-english-langauge.mp3
        goto: english
      2:
        name: German
        play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=press-two-for-german-language.mp3
        goto: german
english:
  - play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=connect-first-available-agent.mp3
  - choice:
      1:
        name: Sales department
        play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=press-one-for-sales.mp3
        do:
          - transfer:
              to: SalesDepartmentID
              if:
                online:
                  - ring
                offline:
                  - goto: voicemail
      2:
        name: Technical department
        play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=press-two-for-technical-support.mp3
        do:
          - transfer:
              to: TechnicalDepartmentID
              if:
                online:
                  - ring
                offline:
                  - goto: offline
german:
  - play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=connect-first-available-agent.mp3
  - choice:
      1:
        name: German Sales department
        play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=press-one-for-sales.mp3
        do:
          - transfer:
              to: germanSalesDepartmentID
              if:
                online:
                  - ring
                offline:
                  - goto: germanvoicemail
                queue:
                  - goto: germanqueue
      2:
        name: German Technical department
        play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=press-two-for-technical-support.mp3
        do:
          - transfer:
              to: germanTechnicalDepartmentID
              if:
                online:
                  - ring
                offline:
                  - goto: germanoffline
                queue:
                  - goto: germanqueue
voicemail:
  - play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=leave-a-voicemail.mp3
  - voicemail
offline:
  - play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=we-are-currently-not-available-check-website.mp3
queue:
  - play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=next-in-queue.mp3
germanvoicemail:
  - play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=leave-a-voicemail-german-language.mp3
  - voicemail
germanoffline:
  - play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=we-are-currently-not-available-check-website-german-language.mp3
germanqueue:
  - play: https://mycompany.ladesk.com/scripts/file.php?view=Y&file=next-in-queue-german-language.mp3

start セクションはウェルカムメッセージを再生し、発信者に言語を選択させます。1を押すと english セクションに進み、2を押すと german セクションに進みます。各言語セクションは、それぞれ独自の部門選択肢を提供し、その言語に対応する部門に着信を転送します。誰もオンラインでない場合、着信は選択された言語の voicemail セクションまたは offline セクションに進みます。キューで待機するドイツ語の発信者は germanqueue セクションに進み、next-in-queue-german-language.mp3 が再生されます。