Jump to content

Archive: How to allow calls from certain users / extensions only

Tom Wellige

Go to solution Solved by Tom Wellige,

Recommended Posts

  • Solution

The following forum topic is restored from the Swyx Forum Archive (2007-2014)



2011-03-02 11:35:35, sceb


we have a phone in our production area that only certain users / extensions should be allowed to call.
The number is widely known, a new extension is not an option. I already have something like that in place, I just connected a few Connect Blocks and checked variables. That is fine for 5 to 10 users, but in this case we talk about more than 30 users.
Can anybody think of a more elegant solution? 





2011-03-02 13:18:53, rolf.hebgen


Hi Stephan,

whats about a new call permissions profile for the calling users?  I have not tested yet if you can deny calling internal extensions in a call permissions profile...
// Rolf



2011-03-02 13:22:58, Tom Wellige


Hi Stephan,

what do you think of using a VBScript Array to keep all the numbers, having a simple function to check if the current caller is listed in this array and call this function in an Evaluate block?


Something like this:

Const AllowedCallersCount = 3
Dim AllowedCallers()
Redim AllowedCallers(AllowedCallersCount-1)
AllowedCallers(0) = "123"
AllowedCallers(1) = "234"
AllowedCallers(2) = "345"
' ...

Function IsAllowedToCall ( sNumber )
	PBXScript.OutputTrace "-------> IsAllowedToCall( " & sNumber & " )"

	Dim bReturn
	bReturn = False

	Dim i
	For i = LBound(AllowedCallers) To UBound(AllowedCallers)
		If AllowedCallers(i) = sNumber Then
			PBXScript.OutputTrace "Number found in list of allowed numbers"
			bReturn = True
		End If

	IsAllowedToCall = bReturn
	PBXScript.OutputTrace "bReturn = " & bReturn
	PBXScript.OutputTrace "<------- IsAllowedToCall"
End Function


Within the properties of the Evaluate block to just enter

IsAllowedToCall( IpPbx.CallingNumber )

If you end up in the True exit you deliver the call using a Connect To block, if you end up in the False exit you just disconnect (for example).





2011-03-02 17:10:03, sceb


In my understanding you could allow / deny outgoing calls with a permissions profile. I guess it may be possible with a separate profile denying this extension and adding all the users... but I'd prefer to keep the profiles as few as possible, this way I would probably have to create 3 or 4 new profiles.


So I prefer  Tom's solution... great answer - I was gonna write about evaluating an array (that's what I would do in PHP) but since I don't know VBScript well enough... 😉


However, thanks for the script. I will try it out!


Edit: Works great in a first test. I will come back here if I run into any problems 😉


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

By using this site, you agree to our Terms of Use and have taken note of our Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.