项目作者: muhannad0

项目描述 :
send SMS with Kannel and huawei 4g usb modem on Linux
高级语言: Shell
项目地址: git://github.com/muhannad0/kannelsms.git
创建时间: 2018-11-22T03:13:32Z
项目社区:https://github.com/muhannad0/kannelsms

开源协议:

下载


Kannel SMS Using Huawei USB 4G Modem

Config files and steps needed to make a Huawei 4G modem work with kannel to send/receive SMS.

Getting Started

This setup was done on a RaspberryPi 3 running Raspbian GNU/Linux 8 (jessie) with Huawei E3372 4G Modem. You may have to adjust configuration based on OS and type of modem used. I assume you have some knowledge on how kannel works and using it to send SMS.

Install Required Packages

Always update & upgrade first to be relevant

  1. sudo apt-get update && sudo apt-get upgrade -y

Make sure you have usb-modeswitch

  1. sudo apt-get install usb-modeswitch

Copy the configuration files to the required locations

12d1:14fe

  1. /etc/usb_modeswitch.d/12d1:14fe

modem-switch.sh

  1. /home/pi/modem-switch.sh

You can run script manually to check if modem switch happens to be sure.

Run lsusb command
Output would be shown as:

from storage mode

  1. ID 12d1:14fe Huawei Technologies Co., Ltd.

to modem mode

  1. ID 12d1:1506 Huawei Technologies Co., Ltd. E398 LTE/UMTS/GSM Modem/Networkcard

modem-switch.service

  1. /lib/systemd/system/modem-switch.service

Set permissions

  1. sudo chmod 644 /lib/systemd/system/modem-switch.service

Enable service to start on reboot

  1. sudo systemctl daemon-reload
  2. sudo systemctl enable sample.service

Installing Kannel

Install Packages

  1. sudo apt-get install kannel -y
  2. sudo mkdir -p /var/log/kannel /var/run/kannel /var/spool/kannel/store
  3. sudo chown -R kannel /var/run/kannel /var/spool/kannel/store
  4. sudo chown -R kannel:adm /var/log/kannel
  5. sudo usermod -a -G dialout kannel

Stop the service until we get the config setup right.

  1. sudo service kannel stop

Set kannel to start SMSbox instead of WAPbox

  1. sudo sed -i 's/#START_SMSBOX/START_SMSBOX/' /etc/default/kannel

Create a backup of original config and replace with provided config.

kannel.conf

  1. sudo cp /etc/kannel/kannel.conf /etc/kannel/kannel.conf.dist
  2. /etc/kannel/kannel.conf

Startup kannel

  1. sudo service kannel start

Check if kannel is running

Acknowledgement