Restrict only internal call to a certain extension

midiabyte

Joined
Aug 31, 2009
Messages
58
Likes
0
Points
0
#1
How to restrict to a certain extension, that only makes calls to internal extensions and can not make external calls, even to enter a number that is equivalent to a patern of existing outbound route?

If I specify that the extension is "type=user", it will make calls to others internal extensions, or not make any call?

Thank's
 

dicko

Joined
Oct 24, 2008
Messages
4,099
Likes
0
Points
0
#2
Try this:-

Make a "custom context" (in /etc/asterisk/extensions_custom.conf)

That looks something like:

Code:
[internal-extension]
exten => _2XX,1,goto(from-internal,${EXTEN},1) 
; 2XX are the extensions it can dial

exten => _3XX,1,goto(from-internal,${EXTEN},1) 
; they can dial also 3XX extensions

exten => 911,1,goto(from-internal,911,1) 
; cover your ass and make sure you don't get sued 
;(911 better work though)

exten => 112,1,goto(from-internal,112,1)
;same thing for the rest of the world


exten => 999,1,goto(from-internal,999,1)
;don't forget the Brits.

exten => _.,1,hangup() 
;reject any non matching calls
(of course adjust to suit your dialplan)


make any "internal-extension" context equal that in the extension page:

context=internal-extension
 

midiabyte

Joined
Aug 31, 2009
Messages
58
Likes
0
Points
0
#3
OK Dicko, thank's for your fast reply!

However, my User has twenty extensions, example: (2401, 2402, 2403, 2404... 2420). In your explanation I would have to create several times the same code in each of these extensions, right?

Example: [internal-2401], [internal-2402], [internal-2403]..., right?

But is there a way to create a mask in the context like until extension 2401 to 2410 (group), only make calls to extensions that started with 20, 22 and 24??

Something like:
[internal-EXTENSIONS] ; this an extensions group, with all extensions of User "use"!
exten=>_2[024]xx,1,goto(from-internal,${EXTEN},1) ; 20XX, 22XX and 24XX, are the extensions it can dial

Thank's, and excuse my poor english!
 

dicko

Joined
Oct 24, 2008
Messages
4,099
Likes
0
Points
0
#4
No, it's easier:

exten => _2XXX,1,goto(from-internal,${EXTEN},1)


matches ALL 4 digit extension starting with 2

be careful with "case", internal-extension is not necessarily the same as internal-EXTENSION

and

Yes, it's a regex, but don't over-engineer, if all your extensions are 4 digit then _XXXX will work marginally quicker, and is easier to understand, anything longer (apart from the noted exceptions) will be rejected.
 

Members online

No members online now.

Latest posts

Forum statistics

Threads
30,913
Messages
130,917
Members
17,589
Latest member
cristian.saiz
Top