Can incoming SMS messages be blocked?

Hi forum
We’re having a Huawei USB modem connected using chan dongle for incoming and outgoing cellphone calls.
This has been working nicely for many years.
Currently, all incoming SMS text messages are being forwarded by email.
We’d like to have some ability for granular management of incoming SMS messages.
Is it possible to have either blacklist or whitelist for incoming SMS messages ?
Thanks for any tips or clues.

FreePBX does not do that by default. You’ll have to explain to us how that’s currently done on your PBX.

Its quite a few years since I built this FreePBX ( with dongle, but IIRC there’s a custom extension, configured as follows :


exten => sms,1,Verbose(Incoming SMS from ${CALLERID(num)} ${BASE64_DECODE(${SMS_BASE64})})
exten => sms,n,System(echo "To: [email protected][local_domain]\nSubject: Incoming SMS from ${CALLERID(num)}\n\n${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)} - Cellphone gateway ${DONGLENAME} - From ${CALLERID(num)}\n" > /tmp/sms.txt)
exten => sms,n,Set(FILE(/tmp/sms.txt,,,a)=${BASE64_DECODE(${SMS_BASE64})})
exten => sms,n,System(sendmail -t < /tmp/sms.txt)

Not sure how this email process is relevant to question regarding granular acceptance or rejection of SMS messages.
Also, IF an SMS message cannot be delivered, does the SMS sender ever know that ?
In a similar way that an email sender gets a rejection message when email delivery permanently fails.

Can’t be delivered where? The sender will get a status based on what their carrier tells them. It could be “We got it and sent it” or “We got it, sent it, the other carrier received it” or “We got it, sent it, the other carrier received it and the end device also received it” logic. Any of those can apply based on the carriers and their setups. Example, I can text my wife and we are on the same carrier. I can see that it was sent, delivered and READ but with one buddy, I can only see it was sent. With another I can see it was sent and delivered. Three different carriers.

But as far as your email solution, that is happening after the SMS delivery process has been done. Your device/SIM card was the final destination for it. The fact you are doing this over chan_dongle to Asterisk is past that. Anything that happens after the sender is unaware.

It was relevant, because I assumed you meant you only wanted some sent to email. At least for GSM, to the best of my knowledge, the air interface doesn’t allow you to reject an incoming SMS.

Thanks for all replies.
I was hoping there might be some way to reject sms messages from blacklisted senders, AND they would know their messages were being blocked.
In a similar manner that emails from blacklisted senders can be rejected, with notification of email delivery failure to the sender.
As this is not possible in the sms realm, we’ll just make do with some filtering on callerid before converting incoming sms messages to internal emails.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.