我们想通过电话会议提供导师与用户之间的交流功能,因此以下是步骤:
一旦导师按1,然后在同一通话中将用户与导师加入。
<?php
require_once "vendor/autoload.php";
$keypair = new \Nexmo\Client\Credentials\Keypair(
file_get_contents('private.key__'),
'############################'
);
$client = new \Nexmo\Client($keypair);
$ncco = [
[
"action"=> "talk",
"text"=> "Welcome to a Voice API I V R. ",
"voiceName"=> "Amy",
"bargeIn"=> false
],
[
"action"=> "talk",
"text"=> "please press 1 to communicate with user",
"voiceName"=> "Amy",
"bargeIn"=> true
],
[
"action"=> "input",
"submitOnHash"=> true,
"eventUrl"=> ["https://studentzmojo.com/answer"]
]
];
$call = new \Nexmo\Call\Call();
$call->setTo('91XXXXXXXXX')
->setFrom('91XXXXXXXXX')
->setNcco($ncco);
$response = $client->calls()->create($call);
echo"<pre>";print_r($response);die;
echo $response->getId();
?>