1

I've followed every single step in the Twilio's documentation called Dynamic Call Center with Laravel.

My problem is that a call gets through the IVR, then after choosing a digit, nothing happens.

My guess is that its not creating a task. the code provided in the documentation just generate a task with json but thats it. I check my tasks in Twilio taskrouter console and nothing shows up.

I've provided all credentials, used ngrok, filled in all url callbacks.

public function enqueueCall(Request $request)
{
    define('workflowSid', env('TWILIO_WORKFLOW_SID'));

    $selectedSkillInstruction = new \StdClass();
    $selectedSkillInstruction->selected_skill = $this->_getSelectedSkill($request);
    $response = new Twiml();
    $enqueue = $response->enqueue(['workflowSid' => workflowSid]);
    $enqueue->task(json_encode($selectedSkillInstruction));
    return response($response)->header('Content-Type', 'text/xml');
}

I expect a code that actually creates a task, but when I call this api via postman, a task is not created

Dmytro Dadyka
  • 2,208
  • 5
  • 18
  • 31
Mr. J
  • 21
  • 3

2 Answers2

1

The above code returns Twilio Markup Language (TwiML) which uses the enqueue verb and a workflowSid attribute. The enqueue verb is used with Programmable Voice. Have you tried associating your application with a Twilio phone number and then calling the Twilio number which should enqueue the call into a task router workflow?

TwiML Voice: Enqueue

https://www.twilio.com/docs/voice/twiml/enqueue#attributes-workflowSid

Alan
  • 10,465
  • 2
  • 8
  • 9
  • Yes, I already bought a Twilio phone number, I've called it using a landline and when I choose a digit, it does not get routed to my workers contact_uri. when I create a task manually (without calling), it works fine and it gets reserved to my worker. I notice that while calling and after picking a digit, a task does not get created. – Mr. J May 04 '19 at 11:14
  • When you say choose a digit, it sounds like it may be using a trial account, https://www.twilio.com/docs/usage/tutorials/how-to-use-your-free-trial-account#trial-account-restrictions-and-limitations. You need to wait for the full message to complete before pressing a digit. My recommendation is to use Request Inspector, https://support.twilio.com/hc/en-us/articles/223136407-Debugging-your-application, to look up the CallSID you placed to you Twilio number and see the returned TwiML, to make sure it is correct. – Alan May 05 '19 at 12:10
1

I have solved my problem. It turned out that everything was in order, the only problem is that I didn't know I need to press # after choosing from the IVR because all the demo I saw from Twilio only press a number and it gets routed.

Mr. J
  • 21
  • 3