I understand your frustration, but as I said I’m a newbie. I don’t have any previous experience with PBX or IPPBX systems, so I don’t know all the naming conventions. When you search for something it helps to know certain keywords, I don’t know all the keywords so I need to google sentences to find what I’m looking for which does not always lead me to where I want to be. To say I haven’t read the documentation is frankly quite harsh. I’ve read so much documentation and you get lots of suggestions but as I am new to this it feels like information overload. But I came across this post and it seems to explain what I want to accomplish so maybe you can help me on the way:
Use a text editor (nano, Midnight Commander’s editor, etc.) to add the following two dialplan fragments to /etc/asterisk/extensions_custom.conf (note, if your extensions can pass the # character to Asterisk then change all instances of _[0-9]! to _[#0-9]! - adding the # character - this applies to all examples on this page):
[custom-restricted-ext1]
exten => 911,1,Noop(Allowing unrestricted 911 call)
exten => 911,n,Goto(from-internal,${EXTEN},1)
exten => _[*0-9]!,1,Noop(Using Call Restriction 1)
exten => _[*0-9]!,n,Set(_RestrictedExt1=TRUE)
exten => _[*0-9]!,n,Goto(from-internal,${EXTEN},1)
exten => h,1,Hangup()
[custom-restricted-trunk1]
exten => _[*0-9]!,1,Noop(Testing for Call Restriction 1 ${RestrictedExt1})
exten => _[*0-9]!,n,GotoIf($["${RestrictedExt1}" = “TRUE”]?restrict1:norestrict1)
exten => _[*0-9]!,n(restrict1),Noop(Call blocked due to call restriction: 1)
exten => _[*0-9]!,n,Playback(feature-not-avail-line,noanswer)
exten => _[*0-9]!,n,Goto(app-blackhole,congestion,1)
exten => _[*0-9]!,n(norestrict1),Noop(No call restriction: 1)
exten => h,1,Hangup()
In the code above, change both instances of 911 to your local emergency number if it is something other than 911, or remove those two lines completely if you do not wish to permit the restricted extensions to make emergency calls (doing that is NOT recommended except in very special circumstances).
After adding this additional code to extensions-custom.conf, create a new custom trunk with the Custom Dial string Local/$OUTNUM$@custom-restricted-trunk1 , then go into any Outbound Route to which you wish to restrict access, and move that new custom trunk to the top of the trunk list (or second from the top if you have an ENUM trunk at the top, assuming that you don’t care if a free ENUM call actually goes through).
The go into any extension that you wish to restrict and change the context from from-internal to custom-restricted-ext1. (In Elastix an extra field is created in the extensions in the device options menu ‘custom context’ which gives you the option to select: allow all and any custom context you have created.) After saving all the configuration changes, you should be able to place a test call that would use the restricted route. You should hear the “That feature is not available on this line” recording (the most appropriate one I could find among the standard recordings supplied with FreePBX).
I can only test after work hours so I wanted to ask if I’m going in the right direction.