I am working on Contact Center application using Twilio TaskRouter and Nodejs. I have setup all the TaskRouter configuration by following quick start tutorial but when I call to Twilio Contact Center number (Twilio Number) every time call get canceled and shows Reason for cancelation as Max assignment exceeded below is code.
app.post('/call', function(req, res) {
console.log('Incoming Call Center!!');
var twiml = new Twilio.TwimlResponse();
var message = "Thanks for calling support line. One of our agents will speak with you soon.";
var json = JSON.stringify({selected_type:"support"});
twiml.say(message, {
voice:'woman',
language:'en-gb'
});
twiml.enqueue({workflowSid:sid}, function(node) {
node.task(json);
});
res.writeHead(200, {
'Content-Type' : 'text/xml'
});
res.end(twiml.toString());
console.log('Outbound : ',twiml.toString());
});
app.post('/assign', function(req, res) {
var reservationSid = JSON.stringify(req.body.ReservationSid);
var taskSid = JSON.stringify(req.body.TaskSid);
console.log('Reservation SID : ', reservationSid);
console.log('Task SID : ', taskSid);
var data = JSON.stringify({
"instruction": "dequeue",
"from": fromNo
});
// dequeue a reservation
res.writeHead(200, {
"Content-Type" : "application/json"
});
//res.setHeader('Content-Type', 'application/json');
res.end(data);
});
when I use instruction as accept then Task Assignment Status shows assigned and Worker also shows Busy but no call initiated to the worker contact_uri.
I am using Twilio Trial account. Is am I missing anything?