How to send SMS from Mac terminal via GSM modem? - terminal

I have Mio A701 communicator that I would like to use as GSM modem for sending SMS from my Mac.
What I've found so far is that one just can send an AT commands directly from terminal to special ports like /dev/ttyUSB0 if modem is connected via USB port or /dev/rfcomm0 if connection is handled via bluetooth.
My problem is that when I try to issue a command I get a "permission denied" response:
"AT+CMGS=test\r" > /dev/ttyUSB0
-bash: /dev/ttyUSB0: Permission denied
Also "ls /dev" shows that neither ttyUSB0 nor rfcomm0 files are present there so I can't update permissions on these files.
Any help would be greatly appreciated, thanks in advance.
Update: problem is solved.
First of all Mio A701 appears to be wrong choice since it does not support AT commands for sending SMS.
This PHP code works fine with Nokia 3310c connected via bluetooth:
$number="<phone number in international format with + sign>";
$message="Hello World\ntest"; // as far as I've tested \n successfully turns into a line break in SMS on Mio, Nokia and Alcatel phones
$port="/dev/tty.phone"; // this path was set in "Mac preferences" -> bluetooth -> "configure ports" for selected device
if($fd = fopen($port, 'a')) {
fwrite($fd, "AT+CMGF=1\r"); // text mode for SMS
sleep(2);
fwrite($fd, "AT+CMGS=\"$number\"\r");
sleep(2);
fwrite($fd, "$message\032");
sleep(2);
$fh = null;
} else
echo "Phone unreachable";

best way to send sms and ussd messages is to install smstools3 (not smstools) and build on the sample scripts.

Try smsd utility from smstools package, hope it will help

Related

Send SMS from Linux programmatically

I want to send SMS ideally using PHP in a Linux Environment. I have a GSM modem which I want to use to send SMS.
Can anybody please tell me an easy way to send SMS from Linux using a USB GSM modem?
Thank you
Your GSM modem will almost certainly support AT commands - you can see some history of AT, or Hayes, commands here: https://en.wikipedia.org/wiki/Hayes_command_set
The commands supported can vary from device to device but the simplest command sequence to send an SMS message is fairly standard - an example, showing the communication over the serial port, is:
AT+CMGF=1. [you send this]
OK [Modem responds]
AT+CMGS="+31628870634". [you send this]
> Yourtextmessage.→. [Modem responds with > and you send text followed by return at end]
+CMGS: 198 [Modem responds after a few moments when message is sent]
You should be able to find many more examples with a quick search including using PHP - e.g. (at the time of writing): https://gonzalo123.com/2011/03/21/howto-sendread-smss-using-a-gsm-modem-at-commands-and-php/
Its worth being aware that different modems may work differently - you will need to experiment to ensure you have a relabel solution.

Reading SMS Through HSDPA Modem with At Commands

I am trying to Read SMS through HSDPA Modem. I Tried
AT+CMGR=1
AT+CMGR=123
AT+CMGR="ALL'
AT+CMGR="REC ALL"
AT+CMGL="ALL"
Commands but No Sucess. Is Any problem with serialport configuration or something else Any other possible solution please help me
Baud Rate:9600
Data bits:8
Parity:None
Stop bit:1
Once you have connected your terminal emulator to your modem (typically /dev/ttyUSB0 on Linux), try AT. If you get an OK or ERROR that means you have no problem with serial port configuration because the modem is responding to you. If you get nothing (ei, no reply from the modem), then you probably have a serial connection or modem hardware issue. Personnaly I'm using miniterm.py (on Linux) and the configuration is
maurice#mickey> sudo miniterm.py -e /dev/ttyUSB0`
--- Miniterm on /dev/ttyUSB0: 9600,8,N,1 ---
Just as yours.
Regarding reading the SMSes, at+cmgl=? should reply either ERROR or a list of statuses. If you get ERROR, this means your modem doesn't accept SMS. Otherwise you should get something like +cmgl: ("REC UNREAD","REC READ","STO UNSENT","STO SENT","ALL")
Now, if you issue at+cmgr, the answer should look like
+CMGL: 8,"REC UNREAD","+XXXXXXXXXXXX",,"16/02/19,19:52:07+12"
Test 1
+CMGL: 9,"REC UNREAD","+XXXXXXXXXXXX",,"16/02/19,19:52:16+12"
Test 2
where +XXXXXXXXXXXX is the sender MSISDN and "Test 1" is the message sent in the SMS (its content). Again, if you get ERROR, that means your modem doesn't accept SMSes. If you have sent some SMSes but the list is empty, maybe SMS are blocked on the HLR for this specific SIM.
To read the 8th SMS, issue at+cmgr=8 and you should get
+CMGR: "REC READ","+XXXXXXXXXXXX",,"16/02/19,19:52:07+12"
Test 1
OK

Why I am not able to receive sms using AT commands?

