Manual of install PiGSM module

PiGSM Module hardware installation

Insert the PiTDM module to a Raspberry Pi 2 or 3 board like below picture shows

IMG_7120

Insert the SIM card like blow picture shows

sim

We provide 4 plastic screws, use them to fix the PiTDM board to Raspberry Pi board such as below shows

IMG_7122

The finally looks like below

IMG_7117

Until now, the PiGSM module installation is done, let us move to software installation.

PiGSM Module software installation

Go to the SwitchPi official website download the switchpi GSM firmware – switchpi-gsm-v102.img.tar.gz in here. The switchpi-tdm firmware currently version is 1.0.2, built-in Asterisk-13.17.1, asterisk-chan-dongle, and Dahdi-2.11.0.

Put the downloaded firmware to a Linux distro PC, then following below steps to clone it to an 8G SD card (we strongly suggested to use a class 10 HC SD card such as below SanDisk one), insert micro SD card to your PC with a USB SD card adaptor, the Linux will recognized it like /dev/sda or /dev/sdb which depends on your OS how many drives, you can check it out with command “dmesg”, we are using the /dev/sdb in here.

SD

root@pigsm:~/pigsm# ls -l
total 850416
-rw-r--r-- 1 root root 870818122 Jan 13 21:43 switchpi-gsm-v102.img.tar.gz
root@pigsm:~/pigsm# tar zxvf switchpi-gsm-v102.img.tar.gz 
switchpi-gsm-v102.img
root@pigsm:~/pigsm# ls -l
total 3308020
-rw-r--r-- 1 root root 2516582400 Jan 13 21:40 switchpi-gsm-v102.img
-rw-r--r-- 1 root root 870818122 Jan 13 21:43 switchpi-gsm-v102.img.tar.gz
root@pigsm:~/pigsm# dd if=switchpi-gsm-v102.img of=/dev/sdb 
4915200+0 records in
4915200+0 records out
2516582400 bytes (2.5 GB) copied, 1275.16 s, 2.0 MB/s

Remove the SD card from Linux PC and insert it to your Raspberry Pi 2/3 board, plug the 12V 1A power supply which is with your PiGSM module together when you received your order as below shows

Screen Shot 2018-01-16 at 2.36.48 PM

Please pay attention in here, as our PiGSM will feeding your Raspberry Pi power as well, thus you DO NOT need to require to insert the Raspberry Pi USB DC power supply anymore !!!

pigsm_dc

The default IP address is 192.168.5.68, you can ssh log into it with username “pi”, password “pi”. We also provide the serial console login your Raspberry Pi, please connect your serial cable like below picture shows, the terminal parameters is 115200/8/n1

PiGSM_SERIAL

The console login username and password same to SSH.

The firmware will automatically detect SIM800L module and configure it up, the channel of PiGSM is recognized by chan_dongle like below shown

raspberrypi*CLI> dongle show devices 
ID Group State RSSI Mode Submode Provider Name Model Firmware IMEI IMSI Number 
dongle0 0 Free 24 0 0 NONE SIMCOM_SIM Revision:1418B04S 866262031312xxx 460019936200xxx +86132699xxxxx
raspberrypi*CLI>

Make calls with the PiGSM

There are few demonstrations Asterisk extension script which we configured you can use it directly to make a first call or test, here are the steps.

Register a SIP phone with extension 6000 in /etc/asterisk/sip.conf

[6000]
type=friend
username=6000
secret=6000
host=dynamic
canreinvite=no ; Typically set to NO if behind NAT
disallow=all
allow=all ; GSM consumes far less bandwidth than G711-u (ulaw)
context=sipphone
mailbox=1234@default

Add below context to /etc/asterisk/extensions.conf

