2
As it’s not possible yet to get a local number from Twilio, you could use another local SMS solution say SMSLeopard or Uwazi. Uwazi have an API but I haven’t taken it for a test drive while SMSleopard currently only works with a spreadsheet. You could collect the texts to a spreadsheet and then develop a custom solution to send the data to a database or to Twilio. The best solution so far for your case I think is AfricasTalking. They cover Kenya, Tanzania, Uganda, Rwanda, Malawi and Nigeria
Update
Twilio have provisioned new local numbers as of June 2017
0
EDIT: django-two-factor-auth is here for illustration purposes, it interfaces wit the Twilio gateway and uses the Twilio package, so I think it is a good example for implementing multi-gateway SMS systems.
I recently wrote a multi SMS gateway solution that supports different backends in the style of django-two-factor-auth SMS GW. We primarily use it to send authentication tokens, but the principle is the same; You probably want to send messages through multiple different SMS providers.
You should probably look into the style introduced in there and provide
- SMS APIs that can be called through in an uniform way to SEND messages
- SMS return URLs for receiving SMS messages that similarly provide different endpoints for different providers but interface similarly.
This would mean that you would have some gateway similar to the Twilio gateway introduced in django-two-factor-auth with dedicated return URLs and a different gateway and different return URLs for a different provider:
class SMSLeopardGateway(object):
"""
A Gateway for sending and receiving SMS messages.
Sending just sends a HTTP message, return provides
a callback URL that interfaces to the receive_sms method.
"""
def send_sms(self, device, message):
# handle sending messages through an uniform API
@staticmethod
def receive_sms(request, *args, **kwargs):
# Django request interface for receiving messages
urlpatterns = [
url(^'/sms/receive/leopard', SMSLeopardGateway.receive_sms),
]
This way you could build a lean support for multiple different gateways and just find out where your numbers are located and react to that in your code; you could provide just one SMS callback URL as well and just interface that to different backends.
The Twilio gateway and django-two-factor-auth source code is not that complicated to read through and you could find a lot of inspiration from there.
- [Answered ]-Django: ValueError when saving an instance to a ForeignKey Field
- [Answered ]-How to pass variable to exception middleware with Django?
- [Answered ]-Bootstrap CSS – Info Box Alignment
- [Answered ]-Logout not working Django 1.9
- [Answered ]-Getting "AttributeError: 'str' object has no attribute 'regex'" in Django urls.reverse