Receive SMS with Asterisk

Asterisk-module Polygator accompanies “Polygator VoIP/GSM-card” (4/8 SIM-cards, PCI/PCIe). Thanks to the module, all features of the Polygator GSM-card are available via Asterisk dialplan or CLI. Among others, there is a feature to receive and process inbound SMS by means of Asterisk and Linux.

For example, here are the steps to set up forwarding inbound SMS to external server:

1. Prepare a handler (script in php, python, bash…).
The script will receive SMS-data from Asterisk and forward data to external server by HTTP-request. Place it on an Asterisk-server in /home/ folder.

2. Configure channel of GSM-card:

Via Asterisk console or via file polygator.conf specify context and extension for incoming SMS.

Sample for channel #3 (gsm-3):

CLI commands:
CLI> polygator channel gsm gsm-3 set sms.ntf.en yes
CLI> polygator channel gsm gsm-3 set sms.ntf.ctx gsm_sms
CLI> polygator channel gsm gsm-3 set sms.ntf.exten sms

Accordingly, we enable SMS feature - yes, context - gsm_sms, extension - sms.

3. Create context and extension in extensions.conf file and specify path to handler script.

Sample for extensions.conf

exten => sms,1,Noop()
same = n,System(/usr/bin/php -q /home/test.php '${PGSMSCHANNEL}^${PGSMSDESTADDRESS}^${CALLERID(num)}^get^sms^${PGSMSCONTENT}^in^${STRFTIME(${EPOCH},,%Y:%m:%d-%H:%M:%S)}')

Since configuring done, each inbound SMS on channel #3 will trigger Asterisk’s dialplan to execute script at /home/test.php. Command line parameter contains SMS-data fields separated by ^.

The way to pass and separate SMS-data fields it totally up to the end-user of GSM-card Polygator.

To get more details about prices for various configurations, please, contact us via email This email address is being protected from spambots. You need JavaScript enabled to view it., skype: elgato-ua or via the contacts on the website

+ Dev by wwsiter