[from-trunk]
exten => _.,1,Answer
exten => _.,n,Background(demo-instruct) ; "Thanks for calling press 1 for sales, 2 for support, ..."
exten => _.,n,WaitExten
exten => 100,1,Goto(meetme,s,1)
exten => 200,1,Goto(voicemail,s,1)
exten => 300,1,Goto(echo,s,1)
exten => 900,1,Hangup
exten => 600,1,Dial(SIP/6000/1,80,r)
exten => sms,1,Set(sms=${SMS})
exten => sms,n,Set(sms_multiline=${BASE64_DECODE(${SMS_BASE64})})
exten => sms,n,Set(raw_cmgr_message=${CMGR})
exten => sms,n,Hangup

[meetme]
exten => s,1,Meetme(1234)
exten => s,2,Hangup

[voicemail]
exten => s,1,Voicemail(1234,u)
exten => s,2,Hangup

[echo]
exten => s,1,echo
exten => s,2,Hangup

[sipphone]
exten => _X.,1,Set(whoHungUp=CALLER)
exten => _X.,n,Dial(Dongle/dongle0/${EXTEN},,g)
exten => _X.,n,Set(whoHungUp=OTHERPARTY)
exten => _X.,n,Hangup
exten => h,1,NoOp(whoHungUp ${whoHungUp})

Then you can use SIP phone 6000 to dial a local mobile phone number, such as below

Connected to Asterisk 13.17.1 currently running on raspberrypi (pid = 457)
 == Using SIP RTP CoS mark 5
 -- Executing [18910500xxx@sipphone:1] Set("SIP/6000-00000002", "whoHungUp=CALLER") in new stack
 -- Executing [18910500xxx@sipphone:2] Dial("SIP/6000-00000002", "Dongle/dongle0/18910500xxx,,g") in new stack
 -- Called Dongle/dongle0/18910500xxx
 -- Dongle/dongle0-0100000001 is making progress passing it to SIP/6000-00000002
 -- Dongle/dongle0-0100000001 is ringing
 -- Dongle/dongle0-0100000001 answered SIP/6000-00000002
 -- Channel Dongle/dongle0-0100000001 joined 'simple_bridge' basic-bridge <3f1ca50e-de26-4c9d-9749-eff21aab76a8>
 -- Channel SIP/6000-00000002 joined 'simple_bridge' basic-bridge <3f1ca50e-de26-4c9d-9749-eff21aab76a8>
 > 0x74604da8 -- Probation passed - setting RTP source address to 192.168.5.18:60280
raspberrypi*CLI>

An incoming call and then dial 200 to forward it to a voicemail will be like below processed

Connected to Asterisk 13.17.1 currently running on raspberrypi (pid = 457)
 -- Executing [+8613269936xxx@from-trunk:1] Answer("Dongle/dongle0-0100000002", "") in new stack
 -- Executing [+8613269936xxx@from-trunk:2] BackGround("Dongle/dongle0-0100000002", "demo-instruct") in new stack
 -- <Dongle/dongle0-0100000002> Playing 'demo-instruct.gsm' (language 'en')
 -- Executing [200@from-trunk:1] Goto("Dongle/dongle0-0100000002", "voicemail,s,1") in new stack
 -- Goto (voicemail,s,1)
 -- Executing [s@voicemail:1] VoiceMail("Dongle/dongle0-0100000002", "1234,u") in new stack
 -- <Dongle/dongle0-0100000002> Playing '/var/spool/asterisk/voicemail/default/1234/unavail.gsm' (language 'en')
 -- <Dongle/dongle0-0100000002> Playing 'vm-intro.gsm' (language 'en')
 -- <Dongle/dongle0-0100000002> Playing 'beep.gsm' (language 'en')
 -- Recording the message
 -- x=0, open writing: /var/spool/asterisk/voicemail/default/1234/tmp/wFmKh7 format: wav49, 0x747063c8
 -- x=1, open writing: /var/spool/asterisk/voicemail/default/1234/tmp/wFmKh7 format: gsm, 0x74706680
 -- x=2, open writing: /var/spool/asterisk/voicemail/default/1234/tmp/wFmKh7 format: wav, 0x7471aae0
 -- User ended message by pressing #
 -- <Dongle/dongle0-0100000002> Playing 'auth-thankyou.gsm' (language 'en')
 -- Executing [s@voicemail:2] Hangup("Dongle/dongle0-0100000002", "") in new stack
 == Spawn extension (voicemail, s, 2) exited non-zero on 'Dongle/dongle0-0100000002'
