def status_callback(request): form = StatusCallbackForm(request.POST or None) if form.is_valid(): TwilioResponse.objects.create( pk=form.cleaned_data['SmsSid'], ip_address=request.get_host(), account=form.cleaned_data['AccountSid'], sender=form.cleaned_data['From'], recipient=form.cleaned_data['To'], status=form.cleaned_data['SmsStatus'], ) return HttpResponse('OK')
def status_callback(request): form = StatusCallbackForm(request.POST or None) if form.is_valid(): try: TwilioResponse.objects.create( pk=form.cleaned_data['SmsSid'], account=form.cleaned_data['AccountSid'], sender=form.cleaned_data['From'], recipient=form.cleaned_data['To'], status=form.cleaned_data['SmsStatus'], ) except: logger.debug("callback data") logger.debug(form.cleaned_data) raise return HttpResponse('OK') else: return HttpResponseBadRequest()
def status_callback(request, backend_name=None): form = StatusCallbackForm(request.POST or None) if form.is_valid(): try: TwilioResponse.objects.create( pk=form.cleaned_data['SmsSid'], account=form.cleaned_data['AccountSid'], sender=form.cleaned_data['From'], recipient=form.cleaned_data['To'], status=form.cleaned_data['SmsStatus'], ) except: logger.debug("callback data") logger.debug(form.cleaned_data) raise return HttpResponse('') else: return HttpResponseBadRequest()