I have a client who has requested the ability to have a txt msg sent to the caller when they make an IVR selection. It’s a restaurant and they want the ability for a caller to receive a link to their online ordering via text message when they select an IVR choice.
I’m sure this is possible, not sure if it already exists or how to create it if it doesn’t
I’ve never really written a dialplan in practice. Never really had the need so really learning it was never a priority. That said I’ve muddle through and come up with this. The API is ClearlyIP’s. I’m pretty sure I don’t have the send request properly written.
[sms-link]
; answer the call
exten => s,1,Answer
; Make CallerID the TO
exten => s,n,set(To=${CALLERID(number)})
; SMS message
exten => s,n,set(Body=$["test test test?"])
; set auth key
exten => s,n,set(authkey=$["mykey"])
; From
exten => s,n,set(From=$["18005551212"])
; CURL
exten => s,n,Set(response=${CURL(https://unity.clearlyip.com/trunking/v2/sms/message?auth=1${authkey},To=1${to},From=1${from},Body=${body},media="")})
; Finish
exten => s,n,return
GET for an operation that is supposed to have real side effects, and not be idempotent would certainly be a misuse of HTTP, but I think it is so common misuse, in practice, that caches had to give up caching get mode forms.
unfortunately the docs are behind a login. I have download the txt from the API docs but it’s too big to post here and I think Pastebin.freepbx.org is still down.
here’s a link to the download that should work without a login. Note that about the first half of this file are depreciated functions:
@ashcortech Nice to see someone utilizing our API. If you don’t mind opening a support ticket over at support.clearlyip.com, the team can work with you to come up with a solution that will make this easier for you to call via your custom dialplan. After we have something working, if it requires any module changes, we will also work on getting those changes pushed out so that others may benefits at well.
Jeff
We did update our wiki here on the AGI we now include in our Trunking module to let you easily use dialplan to send a SMS from Asterisk Dial Plan. FreePBX & PBXact Automated Setup with Module