Gammu SMS
Récupéré sur la Wayback Machine (capture du 27/11/2012)
OK avec : Ubuntu + Clé 3G Huawei E352 Debian + Raspberry PI + Clé 3G Nokia CS-15
POUR PLUS DE FIABILITÉ DÉSACTIVER LE CODE PIN A L'AIDE D'UN VRAI TÉLÉPHONE
- Installation des paquets nécessaires :
apt-get install gsm-utils gammu usb-modeswitch minicom- Passage de la clé 3G en mode modem (ne pas brancher la clé) :
/lib/udev/usb_modeswitch --vendor 0x12d1 --product 0x1446 --type option-zerocd
modprobe usbserial vendor=0x12d1 product=0x140cBranché la clé .
- Utilisation de minicom :
Configuration :
pico /etc/minicom/minirc.dfl# Fichier généré automatiquement - utilisez « minicom -s »
# pour changer les paramètres
pu port /dev/ttyUSB0
pu baudrate 230400
pu bits 8
pu parity N
pu stopbits 1
pu minit ATZUtilisation :
minicomQuelques commandes :
Some AT-commands (reference only):
- Show model and EMEI number:
ATI
Manufacturer: huawei
Model: E220
Revision: 11.117.09.04.00
IMEI: 354111128111119+GCAP: +CGSM,+DS,+ES
OK- show registers
AT&V- provide pin-code:
AT+CPIN="0000"
OK- Get the network signal strength: the first value.
- Typical values from 5 to 22.
- Minimum acceptable for reliable connections is 12.
AT+CSQ+CSQ: 16,99
OK- (replace xxxx with your own PIN)
- Turn off the PIN question
AT+CLCK="SC",0,"XXXX"- To turn the PIN question on again, type
AT+CLCK="SC",1,"XXXX"- Check if the PIN question is on or off.
- "+CLCK: 0" PIN is off, "+CLCK: 1" the PIN is on.
AT+CLCK="SC",2+CLCK: 1
OKDisable PIN procedure in minicom:
- first login with PIN
AT+CPIN="0000"
OK- disable PIN, providing PIN again:
AT+CLCK="SC",0,"0000"
OK- check if disabled (0=disabled, 1=enabled)
AT+CLCK="SC",2+CLCK: 0
- Utilisation de gammu :
Config :
pico gammurc[gammu]
port = /dev/ttyUSB0
connection = at
name=huawei e1550
model=Utilisation :
Il faut bien penser à avoir rentrer le code PIN via minicom si il y en a un sur la SIM .
Envoie SMS :
gammu sendsms TEXT +33661123456 -text "nouveau test"Lire SMS :
gammu --getallsmsEnvoie de SMS en PHP :
Donner les droits :
usermod -a -G dialout www-data
chmod 777 /dev/ttyUSB0Scripts PHP que l'on appelera pour envoyer un msg (attention il faut configurer ensuite apache pour que cette page ne puisse être lui uniquement que par les ips autorisés ) :
pico sms.php<?php
$numeros = $_GET['numeros'];
$texte = $_GET['texte'];
$output = shell_exec("gammu sendsms TEXT '$numeros' -text '$texte'");
echo "$output";
?>Utiliser l'url : http://monserveur.com/sms.php?numeros=33612345678&texte=Mon Texte A Envoyer