Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: How are you looking up the correct SMS gateway for a given number? #93

Open
keepsense opened this issue Nov 28, 2016 · 1 comment

Comments

@keepsense
Copy link

I'm sorry if this isn't the correct area to ask this. I was reviewing the code, and I see where carriers are listed by country, but I don't see the mechanism that you are using to figure out the correct carrier, and SMS gateway, for a given phone number. Do you mind sharing how you are doing that? Are you using a free service for that feature? Or, are you just sending a message to all carrier formats within that country group?

Thanks!
-Ryan

@arturtamborski
Copy link

Hi, I am pretty sure that textbelt just sends a message to all emails from selected providers list.

This is the code responsible for sending messages using mutt.

region = region || 'us'; // 4

var providers_list;
if (carrier) { // 3
  providers_list = carriers[carrier];
} else {
  providers_list = providers[region];
}

var emails = providers_list.map(function(provider) { // 2
  return provider.replace('%s', phone);
}).join(',');
var args = ['-s', 'txt', '-e', 'set from=' + config.fromAddress,
  '-e', 'set use_from=yes', '-e', 'set envelope_from=yes', '-b', emails]; // 1
var child = spawn('mutt', args);
  1. Mutt gets an array of emails as an argument (in args).
  2. This arrray contains emails from providers_list,
  3. providers_list is filtered at top based on the carrier variable. if carrier is set then emails will come from carriers[carrier].
  4. If carrier is not set, then providers_list will contain emails from providers[region] where region will fall back to us as default if not set.

And yes, its a late answer but it might come in handy for others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants