Skip to end of banner
Go to start of banner

How to send SMS from dialplan - Usage of SMS API

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

SMS API allows any external software to use the Wildix PBX as an SMS Server with the possibility of bulk (mass) SMS sending.

To send an SMS:
Make an HTTP POST/GET request with basic authorization (username/password of the user who is the SMS sender) to http(s)://<PBX_IP_Address>/api/v1/orginate/sms

In case the GSM gateway to be used for SMS sending is not specified in the command, the message is sent to a randomly chosen GSM gateway configured in the system.

The timeout for mass sending is 5 sec for each SMS / gateway.

The POST/GET required parameters are
message: the body SMS messages, length of no more than 300 characters
number: the phone number or several numbers separated by a comma. Example: +391234567890 or +391234567890,+391234567891,+391234567892,...


Requirements

W01GSM registered to the PBX

SIM card in the W01GSM able to send SMS

*Before try to send from the dialplan be sure that the SMS can be sent from WEB Collaboration


The POST/GET optional parameters are

postpone: date of postponed message delivery. Example: 14/07/2014 15:35

gsm: GSM gateway MAC address. Example: 9c7514330001


The response of the service is

Success: {"type":"result","result":"Success"}

Warning: {"type":"warning","reason":"Unable to add a SMS to the queue","result":["111"]}

Error: {"type":"error","reason":"Number should not be empty","result":null}

The "reason" part is the description of the warning/error


To try the service you can use the curl software and run it from the command line.



Here is a working example on a test system:

curl -k -X POST -u 101:sms101api --url "https://127.0.0.1/api/v1/originate/sms"  --data-urlencode "number=+39123456789" --data-urlencode "message=This API is awesome, now I can add the sms support to my software" --data-urlencode "gsm=9c7514330001"


And here an example on the dialplan

Set->CURLOPT(userpwd) - 101:sms101api
Custom application-> Set(message=${CURL(http://127.0.0.1/api/v1/originate/sms, message=This API is awesome, now I can add the sms support to my software&number=%2B39333123456)});


Note: the %2B added to the mobile number is the + character with URL encoding transformation. The full reference is available on the w3school web site.


Filter by label

There are no items with the selected labels at this time.



  • No labels