I am trying to build a flow wherein the caller is initially connected to an agent in the flex console (Conference) and then the agent can transfer the caller to another IVR (Which could be an external IVR ) without disconnecting himself from the conference.
Then when the call ends I need to transfer the caller back to the same conference where the agent is waiting.
I have written a Twilio function assignmentCallback (JS) which will create the conference and then another function to redirect the call back to the conference.
The conference is getting created with the TaskSid as the friendlyName and I get only callSid parma in the second function to redirect.
Is there a way to change the conference name to callSid instead of the Default callSid.
CallbackFunction :
const client = context.getTwilioClient();
const api_response = await client.taskrouter.v1.workspaces(WorkspaceSid)
.tasks(TaskSid)
.reservations(ReservationSid)
.update({
instruction: 'conference',
from: _from,
friendlyName: call_sid,
to: assigned_worker_uri,
endConferenceOnExit: true,
startConferenceOnEnter: false
})
.then(reservation => console.log(reservation.workerName))
In the above, the friendlyName param doesn't seem to work.
If the above is not possible then can TaskSid be fetched in the redirect function?
exports.handler = function(context, event, callback) {
console.log("context: ", context);
console.log("event: ", event);
const { CallSid, TaskSid} = event;
console.log('CallSid: ', CallSid);
console.log('TaskSid: ', TaskSid);
console.log('Executing redirect_conference');
return Response(
callback,
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say voice="woman">Thank you for your patience. You are now connecting with an agent</Say>
<Dial>
<Conference endConferenceOnExit="false">${TaskSid}</Conference>
</Dial>
</Response>
);
};