Twilio 告诉排队的呼叫者他们在队列中的哪个号码,

Twilio tell the queued callers which number in a queue are they in,

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

这是我当前的 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;

它有效,但现在我想 use/am 使用 twilio 函数。

请帮忙

提前致谢

这里是 Twilio 开发人员布道者。

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

如果您收到这样的队列位置,您可以使用以下代码将其插入 <Say>

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

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