Restrict Outbound Call by Extension

First of all Sorry by my english.

I had the problem to restrict Restrict Outbound Call by Extension, I was looking for a solution that don’t disturb the configuration of FreePBX and easy to implement.

I found this solution that I wan’t to share with You.

The context in the extension can be:

  • from-internal ( Only internal Calls )
  • from-internal-local ( internal Calls and Local Calls)
  • from-internal-ddn ( internal Calls ,Local Calls and National Calls )
  • from-internal-ddi ( any Calls )

You must put this in extensions_custom.conf file and change the context in the extension accordly

This is cotumized by rules of Argentina

I hope be usefull

;***********************************************
; Restrict Outbound Call by Extension
;***********************************************

[macro-outb-allr-custom]
exten => s,1,Noop( begin )
exten => s,n,GotoIf($["${Var_DialPlan}"=“ddi”]?accept)
exten => s,n,GotoIf($["${ARG1:1:2}"=“00”]?reject)
exten => s,n,GotoIf($["${Var_DialPlan}"=“ddn”]?accept)
exten => s,n,GotoIf($["${ARG1:1:1}"=“0”]?reject)
exten => s,n,GotoIf($["${Var_DialPlan}"=“local”]?accept)
exten => s,n(reject),Playback(cannot-complete-as-dialed)
exten => s,n,Hangup(21)
exten => s,n(accept),Noop( end )
; Now I must set Macro user-callerid because is lost
; the first row in outrt
exten => s,n,Macro(user-callerid,SKIPTTL,)

[from-internal-ddi]
exten => _.,1,Set(Var_DialPlan=“ddi”)
exten => _.,n,Goto(from-internal,${EXTEN},1)

[from-internal-ddn]
exten => _.,1,Set(Var_DialPlan=“ddn”)
exten => _.,n,Goto(from-internal,${EXTEN},1)

[from-internal-local]
exten => _.,1,Set(Var_DialPlan=“local”)
exten => _.,n,Goto(from-internal,${EXTEN},1)

[outbound-allroutes-custom]
exten => _.,n,Macro(outb-allr-custom,${EXTEN})

;****************************************************