VoxStack GSM Gateway API 1.0.0

1. Configuring AMI in VoxStack GSM Gateway.

1.1 How to configure AMI interface?

Login your gateway with your user account and password, and please follow this flow to configure: ADVANCED-->Asterisk API. Please change the default to yours.

Concerning the ‘permit’ option, if you have one more IP addresses, then you should have junction with them by symbol ‘&’. In the demo test, allowing both servers and to have access to this GSM gateway.

1.2 Defining read/write authorization for various event classes.

In this illustration, you will be able to define custom authorization for various event classes. Read authorization permits you to receive asynchronous events, in general. Write authorization permits you to send commands and get back responses.

2. Monitoring and managing your Asterisk over Asterisk Manager Interface (AMI).

2.1 Using telnet to demonstrate AMI connectivity over TCP socket.

     a. Connect to the AMI over a TCP socket on port 5038.

     b. Log in using the login action and your user account.

     c. Execute the Ping action .

Here’s how to get access to the gateway and some responds for the actions from AMI.

2.2 Introduction of SMS sending command

gsm send syncsms <span> <destination> <message> <timeout> [id]


2.2 Starting to send SMS over command action by value “gsm send syscsms ...” .With regard to the SMS ID, you will be able to set it by yourself, or take ActionID to be your SMS ID.


2.3 Introduction of Manager Action Ping.

2.4 Completed transaction of AMI when a short message comes in.

In the whole transaction, you can find a code segment as the following. This section is the most important when you would like to monitor the incoming short message. Asterisk (Gateway core) will report a new event to the client.

If TCP socket connection is still alive. And you receive both parameters Newexten and sms, which indicate that there is a new short message comes in. You will be able to use Ping action to check if your connection is alive or not, and monitor the incoming short message by these two events.

2.5 AMI over TCP for Windows

Yes, you can get access to your GSM Gateway over AMI protocol in Windows system. Please follow thisflow: Click Start-->Run-->Open, at the input text box, type ‘cmd’ to enter a Windows console.

Hit the [Enter], and it will automatically skip to the next illustration.

In this demo, I sent a short message to be outside by action command.

2.6. Using PHP script to send short message over AMI protocol.

Before doing this, please download phpagi target from website: http://sourceforge.net/projects/phpagi/, and place it to /var/lib/asterisk/agi-bin. Give execute permission to the file. Based on my experience, if your PHP version is higher than 5.3, you MUST rename the function goto in phpagi.php.

Here’s demo script voxstack_sms.php:

3. Introduction of USSD sending command.

gsm send ussd <span> <message> [timeout]