Reputation: 535
I just implemented call forwarding based on the following Twilio tutorial: https://www.twilio.com/docs/voice/tutorials/call-tracking-python-django
The call forwarding works, however there are about 3 seconds of "static sounds" before the phone that is dialing the number starts hearing the phone ringer.
Why is there such a delay in forwarding the call, how can this be resolved for a production level application? Calls are made over US phone networks, so did not expect delay issues.
This is the function implementing the forwarding:
# views.py
# View used by Twilio API to connect callers to the right forwarding
# number for that lead source
@csrf_exempt
def forward_call(request):
"""Connects an incoming call to the correct forwarding number"""
r = VoiceResponse()
r.dial('+12324567891')
return HttpResponse(r)
Upvotes: 1
Views: 302
Reputation: 73029
Twilio developer evangelist here.
It appears that you are both reading data from and then saving data to a database before you respond with the TwiML to tell Twilio to forward the call. To get the quickest forwarding you should return TwiML as quick as you can.
Perhaps you can test the same forwarding without hitting the database and see if there is a difference. If there is, then I can see you need to read the database to get the number to forward to, but perhaps you could set up the saving of a new Lead to be done in a background job rather than block the response with it.
Another thing to try is to set answerOnBridge="true" on your .
Let me know if that helps at all.
Upvotes: 3