📜 ⬆️ ⬇️

Sending SMS via the Openvox VoxStack Gateway

The article is likely to be of interest only to owners of VOXStack OpenVox GSM gateways, the present and the potential. It is known that inside these gateways is a full Asterisk. Which has additional commands in AMI and CLI for sending SMS.



[Photos from the topic with a good description of the functionality of these GSM gateways]
')
Next, I want to introduce you to two small developments on node.js, which allowed me to make sending SMS via VoxStack more convenient.



Openvox-sms

npm openvox-sms is a small wrapper for AMI commands for sending SMS from an application to node.js. It has the function of splitting long texts into smaller ones in order to send a composite SMS.

In the asterisk CLI of the gateway there are two commands for sending SMS:

> gsm send sync sms span number text timeout

> gsm send sync csms span number text flag smscount smssequence timeout

The first command to send a simple sms (we specify the span module, the destination number number, the text itself, and timeout if desired).

The second to send the part (concatenated sms) of the long one (in addition, it is necessary for each part to indicate the number of the entire smscount part, and the current part number of the smssequence). You need to send as many commands as you have sms parts. If you send commands with the correct parameters, then on the mobile phone these parts will be collected in one SMS.

Openvox-sms neatly wraps the interaction with an asterisk, and then you can send an sms like this without bothering with a longer or shorter sms.

var osms = require('openvox-sms'); var sms = new osms({host: '192.168.1.5'}); sms.on('connect', function () { sms.sendSMS({ span: 1, number: '8913', text: 'My long-long-long text about London' }, function (err, response) { sms.close(function () { }); }); }); 


A little more about the commands is in the documentation for the gateway .

Learn more about using npm openvox-sms: github.com/antirek/openvox-sms .

Openvox-sms-worker

Of course, using openvox-sms wrapper is convenient, but you won’t be in all applications that should send SMS, add connection settings and check how they send SMS. (Moreover, the option is not excluded that the time will come and you may have to replace the gsm gateway with some kind of online SMS sending service).

In this case, it is more convenient to use the RabbitMQ queue to send SMS, which will be serviced by a worker who is directly working with the gsm gateway OpenVox VoxStack.

This worker has been configured once, and all applications will send messages to the common queue. Now you can watch the logs of work with the gsm gateway in one place, check the sending of SMS.

Learn more about openvox-sms-worker settings: github.com/antirek/openvox-sms-worker .

Suggestions, constructive ideas?

Source: https://habr.com/ru/post/254383/


All Articles