Asterisk GSM
Â
Overview
Â
Asterisk uses the Libwat to interface with the Sangoma W400 GSM cards.
Â
Â
 Installation
Download the following System requirements
->Â Prerequisites
Note: if you do not install the above requirements the installation will fail
Â
Dahdi Installation
Â
Download the latest Dahdi sources from
asterisk.org:
    example:
 wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/releases/dahdi-linux-complete-2.5.0.2.+2.5.0.2.tar.gz |
Untar and install dahdi
tar xfz dahdi-linux-complete-2.5.0.2+2.5.0.2.tar.gz
cd dahdi-linux-complete-2.5.0.2+2.5.0.2
make && make install make config  |
Â
Â
Wanpipe Installation
Â
LibWAT Installation
Download the latest LibWAT:
Â
Untar & Compile & Install
Â
Asterisk LibWAT Patching
Currently, libwat requires a patched version of Asterisk to work. Libwat Asterisk patches can be found in the libwat-X.X.X/asterisk directory.
Autoconf
You will need autoconf 2.60 or later to be able to patch Asterisk.
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.68.tar.gz |
Â
Copy patches to asterisk source directory. Make sure to use the patch version that matches your version of asterisk:
Â
To patch your Asterisk Installation:
Â
Re-configure and re-compile your Asterisk:
Â
Â
Configuration
Â
Use the wancfg_dahdi script to generate your configuration files
Â
Asterisk GSM Advanced Configuration options
v
Sending SMS using Asterisk CLI
Syntax:
Â
Example:Â
Â
Â
Receiving SMS using Asterisk CLI
When a SMS is received, it will printed in the Asterisk CLI and the logs.
Â
Â
Debugging
It is recommended to enable Asterisk full debugging while the LibWAT library is still in beta phase to facilitate debugging.
Instructions on how to enable Asterisk Full Debug Logging
Â
Enable debug configuration in chan_dahdi.conf
In chan_dahdi.conf in the Channel section create a variable called:
wat_debug=
Below are the possible options to use for wat_debug:
all
uart_raw
uart_dump
call_state
span_state
at_parse
at_handle
sms_encode
sms_decode
For example:Â wat_debug=all
any combination of the above separated by commas will work.
Most of the time I'd stick to "all" when debugging a problem and only use the others if you've been asked to.
Â
Â
Â
 You can also enable UART (serial interface) debugging to see which AT commands are sent and received at the driver level:
Â
All UART communications will be dumped to the driver logs (ie: /var/log/messages)
To disable UART debugging:
(gude - GSM uart debug enable)
(gudd - GSM uart debug disable)Â
Troubleshooting
1. Confirm that SIM cards are inserted
Devices currently active:  Wanrouter Status: Device name | Protocol | Station | Status | Wanpipe | Lapb | X25 Link | X25 Svc | Dsp | |
Â
GSM modules that do not have a SIM card connected will have status:Â DisconnectedÂ
 2. Checking network registration
From the Asterisk CLI:
Devices that have registered to the network successfully, will have status:Â Up. If the subscriber number (own number) is available, it will be displayed beside that span ("+16472673394Â " in our case).Â
Â
3. Checking Signal QualityÂ
From the Asterisk CLI:
 WAT span 1: Up Signal strength: (-77)dBm Subscriber: "+16472673394" type:1 plan:1 <"TELEPHONE"> Manufacturer Name: GC864-QUAD-V2 |
Â
Â
It is recommended to have a signal strength higher that (-80) dBM (a value between -50 dBM and -80 dBM) to avoid dropped calls.
Having a high Signal BER (Bit Error Rate) may affect audio quality.
The first time the GSM modules are started in a location, it may take up to 6 minutes for a GSM signal to be detected. This is because the GSM chip is iterating through each of the 4 GSM bands to search for a signal. Once a signal is detected, the band is memorized, and subsequent starts will take only  a couple seconds.
Â
3. Enable Asterisk command line debugging
Â
Aside from the driver debugging of the serial line (which sends and receives AT commands, responses and notifications), Asterisk can also print AT debugging information to the screen, which is easier to correlate to call events within Asterisk.
If you have the latest libwat release + Asterisk patch, there is a way to enable debugging from the command line:
CLI> core set verbose 3 |
Â
Even when wat debugging is enabled, you still have to enable regular Asterisk debugging settings:
 /etc/asterisk/logger.conf
[logfiles] sangoma_gsm => notice,warning,error,debug,verbose,dtmf,fax |
Â
When changing this file you must either restart asterisk or execute "logger reload". Note that if you restart Asterisk the debugging options (verbose, debug, wat all) enabled thru the command line will be lost. Therefore you want to do thelogger.conf changes first.
Â
Please verify the have latest libwat and Asterisk patch, if they do not have it the command "wat debug all" won't be available.