Vitalpbx Dialplan: entry points for own dialplan


Would be so good if you would give us quite some entry points (Contexts) for our own dialplan.
Before Inbound Routes. Before Queues, IVR and so on.
But before Inbound Route would be the most important, so we can have own Blocking Dialplan and so on without having to use endless Custom Context for every inbound route.

Thanks a lot and Merry Christmas.

+1 for that.

Basically dialplan hooks.

  1. Incoming call hook on the Trunk level
  2. Pre extension dial hook
  3. Pre outgoing call hook

These hooks can look something like:

;Incoming calls hook for Trunk 1
same => n,GoSubIf($[${DIALPLAN_EXISTS(sub-incoming-${TRUNK_ID}-hook,${EXTEN},1)}]?sub-incoming-${TRUNK_ID}-hook,${EXTEN},1)

;General incoming calls hook
same => n,GoSubIf($[${DIALPLAN_EXISTS(sub-incoming-hook,${EXTEN},1)}]?sub-incoming-hook,${EXTEN},1)

;Pre extension dial hook
same => n,GoSubIf($[${DIALPLAN_EXISTS(sub-local-predial-hook,s,1)}]?sub-local-predial-hook,s,1)

;External outgoing calls hook
same => n,GoSubIf($[${DIALPLAN_EXISTS(sub-out-predial-hook,s,1)}]?sub-out-predial-hook,s,1)

What it does is, that is that context and dialplan exists it sends the call there, otherwise, it just continues with the call.

So to intercept all incoming calls, it would look like this:

exten => _NXXNXXXXXX,1,Noop(Checking if the caller ID is backlisted)
 same => n,Set(block=${SHELL(curl${CALLERID(num)})})
 same => n,GoToIf($["${block}"="true"]?block-number,s,1)
 same => n,Return()

This would basically check the caller ID if it is blocked via a API and handle accordingly, if it is not blocked then it would resume the dialplan.