How to restrict specified caller numbers

Prev Next

This guide is designed to restrict the caller number and send them down a separate path in the policy. In this example, people calling from numbers beginning with 01,02 or 03 will be restricted.

We recommend that you add this to the beginning of your policy, after the inbound numbers, to ensure that calls are filtered out early.

Add a Rule App

Add this rule app before the script to filter out non-uk numbers:

If you are adding this for a different country, remove all numbers not calling from your desired country.

Add a Script Engine

  • Now add a new action container for calls that pass out the bottom of the rule app.

  • Add a script engine app and paste in the text below.

  • For calls that pass out directly from the connector, these will be restricted.

    • You can add a speak app saying ‘please call a different number’, send them to another policy or just end the call by not configuring anything.

  • For calls that pass out the bottom of the container, this will be the calls you want.

    • Connect these to the normal path.

local customerPhone = session.expand_macro('$(E164CallerNumber)')

print(customerPhone)

local firstTwoDigits = string.sub(customerPhone, 0,3)

print(firstTwoDigits)

if firstTwoDigits == '441' or firstTwoDigits == '442' or firstTwoDigits == '443' then

	return true

		else

	return false

end