I have implemented Twilio Conference call using Twilio JavaScript SDK and PHP. So far, the functionality that is working is:
- Agent can make an outgoing call from browser to a mobile phone
- Agent can receive an incoming call on browser from another phone
<?php
require_once './vendor/autoload.php';
use Twilio\TwiML\VoiceResponse;
use Twilio\Rest\Client;
$response = new VoiceResponse();
$dial = $response->dial('');
$dial->conference('first-conference-room',
['startConferenceOnEnter' => 'true', 'endConferenceOnExit' => 'true']);
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);
$twilio->conferences("first-conference-room")
->participants
->create($fromnumber,
$tonumber,[
"statusCallbackEvent" => ["ringing","initiated","answered","completed"],
"statusCallback" => "link-to-php-function-to-write-call-record-to-database",
"statusCallbackMethod" => "POST"
]);
return $response;
?>
Now, as a supervisor, once a conference call is established between the agent (using browser) and another phone number, I fetch and show the ongoing call's record with a button to join as a supervisor.
Any suggestion on what can be done so 3rd person can join the conference as supervisor or coach?
A separate question - Is a Twilio conference between three people (numbers) charged as two Twilio voice calls or one Twilio voice call with third person joining the conference for a smaller fee?