Include custom context

Hi everyone, I’m using freepbx 16 and asterisk 18.22.

I’m trying to add custom instruction in context

[macro-dial-confirm]
include => macro-dial-confirm-custom
exten => s,1,Set(DB(RG/${ARG4}/${CHANNEL})=RINGING)
exten => s,n,Set(__UNIQCHAN=${CHANNEL})
exten => s,n,Set(USE_CONFIRMATION=TRUE)
exten => s,n,Set(RINGGROUP_INDEX=${ARG4})
exten => s,n,Set(FORCE_CONFIRM=)
exten => s,n,Set(ARG4=)
exten => s,n,Macro(dial,${ARG1},${ARG2},${ARG3})
exten => s,n,Noop(Deleting: RG/${RINGGROUP_INDEX}/${CHANNEL} ${DB_DELETE(RG/${RINGGROUP_INDEX}/${CHANNEL})})
exten => s,n,Set(USE_CONFIRMATION=)
exten => s,n,Set(RINGGROUP_INDEX=)

I’m trying to use the first instruction, include => macro-dial-confirm-custom.

I define macro-dial-confirm-custom in extenstions_custom.conf :
[macro-dial-confirm-custom]
exten => s,1,Verbose(“macro-dial-confirm-custom”)

But, I can’t catching it.

What I doing wrong ?

Includes are only used if there is no match in the including context. You already have an extension s with priority 1 in the including context.

I suspect you really need a GoSub or Macro as priority 2, rather than an include, although having avoided Macros since they were first deprecated, about 10 years ago, I’m not sure about to what extent you can use Macro or Gosub within macros.

Thank’s.

How asterisk evaluate priority in this context ?
An expression more specific like “_33335000000.” for example, shouldn’t be evaluate before “s” ?

If isn’t possible to intermediate a context pre-generated by freepbx if it catch extension “s”, it’s really confusing to keep include => X inside it.

Use the dialplan hooks that exist for this purpose:

Thank’s for this really interesting resource.

But, I don’t find a good solution.
I explain more specificly my problem.

My users send some custom headers when make external calls. I use this headers generally in an hook, macro-dialout-trunk-predial-hook for specific treatments, set cdr for example.
But, when my users call a ring group, headers seem lost before. Probably because headers couldn’t replicated on all target of ringgroup.
I sought in dialplan, but I don’t find an hook allowing me to analyse sip headers during ring group.

Oh I have found the hook dial-ringall-predial-hook where I can catch it :slight_smile:

Your provided code only includes s. In any case, the two are incompatible, so there is no priority order. s will never match _3333… and 3333… will never match s, although there may be cases where s is used as a fallback, if nothing matches.

1 Like