Networking

Installing playSMS with Gammu in Ubuntu Server 15.04 – Part 3 – Gammu installation, configuration & verification

October 24, 2015

Okay, so you have been through some comparatively easy steps but now is the ultimate step leading you to the final configuration of your server using Gammu gateway. So, have patience and configure it step by step..

For this demonstration, I will be using ZTE MF 190 dongle with a SIM Card.

ZTE MF190
ZTE MF190

Also I would like to say that since I am working in a virtualized environment there are some passthrough options required. Though I will go through those steps, you can ignore if you don’t use ESXi. Unfortunately my hardware did not support Passthrough option directly (Direct I/O) so I had to mount my USB of another PC to my server.
Screenshot_1

Steps for mounting USB in vSphere Client:

  1. Open VMWare vShphere Client.
  2. Right click on the VM name and click Edit settings.
    Screenshot_3
  3. Click Add –> Select USB Controller. –> Next
    Screenshot_4
  4. Click Next
    Screenshot_5
  5. Click Finish
    Screenshot_6
  6. Open VM Console. Click on USB icon. Select the Dongle from the list. In my case ZTE.
    Screenshot_7

Detecting & Identifying our modem:

  1. Download wvdialconf tool.
    apt-get install wvdial
  2. Issue wvdialconf to identify modem.
    Screenshot_1
  3. In my case no modem was detected. But issuing lsusb produced the following. That means the device is connected to host successfully. Now if your device is not detected also, follow the steps below but I cannot guarantee it will work for other vendors too apart from ZTE.
    Screenshot_2
  4. Install USB Modeswitch
    apt-get install usb-modeswitch
  5. Find the details of your modem using lsusb, note down the device ID. Then issue the following
    lsusb -v -s [ID].

    Screenshot_3

  6. Note down product ID and vendor ID.
  7. Then change USB mode using the following command. Refer usb_modeswitch manual for more details.
    usb_modeswitch -W -v 19d2 -p 2000 -M "5553424312345678000000000000061b000000020000000000000000000000"

    In the above statement -v denotes Vendor ID & -p denotes Product ID which you have noted in step 5.

  8. Again issue lsusb command and note the changes.
    Screenshot_4
  9. Again issue the wvdialconf and now you will see that the modem will be detected now.
    Screenshot_5
  10. Open the configuration file where your modem details will be saved. Note the Modem Value.
    nano /etc/wvdial.conf

    Screenshot_7

Procedure for installing Gammu:

  1. Enter into super user mode.
    sudo su
  2. Install Gammu
    apt-get install gammu gammu-smsd
  3. Create necessary directories
    mkdir -p /var/log/gammu /var/spool/gammu/{inbox,outbox,sent,error}
  4. Setup Gammu spool directories owner and permission
    chown www-data:www-data -R /var/spool/gammu/*
  5. We’ll get example of gammu-smsdrc from playSMS package and copy to /etc/
    wget -c https://raw.githubusercontent.com/antonraharja/playSMS/master/contrib/gammu/linux/gammu-smsdrc
     cp gammu-smsdrc /etc/
  6. Edit the configuration file
    nano /etc/gammu-smsdrc
  7. Edit port and connection only with the values noted in step 10 of Modem Detection.
  8. Create a symbolic link using the following command(IMPORTANT)
    ln -s /etc/gammu-smsdrc /etc/gammurc
  9. Use the following command to detect modem using gammu.
    gammu -f /var/log/gammulog identify
  10. Change the user in the daemon configuration file. It is by default gammu user. I don’t have any user with that name. So I changed it to root.
    nano /etc/init.d/gammu-smsd

    Edit USER=gammu to USER=root

  11. For testing purpose, issue gammu send sms commandline
    gammu sendsms TEXT [Receiver Phone No.] -text "Hello World!"
  12. Start Gammu.
    /etc/init.d/gammu-smsd start
  13. Now add gammu to rc.local for auto starting it.
    nano /etc/rc.local

    Add /etc/init.d/gammu-smsd start before exit 0

  14. Verify if gammu service is running.
    ps ax | grep -v grep | grep gammu-smsd
  15. Monitor Gammu smsd log file
    tail -f /var/log/gammu/smsd.log
  16. Then login into playSMS via web browser. From settings –> Manage Gateway & SMSC, Click on Gammu Settings.
  17. Copy the folder path.
  18. Then Click on “+” Symbol after Gammu. Create a SMSC.
  19. Then from Settings -> Main Configurations -> Default SMSC -> Select Gammu.
  20. Compose an SMS via playSMS.

Video Tutorial

Other tutorials of this series:

  1. Installing playSMS with Gammu in Ubuntu Server 15.04 – Part 1 – Preparing the server
  2. Installing playSMS with Gammu in Ubuntu Server 15.04 – Part 2 – playSMS installation & configuration
  3. Installing playSMS with Gammu in Ubuntu Server 15.04 – Part 3 – Gammu installation, configuration & verification