Hold, unhold feature for Twilio call which is already running -
i've twilio call routed agent via taskrouter(task, reservation created, agent has accepted call) , agent needs hold, unhold feature same twilio call. can please provide best practice this? can en-queuing call workflow?if yes then, how should redirect same call same agent un-hold feature?
please let me know if has code snippet available. i'm using php
you can handle 1 of few ways basic process is:
first, provide twilio twiml places call "hold" when you're ready, use callsid of call , rest api redirect live call.
<?php // php helper library twilio.com/docs/php/install require_once('/path/to/twilio-php/services/twilio.php'); // loads library // account sid , auth token twilio.com/user/account $sid = "your_account_sid"; $token = "your_auth_token"; $client = new services_twilio($sid, $token); // object sid. if not have sid, // check out list resource examples on page $call = $client->account->calls->get("call_sid"); $call->update(array( "url" => "http://demo.twilio.com/docs/voice.xml", "method" => "post" )); echo $call->to;
to handle "hold" can use <enqueue>
verb guessed, placing call call queue. when ready, redirect call out of queue new experience.
or can use <play>
, set loop
attribute zero, tell twilio loop audio indefinitely. , again, redirect call when ready remove hold.
Comments
Post a Comment