Is there a way to restrict extensions?

titodj
Posts: 61
Member Since:
2006-06-02

Is there a way to restrict extensions so they can call another extension but not use the trunks?
(without using passwords in trunks)

Regards...



philippel
Posts: 700
Member Since:
2006-05-31
Re: Is there a way to restrict extensions?

Freepbx does not have this ability from the gui at this point. You must do it manuallly. You must put those extensions into their own context and then create that context in extensions_custom.conf. You would then include all the other contexts that you want that extension to have access to - besides the outbound routes. Keep in mind when you do this, you should make sure to include emergency routing (911 or equivalent).

p

--

Philippe Lindheimer, FreePBX® Project Leader
http://freepbx.org - #freepbx on irc.freenode.net
http://freepbx.org/forums - The FreePBX® Forum
OTTS Training - Apr 27-29, Huntsville, AL



titodj
Posts: 61
Member Since:
2006-06-02
Re: Is there a way to restrict extensions?

Thanks foy your help...
Could you point me to a forum or site where I can read more on this subjet?
The truth is that Im not that familiar with asterisk but Im willing to read as much as necesary... Regards....



philippel
Posts: 700
Member Since:
2006-05-31
Re: Is there a way to restrict extensions?

sammyantoun (might have that wrong) posted a detailed description on how to do this on the old AAH forum. But the simple answer is:

1. choose another context than from-internal for these extensions
2. copy from-internal as your starting point
3. peel out whatever you don't want
4. make sure you include an emergency routing context

for the last, take a look at outbound-allroutes which you won't want to include, but you may want to include some of the routes that it has for the emergency dialing. And when you are done - make sure to test the emergency dialing.

Beyond that - it's just learning and understanding asterisk better, and then looking at the dialplan and figuring out how to mold it to do what you want to (while not breaking what the gui does)

p

--

Philippe Lindheimer, FreePBX® Project Leader
http://freepbx.org - #freepbx on irc.freenode.net
http://freepbx.org/forums - The FreePBX® Forum
OTTS Training - Apr 27-29, Huntsville, AL



titodj
Posts: 61
Member Since:
2006-06-02
Re: Is there a way to restrict extensions?

Thanks...



gregkeys
Posts: 409
Member Since:
2006-06-01
Re: Is there a way to restrict extensions?

Here is my post from the old AAH forums on this subject:

This is a little complicated, but here goes.

1. Get all your trunks and outbound routes set up for ALL users.

2. open extensions_additional.conf and find the section:
[outbound-allroutes]
There will be an include => line for each outbound route you have defined in FreePBX. it will look something like this:

include => outbound-allroutes-custom
include => outrt-001-911
include => outrt-002-ForceTeliax
include => outrt-003-ForceZap
include => outrt-004-TollFree
include => outrt-005-LD
include => outrt-006-Mexico
include => outrt-007-ToDLK
include => outrt-008-ToHadden
include => outrt-009-Ecuador
exten => foo,1,Noop(bar)

Copy it to a text file somewhere

This is the key to allowing various outbound calls.
Now, open extensions_custom and add a section like this:
[from-restricted]
include => parkedcalls
include => ext-fax
include => app-cf-busy-off
include => app-cf-busy-off-any
include => app-cf-busy-on
include => app-cf-off
include => app-cf-off-any
include => app-cf-on
include => app-cf-unavailable-off
include => app-cf-unavailable-on
include => ext-meetme
include => ext-findmefollow
include => ext-paging
include => ext-queues
include => app-calltrace
include => app-directory
include => app-echo-test
include => app-speakextennum
include => app-speakingclock
include => app-callwaiting-cwoff
include => app-callwaiting-cwon
include => app-recordings
include => app-dialvm
include => app-vmmain
include => app-dnd-off
include => app-dnd-on
include => ext-group
include => app-userlogonoff
include => app-zapbarge
include => ext-test
include => ext-local
;****************OutBound Routes************************
**Copy the outbound routes include statenemts here from YOUR SYSTEM - REMOVE MINE
include => outbound-allroutes-custom
include => outrt-001-911
include => outrt-002-ForceTeliax
include => outrt-003-ForceZap
include => outrt-004-TollFree
include => outrt-005-LD
include => outrt-006-Mexico
include => outrt-007-ToDLK
include => outrt-008-ToHadden
include => outrt-009-Ecuador
exten => foo,1,Noop(bar)
;********************************************************
exten => h,1,Hangup
exten => s,1,Macro(hangupcall)
exten => h,1,Macro(hangupcall)

********end of code to add to extensions_custom

Now, go comment out the outbound routes you do not want the restricted extrensions to use.
Last, go back to FreePBX and pull up the extension you want to restrict. Change the Context to :
from-restricted

