Configuring TWILIO SMS provider: Difference between revisions

From MiRTA PBX documentation
Jump to navigation Jump to search
(Created page with "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 WEBURL...")
 
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
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 WEBURL.
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.


[[twiliosmsprovider.png|400px]]
[[File:twiliosmsprovider.png|400px]]


Use the following link:
Use the following link:
Line 9: Line 9:
Replacing <ACCOUNT SID> with your Twilio Account SID
Replacing <ACCOUNT SID> with your Twilio Account SID


[[twilioconsole.png|400px]]
[[File:twilioconsole.png|400px]]


Complete the configuration with the Auth Token and the Post Data like:
Complete the configuration with the Auth Token and the Post Data like:


To=${URIENCODE(${SMSDESTNUM})}&From=${URIENCODE(+18584334434)}&Body=${URIENCODE(${SMSTEXT})}
To=${URIENCODE(${SMSDESTNUM})}&From=${URIENCODE(+18584334434)}&Body=${URIENCODE(${SMSTEXT})}
[[File:twiliosmsproviderbottom.png|400px]]
Once created the provider, create the Routing Profile, type SMS and define the rules, for example as following
[[File:smsroutingprofilereules.png|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.
[[File:TwilioInboundSMS.png|400px]]

Latest revision as of 21:41, 3 December 2021

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.

Twiliosmsprovider.png

Use the following link:

https://api.twilio.com/2010-04-01/Accounts/<ACCOUNT SID>/Messages.json

Replacing <ACCOUNT SID> with your Twilio Account SID

Twilioconsole.png

Complete the configuration with the Auth Token and the Post Data like:

To=${URIENCODE(${SMSDESTNUM})}&From=${URIENCODE(+18584334434)}&Body=${URIENCODE(${SMSTEXT})}

Twiliosmsproviderbottom.png

Once created the provider, create the Routing Profile, type SMS and define the rules, for example as following

Smsroutingprofilereules.png

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.

TwilioInboundSMS.png