Page 1

VoxStack GSM Gateway API Introduction of SMS sending command gsm send syncsms <span> <destination> <message> <timeout> [id] Synopsis Execute SMS sending over a specific GSM channel. Description Send short message to outside. Arguments span: Which GSM channel will you select to send SMS. destination: What number will be receiving the short message. timeout: How long it will try to send SMS before time is up. id: Identifier of SMS. Syntax Action: Command Command: gsm send syncsms <span> <destination> <message> <timeout> [id]

Introduction of USSD sending command gsm send ussd <span> <message> [timeout] Synopsis Execute USSD sending over a specific GSM channel. Description Send USSD on a given GSM channel. Arguments span: Which GSM channel will you select to send USSD. message: What USSD code will you send. timeout: How long it will try to send USSD code before time is up. How to configure AMI on VoxStack GSM Gateway web page? Once you log in your gateway, please follow this flow: ADVANCED-->Asterisk API. And configure your gateway to be like this illustration.


Where the 172.16.99.17 is my Linux server IP address and 172.16.99.102 is my VoxStack GSM gateway IP address. The next step is login your another Linux server or Windows PC. And connect with your VoxStack GSM gateway over a socket. Meanwhile, you will be able to invoke the command above to send SMS over Asterisk Manager Interface. For Linux: Execute the command at the command line to build a connection with your gateway. Please see this illustration:


Once you get this, which means that you already successfully entered your gateway by AMI. Then you will be able to execute some actions or commands as your Asterisk CLI. In order to send SMS. Please follow this illustration below.

Concerning the options of this command: gsm send syncsms 3 13480798079 "Hello,this is VoxStack GSM Gateway" 60 2013 3: Span number, I choose third span to send this short message. 1340798079: Destination number, the number to receive this short message. “Hello, this is VoxStack GSM Gateway”: Message content. 60: The time to try to send this message, unit is second. 2013: The identifier of this short message.

If the SMS successfully sent, it will receive this information.

For Windows: 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.

Both of these two methods are based on manually send. Of course, you will be able to build your own scripts like PHP, Java, Perl etc. to invoke this command. Right here, there is a PHP script demo to send SMS, you can invoke this script in your dialplan. Before doing this, please download phpagi target from Internet, and place it to /var/lib/asterisk/agi-bin. Give execute permission to the file. PHP script file name: voxstack_api.php #! /usr/bin/php -q <?php include("phpagi-asmanager.php"); $agi=new AGI_AsteriskManager;

$vst_host='YOUR VOXSTACK GSM GATEWAY IP ADDRESS'; $vst_user='admin'; #Corresponding to your GSM gateway API settings $vst_pwd='admin'; #Corresponding to your GSM gateway API settings $vst_port=5038; #Corresponding to your GSM gateway API settings

$agi_status=$agi->connect($vst_host.":".$vst_port,$vst_user,$vst_pwd);


if(!$agi_status) { $msg="Failed to connected Asterisk,exit.."; exit(0); }

$type='gsm'; $method='send'; $sync='syncsms'; $span='2'; $destination='YOUR DESTINATION NUMBER'; $message='HelloWorld'; $timeout='30'; $id='1234'; $agi->Command("$type $method $sync $span $destination $message $timeout $id");

exit(0); ?> Then, execute command ‘php –q voxtack_api.php’, and it will send a short message to your destination. If your PHP version is higher than 5.3, you MUST rename the function goto in phpagi.php file.

Regarding to sending USSD code, you will be able to build a similar PHP script to send to. Additionally, for the incoming SMS, we have a feature <SMS to e-mail>. So you can


consider using this feature to manage your short messages. Concerning how to invoke AGI in dialplan, I think you can read this book<Asterisk The Definitive Guide 3rd Edtion> for more. Available VoxStack GSM Gateway Commands: Explanation Commands extra destroy channel Destroy a channel extra restart Fully restart EXTRA channels extra set dnd Sets/resets DND (Do Not Disturb) mode on a channel extra set hwgain Set hardware gain on a channel extra set swgain Set software gain on a channel extra show channels [group|con Show active EXTRA channels extra show channel Show information on a channel extra show status Show all EXTRA cards status extra show version Show the EXTRA version in use features reload Reloads configured features features show Lists configured features group show channels Display active channels with group(s) gsm check phone stat Check the stat of the phone gsm debug span Enables GSM debugging on a span gsm intensive debug span Enables REALLY INTENSE GSM debugging gsm no debug span Disables GSM debugging on a span gsm power off Power off gsm module gsm power on Power on gsm module gsm power reset Power reset gsm module gsm power stat Get gsm module power stat gsm reload span Reload GSM module configure gsm send at Send AT Commmand on a given GSM span gsm send pdu Send PDU on a given GSM span gsm send sms Send SMS on a given GSM span gsm send syncsms Send SMS and wait finish on a given GSM span gsm send ussd Send USSD on a given GSM span gsm set adcgain Setting ADC gain value gsm set dacgain Setting DAC gain value gsm set debug at Set at command debug mode on a given GSM span gsm set debug file Sends GSM debug output to the specified file


gsm set send sms coding gsm set send sms mode pdu gsm set send sms mode text gsm set send sms smsc gsm show debug gsm show debug at gsm show send sms coding gsm show send sms mode gsm show send sms smsc gsm show spans gsm show span [span number] gsm show version gsm unset debug file

Setting send sms character coding Setting send sms mode is pdu Setting send sms mode is text Setting send sms Service Message Center number Displays current GSM debug settings Show at command debug stat on a given GSM span Show send sms character coding Show send sms mode Show send sms Service Message Center number Displays all GSM Information Displays GSM Information Displays libgsmat version Ends GSM debug output to file

Voxstack gsm gateway api  
Voxstack gsm gateway api  
Advertisement