Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

115
Visualizações
Twilio Task Router

I am using task Router with twilio. I have added three Workers (Users) e.g USER_A,USER_B and USER_C. Each user has attributes which has name and company. USER_A and USER_B belongs to same company lets say Company_A and USER_C belongs to other company lets say COMPANY_C.

I have added code for my voice callback url here as in //example.com/routing.php :

<?php

header('Content-Type: application/xml');
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";

?>
<Response>
  <Gather action="enqueue-call.php" numDigits="1" timeout="10">
    <Say>Press One for Company A</Say>
    <Say>Press Two For Company C</Say>
  </Gather>
</Response>

And here is my enqueue-call.php :

<?php

$digit_pressed = $_REQUEST['Digits'];

if ($digit_pressed == '1') {
  $company = "company_a";
} else {
  $company = "company_c";
}

header('Content-Type: application/xml');
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";

?>

<Response>
  <Enqueue workflowSid="xxxxxxxxxxxxxxxxxxxxx">
    <Task>{"selected_company": "<?php echo $company ?>"}</Task>
  </Enqueue>
</Response>

Everything here is completely working.

The requirement in my case is i want to call the selected worker on browser not on worker's mobile. According to this tutorial : https://www.twilio.com/docs/quickstart/php/taskrouter/twiml-dequeue-call They are calling the worker's mobile number.

I have added the agent screen to my each worker as well by following this tutorial : https://www.twilio.com/docs/quickstart/php/taskrouter/agent-ui-add-project I have added this code in my agent.php file.

So the requirement is to transfer the incoming call for selected worker on my agent.php

This is my Assigment Callback URL exapmle.com/assignment.php :

<?php

$assignment_instruction = [
  'instruction' => 'dequeue',
  'post_work_activity_sid' => '{WA0123401234...}',
  'from' => '+15556667777' // a verified phone number from your twilio account 
];

header('Content-Type: application/json');
echo json_encode($assignment_instruction);

What should be code for me to add here to call the selected worker which is available ?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Twilio developer evangelist here.

If you are doing a dequeue and it calls the worker's mobile number, then you must have set up the worker's contact_uri as the number.

To get it to call the worker in their browser from a dequeue action you need to set that contact_uri to their client name, like this client:USER_A.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda