mercredi 18 février 2015

Members of Twilio Queue undefined

I am getting an error when attempting to access members of a queue.


I have tried both methods below for adding members to the queue in case I was mistaken about how the system worked. (I started using the Enqueue method)



<?xml version="1.0" encoding="UTF-8" ?>
<Response>
<Dial>
<Queue waitUrl="http://ift.tt/1G1Rowt">support</Queue>
</Dial>
</Response>


and



<?xml version="1.0" encoding="UTF-8" ?>
<Response>
<Enqueue waitUrl="http://ift.tt/1G1Rowt">support</Enqueue>
</Response>


Both of these seem to work in adding the call to the queue and playing the hold music


I have also checked to make sure I have the correct SID for the queue


Running the code



client.queues.list(function(err, data) {
data.queues.forEach(function(queue) {
console.log(queue.friendlyName + ": " + queue.sid);
});
});


give me the result


support: QUxxxxxxxxxxxxxxxx6


Yet when I have calls in the queue holding and try to extract data using an example right from the twilio API page at http://ift.tt/1G1RmEM



client.queues('QUxxxxxxxxxxxxxxxx6').members.list(function(err, data) {
data.members.forEach(function(member) {
console.log(member.Position);
});
});


I get the following error



GET /inbound/call/agent 200 39.997 ms - 73

/var/www/tcc/node_modules/twilio/node_modules/q/q.js:126
throw e;
^
TypeError: Cannot call method 'forEach' of undefined
at /var/www/tcc/routes/index.js:348:20
at /var/www/tcc/node_modules/twilio/node_modules/q/q.js:1920:17
at flush (/var/www/tcc/node_modules/twilio/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:415:13)
17 Feb 14:02:42 - [nodemon] app crashed - waiting for file changes before starting...

Aucun commentaire:

Enregistrer un commentaire