Route an block numbers | Search |
NowSMS Support Forums ⬆ NowSMS Support - SMS Issues ⬆ Archive through June 03, 2020 ⬆ |
◄ ► |
Author | Message | |||
Luis Claudio New member Username: Agentelu Post Number: 2 Registered: 11-2018 |
Good morning, I would like to know if there is an option to block invalid numbers in NOWSMS. I have a lot of users who send SMS to invalid number. I wish I could block those numbers. how can I add a rule that checks whether a number is valid or not? for example the number can not be longer than 12 characters, or it should start with 92 or 93 or 94. if the numbers start with these first two numbers, they are considered invalid numbers and are not submitted. I also wanted to know if I can define routes for a certain number. for example the numbers beginning with "92" or "93" follow a route, those starting with "99" or "91" follow another route. | |||
Bryce Norwood - NowSMS Support Board Administrator Username: Bryce Post Number: 8327 Registered: 10-2002 |
Hi Luis, For maximum control, you can use accounting callbacks. Every time a message is submitted, NowSMS will issue a callback over HTTP, and you can provide a script (example PHP) that decides whether or not the message should be accepted, and how its should be routed. There is more info on the callbacks here: https://www.nowsms.com/doc/advanced-configuration-settings/sms-accounting-callba cks Here's a simple example that blocks a single number: https://support.nowsms.com/discus/messages/1/73669.html In PHP, you would use strncmp which matches on the first n characters instead of strcmp which matches on the whole string in the example. If your requirements are simple, there are other simpler ways. NowSMS has a system wide "black list" for blocked numbers. This list can include wildcards which are useful for restricting the number of digits. ? matches any one character, while * matches 0 or more characters. The web interface does not support these wildcards at this time, so it is necessary to manually edit a config file. The system black list is a plain text file DLISTS\BLACKLIST.TXT with one number per line in the file. It is a little difficult for your scenario because it defines numbers to block, not numbers to allow. Here is an example that will block all numbers less than 12 digits, by blocking all numbers with lengths 1 thru 11: ? ?? ??? ???? ????? ?????? ??????? ???????? ????????? ?????????? ??????????? Add this to block numbers longer than 12 digits: ?????????????* Add this to block 12 digit numbers that do not start with 9: 0??????????? 1??????????? 2??????????? 3??????????? 4??????????? 5??????????? 6??????????? 7??????????? 8??????????? Next, block 12 digit numbers that start with 9, but not 92, 93 or 94: 90?????????? 91?????????? 95?????????? 96?????????? 97?????????? 98?????????? 99?????????? It becomes more difficult if you must also support these numbers in international format. In that case, you might want to convert all numbers to international format first, before applying the blacklist. Settings for applying conversion here: https://www.nowsms.com/international-prefix-conversion-for-sms To set a route, define the prefix, adding * in the "Preferred SMSC Connection" list in the SMSC properties. (See https://www.nowsms.com/doc/configuring-smsc-connections/routing-options) In your case, add 92* and 93* to the preferred list of the appropriate SMSC connection and 99** and 91* to the other. -bn Bryce Norwood Now SMS/MMS Support |