【问题标题】:Twilio tell the queued callers which number in a queue are they in,Twilio 告诉排队的呼叫者他们在队列中的哪个号码,
【发布时间】:2020-04-14 16:35:50
【问题描述】:

我正在尝试通知排队的呼叫者他们在队列中的位置,

这是我当前的 twilio 函数,它使调用入队

  let twiml = new Twilio.twiml.VoiceResponse();

    twiml.say("Please hold, while we connect you to one of our available agent ");
    twiml.enqueue({
    workflowSid: context.WORKFLOW_SID,
    })
    .task({}, `{"selected_skill":"operator","name":"${event.name}","email":"${event.email}"}`);
  callback(null, twiml);
so here i want to add something like twiml.say("You are now number ${number} in the queue");
};

但我被困住了。在 php 中,我像这样使用 twiml:

header("Content-type: text/xml");


$var = $_POST['QueuePosition'];

$message = '<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Play>http://com.twilio.sounds.music.s3.amazonaws.com/ClockworkWaltz.mp3</Play>
    <Say>You are currently in position '.$var.' in the queue.</Say>
    <Queue url="about_to_connect.php">support</Queue>
</Response>';
echo $message;

它可以工作,但现在我想使用/正在使用 twilio 功能。

请帮忙

提前致谢

【问题讨论】:

    标签: twilio twilio-api twilio-functions


    【解决方案1】:

    这里是 Twilio 开发者宣传员。

    Twilio Function 中的$_POST['QueuePosition'] 等价于event.QueuePosition。

    如果您收到这样的队列位置,您可以使用以下代码将其插入&lt;Say&gt;:

    const number = event.QueuePosition;
    twiml.say(`You are now number ${number} in the queue`);
    

    注意对字符串使用反引号以允许使用${} 进行插值。

    【讨论】:

      猜你喜欢
      • 2013-08-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多