mino
December 23, 2020, 3:50pm
1
The incoming SMS can be received by the daemon, however not appearing in the inbox.
When setting debug level to 4, I can see the problem:
L4 dba__query # q:INSERT INTO playsms_tblRecvSMS (flag_processed,sms_datetime,sms_sender,message,sms_receiver,smsc) VALUES ('1','2020-12-23 15:30:34','+12345678','Let's go','','gammu')
The single quote in the text body is not being escaped properly. I am using Gammu with playSMS.
Any quick fix for this? Thanks!
anton
December 24, 2020, 9:41am
2
Hi,
Text printed on log is stripslashed:
$label = ( $label ? $label : '-' ); $username = ( $user_config['username'] ? $user_config['username'] : '-' ); if (logger_get_level() >= $level) { $type = 'L'.$level; $fn = $core_config['apps_path']['logs'].'/'.$logfile; if ($fd = fopen($fn, 'a+')) { $dt = date($core_config['datetime']['format'], time()); // REMOTE_ADDR HTTP_HOST DATE TIME PID USERNAME TYPE LABEL # LOG $message = stripslashes($remote." ".$host." ".$dt." "._PID_." ".$username." ".$type." ".$label." # ".$log); $message = str_replace("\n", " ", $message); $message = str_replace("\r", " ", $message); $message .= "\n"; fputs($fd, $message); fclose($fd); } } }
And message received before entering recvsms()
is addslashed:
// saving concatenated message parts $parts_sender = 0; foreach ($messages as $sender => $message_parts) { $parts_message = ""; $parts_sender = $sender; foreach ($message_parts as $part) { $parts_message .= $part['message']; } } $parts_datetime = $messages[$parts_sender][0]['msg_datetime']; $parts_message = addslashes($parts_message); recvsms($parts_datetime, $parts_sender, $parts_message, $sms_receiver, $smsc); _log("sender:" . $parts_sender . " receiver:" . $sms_receiver . " dt:" . $parts_datetime . " msg:[" . $parts_message . "] smsc:[" . $smsc . "]", 3, "gammu_hook_getsmsinbox"); unset($messages); } // new message parts array $messages[$sms_sender] = array( array( "fn" => $fn, "message" => $message,
tblRecvSMS is holding all incoming SMS to be procecessed by daemon recvsmsd, and then message will be saved in tblSMSIncoming and if matched with some rule it will also be saved in tblSMSInbox.
See reports, perhaps your message was in Sandbox.
anton
mino
December 24, 2020, 1:44pm
3
Hi, thanks for the reply!
In that case, then I am not too sure what has gone wrong. Only messages with single quote are not going through still.
The log shows everything is okay as well, i guess? I can confirm that those messages with single quote are not in the Sandbox as well. See the log below when receiving a “Let’s go” message from gammu.
- - 2020-12-24 21:34:16 PID5fe4985743b3e - L3 recvsms # isrecvsmsd:1 dt:2020-12-24 21:33:28 sender:+12345678 m:Let's go receiver: smsc:gammu
- - 2020-12-24 21:34:16 PID5fe4985743b3e - L3 gammu_hook_getsmsinbox # sender:+12345678 receiver: dt:2020-12-24 21:33:28 msg:[] smsc:[gammu]
- - 2020-12-24 21:34:17 PID5fe4985743b3e - L3 recvsmsd # id:63 dt:2020-12-24 21:33:28 sender:+12345678 m:Let's go receiver: smsc:gammu
- - 2020-12-24 21:34:17 PID5fe4985743b3e - L3 recvsms_process # dt:2020-12-24 21:33:28 sender:+12345678 m:Let's go receiver: smsc:gammu
- - 2020-12-24 21:34:17 PID5fe4985743b3e - L3 recvsms_process # unhandled datetime:2020-12-24 21:33:28 sender:+12345678 receiver: message:Let's go
- - 2020-12-24 21:34:17 PID5fe4985743b3e - L3 incoming__recvsms_intercept_after # sandbox to user start u:admin dt:2020-12-24 21:33:28 s:+12345678 r: m:[Let's go]
- - 2020-12-24 21:34:17 PID5fe4985743b3e - L2 recvsms_inbox_add # saving sender:+12345678 receiver: target:admin reference_id:
- - 2020-12-24 21:34:17 PID5fe4985743b3e - L3 incoming__recvsms_intercept_after # sandbox to user end u:admin
This issue can also be reproduced using “Simulate incoming SMS”.
anton
December 24, 2020, 3:33pm
4
Have you checked sandbox ?
Anton
mino
December 24, 2020, 4:04pm
5
Yes, I have double checked Sandbox, not inside.
I am using the latest stable build 1.4.3 from github.
anton
December 28, 2020, 2:38am
6
Hi,
Try these changes:
committed 10:50AM - 26 Dec 20 UTC
Replace your core/recvsms/fn.php
with this one:
https://raw.githubusercontent.com/antonraharja/playSMS/9325d3c7d9fd4e81a730aa050c497f8f04ff9f87/web/plugin/core/recvsms/fn.php
After replace restart playSMS daemon before test.
anton
mino
December 28, 2020, 6:00am
7
Working perfectly now. Thank you Anton.
system
Closed
February 26, 2021, 6:00am
8
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.