def updateNumbers(request):
    if (not request.user.is_authenticated):
        return HttpResponseRedirect(reverse('account:login'))
    config = TwilioConfig.objects.filter(user=request.user)[0]
    client = Client(config.sid, config.token)
    number_list = client.incoming_phone_numbers.list()
    PhoneOwnership.objects.filter(user=request.user).delete()
    for number in number_list:
        incoming_phone_number = client.incoming_phone_numbers(number.sid).update(sms_url='https://hackaway.software/twilio/receive/')
        phone = PhoneOwnership(user=request.user, number=number.phone_number)
        phone.save()
    context = {'config': config}
    return render(request, 'configure.html', context)
def updateNumbers(request):
    if (not request.user.is_authenticated):
        return HttpResponseRedirect(reverse('account:login'))
    config = TwilioConfig.objects.filter(user=request.user)[0]
    client = Client(config.sid, config.token)
    number_list = client.incoming_phone_numbers.list()
    PhoneOwnership.objects.filter(user=request.user).delete()
    for number in number_list:
        incoming_phone_number = client.incoming_phone_numbers(number.sid).update(sms_url='https://hackaway.software/twilio/receive/')
        phone = PhoneOwnership(user=request.user, number=number.phone_number)
        phone.save()
    context = {'config': config}
    return render(request, 'configure.html', context)