Search code examples
twiliotwilio-apitwilio-phptwilio-functions

Taskrouter problem using Laravel. Task not getting created?


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


Solution

  • 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.