Asterisk supports the SIP Message protocol, which allows you to send short text messages between endpoints. This is similar (but NOT the same) as the text messaging on your cell phone. Think of this as an internal-only text message service.
NOTE (as of June 2019): Sangoma has expressed that they have no interest in expanding SipStation SMS availability outside of Zulu and UCP. We welcome any US or Global SIP Trunk provider with an interest in providing their SMS services within Asterisk/FreePBX to contact us to discuss partnering up to make this happen!
NOTE: The method below only works with the Chan_SIP module. No method of SMS support has been documented for Chan_PJSIP at this time.
You need to modify your SIP general settings to add these two lines:
accept_outofcall_message=yes outofcall_message_context=astsms
Go to Settings > Asterisk SIP Settings then select SIP Legacy Setting [chan_sip] from the top tabs (FreePBX 13) or the right-hand menu (FreePBX 12 and earlier). Scroll to the bottom of the page, click the Add Field button to add a second field, and enter the two lines you see above, one per pair of = fields. Then Submit changes. Wait to Apply Changes until AFTER you complete the the rest of this guide.

We will now create the dialplan inside context [astsms]:
OPTION #1: If you are running FreePBX 13 or newer, go to Admin > Config Edit and select extensions_custom.conf from the file selection box.
OPTION #2: If you are running FreePBX 12 or earlier (or simply prefer the CLI), connect your SSH console to the FreePBX instance and edit the extensions_custom.conf file with nano to add the following lines to the following file:
sudo su
nano /etc/asterisk/extensions_custom.conf
Once you have extensions_custom.conf open, add/paste the following (right-click in PuTTY) and save:
[astsms]
exten => _.,1,NoOp(SMS receiving dialplan invoked)
exten => _.,n,NoOp(To ${MESSAGE(to)})
exten => _.,n,NoOp(From ${MESSAGE(from)})
exten => _.,n,NoOp(Body ${MESSAGE(body)})
exten => _.,n,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
exten => _.,n,MessageSend(${ACTUALTO},${MESSAGE(from)})
exten => _.,n,NoOp(Send status is ${MESSAGE_SEND_STATUS})
exten => _.,n,GotoIf($["${MESSAGE_SEND_STATUS}" != "SUCCESS"]?sendfailedmsg)
exten => _.,n,Hangup()
;
; Handle failed messaging
exten => _.,n(sendfailedmsg),Set(MESSAGE(body)="[${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)}] Your message to ${EXTEN} has failed. Retry later.")
exten => _.,n,Set(ME_1=${CUT(MESSAGE(from),<,2)})
exten => _.,n,Set(ACTUALFROM=${CUT(ME_1,@,1)})
exten => _.,n,MessageSend(${ACTUALFROM},ServiceCenter)
exten => _.,n,Hangup()
exten => _.,n,Hangup()
Save (Ctrl+O in nano) and exit, if in nano (Ctrl+X). You may now click the red Apply Changes button in the GUI.
Now you can send SMS from your phones that support the SIP Message protocol (Yealink V70 Series and most softphones support SMS). If your device or softphone need a server configured, use the same address as your general SIP settings (your Elastic/Public IP).
(Adapted from information provided at this site.)