def _add_message(cls, message, device, token):
     message = message % {
         'number': mask_phone_number(device.number),
         'extension': device.extension,
         'token': token
     }
     messages.add_message(get_current_request(), messages.INFO, message)
Exemple #2
0
    def make_call(self, device, token):
        locale = translation.get_language()
        validate_voice_locale(locale)

        request = get_current_request()
        url = reverse('two_factor_twilio:call_app', kwargs={'token': token})
        url = '%s?%s' % (url, urlencode({'locale': locale}))
        if self.base_url:
            uri = self.base_url + url
        else:
            uri = request.build_absolute_uri(url)
        if device.extension:
            dtmf_tones = 'wwww' + device.extension + '#'
            self.client.calls.create(to=device.number.as_e164,
                                     from_=getattr(settings,
                                                   'TWILIO_CALLER_ID'),
                                     send_digits=dtmf_tones,
                                     url=uri,
                                     method='GET',
                                     timeout=15)
        else:
            self.client.calls.create(to=device.number.as_e164,
                                     from_=getattr(settings,
                                                   'TWILIO_CALLER_ID'),
                                     url=uri,
                                     method='GET',
                                     timeout=15)
 def make_call(self, device, token):
     request = get_current_request()
     url = reverse('two_factor:twilio_call_app', kwargs={'token': token})
     uri = request.build_absolute_uri(url)
     self.client.calls.create(to=device.number,
                              from_=getattr(settings, 'TWILIO_CALLER_ID'),
                              url=uri,
                              method='GET')
Exemple #4
0
    def make_call(self, device, token):
        locale = translation.get_language()
        validate_voice_locale(locale)

        request = get_current_request()
        url = reverse('two_factor:twilio_call_app', kwargs={'token': token})
        url = '%s?%s' % (url, urlencode({'locale': locale}))
        uri = request.build_absolute_uri(url)
        self.client.calls.create(to=device.number, from_=getattr(settings, 'TWILIO_CALLER_ID'),
                                 url=uri, method='GET', if_machine='Hangup', timeout=15)
 def make_call(self, device, token):
     request = get_current_request()
     url = reverse("two_factor:twilio_call_app", kwargs={"token": token})
     url = "%s?%s" % (url, urlencode({"locale": translation.get_language()}))
     uri = request.build_absolute_uri(url)
     self.client.calls.create(to=device.number, from_=getattr(settings, "TWILIO_CALLER_ID"), url=uri, method="GET")
 def _add_message(cls, message, device, token):
     message = message % {'number': mask_phone_number(device.number),
                          'token': token}
     messages.add_message(get_current_request(), messages.INFO, message)