Block incoming Alpha Numeric Sender Id's

Block incoming Alpha Numeric Sender Id's SearchSearch
Author Message
Joel Parker
New member
Username: Joelparker

Post Number: 5
Registered: 06-2009
Posted on Friday, August 24, 2012 - 05:56 pm:   

How can I block any message with an alphanumeric sender id coming into the now sms box via an SMPP bind
Joel Parker
New member
Username: Joelparker

Post Number: 6
Registered: 06-2009
Posted on Friday, August 24, 2012 - 05:58 pm:   

Sorry, I meant to say arriving on an incoming SMPP bind or via HTTP
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 4082
Registered: 08-2008
Posted on Tuesday, August 28, 2012 - 09:55 pm:   

Hi Joel,

I assume that these are clients submitting the messages?

The only way to do this is with accounting callbacks.

Understanding accounting callbacks is a little complicated. (There is an article here: http://www.nowsms.com/understanding-sms-accounting-callbacks)

But ... relatively speaking, this would be a simple check to implement in a PreAuth accounting callback.

Here's a quickly written one that seems to do the trick for me:

 
<?php
header ("Content-Type: text/plain");

$response = "OK";

if (isset($_REQUEST['Type'])) {
if ($_REQUEST['Type'] == "SMSSend") {
if (isset($_REQUEST['PreAuth'])) {
if ($_REQUEST['PreAuth'] == "Yes") {
if (isset($_REQUEST['Sender'])) {
if (!preg_match('/^\+?\d+$/', $_REQUEST['Sender'])) {
$response = "PreAuth=Deny";
}
}
}
}
}
}

echo $response;
?>


--
Des
NowSMS Support
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 4083
Registered: 08-2008
Posted on Tuesday, August 28, 2012 - 10:00 pm:   

An additional thought ...

If you wanted to get a little more trick ...

Where I set $response = "PreAuth=Deny"; add this:

echo "SMPPErrorCode=0xA\r\n";
echo "RejectMessage=Alpha Sender not allowed\r\n";


The RejectMessage response is an error text returned to an HTTP client.

The SMPPErrorCode response returns ESME_RINVSRCADR (invalid source address) to an SMPP client.