I have made a custom script in PHP and I am using gammu/wammu to send sms, but I am unable to figure out how to add new line character in SMS.
I have tried
\n
\r
\t
0x0a
0x0d
&10;
but none of these worked.
I have made a custom script in PHP and I am using gammu/wammu to send sms, but I am unable to figure out how to add new line character in SMS.
I have tried
\n
\r
\t
0x0a
0x0d
&10;
but none of these worked.
I can't get this to work in gammu-smsd either, I really need to be able to send a true newline bytecode in an sms as well. I've googled for days, searched the gammu codebase. I can't tell if/where it's being trapped but nomatter how I enter in into my sqlite3 gammu-smsd, it's not a newline that comes out at the other end (machine2machine sms).
I don't need a CR/LF, I just need to send a template with \n after a variable string template, using it in an sms based tracker
Update, I figured out a way to make it send what I want. Since I'm using an sqlite3 database with gammu, this little PHP program makes me send the message to the mobile asset and it gets accepted there:
$sms_template=<<<EOD
insert into outbox ( TextDecoded , DestinationNumber, DeliveryReport, CreatorID) values ('%s','%s','yes','auto');
EOD;
$number=1243456;
$terminator=sprintf("%s",chr(10));
$db = new SQLite3("/var/spool/gammu/smsd.sqlite");
$sms='SRV=12171%s';
$sql=sprintf($sms_template, sprintf($sms, $terminator), $number);
$db->exec($sql);
That actually stores the sms fine in the outbox and a true newline arrives at the destination. Really hope this helps someone. This code is stripped from private stuff, might not work exactly as displayed, but I use a script alike that works.
Glenn
Have you tried
\r\n
? It looks to me like SMS needs both a Carriage Return and Line Feed. Another place I looked at said to use%0a%0d
, which may work, but it seems to be their service rather than everything. I'd give it a try though. Either way, you need to make sure that the0x0A
and0x0D
(two characters in hex) get passed to the service sending the SMS.See here for the site I mentioned that said
%0a%0d
, it also has a chart of the SMS character set.