View Full Version : GSM CLI Commands

06-02-10, 08:17 AM
There are many Asterisk CLI commands available for the Warp's chan_gsm channel driver. To run any of these commands, log into the Asterisk CLI or input them through the 'Asterisk CLI' option in FreePBX. The commands are as follows.

Channel commands
The channel commands work on ports. The valid range for <port> in each command is 1 to 2 if you have one GSM module installed or 1 to 4 if you have two GSM modules installed.

gsm init port <port>
Use this command to initialize a GSM port, where <port> is the port number to be initialized.

gsm shutdown port <port>
Use this command to shut down a GSM port, where <port> is the port number to be shut down.

gsm restart port <port>
This command is used to restart a GSM port, where <port> is the port number to be restarted.

gsm show status
This command is used to list the status of all GSM ports. A sample output from this command would look like the following:

Port Status InUse Provider Home Zone Signal Quality
1 (0) REGISTERED n "Rogers Wireless" y -82dbm
2 (0) REGISTERED n "Rogers Wireless" y -67dbm

The fields here can be detailed as follows:
* Port column is the index to the GSM port.
* Status should be REGISTERED.
* InUse column indicates if the GSM port is busy.
* Provider gives the name of the provider.
* Home Zone indicates if we're registered to our regular provider.
* Signal Quality indicates how good the signal reception is.

For signal quality, we can translate the measurements as follows:
# not measurable (not measured yet)
# -112 dbm is very low
# -97 dbm is low
# -82 dbm is ok
# -67 dbm is good
# -52 dbm is high
# -51 dbm is very high

SMS Related Commands

gsm send sms <port> <number> "<smstext>"
Use this command to send an SMS message to a given number via a given port, where <port> is the port number to use, <number> is the recipient and <smstext> is the message to be sent. A sample command to send SMS on port 1 to number 5556666 would be:
gsm send sms 1 5556666 "Hello, Earthling"

gsm show sms <port>
This command is used to display all stored SMS messages on a given port. A sample output for received SMS messages is as follows:

P(1) SMS RECEIVED: Idx(2) Number(+16133011736) Date(09/12/08,15:54:58+00) Text(testing 1,2,3,4)

gsm fetch sms <port>
This command is used to retrieve all stored SMS messages on a given port and store them to disk. All messages on the given <port> will be stored to disk (under smsdir) and then subsequently erased from the SIM memory. A sample output for "fetched" SSM messages is as follows:

Saving SMS in /var/spool/asterisk/smsin/1260307679-254790.sms

Configuration Commands

gsm show config values
This command displays all configuration values.

gsm show config descriptions
This command displays all available configuration items.

gsm show config description <item>
This command displays the description for a specific configuration item. Use the above command see a list of all available items.

Operator Related Commands

gsm show operators
This command displays a list of all available operators.

gsm set op <port> <operator>
This command sets a port to a specific operator, where <port> is the port number and <operator> is operator name in numeric format.

Debugging Commands

gsm set debug <level>
This command sets the debug level output to <level>, where <level> is the debugging level, which is 0 for no debug and 1 for debugging.

gsm debug info
This command prints out debugging information.

gsm show version
This command displays the version information for the GSM channel driver.

help gsm
This command displays all the available GSM CLI commands.

10-16-12, 03:32 PM
There is also the generic commands to send and receive raw AT commands:

gsm send at <port> <command>

For example, gsm send at 1 AT+CSCS="HEX"

(Note: instead of using '?' in AT commands a '/' must be used. Otherwise Asterisk will interpret the '?' character as a request for help.)