PBX API : POST /Originate/SMS/

To send a SMS, make an HTTP POST request with basic authorization, resource URI:

http(s)://{PBX}/api/v1/originate/sms

Support parameter gsm gateway in sms api

Processing SMS owner for sending SMS to specified gateway was added.

Format of the SMS filename: <sender>_<receiver>_gw<w01gsm_mac>_<timestamp>_<random>.sms.
For example: 503_+380501234567_gw9c751433014a_1412689238_19727.sms 

SMS will be send to random gateway if uses old format, like 505_+380937383114_1412689210_14353.sms
If GSM gateway was removed, all SMS with this owner will be sent via random gateway.

SMS to GSM that offline is sent after timeout ~3-4 minutes

POST Parameters

Required Parameters

NameDescription
messageThe body SMS messages, length of no more than 300 characters
numberThe phone number or several numbers separated by a comma. Example: +391234567890 or +391234567890,+391234567891,+391234567892,...

Optional Parameters:

NameDescription
postponeDate of delayed sending message. Example: 14/07/2014 15:35
gsmGSM gateway MAC address. Example: 9c7514330001

Response

TypeExample
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}

 

Examples

CLI CURL
curl -X POST -u user:pass --url "http://{PBX}/api/v1/originate/sms"  --data-urlencode "number=+391234567890,+391234567891" --data-urlencode "message=Text SMS"
PHP CURL
$ch = curl_init('http://{PBX}/api/v1/originate/sms');
curl_setopt ($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); 
curl_setopt ($ch, CURLOPT_USERPWD, "user:pass");
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_POST, true);	
curl_setopt($ch, CURLOPT_USERAGENT, Useragent_Name);			        
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array('number' => '+391234567890,+391234567891','message' => 'Text SMS')));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);			        	
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
$response = curl_exec($ch);
curl_close($ch);