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


Insert the SIM card like blow picture shows


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


The finally looks like below


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 – 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.


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 
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 !!!


The default IP address is, 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


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

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

canreinvite=no ; Typically set to NO if behind NAT
allow=all ; GSM consumes far less bandwidth than G711-u (ulaw)

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

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

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

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

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

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

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'

Send text message with PiGSM

 [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

And the phone received the Asterisk sent out text message



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s