I am using Twilio Taskrouter and am working on configuring my Assignment Callback handler. I'm using a Twilio Function to do this, if this matters.
I can successfully return a conference instruction as part of the callback. This works, but I'm unable to configure the conference status callback and I would like to find a way to do so. Can anyone help?
Is there any way to set the conference parameters when using a conference instruction?
Here's what I've tried:
return callback(null, {
"instruction":"conference",
"from": "<phone number>",
"statusCallback": "<Conference Status Callback Handler>"
});
try{
client.taskrouter.v1.workspaces(event.WorkspaceSid)
.tasks(event.TaskSid)
.reservations(event.ReservationSid)
.update({
instruction: 'conference',
from: '<phone number>',
statusCallback: 'https://<host>.ngrok.io/postConferenceStatusCallback',
conferenceStatusCallbackEvent: ['start', 'end', 'join', 'leave', 'mute', 'hold']
})
.then(reservation => console.log(reservation.workerName));
} catch (error) {
console.error(error);
return callback(error);
}
If I look at the conference logs, I can see that the initial request that sets up the resulting conferences sets up a different Conference status callback: "http://voiceorchestrator.callback.prod.twilio.com:11532/v1/Accounts/ /Meetings//ConferenceEvents?cluster=voice-orchestrator-34-34"
This makes it look like the Task Router conference instruction is managed by a voice orchestrator which needs the status callback events.
I did find this thread: How to record a call using twilio taskrouter conference instruction? but the parameters do not work.
UPDATE: after some additional testing, I was able to confirm that setting "conference_recording_status_callback" as part of the JSON return does work, as I can see this in the initial setup request parameters that Voice Orchestrator sends to the twilio platform.
This is actually kind of confusing because this page (https://www.twilio.com/docs/taskrouter/api/reservations#conference) says that I'm not supposed to be able to set conference recording status callback as part of a TaskRouter reservation update. It also says I should be able to set the conference status callback - so I don't know what to believe.
Still no luck changing the conference status callback - I am guessing that Voice Orchestrator needs this to ensure the conference is set up properly, but what would be really nice is if there were some way I could change the status callback url once the conference is set up. It's possible additional participants could get bridged into the conference, and I do need to get the reason the conference ended.
I would be grateful if anyone could tell me where these conference instruction parameters are specified, particularly the JSON key names. I know that the documentation says this should follow the Participants API, but I've not had any success setting these parameters and also the JSON key naming scheme seems unpredictable.
Solved: the issue was with the "conference_status_callback_event". You need to provide a single string with the events comma separated, as shown below - if you try to provide multiple values in a different way, you won't get any callback events at all.
Note that this syntax is different than how these are specified in TwiML or the Node.js helper library.
Thanks to Vigneswaran from Twilio support for the answer.
{
"instruction": "Conference",
"conference_record": "true",
"from": "+15555551234",
"conference_status_callback": https://<myid>.ngrok.io/postConferenceStatusCallback,
"conference_status_callback_method": "POST",
"conference_status_callback_event": "start, end, join, leave, mute, hold",
"end_conference_on_customer_exit": "true",
"conference_recording_status_callback": https://<myid>.ngrok.io/postConferenceRecording,
"conference_recording_status_callback_method": "POST"
}