We decided to add SMS to our phone system, just "because we can." Since the SMS app doesn't seem to be currently maintained, I've been doing some digging around to see what needed to be done to get it working. We now have SMS (both sending and receiving) functioning. Here's the steps I took in order to get it set up:
- Follow steps 1 - 5 in the FusionPBX SMS app setup instructions
- Change the Default Settings specifications by editing app/sms/app_defaults.php, between lines 28 and 179...
- Replace all references to $x to $y
- Replace $array with $apps[$x]['default_settings']
- Move this block of code to app/sms/app_config.php (I put it between the "permission details" and "schema details" sections of code already in that file)
- Comment or remove the remaining code within the if block in app_defaults.php
- Fix the schema definition by editing app/sms/app_config.php
- Replace $apps[$x]['db'][$y]['table']['name'] with $apps[$x]['db'][$y]['table']
- Comment or remove occurrences of $apps[$x]['db'][$y]['table']['parent'] = "";
- In FusionPBX web config > Advanced > Upgrade, check "Schema," "App Defaults," "Menu Defaults," " and "Permission Defaults," then click "Execute."
- It should go without saying, but just to be sure, please document your custom configurations in each of these sections BEFORE doing the upgrade, as you will need to go through after the upgrade process and change them all back to how you had them set.
- After the process finishes, log out, and then log back in again to apply the new permissions and menu options
- The default chatplan doesn't line up with the default context settings in FusionPBX, so to make them use the same context, in Advanced > XML Editor, edit chatplan/default.xml change the context name of public to internal (or whatever other context should have access to sending SMS messages).
- The Lua script does some weird URL encoding that doesn't seem to get decoded before the message is sent to the SIP endpoints. Disable this by editing the SMS Lua script (ours is located at /usr/share/freeswitch/scripts/app/sms/index.lua, so I edited it using vi at the console) and commenting out lines 46 - 48.
- In Advanced > Default Settings, enable and set the values for your respective carrier
- In Apps > SMS, add the phone numbers that are allowed to send outgoing SMS messages
- The number formatting isn't very thorough; at the time of this post, the Lua script supports only 10 digit numbers, with and without a preceding "1" (no "+" characters or RegEx's)
- Make sure you have the appropriate destinations set up in Dialplan > Destinations, with the destination number(s) matching those you specified in Apps > SMS
- I have not thoroughly tested all the possibilities, but from what I can tell of the code, and from what I've confirmed with our setup, the SMS webhook for inbound messages supports regular extensions and ring groups (a message will go to all the destinations in a ring group)
- Go to Status > SIP Status, and click "Reload XML"