New open source SMS Connector module

I’m excited to share with the community a module I have been working on over the past few weeks and ask for your collaboration to make it better: a generic, expandable connector for using third-party SMS providers with FreePBX’s SMS subsystem.

Right now I have it working with Telnyx and Flowroute, both SMS and MMS inbound and outbound and synchronized across UCP and the Sangoma softphones.

The module is packaged for installation or you can examine & work with the code; see GitHub - simontelephonics/smsconnector: SMS Connector module for FreePBX 16 .

Collaborators are sought for testing, general module improvement, and addition of more providers. I added two that I use. This is the first module I have written so I admit that it is not well polished.

Requires FreePBX 16 and the sms module.

17 Likes

Really good stuff here Bill, thanks for sharing.

Well done, Bill!

I would add a “custom provider” option. It will probably be a lot of work sanitizing, reconstructing and parsing… Maybe I’ll get my hands dirty and see if I can add it.

Wow! Bill, this is awesome! Question: we often have one phone number for a group of people (department). A ring group will call the different extensions (100, 101, 102, 103) of the group. Will your module allow my Twilio SMS enabled number (Main dept number 877.XXX.XXXX) to be connected to each extension via the Sangoma Connect iOS app?

Extensions 100, 101, 102, 103 all are connected to SMS 877.XXX.XXXX on Sangoma Connect?

That would be the holy grail, right? Maybe just point the module at the provider’s swagger docs to “figure out” the APIs and then it knows how to do SMS/MMS both inbound and outbound. It’s definitely beyond my abilities.

Since I don’t know how to make this truly generic, I opted for more of a plug-in approach where providers are coded in as we add them.

1 Like

Right in the summary:

Limitations

  • One-to-one number/user association currently (no shared numbers or multiple numbers on the same user)

Possible Improvements

  • Multiple numbers per user or multiple users per number

I think it’s actually a pretty small lift to do this, because the capability is part of the FreePBX SMS subsystem, but my use case was one-to-one so that’s what I did so far. As blazestudios pointed out, this is already under consideration as an improvement.

(Also, we would need to implement Twilio first)

1 Like

I would also suggest 10DLC logic for this because it’s going to be required. There’s going to need to be auto replies for things like #HELP or other triggers. There will need to be auto opt-in and more importantly, auto opt-out. If someone sends #STOP or #UNSUBSCRIBE, etc to one of your numbers belonging to a campaign, all DIDs associated that campaign must stop sending messages to the number that requested the stoppage.

My opinion is that the 10DLC logic should go in SMS Plus (SMS Plus: Enhanced SMS functionality for FreePBX / PBXact | FreePBX - Let Freedom Ring). It seems to fit perfectly there.

That commercial module only works with SIPStation or VoIP Innovations. How will that work with the other providers? How will that allow for people to pull/listen for messages over Flowroute (example) and comply with 10DLC campaign requirements? Such as the opt-out or #HELP replies that need to be facilitated?

… or other adaptors that are connected in to the FreePBX SMS subsystem. The SMS Connector module presents itself like a SIPstation or VI “adaptor” (in FreePBX SMS module terms). We’re implementing (I assume) the same abstract classes they are. No guarantees but if SMS Plus works for them it should work for what this module does.

The SMS Plus does not work that way. It requires you to have a api with sangoma trunking and only works with their own Numbers. They went out of there way to make sure it would not work with anyone who sends messages into the sub system

OK, noted.

@BlazeStudios I appreciate the feedback, and as mentioned, not sure how well it fits since this is meant to be a connector module and not really add any extra filtering or parsing logic. I can see how another open source module could do the job though, basically hooking into all SMS send/receive activities.

Ah, missed it. Thanks! This would be a fantastic add in the future. Thanks!

At least with Twilio I think that can be handled on the Twilio side, even if you dont account for it in your code. Not sure about Flowroute.

Where is the Clearly IP module @tonyclewis :slight_smile:

We have a module that already hooks into FreePBX for full SMS and MMS and allows a 1 to many and many to 1 mapping and does not require you to open your Web GUI of FreePBX to the outside world to receive the inbound messages

2 Likes

Can it be used with Sangoma Connect (iOS)? or the Clearly IP mobile app?

This is somewhat regrettable but unavoidable as this is how these providers work. With HTTPS and precise firewall rules restricted to only the IPs the providers use for their webhooks, it can be secure. I know Telnyx also has a way of sending an auth token with the webhooks so you can authenticate them. The only other way I know of to receive SMS* is by SIP methods which actually may be less secure if the trunk isn’t configured as TLS because the messages might cross the internet in plain text.

(* or SMPP but that’s not really in scope)