raspberrypi*CLI>

Send text message with PiGSM

raspberrypi*CLI> 
 [dongle0] Got SMS from +8618910500xxx: 'How are you doing '
 -- Executing [sms@from-trunk:1] Set("Local/sms@from-trunk-00000000;1", "sms=How are you doing ") in new stack
 -- Executing [sms@from-trunk:2] Set("Local/sms@from-trunk-00000000;1", "sms_multiline=How are you doing ") in new stack
 -- Executing [sms@from-trunk:3] Set("Local/sms@from-trunk-00000000;1", "raw_cmgr_message=+CMGR: 0,"",36
 -- 0891683110102105F0240D91688119500068F500008110420154532312C8F71D14969741F9771D447EA7DD6710") in new stack
 -- Executing [sms@from-trunk:4] Hangup("Local/sms@from-trunk-00000000;1", "") in new stack
 == Spawn extension (from-trunk, sms, 4) exited non-zero on 'Local/sms@from-trunk-00000000;1'
 -- Executing [h@from-trunk:1] Answer("Local/sms@from-trunk-00000000;1", "") in new stack
 == Spawn extension (from-trunk, h, 1) exited non-zero on 'Local/sms@from-trunk-00000000;1'

raspberrypi*CLI> dongle sms dongle0 +8618910500xxx "very good, thank you"
[dongle0] SMS queued for send with id 0x73e00580
 -- [dongle0] Successfully sent SMS message 0x73e00580
[Nov 25 15:21:07] NOTICE[521]: at_response.c:265 at_response_ok: [dongle0] Successfully sent SMS message 0x73e00580
raspberrypi*CLI>

And the phone received the Asterisk sent out text message

sms_example

 

Manual of install PiTDM module

PiTDM Module hardware installation

Install the FXS or FXO modules to PiTDM module as below picture shows

FXO_2

Insert the PiTDM module to a Raspberry Pi 2 or 3 board like below picture shows

IMG_7115

We provide 4 plastic screws, use them to fix the PiTDM board to Raspberry Pi board such as below shows

IMG_7122

The finally looks like below

IMG_7117

Until now, the PiTDM module installation is done, let us move to software installation.

PiTDM Module software installation

Go to the SwitchPi official website download the switchpi tdm firmware – switchpi-tdm-v103.img.tar.gz in here (switchpi-tdm-v101/2.img.tar.gz is EOL, please use v103). The switchpi-tdm firmware currently version is 1.0.3, built-in Asterisk-13.17.1 and Dahdi-2.11.0.

Put the downloaded firmware to a Linux distro PC, then following below steps to clone it to an 8G SD card (we strongly suggested to use a class 10 HC SD card such as below SanDisk one), insert micro SD card to your PC with a USB SD card adaptor, the Linux will recognized it like /dev/sda or /dev/sdb which depends on your OS how many drives, you can check it out with command “dmesg”, we are using the /dev/sdb in here.

SD

root@pitdm:~/pitdm# tar zxvf switchpi-tdm-v103.img.tar.gz switchpi-tdm-v1.img root@sipcap:~/pitdm#
root@sipcap:~/pitdm# dd if=switchpi-tdm-v103.img of=/dev/sdb bs=4M
1895+0 records in
1895+0 records out
7948206080 bytes (7.9 GB) copied, 1004.1 s, 7.9 MB/s

Remove the SD card from Linux PC and insert it to your Raspberry Pi 2/3 board, plug the 12V 1A power supply which is with your PiTDM module together when you received your order as below shows

IMG_7118

Please pay attention in here, as our PiTDM will feeding your Raspberry Pi power as well, thus you DO NOT need to require to insert the Raspberry Pi USB DC power supply anymore !!!

IMG_7119

The default IP address is 192.168.5.68, you can ssh log into it with username “pi”, password “pi”. We also provide the serial console login your Raspberry Pi, please connect your serial cable like below picture shows, the terminal parameters is 115200/8/n1

PiTDM

The console login username and password same to SSH which is pi and pi.

The firmware will automatically detect you installed FXO or FXS modules and configure them. There is few demonstrations Asterisk extension script which we configured you can use it directly to make a first call or test, here are the steps.

root@pitdm:~/pitdm# ssh pi@192.168.5.68
The authenticity of host '192.168.5.68 (192.168.5.68)' can't be established.
ECDSA key fingerprint is 68:47:f0:e8:c9:48:a4:4c:8b:aa:27:9f:2xxxxxxxxxx.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.5.68' (ECDSA) to the list of known hosts.
pi@192.168.5.68's password:
Linux raspberrypi 4.9.53-v7+ #1 SMP Mon Oct 9 10:28:56 UTC 2017 armv7l
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sat Nov 25 14:28:53 2017 from 192.168.5.18

pi@raspberrypi:~ $ dmesg
......
[ 7.168609] Module 0: Installed -- AUTO FXS/DPO
[ 9.418584] Module 1: Installed -- AUTO FXS/DPO
[ 11.468594] Module 2: Installed -- AUTO FXS/DPO
[ 13.638572] Module 3: Installed -- AUTO FXS/DPO
[ 13.638584] Found a Wildcard TDM: Raspberry PiTDM FXS/FXO (4 modules)

pi@raspberrypi:~ $ sudo dahdi_genconf 
pi@raspberrypi:~ $ sudo dahdi_scan 
[1]
active=yes
alarms=OK
description=Raspberry PiTDM FXS/FXO Board 5
name=PITDM/4
manufacturer=SwitchPi.com
devicetype=Raspberry PiTDM FXS/FXO
location=BCM2835 Bus 01 Slot 01
basechan=1
totchans=4
irq=0
type=analog
port=1,FXO
port=2,FXO
port=3,FXO
port=4,FXO
pi@raspberrypi:~ $ sudo dahdi_cfg -vv
DAHDI Tools Version - 2.11.0
DAHDI Version: 2.11.0
Echo Canceller(s): 
Configuration
======================
Channel map:
Channel 01: FXS Kewlstart (Default) (Echo Canceler: mg2) (Slaves: 01)
Channel 02: FXS Kewlstart (Default) (Echo Canceler: mg2) (Slaves: 02)
Channel 03: FXS Kewlstart (Default) (Echo Canceler: mg2) (Slaves: 03)
Channel 04: FXS Kewlstart (Default) (Echo Canceler: mg2) (Slaves: 04)
4 channels to configure.
Setting echocan for channel 1 to mg2
Setting echocan for channel 2 to mg2
Setting echocan for channel 3 to mg2
Setting echocan for channel 4 to mg2
*CLI> dahdi show channels 
   Chan Extension       Context         Language   MOH Interpret        Blocked    In Service Description                     
 pseudo                 default                    default                         Yes                                        
      1                 from-pstn                  default                         Yes                                        
      2                 from-pstn                  default                         Yes                                        
      3                 from-pstn                  default                         Yes                                        
      4                 from-pstn                  default                         Yes                     

As we installed 2 dual ports FXS modules in this examples, you can see there are 4 ports were recognized by Asterisk. Now you can make a call to test, insert your FXS phone cable to one of 4 ports of PiTDM module as below picture shows port1 to port 4 location.

ports

Then dial extension 6000, you will hear the Asterisk welcome demo-instruct voice out from the phone.

raspberrypi*CLI> 
    -- Starting simple switch on 'DAHDI/1-1'
    -- Executing [6000@from-internal:1] Answer("DAHDI/1-1", "") in new stack
    -- Executing [6000@from-internal:2] Playback("DAHDI/1-1", "demo-instruct") in new stack
    -- <DAHDI/1-1> Playing 'demo-instruct.gsm' (language 'en')
raspberrypi*CLI>

Or you can use a SIP phone to register to the Asterisk with username 6000 and secret 6000, and try dial extension 6000 (or you can check the sip.conf out for how to add a SIP phone), please be noticed, this test requires you connect to your FXS phone to port 3 of PiTDM module.

Connected to Asterisk 13.17.1 currently running on raspberrypi (pid = 411)
    -- Registered SIP '6000' at 192.168.5.18:64128
       > Saved useragent "X-Lite release 5.0.3 stamp 88253" for peer 6000
    -- Unregistered SIP '6000'
    -- Registered SIP '6000' at 192.168.5.18:64128
  == Using SIP RTP CoS mark 5
    -- Executing [6000@sipphone:1] Set("SIP/6000-00000001", "whoHungUp=CALLER") in new stack
    -- Executing [6000@sipphone:2] Dial("SIP/6000-00000001", "dahdi/3/6000,,g") in new stack
    -- Called dahdi/3/6000
    -- DAHDI/3-1 is ringing
    -- DAHDI/3-1 is ringing
    -- DAHDI/3-1 answered SIP/6000-00000001
    -- Channel DAHDI/3-1 joined 'simple_bridge' basic-bridge <b62863bd-8daf-4932-a971-bd963fcaa562>
    -- Channel SIP/6000-00000001 joined 'simple_bridge' basic-bridge <b62863bd-8daf-4932-a971-bd963fcaa562>
       > 0x743f9250 -- Probation passed - setting RTP source address to 192.168.5.18:54806

For more PiTDM specification please check this link out.

Go here to order a PiTDM module now!

Warning!

Few customers reported that the PiTDM module might have the poor voice(receive) on PI 3+, we would like you to use this module on PI2 B (Released in February 2015[27]) first. 

 

PiGSM module Specification

Single Port GSM module

The PiGSM single port GSM module which can support a quad-band GSM/GPRS, that is integrated a SIM800L module, that works on frequencies GSM850MHz, EGSM900MHz, DCS1800MHz and PCS1900MHz. That features GPRS multi-slot class 12/ class 10 (optional) and supports the GPRS coding schemes CS-1, CS-2, CS-3, and CS-4.

The PiGSM module is compatibles with all versions of Asterisk and the asterisk-chan-dongle driver framework. Asterisk is available for free from the Asterisk.org website, the asterisk-chan-dongle source code available for free in here

Specifications:

  • Frequency bands: Quad-band: GSM 850, EGSM 900, DCS 1800, PCS 1900. SIM800L can search the 4 frequency bands automatically.
  • Compliant with GSM Phase 2/2+
  • Transmitting power: Class 4 (2W) at GSM 850 and EGSM 900, Class 1 (1W) at DCS 1800 and PCS 1900
  • Temperature range: Normal operation: -40°C ~ +85°C

Pictures

This slideshow requires JavaScript.

PiTDM module Specification

4-Ports Analog module

The PiTDM analog module supports up to four (4) connections per card in your Asterisk system. The PiTDM cards can scale from one (1) to four (4) ports.

The modular nature of the cards allows you to mix and match between line (FXO) and station (FXS) interfaces, giving you the exact port configuration you need.

The PiTDM module is compatibles with all versions of Asterisk using the DAHDI driver framework. Asterisk and DAHDI are available for free from the Asterisk.org website.

Specifications:

  1. One (1) – four (4) analog ports
  2. Raspberry Pi I2S, SPI bus architectures
  3. Combine line (FXO) and station (FXS) modules
  4. Accepts up to four (4) single-port modules
  5. Loop Start or Kewl Start Signaling
  6. Temperature: 0° to 50° C
  7. With Asterisk – DAHDI 2.11.0

Pictures:

This slideshow requires JavaScript.