Victor
Victor

Reputation: 835

Put caller on hold twilio version=1.5

I'm trying to implement hold calls functionality with Twilio api.

What is the best way in 2018 without TaskRouter to put caller on hold?

I've been tried to use enqueue and conference but failed.

Maybe someone have the example of code for this. Thanks for helping!

Upvotes: 0

Views: 78

Answers (1)

philnash
philnash

Reputation: 73029

Twilio developer evangelist here.

There is actually a direct way to place a caller on hold in a conference call with Twilio. Using the participants resource you can place a participant on hold by updating the resource, setting Hold to true. You can set a URL to play hold music by updating the HoldUrl at the same time.

See below for an example in PHP:

use Twilio\Rest\Client;

$sid    = "your_account_sid";
$token  = "your_auth_token";
$twilio = new Client($sid, $token);

$participant = $twilio->conferences("conference_sid")
                      ->participants("participant_sid")
                      ->update(array(
                                   "hold" => True,
                                   "holdUrl" => "http://www.myapp.com/hold"
                               )
                      );

Let me know if that helps at all.

Upvotes: 0

Related Questions