我正在尝试使用 Python/Django 使用 Twilio 创建一个最多 2 个扬声器的会议应用程序。但是,在文档中,我发现您可以通过入站呼叫来做到这一点。但是,我的商业模式并不像那样工作。有没有办法像这样工作:
- 我的 Twilio 号码拨打号码 1
- 我的 Twilio 号码拨打 2 号
- Twilio 为新会议带来了两个渠道
我已经尝试过这个解决方案: Twilio how to make two outbound call and join(conference) them using node js 但它对我没有多大帮助..
这是我的代码:
@csrf_exempt
def conference(request):
print("success")
response = VoiceResponse()
dial = Dial()
dial.conference('Rooxm 1234')
response.append(dial)
print(response)
return HttpResponse('')
def call(number):
client = Client(TWILIO_ACCOUNT_SID,TWILIO_AUTH_TOKEN)
call = client.calls.create(
url='https://<blahblah_removed_purposefully>.ngrok.io/conf/',
to='+' + str(number),
from_='<removed_my_twilio_num>'
)
print(call.sid)
def index(request):
if request.method == 'POST':
# create a form instance and populate it with data from the request:
form = CallForm(request.POST)
# check whether it's valid:
if form.is_valid():
#print(dir(form.data.values))
call(form.cleaned_data['inline'])
call(form.cleaned_data['outline'])
return HttpResponseRedirect('/thanks/')
# if a GET (or any other method) we'll create a blank form
else:
form = CallForm()
return render(request, 'CallForm.html', {'form': form})
这在通话期间给了我一条错误消息:“发生应用程序错误。再见”
我也在调试器中得到了这个:“文档第 1 行错误:文件过早结束。”
任何想法?