Internal restrction

Discussion in 'General' started by abukhazneh, Mar 9, 2009.

  1. abukhazneh

    Joined:
    Feb 10, 2009
    Messages:
    68
    Likes Received:
    0
    Hi everyone,
    I just wonder If I can restrict some internal extensions to call a particular extension ?? any sugestions
     
  2. jgutierrez

    Joined:
    Feb 28, 2008
    Messages:
    5,737
    Likes Received:
    0
    Hi,
    I would do the following for the restricted extensions:

    1. Create a context on /etc/asterisk/extensions_custom.conf
    Code:
    [restricted-extensions]
    include => ext-meetme 
    include => app-callwaiting-cwoff 
    include => app-callwaiting-cwon 
    include => app-dnd-off 
    include => app-dnd-on 
    include => app-dictate-record 
    include => app-dictate-send 
    include => ext-queues 
    include => app-recordings 
    include => app-dialvm 
    include => app-vmmain 
    include => app-speeddial 
    include => app-calltrace 
    include => app-directory 
    include => app-echo-test 
    include => app-speakextennum 
    include => app-speakingclock 
    include => ext-group 
    include => grps 
    include => app-pbdirectory 
    include => ext-findmefollow 
    include => fmgrps 
    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 => app-userlogonoff 
    include => app-pickup 
    include => app-zapbarge 
    include => app-chanspy 
    include => ext-test 
    include => park-dial 
    include => parkedcalls 
    exten => h,1,Hangup
    exten => _[13-5]XX,Goto(ext-local,${EXTEN},1)
    exten => _20[013-9],Goto(ext-local,${EXTEN},1)
    exten => _2[1-9]X,Goto(ext-local,${EXTEN},1)
    
    As you will see I'm assunming that my extension's range is from 100 to 599, and there is only 1 extension (ext 202) that I won't let to be called from certain extensions.

    2. Edit the context of the extensions that you want to limit the ability to call other extensions

    Lets suppose that I won't let extensions 101,110,580 to call extension 202, so on the web interface, I should edit those extensions, and place under the "context field" restricted-extensions
     
  3. abukhazneh

    Joined:
    Feb 10, 2009
    Messages:
    68
    Likes Received:
    0
    ok i tried that when trying to make context to control the outbound routes before i downloaded the custom context module and it didnot work is their any other way ?????
     
  4. abukhazneh

    Joined:
    Feb 10, 2009
    Messages:
    68
    Likes Received:
    0
    Thnx for the help but am not asking about the outbound calls cause am using the custom context for that and its working just fine , am asking about internal calls between extensions if their is away to make restrictions on reaching a particular extension ??
    and another thing to ask baout the users complaining from the redial process cause they have to add 9 before the number as calling prefix , so if their as away to change this and make them redial without the adding the 9
     
  5. wiseoldowl

    Joined:
    Aug 19, 2008
    Messages:
    251
    Likes Received:
    0
    I've never heard of anyone wanting to make a particular internal extension unreachable before, and I can tell you that FreePBX is simply not designed to do that - even the third-party Custom Contexts module won't allow that. However, what you want would not be impossible, just potentially a lot of work. If you look at the document I suggested, a slight modification would perhaps allow what you want. Let's say you wanted to restrict calls to extension 299 and all extensions in the 440-449 range (this is just an example) - you might add something like this to /etc/asterisk/extensions_custom.conf:

    [custom-restricted-internal]
    exten => 299,1,Goto(app-blackhole,congestion,1) ;Send calls to extension 299 to congestion
    exten => _44x,1,Goto(app-blackhole,congestion,1) ; Send calls to pattern matching 44x to congestion
    exten => _[*0-9]!,1,Goto(from-internal,${EXTEN},1) ; Send all other calls to from-internal
    exten => h,1,Hangup()

    Don't include the comments, they are just there to explain what's happening in each line. Then go into all the extensions you want to restrict (yes, every single one of them, one by one) and change the context from from-internal to custom-restricted-internal, or whatever you called your context.

    Why use the "dial 9 to get an outside line" at all - that dates back to the 1950's and earlier, when PBX's were built using old-style electromechanical switches. Construct your routes to accept numbers dialed in the normal manner, and configure endpoints so that when a valid extension number is dialed, the endpoint will wait four seconds to see if any more digits will be dialed, until a valid seven or eleven digit number (or 10/11 digit number, depending on what you use in your area) is dialed. Then teach users to dial internal extensions using the # suffix (which on most endpoints will send the digits dialed thus far without further delay) - if they forget the # then the four second timeout will still send the call after a short delay.

    This sounds more complicated than it is - here's an example of a Linksys/Sipura endpoint dial plan that sends a valid 911 or seven or 11 digit call immediately, otherwise waits four seconds between digits unless you use the # suffix to end dialing immediately:

    (911|[2-9]xxxxxxS0|1[2-9]xx[2-9]xxxxxxS0|[*x][*x].S4)

    Or if you allow calls prefixed with *67 and want a second dial tone after the *67 then it gets slightly more complicated, but not much (see How to set up per-use Caller ID blocking (*67) in that case).
     
  6. jgutierrez

    Joined:
    Feb 28, 2008
    Messages:
    5,737
    Likes Received:
    0
    yes, wiseoldowl is right, try his context, or mine
     
  7. rafael

    Joined:
    May 14, 2007
    Messages:
    1,454
    Likes Received:
    1
    The way I had done this is by creating a trunk instead of an extension for the user that does not wants to be call by everyone. Then I created two small contexts one that would dial the only extension in that trunk and the other that would redirect calls to other extensions. Normally this other extensions would be the secretary of someone important.

    Here in Quito Ecuador we have implementation in some ministers and the ministers do not like to be call by everyone.

    Best Regards,

    rafael
     
  8. abukhazneh

    Joined:
    Feb 10, 2009
    Messages:
    68
    Likes Received:
    0
    ok rafeal it seems agood way to do what i want cause am exactly at the situation of the somone important dont want all people to call him , but if u dont mind write the contexts you used to do this and i will be so thankfull .
    thnx in advanced
     
  9. abukhazneh

    Joined:
    Feb 10, 2009
    Messages:
    68
    Likes Received:
    0
    wiseoldowl i tried to remove the dila prefix and the internal calling stopped and the msj all circuits are busy but calling outbound worked ok with no problems, whats the story if you have any idea ??
     
  10. wiseoldowl

    Joined:
    Aug 19, 2008
    Messages:
    251
    Likes Received:
    0
    Do you have an outbound route with your international dialing prefix in the dial patterns? For example, in the U.S.A. and Canada our international calling prefix is 011 so if I wanted to send out International calls I'd create an outbound route with a dial pattern 011. (include the period!) and then send that first to an ENUM trunk (in case there's a free route) and then to whichever of my routes handle international calls. Then in the trunk you may have to make changes, for example in the ENUM trunk you have to strip the international prefix using 011|. as a dial rule - or let's say you dial 00 as an international dial prefix but you are sending the call to a carrier that wants to see 011, you'd then do 00|011+. as a trunk dial rule.

    If you still have problems, make sure your endpoints aren't blocking calls to the international prefix in their dial plans, or putting the calls through before all the digits are dialed.
     
  11. rafael

    Joined:
    May 14, 2007
    Messages:
    1,454
    Likes Received:
    1
    Ok Tomarrow I would do an small lab to help you.
     
  12. abukhazneh

    Joined:
    Feb 10, 2009
    Messages:
    68
    Likes Received:
    0
    I will be so thankfull
     
  13. rafael

    Joined:
    May 14, 2007
    Messages:
    1,454
    Likes Received:
    1
    Sorry for the lateness on my answer, but better later than never:

    Create an Internal context that would not allow you to call outside. For this copy and paste the context from-internal-additional from the file /etc/asterisk/extensions_additional.con to /etc/asterisk/extensions_custom-conf and comment the following line:

    Code:
    ;include => outbound-allroutes
    
    You can use my context as an example:
    Code:
    [internal]
    include => from-internal-additional-custom
    include => app-dnd-off
    include => app-dnd-on
    include => ext-queues
    include => app-miscapps-1
    include => app-dialvm
    include => app-vmmain
    include => app-pbdirectory
    include => app-calltrace
    include => app-directory
    include => app-echo-test
    include => app-speakextennum
    include => app-speakingclock
    include => ext-meetme
    include => app-recordings
    include => ext-group
    include => grps
    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 => app-dictate-record
    include => app-dictate-send
    include => app-callwaiting-cwoff
    include => app-callwaiting-cwon
    include => app-speeddial
    include => ext-findmefollow
    include => fmgrps
    include => app-userlogonoff
    include => app-pickup
    include => app-zapbarge
    include => app-chanspy
    include => ext-test
    include => ext-local
    ;include => outbound-allroutes
    exten => h,1,Hangup
    
    Then you can use the outbound routes created in freepbx and asign them to some context and not in others. For example in this lab I have the following routes in /etc/astersisk/extensions_additional.conf
    Code:
    [outbound-allroutes]
    include => outbound-allroutes-custom
    include => outrt-001-services
    include => outrt-002-local
    include => outrt-003-cellphone
    exten => foo,1,Noop(bar)
    
    So as you can see we have three outbound routes that their contexts start with outr-xxx-name where xxx is the number of the trunk. This trunks are created by freepbx and we can include them in our custom context.

    Note: If you do this the order of outbound routes in freepbx is not going to be relevant and you should not change the order of outbound routes, you would manage this manually on this contexts.

    So now you can have two contexts one for
     

Share This Page