Thats it :)
Any include => line in the above code that you comment out will restrict the extension.
If you comment out:

include => app-zapbarge

then the restricted extension will not be able to use that feature.
Commenting out the include for a long distance route will restrict access to that.

Greg Keys



wmelnick
Posts: 44
Member Since:
2006-08-21
Re: Is there a way to restrict extensions?

Sorry about starting that other thread. I found this one and continue here:

So to allow people to use a trunk outbound with g729 but restrict the fax to ulaw, I would have to set up a second trunk entry to the same provider and point everything to the g729 entry and the fax to the new entry.

Before I mess up my whole setup one question...

I am going to need to set up a second trunk for this, as I want one where g729 and ulaw get used and one where only ulaw gets used. How do I set the second one up? My assumptions are: Different outgoing context. No user context needed at all since that's for incoming. Do I need a registrations string or will having one in the "main" trunk entry take care of that with the IAX2 provider?

Thanks,
Warren



Zildjian26
Posts: 239
Member Since:
2006-06-05
Re: Is there a way to restrict extensions?

Why not just modify the dial plan of your phone(s) to only allow dialing inter-office extensions?



vjfromgt
Posts: 192
Member Since:
2006-11-11
Re: Is there a way to restrict extensions?

This works great if you want to restrict x number of trunk from x number of people
what if I want to restrict
Trunk Abc from user 333 but not trunk XYZ and
Trunk XYZ from user 222 but not trunk ABC



vjfromgt
Posts: 192
Member Since:
2006-11-11
Re: Is there a way to restrict extensions?

To Clarify
I have user 111 and he should only be using trunk 1
user 222 should only use trunk 2
user 333 should only use trunk 3
can this be done?



yesmat
Posts: 127
Member Since:
2006-06-08
Re: Is there a way to restrict extensions?

You can create different [from-restricted] contexts.

[from-restricted1]
allow trunk abc
;allow trunk xyz

[from-restricted2]
;allow trunk abc
allow trunk xyz

and then assign restricted1 to extension1 and restricted2 to extension2 etc.....



cllirabbit
Posts: 30
Member Since:
2006-08-18
Re: Is there a way to restrict extensions?

I'm surprised that no one has mentioned the new Custom Contexts module - it's not part of the official distribution and is still in beta, but it will do exactly what you want and a whole lot more. For details see FreePBX Ticket #1447 at http://freepbx.org/trac/ticket/1447 and the documentation at http://aussievoip.com.au/wiki/freePBX-CustomContexts. I have a feeling this is going to become a very significant module when it becomes part of the official distribution because it makes things that used to be very hard very easy.



bharat
Posts: 1
Member Since:
2008-03-21
Re: Is there a way to restrict extensions?

I have done something different all together. I am blocking extensions by their Caller ID.I Hope it helps others. Here is what i did.

First create a database key in astdb for eg.
asterisk>database put allow_call 399 1234
Here allow_call is the Database family
399 is the key and also the extension number
and 1234 is any secret which might be unknown to the user dialing out.

now i created a custom-context from [ourt-001-Longdistance] in extension_custom.conf
[ourt-001-Longdistance-custom]
exten => s,1,Noop(Authorized by extensions)
exten => s,n,Set(key=${DB(allow_call/${CALLERID(num)})})
exten => s,n,gotoif($["${key}"=""]?101:5)

The Idea here is that whenever a extension tries to make a call, the code above will check if they have a valid allow_call entry in asterisk database.
If it returns empty you can send it to any priority, or just play busy tones and hangup.

Hope it helps.



emanteuf
Posts: 8
Member Since:
2007-08-20
Re: Is there a way to restrict extensions?

This is what I did.

I used FreePBX and set the context of the extension to from-trunk. From-trunk is only allowed to connect to something internal to Asterisk. So a user with an extension in that context is treated as an incoming call. I don't know if that's the "right" way to do it but it seems to work.

Ed



karllui2008
Posts: 196
Member Since:
2007-10-18
Custom Contexts module

emanteuf's method seems the easiest way of restricting extensions based on my search and it works for me as well.

But my question is what happened to Custom Contexts module? It's not in included in FreePBX release yet.



jades
Posts: 2340
Member Since:
2006-11-26
Shouldn't be a problem If

Shouldn't be a problem
If strange things start happening, change it back

--

Joseph Ades
josephades1_at_gmail_dot_com
(212) 937-4299



karllui2008
Posts: 196
Member Since:
2007-10-18
ring group and conference room

But I found that if I put an extension in from-trunk context, that extension cannot dial any ring group or conference room.

What's the best way to solve this problem?



mbrevda
Posts: 209
Member Since:
2006-06-21
see here:

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.