Siemens MC39i GSM Modem send SMS linux - php

I recently bought a serial modem "Siemens MC39i GSM Modem" in an attempt to setup a script that would send SMS to customers.
Anyway its all connected up I believe it is /dev/ttyS0 and I have tried running the following code which I found elsewhere:
echo "AT
AT+CMGF=1
AT+CMGW="+775557"
> A simple demo of SMS text messaging.
+CMGW: 1
AT+CMSS=1
+CMSS: 20
" > /dev/ttyS0
The modem light flashes but nothing happens I dont receive an SMS, also no output is returned either.
Does anyone have any advice who may have done something like this before?
Thanks!

You can do that with any mobile phone connected via the serial port or USB. And while you certainly can interface to it via AT commands, you shouldn't really do it manually.
The prefered way is most certainly to use gnokii for sending sms:
exec('echo "A simple demo." | gnokii --sendsms +775557 --report');
And there are likely SMS libraries for PHP too, especially for the special charset encoding required. (But you can inspect whatever gnokii sends to the serial devfile.)

Related

How to read SMS from GSM Modem using AT and AT+ commands in php?

I want to read SMS received on a SIM.
SIM is inserted into GSM modem, modem is connected to my local machine using USB port.
I am using wamp on windows
After reading SMS I wan't to check whether SMS content has specific word, if yes I want to call one API. I can achieve this once I am able to read the SMS.
Also I will be scheduling this script, as I have to keep reading SMS 24X7.
Is there any library or script available for this?
You can install and make a simple config for Kannel Then use it's API or db to read incoming SMS
But it's not an easy job

How to read GSM device from USB port using PHP Script ?

I have a USB GSM device which I use for Internet connection as well as for Sending SMS through the software provided by the device itself. I would like to know if is it possible to read this device from USB port using PHP server side script ?
If it is possible, how we can do it & process some actions on it like Send SMS or receive SMS ?
Currently I am using Wamp on my Windows Machine. I would also like to do this on Linux machine too but that is in the very later stage so that is not part of this question at the moment.
Thanks in advance.
There are several libraries and tutorials about how to control serial ports with PHP.
Example: https://gist.github.com/51342
Article about this http://www.communitymx.com/content/article.cfm?cid=8658A
An article about exactly what you need is here (thanks to Mathew Hall)

Sending SMS through USB interfaced GSM Modem in PHP

I have searched on Google and found that I have to use AT commands to send SMS here is the link,
http://gonzalo123.wordpress.com/2011/03/21/howto-sendread-smss-using-a-gsm-modem-at-commands-and-php/
But in this tutorial he is using serial interfaced GSM modem, is it possible to send SMS via USB interfaced GMS modem. Please guide me.
A USB interfaced GSM modem will be presenting a USB serial interface, usually / hopefully conforming to the USB CDC specification. In other words you can treat it as a virtual COM port and the tutorial you linked to will still be relevant for you.
In Unix systems you can read/write from USB and Serial port reading data from /dev/ttyS0 or /dev/ttyUSB0. You also can use a usb/serial converter. They are cheap devices. But my experience with those usb converters is very bad. Because of that I prefer to use serial/ethernet convertes. They also allow me to place the serial device in any place and not necesary close to the server. OK maybe with a GSM device is not a problem. We can place it wherever we want, but if we are using the same technique to read/write from another device (like sensors, scales, ...), this may be a problem.

PHP Commands to USB Modem

Please what is the AT commands in PHP compatible with Huawei USB Modem ?
i need to use these commands in script then i can send sms using the Huawei USB Modem.
thanks
The first thing you need to do is to open up the serial port with PHP. There is a class for doing this: http://code.google.com/p/php-serial/
Once open, it is as simple as this:
$serial->sendMessage("AT+CMGS=\"+1231231234\"\nHello");
Obviously, the AT commands can vary from device to device, so you will need to find out the commands for your specific device.
A saner approach would be to delegate SMS management to a specialized software, because in my experience there's more to do to manage SMS sends than just throwing a couple of bytes to a modem
network availability checks and the corresponding retries to optimize your delivery rate
capability to receive SMS'es
multipart messages
routing
...
I suggest the most excellent SMSTools it's a server software compatible with Linux and Windows, it talks with your application via regular ASCII files in specific directories (in, out, failed, ...) and has a host of other advanced functions.
To send a basic sms with default options you just have to create a text file like this one
To: 155512345
Hello, this is the text of the SMS
in the out-spool directory, on Linux that's /var/spool/sms/outgoing unless you reconfigure that path.
Best of all it's free and open source.

What do I need to send text messages with Kannel?

I want to be able to send text messages from Linux with PHP. I've read about and installed Kannel, a free SMS gateway. When I try to use the HTTP interface, it won't send a message. Do I need something else to send text messages via kannel, like a modem?
Yes, you need a GSM modem and a SIM card from your local mobile network provider.
To setup your GSM modem, you can auto-detect its settings using wvdialconf. The output contains pertinent information such as Baud rate, which serial port is used, and the modem's initialization string.
To test that your modem works properly, you can use minicom. Minicom acts as a terminal to any serial device (in this case, a GSM modem) and, with it, you can send AT commands to your modem.
I dont know if this is a solution, but Clickatell provides a very easy to use HTML api for sending sms messages anywhere in the world. I'v been using them for several years. You only pay for the sms messages you send.

Categories