I want to send / receive sms using AT commands from my computer to my mobile phone. I connected my phone to my computer using a USB port. My computer detects the modem and I am able to send sms from the computer to mobile phone. However, I am not able to receive sms in my computer..
I am presenting a sample of what I get from AT editor
AT+CMGF=1
OK
AT+CNMI=1,2,0,0,0
Error
What can I do to send this prob and why am I getting this Error?
Every phone has different capabilities so you should check which values for each parameter are valid for your phone by sending it a
AT+CNMI=?
For example my phone doesn't support your example because mode 1 is not supported. For the full syntax of +CNMI you can consult the AT Manual of your manufacturer or the ETSI standard or read this brief tutorial http://www.cellular.co.za/at_etsi.htm
AT+CNMI is used anyway just to get a notification when a SMS arrives, in order to read the content of the stored SMS you have to use AT+CMGL= or AT+CMGR=.
Briefly:
AT+CMGF=1 ;sets the text mode
AT+CMGL=? ;tells you which memories are available
AT+CSCS=? ;tells you which character sets are available
AT+CSCS="8859-1" ;sets Latin1 as the charset so that you can see eventually accented letters
AT+CMGL="ALL" ;prints every text message you have stored in your phone
Most of the phones returns Error when some special AT command sent to them and +CNMI is one of that command. It will return error also when send AT+CNMI=?.
So forget Phones buy a GSM Modem based on RS232 or USB and then try it again.

SMS: AT commands

I am trying to set up an SMS gateway on my computer
here's some code I found:
AT
OK
AT+CMGF=1
OK
AT+CMGL="ALL"
+CMGL: 1,"REC READ","+85291234567",,"06/11/11,00:30:29+32"
Hello, welcome to our SMS tutorial.
+CMGL: 2,"REC READ","+85291234567",,"06/11/11,00:32:20+32"
A simple demo of SMS text messaging.
OK
can this be done in windows?
what steps do I have to take in order to set this up?
what is the compiler?
how do I get started?
These are AT commands, which are used with modems (or cell phones) who support that interface.
If you cell phone is connected to your computer by serial, you can open a HyperTerminal/Telnet/etc and communicate with it via AT commands.
There is no compiler or such, as this is merely a protocol for communicating with supporting devices.

error 734 the ppp link control protocal was terminated

I want to connect my mobile internet to pc using bluetooth device. I installed blue soleil software in my pc.
Steps:
I can able to pair my cellphone with pc bluetooth device.
I selected my device and select bluetooth dialup networking service.
It asks an alert "DUN connection with device?" in my mobile.
After Clicked "YES", connect bluetooth DUN connection window opens.
In that window there was a fields "User Name", "PassWord" which i leave empty and then in "Dial = *99***1#" and click Dial button.
After that it say "Registering your computer on the netwok.." and become fails.
The Error is as "error 734 the ppp link control protocal was terminated"
The same procedure should be followed for Nokia 3110c it works fine.But in my samsung mobile c3053 it not connected also i am tryig with samsung corby pro BT3510 mobile .
Is there any settings changes needed for samsung mobiles ?
When I've seen this error in the past, it generally indicates that the username and password for the connection is not correct. (Many GPRS configurations do not require a username and password, but some do.)
Or, the GPRS APN is not configured correctly.
If you are trying to use the device as a general purpose modem, it can be difficult to set the GPRS APN without extra dialer software. The easiest way is to add an "AT+CGDCONT" command to the "extra initialisation commands" that can be configured for the modem in the Windows control panel.
A specific example of what would be configured for this "extra initialisation command" is:
AT+CGDCONT=1,"IP","internet"
You would replace internet in this example with the name of the GPRS APN to which you want to connect.
Also, you can refer the following link for checking the connection:
http://support.microsoft.com/kb/318718
I almost got mad as a result of this problem few days back. I tried all the solutions suggested in different forums but to no avail.
My issue was not of insufficient airtime as suggested by some folks, nor the ppp link settings but because i had a space before the username input in my username and password field input in my dial up box.
So folks, if you are getting a PPP link termination error, check user name and password fields carefully for a single SPACE in this field will automatically call up this error when you dial. eg
My user name is: 7032564825#bluebroadband.com
Password: 1234
A space before the first number (that is 7 as in the example above) will trigger this error message. So guys give it a check before you search for other options like airtime and dial up settings.
If you get "734 the ppp link control protocal was terminated" with a SAMSUNG mobile phone, the problem is in the phone. On Phone Settings -> PC Connections select that your phone will always be in "PC Studio" mode. If you select other modes or "Ask each time" you will get 743 when trying to use the phone as a modem.
the solution is very simple. you just need to put extra initialization command.
Please don't read too much tech about ppp and its meaning.
i had same problem in 2006 what you have to do is in modem( the active e.g. bluetooth DUN modem or hardware modem or mobile as a modem) just go to propertise of : my computer>device manager> modem
then modem propertises> advance> Extra Initialization command
here you just have to put command
e.g i use bsnl net so command will be:
at+cgdcont=1,"ip","bsnlnet"
bsnlnet is APN, if you use airtel, anp is "airtelgprs.com"
I too faced the same problem, I even searched on line for a solution, but I figured my self based on the instructions that were given from the customer service centre. I have been using a bsnl network, to avoid ppp link control termination problem
Activate GPRS by sending START sms to BSNL service initiated number
Wait for some time at-least 2 hours to get activated after activation you will receive a activation message.
Since bsnl network, we have to create a APN - Access Point Network
i) create an APN as - bsnlnet
ii) password as 1111
Now change your access point network as bsnlnet switch on your mobile data.
Enjoy Internet.....

Resources