+CMS ERROR: 304, sending message using at command - sms

Im new to GSM and AT command sets,
based on the error +CMS ERROR: 304 its a Invalid PDU mode parameter according to activexperts
Im trying to send message using AT command to GSM modem in PDU mode
AT+CMGF=0
OK
AT+CMGS=31
> 079136190700203911000C913639350768260000AA13C834A89D07B9C3ED32283D0751C3F3F41B
+CMS ERROR: 304
Can you help me guys what did I missed or mistake? I used this to encode the PDU
Thanks guys.

Try by chaning PDU mode. Use the following command:
AT + CMGF = 1
If you are trying to Send SMS try AT + CMGF = 1 first and then again AT+CMGS="NUMBER" and hope after typing the message on > prompt, you are using CTRL+Z key combination to send SMS.

Instead of hitting ENTER after placing the PDU, use CTRL-Z to send message.
credits to #user2543882

Related

SIM900 - Send SMS over 160 characters using Gammu

I am using raspberry
Pi 3 for sending SMS using SIM900A. I configured Gammu to send SMS via SIM900A and it worked fine. But I was able to send only 156 characters(Max). I need to send more than 200 characters.
Command I used : " echo 'MESSAGE' | sudo gammu sendsms TEXT +91XXXXXXXXXX"
Is there any way to do that? I am open for both AT commands and Gammu way.
Thanks in advance...
P.S : I would prefer TEXT format than PDU
This works for me.
Please try this.
echo 'MESSAGE' | sudo gammu sendsms TEXT +91XXXXXXXXXX" -len 400
Internally gammu sends more than one message if it is greater than 156 characters, but that is transparent to you. You only send a message with that command of up to 400 characters, and the phone receives 1 SMS only.

Candump Filter is occasionally not working correctly

For a bash script, where I read information from a Micoboard via can, I use the candump command with a filter to read a specific message.
My problem is that while the filter itself is working correctly, the candump command with the filter occasionally does not record the specific message on the Can Bus.
I have already verified that the expected message is being sent, by displaying all can canmessages with candump without the filter.
The code of the bash script to receive the specific can message is displayed here :
CAN_PORT="can4"
CAN_ID_GET_VERSION=01500000
CAN_ID_SET_VERSION=01230000
candump -L ${CAN_PORT},${CAN_ID_SET_VERSION}:1ffffff | tee temp_candump.log &
candumpid=$!
cansend ${CAN_PORT} ${CAN_ID_GET_VERSION}#
sleep 0.5 # wait for an answer from microboard
kill $candumpid
cat temp_candump.log
This code gives me the expected can message about 9 out of 10 times.
My question is if there is a problem in the code or has someone else experienced a similar problem and found a solution ?
Any answer would be appreciated.
With kind regards

Ruby server logging a socket's request thrice

I am writing a simple server in Ruby in order to understand the Socket module. Here is my code:
require 'socket'
s = TCPServer.new(3939)
loop do
c = s.accept
STDERR.puts c.gets
c.close
end
I simply want to print the request to the server console before closing the socket. Why does it print the request thrice, instead of just once?
If I curl that code
$ curl localhost:3939
I get an empty reply
curl: (52) Empty reply from server
and a single GET request
GET / HTTP/1.1

sending https request using inetc

So I tried to send some POST data to an url using this code:
StrCpy $PostStr "a=input1&c=input2"
inetc::post $PostStr "https://url/index.php" "$INSTDIR\result.html" /END
Pop $0
StrCmpS $0 "OK" success failedToSubmit
failedToSubmit:
MessageBox MB_OK|MB_ICONEXCLAMATION "There was an error submitting information: $0"
Abort
success:
MessageBox MB_OK|MB_ICONINFORMATION "Your information was successfully received"
but when the url is in https, the following message always appeared:
There was an error submitting information: SendRequest Error
I tried this with http, and it run smoothly. The server php script does nothing but echo the POST variable.
Have I missed something in dealing with the https with inetc?
Thanks
INetC should be using the SECURITY_FLAG_IGNORE_UNKNOWN_CA + SECURITY_FLAG_IGNORE_REVOCATION flags on https URLs and there seems to be some kind of auth retry code in there so I'm not sure why it is not working.
There are other flags like SECURITY_FLAG_IGNORE_CERT_CN_INVALID that it is not using, maybe you could request a new /nosecurity switch here...

Recieve and reply to sms on huawei modem, gammu-smsd: Process failed with exit status 2

I Have a Huawei E220 HSDPA Modem on linux xubuntu
I wanted to recieve sms and reply automatically to the sender.
I Use gammu and Gammu-smsd to do this.
To automatically send sms back I added runOnRecieve = /path/to/bash/file into the /etc/gammu-smsdrc configuration-file.
Here is the script:
#!/bin/bash
str=$SMS_1_TEXT //string containing text from sender
tlf=$SMS_1_NUMBER //containing number from sender
tlf=${tlf:3}
if test "$str" = "today"; then
echo "[Weather for today in Norway]
Sol, noe overskyet
[Vind fra sørøst]
Ha en fin dag!" | gammu-smsd-inject TEXT $tlf -unicode -autolen 200
else
echo "fail" >> /home/mattis/sms.txt
fi
This is how I start the daemon
$ sudo gammu-smsd
This works if I run the bash script from terminal using test-input, but when the program gammu-smsd calls the script I get.
gammu-smsd[3183]: Process failed with exit status 2
Now i can remove "gammu-smsd-inject" from the code and replace with "gammu sendsms" , but that would just give me gibberish letters instead of "æøå and [ ]" when received back to the mobile.
Hoping for positive answers.
--//--Working code--//--
The thing is: Gammu sms inject acctually sends data to mysql database called smsd.
Creating this database:
This should be created as specified in wammu sql database. Storing the SQL script for creating tables in MySQL database will able you to import it with phpmyadmin(gui) or any other way to interface mysql.
Run on recieve
Add to the end of /etc/gammu-smsdrc --configuration file for gammu
runOnRecieve = /path/to/bash/file
Open the /path/to/bash/file
#!/bin/bash
str=$SMS_1_TEXT //codeword "weather"
tlf=$SMS_1_NUMBER //+47 41412424
tlf=${tlf:3} //remove +47
if test "$tlf" = "41412424"; then
toSend = "[Weather for today in Norway]"
else
toSend = "[you are not part of this group]"
echo "Someone outside the group send to this number" > /home/user/activity.txt
fi
mysql --host=localhost --user=username --password=pw smsd << EOF
INSERT INTO outbox (
DestinationNumber,
TextDecoded,
CreatorID,
RelativeValidity
) VALUES (
'$tlf',
'$toSend',
'Program',
'255'
);
EOF
Start the daemon
$ sudo gammu-smsd
That should be it!
Extra tips:
Use $ gammu-detect to find out where the device is connected. Look for name = Phone on USB serial port HUAWEI_Technology HUAWEI_Mobile or something similar. Put this info in the configfile.
Be shure to add right permission to the bashfile. Make it readable to user running gammu-smsd.
Make the bashfile executable using chmod u+x /path/to/bash/file.
The gammu-smsd-monitor can be used to check how good signal you have. Be shure not to stop running the gammu-smsd when trying to run this.
You can test the bashfile by running it with dummy tlf and dummytext as input. $ ./bashfile.sh.

Resources