Configuring TWILIO SMS provider
This example is written for the Canistracci OIL tenant. Create the objects with a Docs Demo prefix, test them on non-production numbers, and then adapt the same structure for the production tenant.
Twilio has announced a new API to deliver SMS, but the old RESTful simple API is still working. We are going to use it. Configure a new Provider, type SMS with protocol WEB URL.
400px
Use the following link:
https://api.twilio.com/2010-04-01/Accounts/<ACCOUNT SID>/Messages.json
Replacing <ACCOUNT SID> with your Twilio Account SID
400px
Complete the configuration with the Auth Token and the Post Data like:
To=${URIENCODE(${SMSDESTNUM})}&From=${URIENCODE(+18584334434)}&Body=${URIENCODE(${SMSTEXT})}
400px
Once created the provider, create the Routing Profile, type SMS and define the rules, for example as following
400px
If you want to send a MMS, use:
To=${URIENCODE(${SMSDESTNUM})}&From=${URIENCODE(${SMSSOURCENUM})}&Body=${URIENCODE(${SMSTEXT})}&MediaUrl=http://<your server>/pbx/mms/${MMSKEY}/${MMSFILENAME}
Receiving SMS
To receive SMS with Twilio, the best is to use the Custom format in POST/GET. Twilio seems to have problems in delivering messages over https when using a LetsEncrypt certificate. Not a smart move from them. This will force you to use HTTP as protocol. Beware, if using LetsEncrypt certificate, you may have a redirect forcing all communications to go over HTTPS. You need to disable it in /etc/httpd/conf/httpd.conf.
400px
Validation
- Confirm the tenant selected in the top bar is Canistracci OIL before creating the example.
- Verify the created objects appear in the expected Configuration menu page.
- Place a controlled test call or run the related status check.
- Remove or disable temporary test numbers when the example is no longer needed.