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:
wget ftp://ftp.sangoma.com/linux/libwat/libwat-2.1-current.tgz |
Untar & Compile & Install
tar xfz libwat-2.1-current.tgz cd libwat-X.X.X/build cmake .. make make 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:
cd libwat-1.X.X/asterisk cp asterisk-<your specific asterisk patch> /usr/src/asterisk-<verison> |
To patch your Asterisk Installation:
cd asterisk-<version> patch -p 1 < asterisk-<version>.patch |
Re-configure and re-compile your Asterisk:
./bootstrap ./configure make clean make make install |
Configuration
Use the wancfg_dahdi script to generate your configuration files
wancfg_dahdi |
Asterisk GSM Advanced Configuration options
Sending and Receiving SMS with Asterisk
Sending SMS using Asterisk CLI
Syntax:
wat send sms <span> <number> <message> |
Example:
CLI> wat send sms 1 6474024628 "Hello World" |
Receiving SMS using Asterisk CLI
When a SMS is received, it will printed in the Asterisk CLI and the logs.
-- Span 1: SMS received Hello World |
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:
wanpipemon -i w1g1 -c gude |
All UART communications will be dumped to the driver logs (ie: /var/log/messages)
To disable UART debugging:
wanpipemon -i w1g1 -c gudd |
(gude - GSM uart debug enable)
(gudd - GSM uart debug disable)
Troubleshooting
1. Confirm that SIM cards are inserted
wanrouter status |
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:
CLI> wat show spans |
WAT span 1: Up ("+16472673394") WAT span 2: Down WAT span 3: Down WAT span 4: Down |
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:
CLI> wat show span 1 |
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.