Python:Twilio TaskRouter 会议说明

Python: Twilio TaskRouter Conference Instruction

我正在使用 TaskRouter 处理来电,会议指令如此

@csrf_exempt
def TaskEnqueue(request):
    """ Put call into queue """
    response = VoiceResponse()
    digits = request.POST['Digits']
    selected_service = 'Support' if digits == '1' else 'Sales'
    task = {'selected_service': selected_service}

    enqueue = response.enqueue(None, workflowSid=TWILIO_WORKFLOW_SID)
    enqueue.task(json.dumps(task))

    return HttpResponse(
        str(response), content_type='application/xml; charset=utf-8'
    )

@csrf_exempt
def TaskAssignmentView(request):    
    """ Task assignment """
    worker_attributes = json.loads(request.POST['WorkerAttributes'])
    assigned_worder_uri = worker_attributes['contact_uri']


    response = {'instruction': 'conference',
                'from': TWILIO_NUMBER,
                'to': assigned_worder_uri,
                'end_conference_on_exit': True,
                'post_work_activity_sid': TWILIO_ACTIVITY_BREAK}

    return JsonResponse(response)

我想在座席或呼叫者挂断电话后结束会议。

即使使用“end_conference_on_exit”属性会议也只有在座席挂断时才会结束,而在主叫方挂断时不会。

我错过了什么吗?

在会议说明中添加“end_conference_on_customer_exit”即可。

response = {'instruction': 'conference',
                'from': TWILIO_NUMBER,
                'to': assigned_worder_uri,
                'end_conference_on_exit': True,
                'post_work_activity_sid': TWILIO_ACTIVITY_BREAK,

                'end_conference_no_customer_exit': True
}