How to filter messages sent from particular telephone numbers and messages sent to
particular telephone numbers
There can be cases when you do not want to accept messages from a particular
telephone number or cases when you do not want to enable sending messages for a
particular telephone number. The following guide explains how to configure Ozeki
NG SMS Gateway's inbound and outbound routes to filter telephone numbers.
To have this configured in Ozeki NG SMS Gateway, you need to set an appropriate
regular expression in the inbound route or outbound route you want to use for filtering.
Filtering particular telephone numbers for incoming messages
To filter telephone numbers for incoming messages, you need to edit
your inbound routes. To do this, click Inbound routing in the Edit menu (Figure 1).
Figure 1 - Inbound routing menu
You inbound routes will be shown. You can edit every route by clicking the edit
button in the routes' lines (Figure 2).
Figure 2 - Edit inbound routes
You will see the edit form of the selected route. In this form, you can configure
the selected inbound route. Here, you need to enter an appropriate regular expression in the
Condition 1. (Sender phone number) field (Figure 3).
Figure 3 - Setting regular expression in the sender phone number field
For example, you do not want to accept messages from the telephone number +0022334455 and
+1133445566. You will need the following regular expression to exclude these two telephone numbers:
/^(?!(.*)(0022334455|1133445566)(.*)).*$/
This regular expression matches to everything except +0022334455 and +1133445566, so messages from these
two number will not be delivered. Note, that if you set only one incoming route to filter messages, if this route
is in copy mode, then the message will be passed to the next inbound route as well. If you do not set the same
regular expression on the next route(s), the message will be sent through those routes. You need to
set the regular expression in every inbound route you have to completely ban accepting messages from the particular
telephone numbers.
When Ozeki NG SMS Gateway recieves a message from these two numbers, you will see the following error in
the service provider's log:
ERROR 1217: Message dropped. No incoming route found for message coming from operator 'SMPP0'.
Filtering messages sent to particular telephone numbers
To filter telephone numbers for outgoing messages, you need to edit
your outbound routes. To do this, click Outbound routing in the Edit menu (Figure 4).
Figure 4 - Outbound routing menu
Your outbound routes will be shown. You can edit every route by clicking the edit
button in the routes' lines (Figure 5).
Figure 5 - Edit outbound routes
You will see the edit form of the selected route. In this form, you can configure
the selected inbound route. Here, you need to enter an appropriate regular expression in the
Condition 2. (Recipient phone number) field (Figure 6).
Figure 6 - Setting regular expression in the recipient phone number field
For example, you do not want to enable sending messages to +0022334455 and +1133445566. You will need
the following regular expression to exclude these two telephone numbers:
/^(?!(.*)(0022334455|1133445566)(.*)).*$/
This regular expression matches to everything except +0022334455 and +1133445566 so messages having these
two phone numbers as recipient will not be sent. You need to set the regular expression in every outbound route you have to completely
ban sending messages to the particular telephone numbers.
When your users or applications will try to send a message for these two filtered numbers, you will see an error (Figure 7).
Figure 7 - Sending message to filtered telephone numbers