medic / cht-core

The CHT Core Framework makes it faster to build responsive, offline-first digital health apps that equip health workers to provide better care in their communities. It is a central resource of the Community Health Toolkit.
https://communityhealthtoolkit.org
GNU Affero General Public License v3.0
439 stars 211 forks source link

Work out how to support multiple short codes for a single CHT deployment #6554

Open derickl opened 4 years ago

derickl commented 4 years ago

Is your feature request related to a problem? Please describe. A typical medic-gateway deployment uses a simcard which can send/receive messages across any MNO. With shortcodes, this may not necessarily be the case. In some countries one has to apply to each MNO for a short code and you would very likely end up with different numbers for each of the networks applied to (e.g. Kenya). In other countries, short code issuance is governed by one authority which ensures one short code works across all networks in that country (e.g South Africa)

In our EBS deployment in Kenya, we used Safaricom as the default MNO since they are the largest provider in the country. As we are scaling, we will definitely deploy in areas where Safaricom is not the dominant provider and would be unfair to have users acquire a simcard just to use the service especially given that the model used is BYOD.

CHT currently only supports one gateway number per deployment.

Describe the solution you'd like I'd like to see us support multiple short codes in a single deployment.

Describe alternatives you've considered Use of medic-gateway. This however does not scale well in large deployments.

@SMurithi @benkags @PhilipNgari please add any tidbits I may have missed

SMurithi commented 4 years ago

Well put @derickl. Just to add that there is potential for national scale and we need to be ready ahead of that. Having users buy Safaricom lines has been termed as disruptive and a potential barrier to engagement.

garethbowen commented 4 years ago

CHT currently supports receiving SMS messages from multiple aggregators. The missing component is adding support for sending SMS using multiple aggregators. The challenge here is knowing which aggregator to use for each outgoing message.

@derickl Can you think of a way to configure the logic of which aggregator to use? For example, does everyone on Safaricom use the same phone number prefix?

This is also a requirement for SMS aggregation in Nepal.

derickl commented 4 years ago

I'll have a quick think about it @garethbowen

derickl commented 4 years ago

@garethbowen libphonenumber provides a way to extract the carrier details from phone numbers. They do embed mobile number prefixes by country e.g. for Kenya https://github.com/google/libphonenumber/blob/master/resources/carrier/en/254.txt

Here's an example of the output we'd get from looking up a number https://libphonenumber.appspot.com/phonenumberparser?number=0722+002100&country=KE.

The above would solve level 0 of the problem. In countries where we have number portability (e.g Kenya), a number that clearly matches Nextork X, could be registered in Network Y. So we need to complement the above with a Home Location Register (HLR) Lookup. This is a service that is provided at a fee per lookup. E.g https://www.free-hlr.com but there are many more available.

MaxDiz commented 4 years ago

@derickl I have this issue noted as needed for the I-Tech projects later this year/early next year. Is this still accurate?